对源安装时,要先知道系统的版本,以免安装错的版本
使用命令:lsb_release -c
备份原先的配置文件
cd /etc/apt
sudo cp sources.list sources.list.backup
修改源文件的内容
sudo vim sources.list # 在 /etc/apt 目录下
阿里源的源文件如下:
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下,用vim的相应操作
全部删除:按esc键后,先按gg(到达顶部),然后dG
全部复制:按esc键后,先按gg,然后ggyG
全选高亮显示:按esc键后,先按gg,然后ggvG或者ggVG
单行复制:按esc键后, 然后yy
单行删除:按esc键后, 然后dd
粘贴:按esc键后, 然后p
复制到粘贴板: 全选高亮显示之后,ctrl+shift+c
参考:
原文:https://blog.csdn.net/vivian_wanjin/article/details/82804884
更新源
sudo apt-get update
更新软件
sudo apt-get upgrade