1. 源码(以vim8安装为例,会涉及到很多dependencies,比较麻烦)
一般分为 tar/configure/make/make install四个步骤
检查旧版本是否存在
vim
有则删除
yum remove vim* -y
yum install ncurses-devel -y
编译安装
$ cd /usr/local/src/
$ wget https://codeload.github.com/vim/vim/tar.gz/v8.0.0134
$ tar -zxvf v8.0.0134
$ cd vim-8.0.0134/
$ ./configure --prefix=/usr/local/vim8
$ make && make install
$ echo $?
安装成功后,通过/usr/local/vim8/bin/vim运行vim命令。
将vim命令路径添加到系统变量,就可以直接运行vim了。
$ /usr/local/vim8/bin/vim /etc/profile.d/path.sh
添加以下内容:
#!/bin/bash
export PATH=$PATH:/usr/local/vim8/bin/
$ source /etc/profile.d/path.sh ??????
$ vim
2. yum安装(Yellow Updated Modifield)
简单,可以自动安装相关dependicies ,前提是连接互联网
查询是否已安装
rpm -qa | grep vim
yum -ivh vim*
vim --version
3. RPM包安装
离线安装,需下载dpendencies,解决软件依赖
可以通过版本一致的OS下载RPM依赖包,然后通过WinSCP、SCP command 形式传到待安装linux服务器
以下以安装VIM为例
[root@localhost src]# rpm -ivh vim-8.2.0119-1.1.x86_64.rpm
warning: vim-8.2.0119-1.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 3dbdc284: NOKEY
error: Failed dependencies:
libc.so.6(GLIBC_2.28)(64bit) is needed by vim-8.2.0119-1.1.x86_64
libm.so.6(GLIBC_2.29)(64bit) is needed by vim-8.2.0119-1.1.x86_64
libperl.so()(64bit) is needed by vim-8.2.0119-1.1.x86_64
libtinfo.so.6()(64bit) is needed by vim-8.2.0119-1.1.x86_64
libtinfo.so.6(NCURSES6_TINFO_5.0.19991023)(64bit) is needed by vim-8.2.0119-1.1.x86_64
perl = 5.30.1 is needed by vim-8.2.0119-1.1.x86_64
update-alternatives is needed by vim-8.2.0119-1.1.x86_64
vim-data-common = 8.2.0119-1.1 is needed by vim-8.2.0119-1.1.x86_64
直接安装提示缺少依赖
[root@localhost /]# yum install --downloadonly --downloaddir=/usr/local/src/ vim
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.cn99.com
* updates: mirrors.cn99.com
Resolving Dependencies
--> Running transaction check
---> Package vim-enhanced.x86_64 2:7.4.629-6.el7 will be installed
--> Processing Dependency: vim-common = 2:7.4.629-6.el7 for package: 2:vim-enhanced-7.4.629-6.el7.x86_64
--> Processing Dependency: perl(:MODULE_COMPAT_5.16.3) for package: 2:vim-enhanced-7.4.629-6.el7.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 2:vim-enhanced-7.4.629-6.el7.x86_64
--> Processing Dependency: libgpm.so.2()(64bit) for package: 2:vim-enhanced-7.4.629-6.el7.x86_64
--> Running transaction check
---> Package gpm-libs.x86_64 0:1.20.7-6.el7 will be installed
---> Package perl.x86_64 4:5.16.3-294.el7_6 will be installed
--> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl-macros for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(constant) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Temp) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec::Unix) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec::Functions) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Path) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Exporter) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Cwd) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Carp) for package: 4:perl-5.16.3-294.el7_6.x86_64
---> Package perl-libs.x86_64 4:5.16.3-294.el7_6 will be installed
---> Package vim-common.x86_64 2:7.4.629-6.el7 will be installed
--> Processing Dependency: vim-filesystem for package: 2:vim-common-7.4.629-6.el7.x86_64
--> Running transaction check
---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed
---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed
---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed
---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed
---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed
---> Package perl-Getopt-Long.noarch 0:2.40-3.el7 will be installed
--> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-3.el7.noarch
--> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-3.el7.noarch
---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed
---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
--> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed
---> Package perl-Socket.x86_64 0:2.010-4.el7 will be installed
---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed
---> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed
---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed
---> Package perl-constant.noarch 0:1.27-2.el7 will be installed
---> Package perl-macros.x86_64 4:5.16.3-294.el7_6 will be installed
---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed
---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed
---> Package vim-filesystem.x86_64 2:7.4.629-6.el7 will be installed
--> Running transaction check
---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed
---> Package perl-Pod-Escapes.noarch 1:1.04-294.el7_6 will be installed
---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed
--> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch
--> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch
---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed
--> Running transaction check
---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
--> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
--> Running transaction check
---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
---> Package perl-parent.noarch 1:0.225-244.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
vim-enhanced x86_64 2:7.4.629-6.el7 base 1.1 M
Installing for dependencies:
gpm-libs x86_64 1.20.7-6.el7 base 32 k
perl x86_64 4:5.16.3-294.el7_6 base 8.0 M
perl-Carp noarch 1.26-244.el7 base 19 k
perl-Encode x86_64 2.51-7.el7 base 1.5 M
perl-Exporter noarch 5.68-3.el7 base 28 k
perl-File-Path noarch 2.09-2.el7 base 26 k
perl-File-Temp noarch 0.23.01-3.el7 base 56 k
perl-Filter x86_64 1.49-3.el7 base 76 k
perl-Getopt-Long noarch 2.40-3.el7 base 56 k
perl-HTTP-Tiny noarch 0.033-3.el7 base 38 k
perl-PathTools x86_64 3.40-5.el7 base 82 k
perl-Pod-Escapes noarch 1:1.04-294.el7_6 base 51 k
perl-Pod-Perldoc noarch 3.20-4.el7 base 87 k
perl-Pod-Simple noarch 1:3.28-4.el7 base 216 k
perl-Pod-Usage noarch 1.63-3.el7 base 27 k
perl-Scalar-List-Utils x86_64 1.27-248.el7 base 36 k
perl-Socket x86_64 2.010-4.el7 base 49 k
perl-Storable x86_64 2.45-3.el7 base 77 k
perl-Text-ParseWords noarch 3.29-4.el7 base 14 k
perl-Time-HiRes x86_64 4:1.9725-3.el7 base 45 k
perl-Time-Local noarch 1.2300-2.el7 base 24 k
perl-constant noarch 1.27-2.el7 base 19 k
perl-libs x86_64 4:5.16.3-294.el7_6 base 688 k
perl-macros x86_64 4:5.16.3-294.el7_6 base 44 k
perl-parent noarch 1:0.225-244.el7 base 12 k
perl-podlators noarch 2.5.1-3.el7 base 112 k
perl-threads x86_64 1.87-4.el7 base 49 k
perl-threads-shared x86_64 1.43-6.el7 base 39 k
vim-common x86_64 2:7.4.629-6.el7 base 5.9 M
vim-filesystem x86_64 2:7.4.629-6.el7 base 11 k
Transaction Summary
===============================================================================================================================================================================================
Install 1 Package (+30 Dependent packages)
Total download size: 18 M
Installed size: 60 M
Background downloading packages, then exiting:
warning: /usr/local/src/gpm-libs-1.20.7-6.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY ] 0.0 B/s | 0 B --:--:-- ETA
Public key for gpm-libs-1.20.7-6.el7.x86_64.rpm is not installed
(1/31): gpm-libs-1.20.7-6.el7.x86_64.rpm | 32 kB 00:00:00
(2/31): perl-Carp-1.26-244.el7.noarch.rpm | 19 kB 00:00:00
(3/31): perl-File-Path-2.09-2.el7.noarch.rpm | 26 kB 00:00:00
(4/31): perl-File-Temp-0.23.01-3.el7.noarch.rpm | 56 kB 00:00:00
(5/31): perl-Filter-1.49-3.el7.x86_64.rpm | 76 kB 00:00:00
(6/31): perl-Getopt-Long-2.40-3.el7.noarch.rpm | 56 kB 00:00:00
(7/31): perl-HTTP-Tiny-0.033-3.el7.noarch.rpm | 38 kB 00:00:00
(8/31): perl-Pod-Escapes-1.04-294.el7_6.noarch.rpm | 51 kB 00:00:00
(9/31): perl-PathTools-3.40-5.el7.x86_64.rpm | 82 kB 00:00:00
(10/31): perl-Pod-Perldoc-3.20-4.el7.noarch.rpm | 87 kB 00:00:00
(11/31): perl-Pod-Usage-1.63-3.el7.noarch.rpm | 27 kB 00:00:00
(12/31): perl-Pod-Simple-3.28-4.el7.noarch.rpm | 216 kB 00:00:00
(13/31): perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm | 36 kB 00:00:00
(14/31): perl-Exporter-5.68-3.el7.noarch.rpm | 28 kB 00:00:01
(15/31): perl-Text-ParseWords-3.29-4.el7.noarch.rpm | 14 kB 00:00:00
(16/31): perl-Socket-2.010-4.el7.x86_64.rpm | 49 kB 00:00:00
(17/31): perl-Storable-2.45-3.el7.x86_64.rpm | 77 kB 00:00:00
(18/31): perl-Time-HiRes-1.9725-3.el7.x86_64.rpm | 45 kB 00:00:00
(19/31): perl-Time-Local-1.2300-2.el7.noarch.rpm | 24 kB 00:00:00
(20/31): perl-constant-1.27-2.el7.noarch.rpm | 19 kB 00:00:00
(21/31): perl-parent-0.225-244.el7.noarch.rpm | 12 kB 00:00:00
(22/31): perl-macros-5.16.3-294.el7_6.x86_64.rpm | 44 kB 00:00:00
(23/31): perl-threads-1.87-4.el7.x86_64.rpm | 49 kB 00:00:00
(24/31): perl-podlators-2.5.1-3.el7.noarch.rpm | 112 kB 00:00:00
(25/31): perl-threads-shared-1.43-6.el7.x86_64.rpm | 39 kB 00:00:00
(26/31): perl-libs-5.16.3-294.el7_6.x86_64.rpm | 688 kB 00:00:00
(27/31): vim-filesystem-7.4.629-6.el7.x86_64.rpm | 11 kB 00:00:00
(28/31): vim-enhanced-7.4.629-6.el7.x86_64.rpm | 1.1 MB 00:00:01
(29/31): vim-common-7.4.629-6.el7.x86_64.rpm | 5.9 MB 00:00:04
(30/31): perl-Encode-2.51-7.el7.x86_64.rpm | 1.5 MB 00:00:16
(31/31): perl-5.16.3-294.el7_6.x86_64.rpm | 8.0 MB 00:00:34
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 538 kB/s | 18 MB 00:00:34
exiting because "Download Only" specified
下载完成所有依赖包
[root@localhost src]# vi viminstall.sh
[root@localhost src]# cat viminstall.sh
#author : lulishuang
#date : 2020-02-01
#rool : install vim dep
rpm -ivh *.rpm
#rpm -Uvh update/*.rpm
[root@localhost src]# chmod 750 viminstall.sh #提升权限
创建shell安装所有RPM包,本例是全部需要安装bash,没有Update,如果同时存在,则通过shell更快捷
[root@localhost src]# sh viminstall.sh
warning: gpm-libs-1.20.7-6.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:perl-parent-1:0.225-244.el7 ################################# [ 3%]
2:perl-HTTP-Tiny-0.033-3.el7 ################################# [ 6%]
3:perl-podlators-2.5.1-3.el7 ################################# [ 10%]
4:perl-Pod-Perldoc-3.20-4.el7 ################################# [ 13%]
5:perl-Pod-Escapes-1:1.04-294.el7_6################################# [ 16%]
6:perl-Text-ParseWords-3.29-4.el7 ################################# [ 19%]
7:perl-Encode-2.51-7.el7 ################################# [ 23%]
8:perl-Pod-Usage-1.63-3.el7 ################################# [ 26%]
9:perl-constant-1.27-2.el7 ################################# [ 29%]
10:perl-Carp-1.26-244.el7 ################################# [ 32%]
11:perl-Exporter-5.68-3.el7 ################################# [ 35%]
12:perl-Filter-1.49-3.el7 ################################# [ 39%]
13:perl-libs-4:5.16.3-294.el7_6 ################################# [ 42%]
14:perl-macros-4:5.16.3-294.el7_6 ################################# [ 45%]
15:perl-File-Path-2.09-2.el7 ################################# [ 48%]
16:perl-File-Temp-0.23.01-3.el7 ################################# [ 52%]
17:perl-PathTools-3.40-5.el7 ################################# [ 55%]
18:perl-Scalar-List-Utils-1.27-248.e################################# [ 58%]
19:perl-Socket-2.010-4.el7 ################################# [ 61%]
20:perl-Storable-2.45-3.el7 ################################# [ 65%]
21:perl-threads-1.87-4.el7 ################################# [ 68%]
22:perl-threads-shared-1.43-6.el7 ################################# [ 71%]
23:perl-Time-HiRes-4:1.9725-3.el7 ################################# [ 74%]
24:perl-Pod-Simple-1:3.28-4.el7 ################################# [ 77%]
25:perl-Getopt-Long-2.40-3.el7 ################################# [ 81%]
26:perl-Time-Local-1.2300-2.el7 ################################# [ 84%]
27:perl-4:5.16.3-294.el7_6 ################################# [ 87%]
28:vim-filesystem-2:7.4.629-6.el7 ################################# [ 90%]
29:vim-common-2:7.4.629-6.el7 ################################# [ 94%]
30:gpm-libs-1.20.7-6.el7 ################################# [ 97%]
31:vim-enhanced-2:7.4.629-6.el7 ################################# [100%]
安装完成
[root@localhost src]# vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 9 2019 03:17:15)
Included patches: 1-207, 209-629
Modified by <[email protected]>
Compiled by <[email protected]>
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +syntax
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
-balloon_eval +float +mouse_urxvt -tag_any_white
-browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent +gettext -mzscheme +textobjects
-clientserver -hangul_input +netbeans_intg +title
-clipboard +iconv +path_extra -toolbar
+cmdline_compl +insert_expand +perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak +python/dyn +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua +rightleft +windows
+diff +menu +ruby/dyn +writebackup
+digraphs +mksession +scrollbind -X11
-dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent -xim
+emacs_tags -mouseshape -sniff -xsmp
+eval +mouse_dec +startuptime -xterm_clipboard
+ex_extra +mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop -xpm
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/etc"
f-b for $VIMRUNTIME: "/usr/share/vim/vim74"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -g -pipe -Wall -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D__linux__ -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic