9

Currently, Ubuntu 16.04 has Qt up to 5.5.1 while Ubuntu 18.04 has Qt up to 5.9.5. Currently I'm forced to use Ubuntu 16.04, however, I need to use a program that needs Qt 5.9. How could I update Qt to version 5.9.5?


Note that I'm configuring it on a docker container. This means that the solution shouldn't involve GUI.

8
  • You need to either find a ppa or co.pile it yourself. Get a start and post back if you have problems – Panther Aug 3 '18 at 15:16
  • @Panther I know that the command to add a ppa is something like add-apt-repository ppa:<ppa_name> and the I need is this. However, I don't know the ppa name nor how to search for it. – gvgramazio Aug 3 '18 at 15:25
  • 1
    @Panther Seriously, I appreciate when someone tries to make me understand a bit instead of giving to me a copy-paste solution. However, even with your link, I don't understand which is the name of Ubuntu 18 repository that has the version I need. – gvgramazio Aug 3 '18 at 15:45
  • @Panther On anther system, with 18.04 I installed them at first try with apt-get. The problem is that on 16.04 I don't have the same packages. – gvgramazio Aug 3 '18 at 16:10
14

A second option is to add Qt using a PPA. The example below installs Qt 5.11.1. There are PPA's for other versions if required.

Add the PPA

sudo add-apt-repository ppa:beineri/opt-qt-5.11.1-xenial
sudo apt update

Install Qt

sudo apt install qt511-meta-full

Configure the System

There are a couple of choices here depending on whether you want to configure the use of the new Qt version system wide or to the current user.

For system wide, create the following file in location /etc/xdg/qtchooser.

For the current user, create the following file in location ~/.config/qtchooser.

Create a text file in the chosen qtchooser folder named default.conf with the following contents:

/opt/qt511/bin
/opt/qt511/lib

The first line in the file is the path to the Qt binaries and the second is the path to the Qt libraries.

Check the Configuration

qmake -v

If the configuration is working correctly you should see something like:

QMake version 3.1
Using Qt version 5.11.1 in /opt/qt511/lib
2
  • @roger no, that’s not correct. That would install the packaged version from the Ubuntu repositories which is not what the user that asked this question wanted. – gsxruk Dec 17 '19 at 21:35
  • Thank you -- I've deleted my comment. I was trying to compile current Konsole on Ubuntu 16.04 and that command looked like it helped for a while. I gave up, eventually. – Roger Dahl Dec 17 '19 at 23:05
6

You could install Qt using the installers provided by Qt. The open source installer can be downloaded here.

Once downloaded (the following assumes the download location is ~/Downloads):

Install Qt

cd ~/Downloads
chmod +x qt-unified-linux-x64-3.0.5-online.run
./qt-unified-linux-x64-3.0.5-online.run

In the "Installation Folder" screen, enter /opt/Qt.

Qt Install Folder

In the "Select Components" screen, choose the version you would like to install (Qt 5.11.1 used in this example) and tick the "Desktop gcc 64-bit" option.

Qt Select Components

The installer will request your sudo password during installation.

Configure the System

There are a couple of choices here depending on whether you want to configure the use of the new Qt version system wide or to the current user.

For system wide, create the folder qtchooser in location /etc/xdg/ (the location used in this example).

For the current user, create the folder qtchooser in location ~/.config/.

Create a text file in the qtchooser folder created in the previous step named default.conf with the following contents:

/opt/Qt/5.11.1/gcc_64/bin
/opt/Qt/5.11.1/gcc_64/lib

The first line in the file is the path to the Qt binaries and the second is the path to the Qt libraries.

Check the Configuration

qmake -v

If the configuration is working correctly you should see something like:

QMake version 3.1
Using Qt version 5.11.1 in /opt/Qt/5.11.1/gcc_64/lib
2
  • Sorry, I forgot to mention one important thing: I'm configuring it on a docker container. This means that the solution shouldn't involve GUI. – gvgramazio Aug 4 '18 at 10:46
  • Ok. I've added another answer using a PPA. – gsxruk Aug 4 '18 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.