CentOS7 upgrade VIM

Server platform:
VMware® Workstation 15 Pro(15.5.2 build-15785246)
CentOS7(3.10.0-957.el7.x86_64)
vim 7.4

Part1. Installation

step

1. Click to enter the official website , find the required version, and download the .tar.gzfile.

wget https://github.com/vim/vim/archive/v8.2.1862.tar.gz

You can also use other tools to download and upload after entering the official website.

2. Unzip

tar -zxvf  v8.2.1862.tar.gz

3. Enter the directory, execute compile and install

cd v8.2.1862
./configure --prefix=/usr/share/vim/vim82&&make && make install

Note: The original installation location of vim7 is:/usr/share/vim/vim74

4. Direct vim instructions to vim8

alias vim='/usr/share/vim/vim82/bin/vim'
echo "alias vim='/usr/share/vim/vim82/bin/vim' " >> ~/.bashrc

5. Inspection

vim -version


Error resolution

1) Step 3, compile and install error:

no terminal library found
checking for tgetent()... configure: error: NOT FOUND!
      You need to install a terminal library; for example ncurses.
      Or specify the name of the library with --with-tlib.

Install ncurses

yum install ncurses

Prompt already installed

Package ncurses-5.9-14.20130511.el7_4.x86_64 already installed and latest version
Nothing to do

Finally solved

CentOS
yum install -y ncurses-devel.x86_64

Ubuntu
apt install -y libncurses5-dev

to sum up

This should be considered a new addition, not an upgrade of the original one.



Part2. Upgrade

CentOS7 upgrade VIM

In fact, the upgrade only needs to execute the following commands.

rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm
rpm --import http://mirror.ghettoforge.org/distributions/gf/RPM-GPG-KEY-gf.el7
yum -y remove vim-minimal vim-common vim-enhanced sudo
yum -y --enablerepo=gf-plus install vim-enhanced sudo


Part3. Installation script of the complete process

1. Uninstall the old version

yum -y remove vim*

2. Installation dependencies

yum install git -y
yum install gcc gcc-c++ -y
yum install ncurses-devel -y
yum install python3 python3-devel -y

3. Compile and install (installation files have been downloaded in advance)

cd /root/vim-8.2.1862
./configure --with-features=huge \
            --enable-multibyte \
            --enable-rubyinterp=yes \
            --enable-pythoninterp=yes \
            --enable-python3interp=yes \
            --prefix=/usr/local/vim
make
sudo make install
rm -rf ~/vim
Configuration Description
–with-features=huge Support maximum features
–enable-pythoninterp Open support for plugins written in python
–enable-python3interp Open support for plugins written in python3
–enable-rubyinterp Open support for plugins written in ruby
–enable-luainterp Open support for plugins written in lua
–enable-perlinterp Open support for plugins written in perl
–enable-multibyte Open multi-byte support, you can enter Chinese in Vim
–enable-cscope Open support for cscope, cscope is an excellent code browsing tool
–with-python-config-dir=/usr/lib/python2./config*/ Specify python path
–with-python3-config-dir=/usr/lib/python3./config*/ Specify python3 path
–prefix=/usr/local/vim Specify the path to be installed (default installation and then /usr/local/bin/vim)
–enable-fontset Support font settings
–enable-gui=gtk2 gtk2 support, you can also use gnome, which means to generate gvim
–with-compiledby Compiler

4. Configure/usr/bin

[root@localhost bin]# cd /usr/bin
[root@localhost bin]# ll | grep vim
lrwxrwxrwx.   1 root root          3 Oct 20 00:35 rvim -> vim
-rwxr-xr-x.   1 root root    2761694 Sep 18  2016 vim
lrwxrwxrwx.   1 root root          3 Oct 20 00:35 vimdiff -> vim
-rwxr-xr-x.   1 root root       2084 Sep 18  2016 vimtutor

and so

mv vim vim2
ln -s /usr/local/vim/bin/vim /usr/bin/vim

5. View

# 查看 vim 版本
vim -version
# 查看是否支持 python3
vim --version | grep python

Guess you like

Origin blog.csdn.net/weixin_43298913/article/details/109158783