pve更新源和离线下载安装包

apt离线下载安装工具包

在线资源:https://pkgs.org/

#方法一前提:有网的系统未安装目标软件
# 有网的系统下载
apt install -d net-tools 
mv /var/cache/apt/archives/*.deb ~/net-tools
#或者直接下载到指定目录(绝对路径)
mkdir -p /root/net_tools
apt install -y -o dir::cache::archives="/root/net_tools/" -d net-tools


# 有网/离线的系统安装
apt install ./net-tools/*.deb 
#或者
dpkg -i ./net_tools/*.deb


#方法二前提:离线的系统必须安装有apt-offline软件
#离线的系统产生安装包信息sig文件,
#eg:apt-offline set --install-packages chrpath libfuse2 automake libnl-3-dev quilt debhelper gfortran libltdl-dev autotools-dev --update apt-offline-pkgs.sig
apt-offline set --install-packages 安装包名称 --update apt-offline-pkgs.sig
#有网机器上利用sig文件打包
apt-get update && apt-offline get apt-offline-pkgs.sig --bundle bundle-pkgs.zip --threads 10
#离线系统将压缩包的软件放进本地仓库
apt-offline install bundle-pkgs.zip
#离线系统取本地包安装,eg: apt-get install -y chrpath libfuse2 automake libnl-3-dev quilt debhelper gfortran libltdl-dev autotools-dev dpatch autoconf libnl-route-3-dev tk libgfortran5
apt-get install -y 安装包名称

pip离线安装python模块

在线资源:https://pypi.org/

python3 --version  

#方式一:下载Built Distribution格式

#例如下载python3模块离线包
# 这个命令是将 requirements.txt 的依赖列表下载到 /tmp/pkgs 目录中(绝对路径或者相对路径都可以),如果只想下载某个单独的依赖,可以将 -r requirements.txt 改为 依赖的名称
pip3 download -d /tmp/pkgs -r requirements.txt -i http://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com
pip3 download -d /root/offline-files/spicy-pip3-1 "btest>=0.66" sphinx-rtd-theme Pygments -i http://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com

#安装模块包
pip install --no-index --find-links=file:/tmp/pkgs -r requirements.tx
pip3 install --no-index --find-links=file:/root/offline-files/spicy-pip3-1  "btest>=0.66" sphinx-rtd-theme Pygments

#方式二:下载Source Distribution格式
#解压
#进入模块包目录
#安装模块
python3 setup.py install

更新国内源

1./etc/apt/sources.list

将系统 /etc/apt/sources.list 软件包仓库位置的原始默认配置文件备份,修改为 Debian系统源(阿里云源)和中科大proxmox源【https://mirrors.ustc.edu.cn/proxmox/】

"""/etc/apt/sources.list"""
#deb http://ftp.debian.org/debian buster main contrib
#deb http://ftp.debian.org/debian buster-updates main contrib
# security updates
#deb http://security.debian.org buster/updates main contrib

# debian aliyun source
deb https://mirrors.aliyun.com/debian buster main contrib non-free
deb https://mirrors.aliyun.com/debian buster-updates main contrib non-free
deb https://mirrors.aliyun.com/debian-security buster/updates main contrib non-free

# proxmox source
# deb http://download.proxmox.com/debian/pve buster pve-no-subscription
deb https://mirrors.ustc.edu.cn/proxmox/debian/pve buster pve-no-subscription

脚本操作:

2./etc/apt/sources.list.d/pve-enterprise.list

如果你没有订阅 Proxmox VE 企业版,可以将企业版软件源配置信息在软件源配置文件中注释掉(在该行开头插入一个 # 字符),以避免系统发出错误提示信息。这种情况下可以配置使用 pve-no-subscriptin 软件源。

因为没有订阅 Proxmox VE 企业版服务,所以这里对Proxmox VE 企业版更新源进行注释操作。

"""/etc/apt/sources.list.d/pve-enterprise.list"""
## deb https://enterprise.proxmox.com/debian/pve buster pve-enterprise

3.脚本操作

#!/bin/bash
#scripts name:change_apt_mirror.sh
NOW=$(date +%Y%m%d-%H%M);
if ! grep -q "tsinghua" /etc/apt/sources.list; then
    # 需要换成清华源
    mv /etc/apt/sources.list /etc/apt/sources.list.${NOW}
    sh -c 'echo "# debian aliyun source
deb https://mirrors.aliyun.com/debian buster main contrib non-free
deb https://mirrors.aliyun.com/debian buster-updates main contrib non-free
deb https://mirrors.aliyun.com/debian-security buster/updates main contrib non-free

# proxmox source
# deb http://download.proxmox.com/debian/pve buster pve-no-subscription
deb https://mirrors.ustc.edu.cn/proxmox/debian/pve buster pve-no-subscription" > /etc/apt/sources.list'
 
    echo "更换apt源为清华源"
fi
sed -i 's/deb/#deb/g' /etc/apt/sources.list.d/pve-enterprise.list;

apt update

最后执行上述命令来更新源。

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值