Ubuntu18.04下更改apt源为阿里云源
1.复制源文件备份,以防万一
我们要修改的文件是sources.list,它在目录/etc/apt/下,sources.list是包管理工具apt所用的记录软件包仓库位置的配置文件,同样类型的还有位于 同目录下sources.list.d文件下的各种.list后缀的各文件。
命令如下:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2.编辑源列表文件
命令如下:
sudo vim /etc/apt/sources.list
如果报错:sudo:vim:command not found 说明没装vim编辑器
使用命令:
sudo apt-get install vim 安装即可
3.查看新版本信息
其实Ubuntu18.04版之前的任一版更改apt源为国内源方法早就有了,内容大同小异,我们应当掌握其规律了,其实每一版内容不同的地方就是版本号(或者官方一点的说:系统代号),所以我们先了解下新版本的系统代号:
使用如下命令:
lsb_release -c
得到本系统的系统代号,如下图所示:
我们可以看到新版本的Ubuntu系统代号为bionic
同样的我们也可以得到之前任意版本的系统代号:
Ubuntu 12.04 (LTS)代号为precise。
Ubuntu 14.04 (LTS)代号为trusty。
Ubuntu 15.04 代号为vivid。
Ubuntu 15.10 代号为wily。
Ubuntu 16.04 (LTS)代号为xenial。
所以这也就解释了为什么我们百度出来的那么多方案里面内容不尽相同的原因,因为他们更改apt安装源时用的系统不一样。
4.将原有的内容注释掉,添加以下内容(或者你把里面内容修改成下面的就可以,但是不能有除了以下内容的有效内容)
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
值得注意的是sources.list文件的条目都是有格式的(通过上面的内容大家也看的出来),一般有如下形式
deb http://site.example.com/debian distribution component1 component2 component3
deb-src http://site.example.com/debian distribution component1 component2 component3
所以后面几个参数是对软件包的分类(Ubuntu下是main, restricted,universe ,multiverse这四个)
5.更新软件列表
运行如下命令:
sudo apt-get update
6.更新软件包
运行如下命令:
sudo apt-get upgrade
Ubuntu18.04下更改apt源为阿里云源的更多相关文章
- Linux - Ubuntu18.04下更改apt源为阿里云源
进入apt目录,备份原来的源地址 cd /etc/apt mv ./source.list ./source.list.bak 修改源文件source.list vim source.list 更换阿 ...
- Centos5, 6, 以及Ubuntu18.04下更改系统时间和时区
http://www.namhuy.net/2435/how-to-change-date-time-timezone-on-centos-6.html 查看日期(使用 -R 参数会以数字显示时区) ...
- Centos下替换yum源为阿里云源
阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/ 第一步:备份原镜像文件 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum ...
- ubuntu更改apt源为阿里云源
https://blog.csdn.net/zhangjiahao14/article/details/80554616 https://yq.aliyun.com/articles/704603 h ...
- 更换yum源为阿里云源
1.复制备份: cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 2.下载: wget -O ...
- Deepin 15.4 更改为 阿里云源
自带的 软件包源 不好用,卡顿严重,准备替换它: 方式一:deepin linux 如何更新或者更换软件源(注意:好像不起作用) 方式二:[推荐]利用 阿里云 提供的镜像快速更换本地的 yum 源 ( ...
- CentOS7搭建本地YUM仓库,并定期同步阿里云源
CentOS7同步阿里云镜像rpm包并自建本地yum仓库 系统环境 # cat /etc/centos-release CentOS Linux release 7.6.1810 (Core) # u ...
- CentOS 7 搭建本地YUM仓库,并定期同步阿里云源
目录导航: 1. 系统环境 2. 修改yum 源为阿里云源 3. 安装yum相关的软件 4. 根据源标识同步源到本地目录 5. 安装nginx开启目录权限保证本地机器可以直接本地yum源 6. 客户端 ...
- 在Ubuntu18.04下编译出ffmpeg(支持推流H265成rtmp)
Ubuntu18.04下编译libx264.libx265.libfdk_aac和ffmpeg 一.编译x264库 二.编译fdk-aac库 三.编译x265库 四.编译FFmpeg源码 五.设置环境 ...
随机推荐
- C++ 简介 基本语法 注释
一.第一个 C++ 程序 #include <iostream> using namespace std; int main() { cout << "Hello, ...
- Ubuntu安装并使用emacs
1. sudo add-apt-repository ppa:kelleyk/emacs 2. sudo apt update sudo apt install emacs26 3.安装完成,查看em ...
- CodeSmith 找不到请求的 .Net Framework Data Provider
连接数据库时候报标题的错误解决方案 安装mysql-connector-net-6.8.7.msi,下载地址:http://dev.mysql.com/downloads/connector/net/ ...
- 【转帖】大话Spring Cloud
springcloud(一):大话Spring Cloud 2017/05/01 http://www.ityouknow.com/springcloud/2017/05/01/simple-sp ...
- JS中的 map, filter, some, every, forEach, for in, for of 用法总结和区别
JS中的 map, filter, some, every, forEach, for in, for of 用法总结和区别 :https://blog.csdn.net/hyupeng1006/a ...
- Go语言基本数据类型(四)
Go语言基本数据类型主要包含:bool,number,string 布尔类型 go中的布尔类型,只能是 true 和 false,例如:var b bool = true 数字类型 整型 类型 描述 ...
- 洛谷 P2398 GCD SUM 题解
题面 挺有意思的. 设f[i]表示gcd(i,j)=i的个数,g[i]表示k|gcd(i,j)的个数; g[i]=(n/i)*(n/i); g[i]=f[i]+f[2i]+f[3i]+...; 所以f ...
- html之input
<input>在w3c中解释的是用于搜集用户的信息 它其实就是一个输入框,根据type的不同这个框可以用作不同的功能可以输入一个文本,可以定义一个按钮什么的. 属性type一些值的介绍 1 ...
- zk ui安装 (选装,页面查看zk的数据)
# 使用WEB UI查看监控集群-zk ui安装 cd /usr/local git clone https://github.com/DeemOpen/zkui.git yum install -y ...
- mac osx sed 命令
$ sed -i "s/devicedemo/device/g" `grep devicedemo -rl ./` sed: 1: ".//.coveragerc&quo ...