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
相关推荐
李斯维几秒前
第18章 过滤器:统计和格式化
linux·bash·unix
云和数据.ChenGuang3 分钟前
OpenEuler 系统中安装 MySQL
运维·数据库·mysql·adb·运维工程师·运维技术
DeeplyMind9 分钟前
ROCm rocr-libhsakmt性能跟踪与分析系列10-5:跟踪启动、数据采集与停止
linux·驱动开发
jerryinwuhan11 分钟前
linux_1219_1
linux
为什么不问问神奇的海螺呢丶11 分钟前
SFTP搭建-自动检测上传文件修改权限-rsync 自动同步到其他服务器
运维·服务器
山沐与山12 分钟前
【Docker】Docker容器技术详解
运维·docker·容器
@小博的博客14 分钟前
Linux的工具第一篇:vim编辑器的使用详解
linux·编辑器·vim
梦想的旅途215 分钟前
探索界面自动化技术在企业微信外部群管理中的应用场景与实现思路
运维·自动化·企业微信
叮咚侠20 分钟前
Ubuntu 24.04.3 LTS如何扩容逻辑卷
linux·数据库·ubuntu
路溪非溪27 分钟前
UBUS基本使用总结
linux·网络·arm开发·智能路由器