标签:列表 modify 软件 dump 选择 网易 配置文件 mod script
1、简介????很多时候,为了方便 操作,条件允许的情况下,直接 联网 进行安装,但是 系统 所配置的 apt源 配置的 url 地址 并非 国内的,获取资源很慢,所以 需要 配置成 国内的 源,本人 喜欢 163网易源,根据个人喜好 自行选择
????
## 本文操作系统 Ubuntu 16.04 amd64
## 发行版本号 xenial
# lsb_release -a
????
## 备份原有的源配置文件
# cd /etc/apt
# mv -v source.list{,.bak}
????
## 设置本地源,baseurl中file路径对应挂载的路径
# cat /etc/apt/source.list
deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
????
# apt-get clean all
????
# apt-get update
????
# apt-cache dump | grep Package
????
????本人 测试环境 需要 不断的恢复纯净 环境 进行 相关 测试操作,所以 每次 都手动 配置 实在 难受,简单的写了一个 配置脚本,可优化 之处 还望 留言 提示,嘿嘿!
????
# tar -zxvf set_apt_source.tar.gz -C .
????
## 安装完成之后,即可 直接 联网 安装 所需的 软件包
# cd set_apt_source/
# ./modify_apt_source.sh
????
# cat modify_apt_source.sh
#!/bin/bash
# file name :
# date :
# description :
deb_1="deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse"
deb_2="deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse"
deb_3="deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse"
deb_4="deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse"
deb_5="deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse"
deb_src1="deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse"
deb_src2="deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse"
deb_src3="deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse"
deb_src4="deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse"
deb_src5="deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse"
DEB_SOURCE="${deb_1}\n${deb_2}\n${deb_3}\n${deb_4}\n${deb_5}\n${deb_src1}\n${deb_src2}\n${deb_src3}\n${deb_src4}\n${deb_src5}\n"
APT_FILE="/etc/apt/sources.list"
[ -f ${APT_FILE} ] && mv ${APT_FILE}{,.bak}
printf "${DEB_SOURCE}" >> ${APT_FILE} && apt-get update
????
Ubuntu 16.04 163网易源设置(自动化配置脚本)
标签:列表 modify 软件 dump 选择 网易 配置文件 mod script
原文地址:http://blog.51cto.com/11495268/2333692