Ubuntu16.04 NAT网络和镜像源

1、NAT网络设置

sudo vim /etc/network/interfaces

#修改配置
auto ens33
iface ens33 inet static
address 192.168.162.130
netmask 255.255.255.0
gateway 192.168.162.2
dns-nameservers 8.8.8.8

#重启网卡
sudo /etc/init.d/networking restart

2、镜像源设置

cd /etc/apt
## 备份
cp sources.list /etc/apt/sources.list.old

sudo vim sources.list

# 配置
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
#deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

# 更新命令
sudo apt-get update

sudo apt-get upgrade

你可能感兴趣的:(Ubuntu16.04 NAT网络和镜像源)