2009年10月20日火曜日
CentOS5 にあれこれインストール

ちょっと別のサーバの環境をいじる機会があったので、忘れないようにメモしておきます。

OSはCentOS5です。

色々とあってPerl+SQLiteの環境が欲しかったので、とりあえずSQLiteのファイルを作って、アクセス確認用のファイルを書いてみた。

SQLite - Perl
http://www.tuyudaku.net/sqlite/perl.html

「PerlでSQLiteに接続」という記事を参考にしてみた。

とりあえずVirtualHostの設定を確認するのも面倒なので、コマンドラインからアクセスしてみる。

# perl -f sqlite.pl
Can't connect to data source SQLite:dbname=test.db, no database driver specified and DBI_DSN env var not set at sqlite.pl line 5
#


まぁ、SQLiteのモジュールがないんだろうなって思って、インストール。
ここを参考にしました。
CPAN経由でLinuxにモジュールを組み込む
http://y-kit.jp/saba/xp/cpan.htm


# perl -MCPAN -e shell
Are you ready for manual configuration? [yes]
CPAN build and cache directory? [/root/.cpan]
Cache size for build directory (in MB)? [10]
Perform cache scanning (atstart or never)? [atstart]
Cache metadata (yes/no)? [yes]
Your terminal expects ISO-8859-1 (yes/no)? [yes]
File to save your history? [/root/.cpan/histfile]
Number of lines to save? [100]
Policy on building prerequisites (follow, ask or ignore)? [ask]


プログラムのパスを指定する箇所が続くけど、いくつかは無視した。

Where is your gzip program? [/bin/gzip]
Where is your tar program? [/bin/tar]
Where is your unzip program? [/usr/bin/unzip]
Where is your make program? [/usr/bin/make]
Where is your links program? [/usr/bin/links]
Where is your wget program? [/usr/bin/wget]
Warning: ncftpget not found in PATH
Where is your ncftpget program? []
Warning: ncftp not found in PATH
Where is your ncftp program? []
Where is your ftp program? [/usr/kerberos/bin/ftp]
Where is your gpg program? [/usr/bin/gpg]
What is your favorite pager program? [/usr/bin/less]
What is your favorite shell? [/bin/bash]

'perl Makefile.PL'コマンドのパラメタ

Your choice: []

今度は'make'コマンドのパラメタ

Your choice: []

今度は'make install'コマンドのパラメタ

Your choice: [] UNINST=1

あと少し…

Timeout for inactivity during Makefile.PL? [0]
Your ftp_proxy?
Your http_proxy?
Your no_proxy?


このあとサイトを探しに行くみたい。
(1) Africa
(2) Asia
(3) Australasia
(4) Central America
(5) Europe
(6) North America
(7) Oceania
(8) South America
Select your continent (or several nearby continents) [] 2
Sorry! since you don't have any existing picks, you must make a
geographic selection.

(1) China
(2) Hong Kong
(3) India
(4) Indonesia
(5) Japan
(6) Kazakhstan
(7) Republic of Korea
(8) Russia
(9) Singapore
(10) Taiwan
(11) Thailand
(12) Turkey
Select your country (or several nearby countries) [] 5
Sorry! since you don't have any existing picks, you must make a
geographic selection.

(1) ftp://ftp.dti.ad.jp/pub/lang/CPAN/
(2) ftp://ftp.jaist.ac.jp/pub/CPAN/
(3) ftp://ftp.kddilabs.jp/CPAN/
(4) ftp://ftp.nara.wide.ad.jp/pub/CPAN/
(5) ftp://ftp.riken.jp/lang/CPAN/
(6) ftp://ftp.ring.gr.jp/pub/lang/perl/CPAN/
(7) ftp://ftp.u-aizu.ac.jp/pub/CPAN
(8) ftp://ftp.yz.yamagata-u.ac.jp/pub/lang/cpan/
Select as many URLs as you like (by number),
put them on one line, separated by blanks, e.g. '1 4 5' [] 1 2 3 4 5 6 7 8

なんか問題あるとイヤだから、全部指定してみた。

Enter another URL or RETURN to quit: []
New set of picks:
ftp://ftp.dti.ad.jp/pub/lang/CPAN/
ftp://ftp.jaist.ac.jp/pub/CPAN/
ftp://ftp.kddilabs.jp/CPAN/
ftp://ftp.nara.wide.ad.jp/pub/CPAN/
ftp://ftp.riken.jp/lang/CPAN/
ftp://ftp.ring.gr.jp/pub/lang/perl/CPAN/
ftp://ftp.u-aizu.ac.jp/pub/CPAN
ftp://ftp.yz.yamagata-u.ac.jp/pub/lang/cpan/


commit: wrote /usr/lib/perl5/5.8.8/CPAN/Config.pm
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support available (try 'install Bundle::CPAN')

cpan>


これでCPANの準備が終わった。んでDBD::SQLiteをインストールするんだけど…
cpan> install DBD::SQLite
(中略)
CPAN.pm: Going to build A/AD/ADAMK/DBD-SQLite-1.25.tar.gz

DBI 1.57 is required to configure this module, please install it or upgrade your CPAN/CPANPLUS shell
make: *** ターゲットが指定されておらず, makefile も見つかりません. 中止.
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible

cpan>


はぁ…
DBIがない(or 古い)ってこと?
じゃぁ
cpan> install DBI
(中略)
gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -DVERSION=\"1.609\" -DXS_VERSION=\"1.609\" -fPIC "-I/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE" -W -Wall -Wpointer-arith -Wbad-function-cast -Wno-comment -Wno-sign-compare -Wno-cast-qual -Wmissing-noreturn -Wno-unused-parameter Perl.c
/bin/sh: gcc: command not found
make: *** [Perl.o] エラー 127
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible

cpan>


まさか、gccがないなんて!

ってことで、今度はgccを入れるぜ!
いろんなサイトでyumを使ってgccを入れるにはこれだ!みたいなのがあったので、コピペしてみる。
# yum install gcc* compat-gcc* compat-glibc* compat-lib*
Loaded plugins: downloadonly, fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository addons is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* epel: ftp.iij.ad.jp
* rpmforge: apt.sw.be
epel | 3.4 kB 00:00
rpmforge | 1.1 kB 00:00
primary.xml.gz | 0 B 00:30
http://apt.sw.be/redhat/el5/en/i386/rpmforge/repodata/primary.xml.gz: [Errno 4] Socket Error: timed out
Trying other mirror.
(以下省略)

つまり、yumがダメ。
管理者に訊いてみると、どうもyumがタイムアウトするらしい。
最初はサイトが悪いのかと思って、yumの設定を変えてみたりするもダメ。

gccのrpmとかって、どこに落ちてんだ?

そろそろ諦めようかと、ちょっとした息抜きの後にグーグル先生に尋ねてみたら、このページに行き当たった。
教えて!Ziddyちゃん gccのダウンロードインストールのやりかたを教えてください。
http://ziddy.japan.zdnet.com/qa5360918.html


そこに、こんなコマンドが書かれていた。
「# yum --disablerepo=\* --enablerepo=base groupinstall "Development Tools"」
とりあえず、実行してみる。
# yum --disablerepo=\* --enablerepo=base groupinstall "Development Tools"
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
base | 1.1 kB 00:00
(中略)
Install 57 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 59 M
Is this ok [y/N]:

あ、動く!?

でも59MBもインストールしてられない。
モノは試しだ。
# yum --disablerepo=\* --enablerepo=base install gcc
(中略)
Installed: gcc.i386 0:4.1.2-44.el5
Dependency Installed: glibc-devel.i386 0:2.5-34 glibc-headers.i386 0:2.5-34 kernel-headers.i386 0:2.6.18-128.el5 libgomp.i386 0:4.3.2-7.el5
Complete!
#

は…入った?
# which gcc
/usr/bin/gcc
#

スゲー。

あとはCPANで「install DBI」やって「install DBD::SQLite」をやればOK。
「perl -f sqlite.pl」で正常にSQLiteのデータが読み出せました。

あー、疲れた。



0 コメント | コメントを書く
Template Design: © 2007 Envy Inc.