How to install Qt5 on Linux

Question: I need to install Qt5 to build a Qt application. How can I install and set up Qt5 development environment on [insert your Linux distro]?

Qt is a cross-platform application and UI development framework. Using Qt, you can easily port a GUI application to multiple platforms without rewriting application code from scratch.

The easiest way to install Qt libraries and Qt IDE on Linux (e.g., Debian, Ubuntu, Fedora or CentOS) is by using an executable Qt installer, which is available from its official site.

First download a Qt installer. For Linux, there are 32-bit and 64-bit versions of the installer. Choose a right one according to your Linux environment.

Make the downloaded installer file executable, and run the installer.

$ chmod +x qt-linux-opensource-5.2.0-x86-offline.run
$ sudo ./qt-linux-opensource-5.2.0-x86-offline.run

Click on "Next" button at the initial window of Qt installation wizard.

Choose the installation target folder. Accept the default (i.e., /opt/Qt5.2.0).

Select Qt components to install. By default, it will install Qt libraries, as well as a cross-platform Qt IDE called Qt Creator.

After installation, you will see the following message. Close the window.

Finally, add the locations of installed Qt binaries to PATH environment variable.

$ echo "PATH=\$PATH:/opt/Qt5.2.0/Tools/QtCreator/bin:/opt/Qt5.2.0/5.2.0/gcc/bin" >> ~/.bashrc
$ source ~/.bashrc

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

Leave a comment

Your email address will not be published. Required fields are marked *