1. 离线制作机操作
1.1 下载软件包及其依赖
cd /var/cache/apt/archives
apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances vim chrony | grep "^\w" | sort -u)
1.2 构建离线源
mkdir -p /opt/openstackpkg/debs/
touch /opt/openstackpkg/debs/Packages.gz
chmod 777 -R /opt/openstackpkg
# 拷贝离线包到目录
cp -r /var/cache/apt/archives/* /opt/openstackpkg/
# 构建依赖关系
dpkg-scanpackages /opt/openstackpkg /dev/null | gzip > /opt/openstackpkg/debs/Packages.gz
# 打包环境
tar zcvf openstackpkg.tar.gz openstackpkg/
2. 使用离线源
2.1 配置
- 将离线压缩包拷贝到相应机器上解压配置
tar zxvf openstackpkg.tar.gz
cp /etc/apt/sources.list{,.bak}
cat > /etc/apt/sources.list << EOF
deb [trusted=yes] file:// /opt/openstackpkg/debs/
EOF
apt-get clean all
apt-get update
标签:opt,no,--,openstackpkg,离线,apt,Ubuntu,制作
From: https://www.cnblogs.com/wsxier/p/16935044.html