1. 如何配置Ubuntu Server 24.04中的DNS
vim /etc/systemd/resolved.conf
然后写入下面内容
[Resolve]
DNS=223.5.5.5 114.114.114.114
FallbackDNS=1.1.1.1
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
systemctl restart systemd-resolved
netplan apply
然后ping一下域名,如果地址返回的是真实的公网ip地址,而不是192.168这样的内网地址,说明生效了。
ping www.baidu.com
2. 修改apt源为阿里云apt源
vim /etc/apt/sources.list.d/ubuntu.sources
注意:Ubuntu 24.04和之前的版本,修改的文件不一样。
写入下面内容,并且把默认的注释掉。
# 阿里云
Types: deb
URIs: http://mirrors.aliyun.com/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
然后执行下面命令。
apt-get update -y && apt update -y
评论区