Skip to content
Go back

Install Qt 6.8.0 Offline on Ubuntu

banner

Install Qt 6.8.0 Offline on Ubuntu 24.04 (Complete Guide)

Installing Qt 6.8.0 LTS from source on Ubuntu 24.04 without internet access requires careful preparation. This comprehensive guide walks you through every step, from installing system dependencies to verifying your Qt installation.

Whether you’re building Qt for embedded systems, air-gapped environments, or simply want full control over your Qt installation, this tutorial covers everything you need.

Table of Contents

Open Table of Contents

System Requirements

Before starting the Qt 6.8.0 offline installation, ensure your Ubuntu 24.04 system meets these requirements:

ComponentRequirement
OS VersionUbuntu 24.04.3 LTS
Disk Space90 GB free (includes build artifacts)
RAM8 GB minimum (16 GB recommended)
CPU Cores4+ cores recommended
CMake Version3.16 or higher
CompilerGCC 11+ or Clang 14+

⚠️ Important: The build process takes 1-3 hours depending on your CPU and RAM configuration.


Step 1: Install System Dependencies

Qt 6.8.0 requires numerous development libraries. Install all required dependencies with this single command:

sudo apt update && sudo apt install -y \
    build-essential \
    cmake \
    ninja-build \
    git \
    perl \
    python3 \
    libclang-dev \
    clang \
    llvm \
    libgl1-mesa-dev \
    libglu1-mesa-dev \
    libfontconfig1-dev \
    libfreetype6-dev \
    libx11-dev \
    libx11-xcb-dev \
    libxext-dev \
    libxfixes-dev \
    libxi-dev \
    libxrender-dev \
    libxcb1-dev \
    libxcb-cursor-dev \
    libxcb-cursor0 \
    libxcb-glx0-dev \
    libxcb-keysyms1-dev \
    libxcb-image0-dev \
    libxcb-shm0-dev \
    libxcb-icccm4-dev \
    libxcb-sync-dev \
    libxcb-xfixes0-dev \
    libxcb-shape0-dev \
    libxcb-randr0-dev \
    libxcb-render-util0-dev \
    libxcb-util-dev \
    libxcb-xinerama0-dev \
    libxcb-xkb-dev \
    libxkbcommon-dev \
    libxkbcommon-x11-dev \
    libssl-dev \
    libdbus-1-dev \
    libudev-dev \
    libglib2.0-dev \
    libicu-dev \
    libpcre2-dev \
    libzstd-dev \
    libpng-dev \
    libjpeg-dev \
    libsqlite3-dev \
    zlib1g-dev \
    libharfbuzz-dev \
    libb2-dev \
    libmd4c-dev \
    libmd4c-html0-dev \
    libatspi2.0-dev \
    libdouble-conversion-dev \
    libtiff-dev \
    libwebp-dev

Verify CMake Version

Qt 6.8.0 requires CMake 3.16 or higher:

cmake --version

Expected output:

cmake version 3.28.3

Step 2: Prepare Qt Source Code

Download Qt Source (On Connected Machine)

If you’re preparing for offline installation, download the Qt source on a machine with internet access:

# Download Qt 6.8.0 LTS source
wget https://download.qt.io/official_releases/qt/6.8/6.8.0/single/qt-everywhere-src-6.8.0.tar.xz

Transfer the file to your offline Ubuntu 24.04 machine using USB or network transfer.

Extract Qt Source

cd ~/Downloads
tar xf qt-everywhere-src-6.8.0.tar.xz
cd qt-everywhere-src-6.8.0

Create Installation Directory

sudo mkdir -p /opt/Qt6.8.0
sudo chown $USER:$USER /opt/Qt6.8.0

Step 3: Configure Qt Build

Clean any previous configuration attempts:

cd ~/Downloads/qt-everywhere-src-6.8.0
rm -rf CMakeCache.txt CMakeFiles config.cache

Configure Qt with optimized settings for offline installation:

./configure \
    -prefix /opt/Qt6.8.0 \
    -opensource \
    -confirm-license \
    -release \
    -nomake examples \
    -nomake tests \
    -skip qtwebengine

Configuration Options Explained

OptionPurpose
-prefix /opt/Qt6.8.0Installation directory
-opensourceUse open-source license
-confirm-licenseAuto-accept license
-releaseBuild optimized release version
-nomake examplesSkip examples (saves time/space)
-nomake testsSkip tests (saves time/space)
-skip qtwebengineSkip WebEngine (reduces dependencies)

Step 4: Build and Install Qt

Build Qt (Parallel Compilation)

For systems with 8+ GB RAM and 4+ cores:

cd ~/Downloads/qt-everywhere-src-6.8.0
cmake --build . --parallel $(nproc)

⏱️ Build Time: 1-3 hours depending on hardware

For systems with less RAM (4-8 GB):

cmake --build . --parallel 2

Install Qt

After successful build, install Qt to /opt/Qt6.8.0:

cmake --install .

Step 5: Set Up Environment Variables

Create a reusable environment configuration script:

cat > ~/qt6_env.sh << 'EOF'
#!/bin/bash
# Qt 6.8.0 LTS Environment Setup

export QTDIR=/opt/Qt6.8.0
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QT_PLUGIN_PATH=$QTDIR/plugins
export QML_IMPORT_PATH=$QTDIR/qml
export QML2_IMPORT_PATH=$QTDIR/qml
export PKG_CONFIG_PATH=$QTDIR/lib/pkgconfig:$PKG_CONFIG_PATH
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins/platforms

echo "========================================="
echo "Qt 6.8.0 LTS Environment Configured"
echo "========================================="
qmake --version
echo "qmake: $(which qmake)"
echo "========================================="
EOF

chmod +x ~/qt6_env.sh

Add to Shell Profile (Automatic Loading)

echo "" >> ~/.bashrc
echo "# Qt 6.8.0 LTS Environment" >> ~/.bashrc
echo "source ~/qt6_env.sh" >> ~/.bashrc

Load environment immediately:

source ~/qt6_env.sh

Step 6: Verify Installation

Check qmake

ls -la /opt/Qt6.8.0/bin/qmake
/opt/Qt6.8.0/bin/qmake --version

Expected output:

QMake version 3.1
Using Qt version 6.8.0 in /opt/Qt6.8.0/lib

Create Test Application

mkdir -p ~/qt_test
cd ~/qt_test

cat > main.cpp << 'EOF'
#include <QCoreApplication>
#include <QDebug>

int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);
    qDebug() << "Qt" << QT_VERSION_STR << "is working!";
    return 0;
}
EOF

cat > test.pro << 'EOF'
QT += core
CONFIG += console
CONFIG -= app_bundle
SOURCES += main.cpp
EOF

Build and Run Test

qmake test.pro
make
./test

Expected output:

Qt 6.8.0 is working!

Clean Up Build Files (Optional)

Save ~10-15 GB of disk space by removing build artifacts:

# Remove build directory
rm -rf ~/Downloads/qt-everywhere-src-6.8.0

# Keep source tarball for backup (optional)
# rm ~/Downloads/qt-everywhere-src-6.8.0.tar.xz

Troubleshooting

Issue: CMake Version Too Old

Error:

CMake 3.16 or higher is required

Solution:

# Install newer CMake from Kitware repository
sudo apt install -y software-properties-common
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ jammy main'
sudo apt update
sudo apt install cmake

Issue: Out of Memory During Build

Error:

c++: fatal error: Killed signal terminated program cc1plus

Solution:

# Reduce parallel jobs
cmake --build . --parallel 2

# Or add swap space
sudo fallocate -l 8G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Issue: Missing libxcb-cursor0

Error:

libxcb-cursor0: not found

Solution:

sudo apt install libxcb-cursor0

Issue: qmake Not Found After Installation

Solution:

# Reload environment
source ~/qt6_env.sh

# Or manually add to current session
export PATH=/opt/Qt6.8.0/bin:$PATH

Frequently Asked Questions

Can I install multiple Qt versions simultaneously?

Yes, install each version to a separate directory (e.g., /opt/Qt6.8.0, /opt/Qt6.10.1) and use different environment scripts.

How much disk space do I need?

Should I use Qt 6.8.0 or Qt 6.10.1?

Qt 6.8.0 is an LTS (Long Term Support) release, recommended for production. Qt 6.10.1 has newer features but shorter support lifecycle.

Can I cross-compile Qt for ARM/embedded systems?

Yes, but requires additional -device and -sysroot configuration options during the configure step.

How do I uninstall Qt?

sudo rm -rf /opt/Qt6.8.0
# Remove from .bashrc
sed -i '/Qt 6.8.0/d' ~/.bashrc
sed -i '/qt6_env.sh/d' ~/.bashrc


Share this post on:

Next Post
Enable TLS in FusionPBX with Let's Encrypt