ubuntu更换国内apt源

ubuntu必备操作

1 更换apt镜像源

  1. 备份镜像
bash 复制代码
cp /etc/apt/sources.list /etc/apt/sources.list.bak
  1. 查看自己ubuntu版本
bash 复制代码
# 查看自己的codename
#查看自己的ubuntu版本[注意关注:DISTRIB_CODENAME,发行代号]
cat /etc/*release

# DISTRIB_CODENAME=cosmic
# 例如(下面是ubuntu的LTS长期支持版):
# Ubuntu20.04(focal)
# Ubuntu19.10(eoan)
# Ubuntu19.04(disco)
# Ubuntu18.04(bionic)
# Ubuntu16.04(xenial)
  1. 设置国内镜像源

我ubuntu的版本是18.10,国内上没有维护对应的镜像,但是大版本一致即可(所以我采用了bionic)

bash 复制代码
vim /etc/apt/sources.list
bash 复制代码
deb http://mirrors.aliyun.com/ubuntu/ bionic  main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
  1. 更新软件列表,完成换源
bash 复制代码
apt update
  1. 修复损坏的软件包
bash 复制代码
apt-get install  -f
  1. 更新软件
bash 复制代码
apt-get upgrade

2 其他命令

①防火墙相关

bash 复制代码
# 查看防火墙状态
sudo ufw status
# 开启/关闭防火墙
sudo ufw enable/disable
相关推荐
斗转星移34 小时前
Ubuntu20.04 中使用vscode中编辑查看PlantUML
linux·vscode·uml·plantuml
正经教主5 小时前
【问题】解决docker的方式安装n8n,找不到docker.n8n.io/n8nio/n8n:latest镜像的问题
运维·docker·容器·n8n
sukida1005 小时前
BIOS主板(非UEFI)安装fedora42的方法
linux·windows·fedora
●^●6 小时前
Linux 权限修改详解:chmod 命令与权限数字的秘密
linux
唯独失去了从容6 小时前
WebRTC服务器Coturn服务器中的通信协议
运维·服务器·webrtc
光而不耀@lgy7 小时前
C++初登门槛
linux·开发语言·网络·c++·后端
joker_zsl7 小时前
docker的安装和简单使用(ubuntu环境)
运维·docker·容器
偶尔微微一笑7 小时前
AI网络渗透kali应用(gptshell)
linux·人工智能·python·自然语言处理·编辑器
Run1.7 小时前
深入解析 Linux 中动静态库的加载机制:从原理到实践
linux·运维·服务器
VI8664956I267 小时前
全链路自动化AIGC内容工厂:构建企业级智能内容生产系统
运维·自动化·aigc