ubuntu20.04.3安装Qt6.22操作步骤
镜像下载、域名解析、时间同步请点击 阿里云开源镜像站
前言
Qt6.22LTS版本正式推出了,刚好有个项目,使用的linux屏资源比较好,准备使用Qt6.22,记录下在ubuntu20.04.3下安装Qt6.22的步骤
一、安装步骤
1.安装ubuntu20.04.3
直接到ubuntu网站,下载该安装镜像,在虚拟机下安装即可
2.更新ubuntu镜像下载源
2.1 修改 sources.list文件
不要使用ubuntu桌面的设置来设置为国内下载源,直接修改/etc/apt/sources.list文件
使用 sudo gedit /etc/apt/sources.list打开该文件
删除文件内所有内容后,使用阿里云镜像
# 阿里云镜像
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
2.2 更新操作
在终端内运行
sudo apt update
sudo apt upgrade
若执行 sudo apt upgrade 提示以下错误,是因为某个进程锁住了文件,我是直接重启后再upgrade,或参考其他方法,杀死进程,删除导致锁定的文件
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend xxxx
3.替换系统的vim
ubuntu自带的vim是tiny版,经常会有奇怪的字符,替换系统自带的vim
sudo apt remove vim-common
sudo apt install vim
4. 安装ifconfig支持
ubuntu默认没有安装ifconfig,需要手动安装
sudo apt install net-tools
5.安装sshd
ubuntu默认没有安装sshd,需要手动安装
sudo apt install openssh-server
6.安装gcc编译器
sudo apt-get install build-essential
sudo apt-get install libgl1-mesa-dev
安装完毕后,控制台输入gcc -v查看版本号,我的是9.4
root@ubuntu:/opt# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-yTrUTS/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04)
注:安装libgl1-mesa-dev,避免Qt在编译工程时出现
/usr/bin/ld: cannot find -lGL错误
7.安装Qt
在ubuntu中打开浏览器,到Qt官网 https://www.qt.io/download
阿里云镜像源:https://developer.aliyun.com/mirror/qt
下载(需登录)Qt的在线安装程序 qt-unified-linux-x64-4.2.0-online.run
本文转自:https://blog.csdn.net/sonicss/article/details/121802956