Offline Cent OS Stream 9 QT 6 build Steps
Step 1:
mkdir -p /root/qt6-offline/{build,install,rpms}
cd /root/qt6-offline
step 2:
You install development tools and libraries required to compile Qt:
Compilers: gcc-c++
Build tools: cmake, ninja
Libraries: fontconfig-devel, wayland-devel, freetype-devel, etc
dnf install /root/qt6-offline/rpms/*.rpm
cd /root/qt6-offline/rpms
dnf install *.rpm --nogpgcheck
run this to ensure these are installed ->gives the path
which cmake
which ninja
which g++
step 3:
You are unpacking the complete Qt 6.6.2 source code, which contains all modules (qtbase,
qtmultimedia, qttools, etc.).
This becomes the input to the configuration process.
download and extract src tar folder
tar -xf qt-everywhere-src-6.6.2.tar.xz
step 4:
You're telling Qt:
Where to install the build (-prefix)
What to build or skip (-nomake, -skip qtwebengine)
To accept the open source license (-opensource, -confirm-license)
Build type: release, not debug.
configure internally runs CMake with Qt’s specific settings.
This generates build.ninja files (Ninja build rules) inside your build/ directory.
cd /root/qt6-offline/build
../src/qt-everywhere-src-6.6.2/configure \
-prefix /root/qt6-offline/install \
-opensource -confirm-license \
-nomake examples -nomake tests \
-skip qtwebengine \
-no-warnings-are-errors \
-DQT_BUILD_TOOLS_BY_DEFAULT=ON \
-DCMAKE_BUILD_TYPE=Release
step 5:
buidlding Qt using ninja
Ninja reads the build.ninja file and starts compiling the Qt source.
-j$(nproc) makes it use all CPU cores in parallel = faster builds.
Produces compiled binaries like .so, .a, and Qt tools (like designer, qmake, etc.
cd /root/qt6-offline/build
ninja -j$(nproc)
step 6:
install qt
All built binaries, libraries, and headers are copied into the install/ folder.
The structure mimics what you’d see in /usr/:
install/bin/: Tools like qmake, designer, assistant
install/lib/: Qt shared libraries
install/include/: C++ headers for development
install/plugins/: Qt plugin modules (like platform plugins)
cd /root/qt6-offline/build
ninja install
step 7:
You're creating a script to:
Add your custom Qt’s bin/ folder to the PATH so you can run tools without full path.
Tell the system where to find Qt’s libraries (LD_LIBRARY_PATH)
Register plugin and QML paths.
This makes your Qt environment portable and reproducible — no need to install globally.
source /root/qt6-offline/qt6.6.2-install/env-setup.sh
shortcut
Yes! Since you've already successfully built Qt 6.6.2 once on your online CentOS Stream 9 system, you
don’t need to repeat the long build process on each online system. You can reuse your existing build
by creating a portable Qt 6 package and copying it to other systems.
Here’s the clean and fast way to do it:
✅ Option 1: Copy Prebuilt Qt 6 (RECOMMENDED for same distro/version)
You only need to copy the install folder and environment setup to each
system:
1. On your current system (where Qt is built):
cd /root/qt6-offline
tar -czf qt6.6.2-install.tar.gz install env-setup.sh
2. Copy this .tar.gz to your other system(s):
You can use scp, USB, or any other method.
3. On the target system:
mkdir -p /root/qt6-offline
cd /root/qt6-offline
tar -xzf /path/to/qt6.6.2-install.tar.gz
source /root/qt6-offline/env-setup.sh
Qt 6 will now be fully ready on that system. Test it with:
qmake --version
designer &
🧠 Notes
This works because your install/ folder is relocatable — Qt tools don’t
hardcode absolute paths.
All systems must be CentOS Stream 9 with the same RPM dependencies
installed. If you also have /root/qt6-offline/rpms/, you can install them the
same way on each system:
bash
Copy
Edit
dnf install /root/qt6-offline/rpms/*.rpm
1. Make folders
make folders
mkdir -p /root/qt6-offline/{build,build-tools,install,repo,rpms,setup-tools,src}
cd /root/qt6-offline
put the rpms.zip and qt6.6.2-install.tar.gz in qt6-offline folder
2.Install Rpms
mkdir -p /etc/yum.repos.d/backup
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/
extract rpms folder then run
cd /root/qt6-offline/rpms
dnf install -y *.rpm --disablerepo=* --skip-broken
dnf install *.rpm --nogpgcheck
dnf install *.rpm --allowerasing
merged (dnf install -y *.rpm --disablerepo=* --nogpgcheck --skip-broken)
3. Extact qt6.6.2-install.tar.gz
cd /root/qt6-offline
tar -xzf qt6.6.2-install.tar.gz
4: Set Up the Qt Environment
source /root/qt6-offline/qt6.6.2-install/env-setup.sh
/root/qt6-offline/qt6.6.2-install/install/bin/qmake --version
/root/qt6-offline/qt6.6.2-install/install/bin/qmake6 --version