Throughout this chapter, I'll be using Ubuntu 16.04 OS; however, the programs that are listed in this chapter should work on any platform that supports Qt.
For detailed installation instructions, refer to https://wiki.qt.io/install_Qt_5_on_Ubuntu.
At this point, you should have a C++ compiler installed on your system. If this is not the case, first ensure that you install a C++ compiler, as follows:
sudo apt-get install build-essential
From the Ubuntu Terminal, you should be able to download Qt 5.7.0, as shown in the following command:
wget http://download.qt.io/official_releases/qt/5.7/5.7.0/qt-
opensource-linux-x64-5.7.0.run
Provide execute permission to the downloaded installer, as shown in the following command:
chmod +x qt-opensource-linux-x64-5.7.0.run
Launch the installer as shown in the following command:
./qt-opensource-linux-x64-5.7.0.run
As Qt makes use of OpenGL, make sure you install the following before you start writing your first program in Qt. To install libfontconfig1, run the following command:
sudo apt-get install libfontconfig1
To install mesa-common-dev, run the following command:
sudo apt-get install mesa-common-dev
At this point, you should have a working Qt setup. You can verify the installation by issuing the following command in the Linux Terminal:

In case the qmake command isn't recognized, make sure you export the bin path of the Qt installation folder, as shown in the preceding screenshot. Additionally, creating a soft link might be useful too. The command for this is as follows:
sudo ln -s /home/jegan/Qt5.7.0/5.7/gcc_64/bin/qmake /usr/bin/qmake
The path where Qt is installed on your system might vary from mine, so please substitute the Qt path accordingly.