> 技术文档 > ubuntu qt 在线安装使用国内镜像_qt 国内镜像

ubuntu qt 在线安装使用国内镜像_qt 国内镜像

在Ubuntu系统上通过国内镜像加速Qt在线安装的步骤如下:


1. 下载Qt在线安装器(使用国内镜像)

从国内镜像源下载Qt安装器(以清华大学镜像站为例):

wget https://mirrors.tuna.tsinghua.edu.cn/qt/archive/online_installers/4.6/qt-unified-linux-x64-4.6.0-online.runchmod +x qt-unified-linux-x64-4.6.0-online.run

2. 配置Qt安装器使用国内镜像

方法一:通过命令行参数指定镜像

运行安装器时,通过 --mirror 参数指定国内镜像地址:

./qt-unified-linux-x64-4.6.0-online.run --mirror https://mirrors.tuna.tsinghua.edu.cn/qt
方法二:修改安装器配置文件
  1. 运行安装器一次,进入安装界面后关闭。
  2. 找到配置文件路径:
    • 通常位于 ~/.cache/Qt/qtinstaller.conf 或 ~/.config/QtProject/qtinstaller.conf
  3. 编辑配置文件,添加国内镜像地址:
    [General]repository.qt_official_repository.url=https://mirrors.tuna.tsinghua.edu.cn/qt/online/qtsdkrepository/linux_x64/root/qt/

3. 安装Qt

运行安装器并按照向导完成安装:

./qt-unified-linux-x64-4.6.0-online.run

4. 配置Qt维护工具(MaintenanceTool)

安装完成后,Qt的维护工具默认可能仍使用官方源。需手动修改其配置:

  1. 打开维护工具路径:
    cd ~/Qt/MaintenanceTool
  2. 编辑配置文件 qt.conf,替换镜像地址:
    [Paths]Prefix=/home/你的用户名/Qt[Online]Repository=https://mirrors.tuna.tsinghua.edu.cn/qt/online/qtsdkrepository/linux_x64/root/qt/

5. 验证镜像源

  • 安装过程中观察下载速度是否显著提升。
  • 安装完成后,通过维护工具更新组件,确认镜像生效。

国内常用Qt镜像源列表

镜像站 地址 清华大学镜像站 https://mirrors.tuna.tsinghua.edu.cn/qt 中国科技大学镜像站 https://mirrors.ustc.edu.cn/qtproject 阿里云镜像站 https://mirrors.aliyun.com/qt

注意事项

  1. 版本兼容性:不同Qt版本可能需要调整镜像路径中的版本号(如 online/qtsdkrepository/linux_x64/root/qt/)。
  2. 代理设置:若公司/学校网络需代理,需在安装器中配置代理。
  3. 镜像同步延迟:国内镜像可能存在同步延迟,最新版本建议优先使用官方源。

通过以上步骤,可显著提升Qt在Ubuntu上的安装和更新速度。