原创

Ubuntu系统配置DNS、修改apt源

一、修改DNS

1、修改resoled文件

vim /etc/systemd/resolved.conf
DNS=223.5.5.5 202.106.0.20

2、重启resolved

systemctl restart systemd-resolved

3、备份配置文件

mv /etc/resolv.conf /etc/resolv.conf.bak

4、软链替换原配置文件

ln -s /run/systemd/resolve/resolv.conf /etc/

## DNS没生效的就在重启一下resolved

二、配置apt源

1、修改apt源配置文件

sudo vim /etc/apt/sources.list

2、增加阿里云源

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

3、更新缓存

sudo apt-get update
sudo apt-get upgrade
正文到此结束
评论

登录后才能发表评论 登录/注册

0评论
  • 还没有评论,快来抢沙发吧!