基于ubuntu2310制作离线源

ubuntu2310制作openstack离线源

2310清华源

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ mantic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ mantic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ mantic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ mantic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ mantic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ mantic-backports main restricted universe multiverse
root@controller:~# cd /var/cache/apt/archives
root@controller:/var/cache/apt/archives# rm -rf ./*

apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances 软件包名 | grep “^\w” | sort -u)

apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances sshpass python3-openstackclient mariadb-server python3-pymysql rabbitmq-server memcached python3-memcache keystone glance placement-api nova-api nova-conductor nova-novncproxy nova-scheduler nova-compute neutron-server neutron-plugin-ml2  neutron-l3-agent neutron-dhcp-agent  neutron-metadata-agent neutron-openvswitch-agent openstack-dashboard | grep "^\w" | sort -u)

–no-enhances:后面跟下载所需的软件包

拷贝软件包

root@controller:/var/cache/apt/archives# mkdir -p /opt/openstackpkg/debs/
root@controller:/var/cache/apt/archives# touch /opt/openstackpkg/debs/Packages.gz
root@controller:/var/cache/apt/archives# chmod 777 -R /opt/openstackpkg
root@controller:/var/cache/apt/archives# cp -r /var/cache/apt/archives/* /opt/openstackpkg/

构建依赖环境

root@controller:/var/cache/apt/archives# apt install dpkg-dev -y
root@controller:/var/cache/apt/archives# dpkg-scanpackages /opt/openstackpkg /dev/null | gzip > /opt/openstackpkg/debs/Packages.gz

打包离线源

root@controller:/opt# tar zcvf openstackpkg-B.tar.gz openstackpkg/

验证

root@controller:~# cp /etc/apt/sources.list{,.bak}
cat > /etc/apt/sources.list << EOF
deb [trusted=yes] file:// /opt/openstackpkg/debs/
EOF
root@controller:~# apt update
posted @ 2024-03-19 20:15  huhy  阅读(16)  评论(0)    收藏  举报  来源
--> --> /*文章评论*/