Ubuntu22.04.4 - apt - 笔记

一、修改源配置

这里使用的时候又出现了联不通的情况,换成国内镜像 在update

cp /etc/apt/source.list /etc/apt/source.list.bak

vim source.list

换源地址 修改完(网上有,注意:根据Ubuntu版本不一样,部分内同也会不一样)

bash 复制代码
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse

这里又遇到最后几个 update 还是连不上

根据网上资料

/etc/resolv.conf 文件 加上

复制代码
	nameserver 8.8.8.8
	nameserver 114.114.114.114

然后 apt update 就可以了

1、/etc/resolv.conf 重启被重置

嗯...... Do not edit 好家伙

1. 修改 /etc/systemd/resolved.conf 文件

Resolve

DNS=8.8.8.8 114.114.114.114

2.重启域名解析服务

systemctl restart systemd-resolved

systemctl enable systemd-resolved

3.备份当前的/etc/resolve.conf,并重新设置/run/systemd/resolve/resolv.conf 到/etc/resolve.conf的软链接

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

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

4.查看验证

cat /etc/resolv.conf

相关推荐
字节逆旅5 小时前
ubuntu应用深度守护
ubuntu
欧云服务器6 天前
怎么让脚本命令可以同时在centos、debian、ubuntu执行?
ubuntu·centos·debian
智渊AI6 天前
Ubuntu 20.04/22.04 下通过 NVM 安装 Node.js 22(LTS 稳定版)
ubuntu·node.js·vim
The️7 天前
Linux驱动开发之Read_Write函数
linux·运维·服务器·驱动开发·ubuntu·交互
再战300年7 天前
Samba在ubuntu上安装部署
linux·运维·ubuntu
qwfys2007 天前
How to install golang 1.26.0 to Ubuntu 24.04
ubuntu·golang·install
木尧大兄弟7 天前
Ubuntu 系统安装 OpenClaw 并接入飞书记录
linux·ubuntu·飞书·openclaw
小虾爬滑丫爬7 天前
ubuntu上设置Tomcat 开机启动
ubuntu·tomcat·开机启动
老师用之于民7 天前
【DAY25】线程与进程通信:共享内存、同步机制及实现方案
linux·c语言·ubuntu·visual studio code
小虾爬滑丫爬7 天前
Ubuntu 上设置防火墙
ubuntu·防火墙