2010年10月6日水曜日

CentOSにvim7.3をインストールする

CentOSの標準リポジトリーにあるのは旧バージョンのvimなので
最新のvim7.3をインストールします
まず既存のvimをアンインストールし必要なパッケージを追加します
[root@blog.m264.com ~]$ yum -y remove vim-enhaced vim-common
[root@blog.m264.com ~]$ yum -y install ncurses-devel patch gcc

次に必要なファイルをダウンロードします
[root@blog.m264.com ~]$ wget http://short.m264.info/vim730
--2010-10-06 00:35:16--  
Resolving short.m264.info... 168.143.174.97
Connecting to short.m264.info|168.143.174.97|:80... connected.
HTTP request sent, awaiting response... 301 Moved
Location: http://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2 [following]
--2010-10-06 00:35:16--  http://short.m264.info/vim730
Resolving ftp.vim.org... 192.87.102.42, 192.87.102.43, 2001:610:1:80aa:192:87:102:42, ...
Connecting to ftp.vim.org|192.87.102.42|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9080692 (8.7M) [application/x-bzip2]
Saving to: `vim-7.3.tar.bz2'

100%[=========================================================>] 9,080,692    894K/s   in 15s

解凍してパッチフォルダを作ります
[root@blog.m264.com ~]$ tar -xvf ./vim-7.3.tar.bz2
[root@blog.m264.com ~]$ mkdir patches
[root@blog.m264.com ~]$ cd vim73/patches

パッチをダウンロードします
http://short.m264.info/ayQLCM からパッチの数を確認してください
(7.3.*** ←ココの数字が何番まであるか確認)

[root@blog.m264.com ~]$ seq -f http://ftp.vim.org/pub/vim/patches/7.3/7.3.%03g パッチの数 | xargs wget
--2010-10-06 00:28:21--  http://ftp.vim.org/pub/vim/patches/7.3/7.3.001
Resolving ftp.vim.org... 192.87.102.43, 192.87.102.42, 2001:610:1:80aa:192:87:102:42, ...
Connecting to ftp.vim.org|192.87.102.43|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1720 (1.7K) [text/plain]
Saving to: `7.3.001'

100%[=====================================================>] 1,720       --.-K/s   in 0.001s

2010-10-06 00:28:24 (2.06 MB/s) - `7.3.019' saved [2747/2747]

-----------
パッチの数だけダウンロードするのでパッチの数によっては時間がかかる
-----------

--2010-10-06 00:28:24--  http://ftp.vim.org/pub/vim/patches/7.3/7.3.019
Connecting to ftp.vim.org|192.87.102.43|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2987 (2.9K) [text/plain]
Saving to: `7.3.019'

100%[======================================================>] 2,987       --.-K/s   in 0.001s

パッチを当てる
[root@blog.m264.com ~]$ cat patches/7.3.* | patch -p0
patching file src/misc1.c
patching file src/version.c
patching file src/ex_docmd.c
patching file src/version.c
patching file src/quickfix.c
patching file src/version.c
patching file src/regexp.c
patching file src/version.c
patching file src/eval.c
patching file src/testdir/Makefile
patching file src/testdir/test61.in
patching file src/version.c
patching file src/mbyte.c
patching file src/spell.c
patching file src/version.c
patching file src/if_py_both.h
patching file src/version.c
patching file src/buffer.c
patching file src/diff.c
patching file src/ex_cmds.c
patching file src/ex_cmds2.c
patching file src/ex_docmd.c
patching file src/ex_getln.c
patching file src/if_cscope.c
patching file src/macros.h
patching file src/quickfix.c
patching file src/search.c
patching file src/tag.c
patching file src/window.c
patching file src/version.c
patching file src/os_win32.c
patching file src/version.c
patching file src/gui_mac.c
patching file src/version.c
patching file src/ui.c
patching file src/os_unix.c
patching file src/version.c
patching file src/Make_ming.mak
patching file src/GvimExt/Make_ming.mak
patching file src/version.c
patching file src/if_ruby.c
patching file src/version.c
patching file src/ex_getln.c
patching file src/version.c
patching file src/testdir/test49.vim
patching file src/version.c
patching file runtime/doc/netbeans.txt
patching file src/gui.c
patching file src/main.c
patching file src/netbeans.c
patching file src/version.c
patching file src/spell.c
patching file src/syntax.c
patching file src/version.c
patching file src/Make_ming.mak
patching file src/GvimExt/Make_ming.mak
patching file src/version.c
patching file src/netbeans.c
patching file src/version.c
configureする(オプションはお好みで)
[root@blog.m264.com ~]$ ./configure --prefix=/usr --enable-multibyte --with-features=huge --disable-selinux
configure: loading cache auto/config.cache
checking whether make sets $(MAKE)... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for library containing strerror... none required
以下略
makeしてインストール!
[root@blog.m264.com ~]$ make
mkdir objects
CC="gcc -Iproto -DHAVE_CONFIG_H         " srcdir=. sh ./osdef.sh
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/buffer.o buffer.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/blowfish.o blowfish.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/charset.o charset.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/diff.o diff.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/digraph.o digraph.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/edit.o edit.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/eval.o eval.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_cmds.o ex_cmds.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_cmds2.o ex_cmds2.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_docmd.o ex_docmd.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_eval.o ex_eval.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_getln.o ex_getln.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/fileio.o fileio.c
以下略
[root@blog.m264.com ~]$ make install
Starting make in the src directory.
If there are problems, cd to the src directory and run make there
cd src && make install
make[1]: Entering directory `/root/work/vim/vim73/src'
if test -f /usr/bin/vim; then \
          mv -f /usr/bin/vim /usr/bin/vim.rm; \
          rm -f /usr/bin/vim.rm; \
        fi
cp vim /usr/bin
strip /usr/bin/vim
chmod 755 /usr/bin/vim
/bin/sh ./mkinstalldirs /usr/share/vim
mkdir /usr/share/vim
chmod 755 /usr/share/vim
cp vimtutor /usr/bin/vimtutor
以下略
vimを起動する
vim

1
~
~                                   VIM - Vi IMproved
~
~                                     version 7.3.19
~                                by Bram Moolenaar et al.
~                      Vim is open source and freely distributable
~
~                             Help poor children in Uganda!
~                     type  :help iccf       for information
~
~                     type  :q               to exit
~                     type  :help  or    for on-line help
~                     type  :help version7   for version info
~

1 件のコメント:

匿名 さんのコメント...

Thanks for some quality points there. I am kind of new to online , so I printed this off to put in my file, any better way to go about keeping track of it then printing?