[GIS] Install QGIS 3.x on Ubuntu 18.04

installationqgisUbuntuubuntugis

I've tried several packages including ubuntugis but none helped. How to install qgis 3.x, more preferably qgis 3.4 lts in Ubuntu?

I've added following repos::
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update

and then tried to install:
but i get these errors::

$ sudo apt-get install qgis python-qgis qgis-plugin-grass
[sudo] password for hillson: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python-qgis : Depends: python-qgis-common (= 2.18.28+dfsg-1~bionic1) but it is not going to be installed
               Depends: python-dateutil but it is not installable
               Depends: python-future but it is not installable
               Depends: python-httplib2 but it is not installable
               Depends: python-jinja2 but it is not installable
               Depends: python-markupsafe but it is not installable
               Depends: python-owslib but it is not installable
               Depends: python-psycopg2 but it is not installable
               Depends: python-pygments but it is not installable
               Depends: python-qscintilla2 but it is not installable
               Depends: python-qt4 but it is not installable
               Depends: python-qt4-sql but it is not installable
               Depends: python-requests but it is not installable
               Depends: python-sip but it is not installable
               Depends: python-tz but it is not installable
               Depends: python-yaml but it is not installable
               Depends: libqgispython2.18.28 but it is not going to be installed
               Depends: libqgis-analysis2.18.28 (>= 2.14.0) but it is not going to be installed
               Depends: libqgis-core2.18.28 (>= 2.18.28) but it is not going to be installed
               Depends: libqgis-gui2.18.28 (>= 2.18.17) but it is not going to be installed
               Depends: libqgis-networkanalysis2.18.28 (>= 2.14.0) but it is not going to be installed
               Depends: libqgis-server2.18.28 (>= 2.18.21) but it is not going to be installed
               Depends: libqscintilla2-qt4-13 (>= 2.8.4) but it is not installable
               Depends: libqt4-network (>= 4:4.5.3) but it is not installable
               Depends: libqt4-xml (>= 4:4.5.3) but it is not installable
               Depends: libqtcore4 (>= 4:4.8.0) but it is not installable
               Depends: libqtgui4 (>= 4:4.8.0) but it is not installable
               Depends: sip-api-12.3 but it is not installable
 qgis : Depends: libgsl23 but it is not installable
        Depends: libgslcblas0 but it is not installable
        Depends: libqgis-analysis2.18.28 (>= 2.14.0) but it is not going to be installed
        Depends: libqgis-app2.18.28 (>= 2.14.0) but it is not going to be installed
        Depends: libqgis-core2.18.28 (>= 2.18.28) but it is not going to be installed
        Depends: libqgis-gui2.18.28 (>= 2.18.17) but it is not going to be installed
        Depends: libqgis-networkanalysis2.18.28 (>= 2.0.1) but it is not going to be installed
        Depends: libqt4-network (>= 4:4.5.3) but it is not installable
        Depends: libqt4-sql (>= 4:4.5.3) but it is not installable
        Depends: libqt4-xml (>= 4:4.5.3) but it is not installable
        Depends: libqtcore4 (>= 4:4.8.0) but it is not installable
        Depends: libqtgui4 (>= 4:4.8.0) but it is not installable
        Depends: qgis-providers (= 2.18.28+dfsg-1~bionic1) but it is not going to be installed
        Depends: qgis-common (= 2.18.28+dfsg-1~bionic1) but it is not going to be installed
        Recommends: qgis-provider-grass but it is not going to be installed
 qgis-plugin-grass : Depends: qgis-provider-grass (= 2.18.28+dfsg-1~bionic1) but it is not going to be installed
                     Depends: grass-core (>= 7.6.0) but it is not going to be installed
                     Depends: grass760
                     Depends: libqgis-app2.18.28 (>= 2.14.0) but it is not going to be installed
                     Depends: libqgis-core2.18.28 (>= 2.18.17) but it is not going to be installed
                     Depends: libqgis-gui2.18.28 (>= 2.18.17) but it is not going to be installed
                     Depends: libqgisgrass7-2.18.28 (>= 2.14.0) but it is not going to be installed
                     Depends: libqt4-svg (>= 4:4.5.3) but it is not installable
                     Depends: libqt4-xml (>= 4:4.5.3) but it is not installable
                     Depends: libqtcore4 (>= 4:4.8.0) but it is not installable
                     Depends: libqtgui4 (>= 4:4.8.0) but it is not installable
E: Unable to correct problems, you have held broken packages.

Best Answer

The ubuntugis ppa holds only LTR versions, currently QGIS 2.18.28, see https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/?field.series_filter=bionic.

If you want QGIS 3.4, you can take the https://qgis.org/ubuntu/ repository without any ubuntugis dependencies. You might have to remove any packages you have from ubuntugis before installing.

https://qgis.org/ubuntugis/ has support for bionic as well, but faced some issues recently. The QGIS packages are built against GRASS 7.4.3, but the ubuntugis ppa has meanwhile switched to GRASS 7.6.0. So I don't suggest that at the moment.

The situation is different for Xenial, because the main ubuntu repo for that does not include GDAL 2, which is mandatory for QGIS 3.


UPDATE

Ubuntugis unstable now has QGIS 3.4.14 for bionic.

Related Question