apt离线源配置

1、前提条件

  1. nginx #apt install -y nginx
  2. apt离线源:
  3. ARMhttp://58.49.120.2:56998/mirrors.aliyun.com.arm.tar.gz #大小120G

2、apt离线源服务端搭建

如文件:mirrors.aliyun.com.arm.tar.gz上传到服务器

  1. tar zxvf mirrors.aliyun.com.arm.tar.gz -C /opt #时间非常久
  2. mv /opt/mirrors.aliyun.com /opt/apt-mirrors #修改目录名
  3. chmod 777 /opt/apt-mirrors #修改权限

配置nginx

  1. sed -i 's#root .*;#root /opt/apt-mirrors;#' /etc/nginx/sites-enabled/default
  2. systemct restart nginx #重启
  3. systemct enable nginx #开机启动

3、apt客户端配置

清除代理配置

  1. sed -i 's/^/#/g' /etc/apt/apt.conf

配置apt源

  1. cat << EOF > /etc/apt/sources.list
  2. deb http://mirrors.zenview.com/ubuntu-ports/ bionic main restricted universe multiverse
  3. deb http://mirrors.zenview.com/ubuntu-ports/ bionic-security main restricted universe multiverse
  4. deb http://mirrors.zenview.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
  5. deb http://mirrors.zenview.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse
  6. deb http://mirrors.zenview.com/ubuntu-ports/ bionic-backports main restricted universe multiverse
  7. EOF

配置hosts

  1. vi /etc/hosts

添加如下,200.100.128.18修改为apt服务端ip地址

  1. 200.100.128.18 mirrors.zenview.com

完成,可以更新源了

  1. apt update

清华源地址

  1. https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/