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
相关推荐
刘某的Cloud30 分钟前
SSH命令建立隧道
linux·运维·ssh·系统·shell
weixin_471525783 小时前
【gdb/sqlite3移植/mqtt】
linux·运维·服务器
大聪明-PLUS4 小时前
TCP/IP 协议族—理论与实践(一)
linux·嵌入式·arm·smarc
迎風吹頭髮7 小时前
Linux内核架构浅谈2- Linux内核与硬件交互的底层逻辑:硬件抽象层的作用
linux·架构·交互
Guheyunyi7 小时前
消防管理系统如何重构现代空间防御体系
大数据·运维·人工智能·安全·信息可视化·重构
我是好小孩7 小时前
【Android】六大设计原则
android·java·运维·服务器·设计模式
~光~~7 小时前
【环境配置 】WSL2 +ubuntu20.04 +Qt配置+Kits配置
开发语言·qt·ubuntu
孙同学要努力8 小时前
《Linux篇》进程状态——浅度、深度睡眠状态、僵尸状态、运行状态
linux·运维
jieyu11198 小时前
Linux Rootkit 详解
linux·运维·系统安全
宁檬精9 小时前
运维面试准备——综合篇(一)
linux·运维·服务器