ubuntu 源码重装vim

一 卸载自带vi

// 彻底卸载 vim

sudo apt-get remove vim vim-runtime vim-tiny vim-common vim-scripts vim-doc

二 安装git

apt install git

**三 从github下载vim源码  **

git clone https://github.com/vim/vim.git

本来接下来应该安装依赖库,但是可能会遇到如下问题

 

所以需要更新软件源 

四 更新apt软件源(如果安装依赖库没问题可以跳过这个步骤)

主要有:阿里云,清华源,中科大源,163

更新apt软件源root用户操作,首先

cd /etc/apt/

mv sources.list sources.list.bak         //备份已有源

lsb_release -c   //查看系统代号

ubuntu20.04系统代号如下

Codename:    focal

新建一个sources.list

拷贝并保存如下内容:

1#阿里云源 2deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse 3deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse 4deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse 5deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse 6deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse 7deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse 8deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse 9deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse 10deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse 11deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse 12 13#中科大源 14deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse 15deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse 16deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse 17deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse 18deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse 19deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse 20deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse 21deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse 22deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse 23deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse 24 25#清华源 26deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse 27deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse 28deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse 29deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse 30deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse 31deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse 32deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse 33deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse 34deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse 35deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse 36 37#163源 38deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse 39deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse 40deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse 41deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse 42deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse 43deb-src http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse 44deb-src http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse 45deb-src http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse 46deb-src http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse 47deb-src http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse 48

值得注意的是 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这四个)
所以你把内容写成:

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed universe multiverse

更新源

使用 sudo apt-get update 即可更新获取 阿里软件源 提供的软件列表

sudo apt-get update

其他的一些apt命令

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

 

 

待续。。。

 

 

 

 

 

 

 

 

 

 

代码交流 2021