Ubuntu18.04更换国内源

简介: 转载自网络


Ubuntu本身的源使用的是国内的源,下载速度比较慢,不像CentOS一样yum安装的时候对镜像站点进项选择, 
所以选择了更换成国内的源。 
以下内容整合自网络

备份/etc/apt/sources.list文件

mv /etc/apt/sources.list /etc/apt/sourses.list.backup
  • 1

新建/etc/apt/sources.list文件并添加以下内容

#163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

更改完成之后执行以下命令

# apt update
# apt upgrade
  • 1
  • 2

其他的一些apt命令

sudo apt-get update  更新源
sudo apt-get install package 安装包
sudo apt-get remove package 删除包
sudo apt-cache search package 搜索软件包
sudo apt-cache show package  获取包的相关信息,如说明、大小、版本等
sudo apt-get install package --reinstall  重新安装包
sudo apt-get -f install  修复安装
sudo apt-get remove package --purge 删除包,包括配置文件等
sudo apt-get build-dep package 安装相关的编译环境
sudo apt-get upgrade 更新已安装的包
sudo apt-get dist-upgrade 升级系统
sudo apt-cache depends package 了解使用该包依赖那些包
sudo apt-cache rdepends package 查看该包被哪些包依赖
sudo apt-get source package  下载该包的源代码
sudo apt-get clean && sudo apt-get autoclean 清理无用的包
sudo apt-get check 检查是否有损坏的依赖
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

其他几个国内的源:

#中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

#阿里云源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

#清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
目录
相关文章
|
Ubuntu Python
Ubuntu安装pip并切换国内源
Ubuntu安装pip并切换国内源
2567 0
Ubuntu安装pip并切换国内源
|
16天前
|
Ubuntu Linux Python
Linux(15)Ubuntu安装ninja构建工具
Linux(15)Ubuntu安装ninja构建工具
66 0
|
1天前
|
Ubuntu Python
Ubuntu 安装Python3.8
Ubuntu 安装Python3.8
9 0
|
2天前
|
Ubuntu 应用服务中间件 nginx
ubuntu编译安装nginx及安装nginx_upstream_check_module模块
以上是编译安装Nginx和安装 `nginx_upstream_check_module`模块的基本步骤。根据你的需求和环境,你可能需要进一步配置Nginx以满足特定的要求。
15 3
|
4天前
|
资源调度 JavaScript Ubuntu
Yarn介绍及快速安装Debian/Ubuntu Linux
现在,你已经成功安装了Yarn,可以在你的JavaScript项目中使用它来管理依赖。
40 3
|
4天前
|
Ubuntu
Ubuntu20.04安装SNMP服务
至此,你已经成功在Ubuntu 20.04上安装了SNMP服务。你可以使用SNMP工具来监视和管理你的系统,或者将其集成到网络管理系统中。
20 3
|
8天前
|
Ubuntu 关系型数据库 MySQL
Ubuntu 20.04 + mysql8 安装以及配置大小写不敏感
Ubuntu 20.04 + mysql8 安装以及配置大小写不敏感
|
8天前
|
缓存 Ubuntu 数据库
ubuntu无法使用apt命令时怎么安装库
无论哪种方法,一旦成功安装了所需的库文件,你应该能够在Ubuntu系统上正常使用它们。如果问题仍然存在,可能需要进一步检查系统的包管理配置和依赖关系问题。
27 0
|
10天前
|
Ubuntu Shell 网络安全
【专栏】如何在 Ubuntu 22.04 上安装 KubeSphere?
【4月更文挑战第28天】在Ubuntu 22.04上安装KubeSphere的指南:确保系统至少有4GB内存和2核CPU,安装Docker和docker-compose。下载安装脚本`curl -sSL https://kubesphere.io/install.sh | bash`,根据提示选择安装选项,等待完成。安装后,通过访问控制台验证安装效果。解决可能出现的错误、网络问题和性能问题,利用KubeSphere提升容器管理效率。本文为顺利安装和使用提供参考。