Ubuntu18.04.5下载离线仓库
########################################################
缓存下载离线软件包
apt download -d apache
ls /var/cache/archives/
apt remove --purge linux-tools-4.15.0-20-generic
apt-get -d install linux-tools-4.15.0-20-generic
########################################################
1、创建离线镜像仓库存储路径
mkdir -p /var/www/html/{20.04,18.04.5}
2、安装apache2
apt install -y apache2
systemctl enable apache2 && systemctl start apache2
3、配置离线仓库
cat>/etc/apt/mirror.list<<'EOF' ############# config ################## # set base_path /var/www/html/20.04 # set mirror_path $base_path/mirror # set skel_path $base_path/skel # set var_path $base_path/var # set cleanscript $var_path/clean.sh # set defaultarch <running host architecture> # set postmirror_script $var_path/postmirror.sh # set run_postmirror 0 set nthreads 20 set _tilde 0 # ############# end config ############## deb http://repo.huaweicloud.com/ubuntu-ports/ focal main restricted deb http://repo.huaweicloud.com/ubuntu-ports/ focal-updates main restricted deb http://repo.huaweicloud.com/ubuntu-ports/ focal universe deb http://repo.huaweicloud.com/ubuntu-ports/ focal-updates universe deb http://repo.huaweicloud.com/ubuntu-ports/ focal multiverse deb http://repo.huaweicloud.com/ubuntu-ports/ focal-updates multiverse deb http://repo.huaweicloud.com/ubuntu-ports/ focal-backports main restricted universe multiverse deb http://repo.huaweicloud.com/ubuntu-ports/ focal-security main restricted deb http://repo.huaweicloud.com/ubuntu-ports/ focal-security universe deb http://repo.huaweicloud.com/ubuntu-ports/ focal-security multiverse clean http://archive.huaweicloud.com/ubuntu-ports/ EOF
cat>/etc/apt/mirror.list<<'EOF' ############# config ################## # #set base_path /var/www/html/18.04.5/ # set mirror_path $base_path/mirror # set skel_path $base_path/skel # set var_path $base_path/var # set cleanscript $var_path/clean.sh # set defaultarch <running host architecture> # set postmirror_script $var_path/postmirror.sh # set run_postmirror 0 set nthreads 20 set _tilde 0 # ############# end config ############## deb http://repo.huaweicloud.com/ubuntu-ports/ bionic main restricted universe multiverse deb http://repo.huaweicloud.com/ubuntu-ports/ bionic-updates main restricted universe multiverse deb http://repo.huaweicloud.com/ubuntu-ports/ bionic-backports main restricted universe multiverse deb http://repo.huaweicloud.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse deb http://repo.huaweicloud.com/ubuntu-ports/ bionic-security main restricted universe multiverse clean http://archive.huaweicloud.com/ubuntu-ports/ EOF
4、执行下载
nohup apt-mirror &
5、配置仓库文件
cat>/etc/apt/sources.list<<'EOF' #--- 18.04.5 deb http://168.7.10.14/18.04.5/mirror/repo.huaweicloud.com/ubuntu-ports/ bionic main restricted deb http://168.7.10.14/18.04.5/mirror/repo.huaweicloud.com/ubuntu-ports/ bionic universe deb http://168.7.10.14/18.04.5/mirror/repo.huaweicloud.com/ubuntu-ports/ bionic multiverse deb http://168.7.10.14/18.04.5/mirror/repo.huaweicloud.com/ubuntu-ports/ bionic-updates main restricted deb http://168.7.10.14/18.04.5/mirror/repo.huaweicloud.com/ubuntu-ports/ bionic-updates universe deb http://168.7.10.14/18.04.5/mirror/repo.huaweicloud.com/ubuntu-ports/ bionic-updates multiverse deb http://168.7.10.14/18.04.5/mirror/repo.huaweicloud.com/ubuntu-ports/ bionic-backports main restricted universe multiverse deb http://168.7.10.14/18.04.5/mirror/repo.huaweicloud.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse deb http://168.7.10.14/18.04.5/mirror/repo.huaweicloud.com/ubuntu-ports/ bionic-security main restricted deb http://168.7.10.14/18.04.5/mirror/repo.huaweicloud.com/ubuntu-ports/ bionic-security universe deb http://168.7.10.14/18.04.5/mirror/repo.huaweicloud.com/ubuntu-ports/ bionic-security multiverse #--- 20.04 deb http://168.7.10.14/20.04/mirror/repo.huaweicloud.com/ubuntu-ports/ focal main restricted deb http://168.7.10.14/20.04/mirror/repo.huaweicloud.com/ubuntu-ports/ focal-updates main restricted deb http://168.7.10.14/20.04/mirror/repo.huaweicloud.com/ubuntu-ports/ focal universe deb http://168.7.10.14/20.04/mirror/repo.huaweicloud.com/ubuntu-ports/ focal-updates universe deb http://168.7.10.14/20.04/mirror/repo.huaweicloud.com/ubuntu-ports/ focal multiverse deb http://168.7.10.14/20.04/mirror/repo.huaweicloud.com/ubuntu-ports/ focal-updates multiverse deb http://168.7.10.14/20.04/mirror/repo.huaweicloud.com/ubuntu-ports/ focal-backports main restricted universe multiverse deb http://168.7.10.14/20.04/mirror/repo.huaweicloud.com/ubuntu-ports/ focal-security main restricted deb http://168.7.10.14/20.04/mirror/repo.huaweicloud.com/ubuntu-ports/ focal-security universe deb http://168.7.10.14/20.04/mirror/repo.huaweicloud.com/ubuntu-ports/ focal-security multiverse EOF 离线仓库配置文件