2009年10月26日月曜日
CPANで苦労してみたり

先日のエントリは言わばテストであって、本日本番環境へインストールを試みたワケです。

今日はこのあたりのサイトを参考にさせていただきました。
[ヅラド] FTP が利用できない環境で Perl CPAN の環境を設定する on Linux
http://www.nilab.info/zurazure2/000246.html

CPANのダウンロードサイトにローカルを追加する - azrizの日記
http://d.hatena.ne.jp/azriz/20090815/1250311032#


まずはCPANを実行する。

$ perl -MCPAN -e shell
We have to reconfigure CPAN.pm due to following uninitialized parameters:

cpan_home, keep_source_where, build_dir, build_cache, scan_cache, index_expire, gzip, tar, unzip, make, pager, makepl_arg, make_arg, make_install_arg, urllist, inhibit_startup_message, ftp_proxy, http_proxy, no_proxy, prerequisites_policy, cache_metadata

/usr/lib/perl5/5.8.5/CPAN/Config.pm initialized.
(以下省略)


問題はこのあと。
Your ftp_proxy?  
Your http_proxy?
Your no_proxy?
You have no /root/.cpan/sources/MIRRORED.BY
I'm trying to fetch one
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY.gz
Fetching with Net::FTP:
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY
Fetching with Net::FTP
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY.gz

Trying with "/usr/bin/links -source" to get
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY
ERROR at dump.c:188: Receive timeout


タイムアウト?

どうもftp.perl.orgが死んでるらしい。
ってことで、FTPをCtrl+cで中断して、別のサイト(http)を追加してみる。
ftp.perl.org|163.143.1.21|:21 に接続しています... Issuing "/usr/kerberos/bin/ftp -n"

Not connected.
Local directory now /root/.cpan/sources
Not connected.
Not connected.
Not connected.
Not connected.
Not connected.
Bad luck... Still failed!
Can't access URL ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY.

Please check, if the URLs I found in your configuration file () are valid.
The urllist can be edited. E.g. with 'o conf urllist push ftp://myurl/'

Could not fetch MIRRORED.BY
CPAN.pm needs at least one URL where it can fetch CPAN files from.

Please enter your CPAN site: [] http://ftp.cpan.jp/
Enter another URL or RETURN to quit: []
New set of picks:
http://ftp.cpan.jp/


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

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

cpan>


http://ftp.cpan.jp/を選んだのは、特に意味はない。調べてみたら、一番多く出てくるのできっと使えるサイトなのだろうと思った程度。

心配なので、テストインストールしてみる。
cpan> test GD
CPAN: Storable loaded ok
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
http://ftp.cpan.jp/authors/01mailrc.txt.gz
LWP failed with code[500] message[Can't connect to ftp.cpan.jp:80 (Bad hostname 'ftp.cpan.jp')]

Trying with "/usr/bin/links -source" to get
http://ftp.cpan.jp/authors/01mailrc.txt.gz
ERROR at dump.c:188: Host not found

System call "/usr/bin/links -source "http://ftp.cpan.jp/authors/01mailrc.txt.gz" > /root/.cpan/sources/authors/01mailrc.txt"
returned status 1 (wstat 256)
Warning: expected file [/root/.cpan/sources/authors/01mailrc.txt.gz] doesn't exist

Trying with "/usr/bin/wget -O -" to get
http://ftp.cpan.jp/authors/01mailrc.txt.gz
--13:10:55-- http://ftp.cpan.jp/authors/01mailrc.txt.gz
=> `-'
ftp.cpan.jp をDNSに問いあわせています... 失敗しました: 名前またはサービスが不明です.

System call "/usr/bin/wget -O - "http://ftp.cpan.jp/authors/01mailrc.txt.gz" > /root/.cpan/sources/authors/01mailrc.txt"
returned status 1 (wstat 256)
Warning: expected file [/root/.cpan/sources/authors/01mailrc.txt.gz] doesn't exist
Please check, if the URLs I found in your configuration file
(http://ftp.cpan.jp/) are valid. The urllist can be edited. E.g. with 'o
conf urllist push ftp://myurl/'

Could not fetch authors/01mailrc.txt.gz
Fetching with LWP:
http://ftp.cpan.jp/modules/02packages.details.txt.gz
LWP failed with code[500] message[Can't connect to ftp.cpan.jp:80 (Bad hostname 'ftp.cpan.jp')]

Trying with "/usr/bin/links -source" to get
http://ftp.cpan.jp/modules/02packages.details.txt.gz
ERROR at dump.c:188: Host not found

System call "/usr/bin/links -source "http://ftp.cpan.jp/modules/02packages.details.txt.gz" > /root/.cpan/sources/modules/02packages.details.txt"
returned status 1 (wstat 256)
Warning: expected file [/root/.cpan/sources/modules/02packages.details.txt.gz] doesn't exist

Trying with "/usr/bin/wget -O -" to get
http://ftp.cpan.jp/modules/02packages.details.txt.gz
--13:10:58-- http://ftp.cpan.jp/modules/02packages.details.txt.gz
=> `-'
ftp.cpan.jp をDNSに問いあわせています... 失敗しました: 名前またはサービスが不明です.

System call "/usr/bin/wget -O - "http://ftp.cpan.jp/modules/02packages.details.txt.gz" > /root/.cpan/sources/modules/02packages.details.txt"
returned status 1 (wstat 256)
Warning: expected file [/root/.cpan/sources/modules/02packages.details.txt.gz] doesn't exist
Please check, if the URLs I found in your configuration file
(http://ftp.cpan.jp/) are valid. The urllist can be edited. E.g. with 'o
conf urllist push ftp://myurl/'

Could not fetch modules/02packages.details.txt.gz
Fetching with LWP:
http://ftp.cpan.jp/modules/03modlist.data.gz
LWP failed with code[500] message[Can't connect to ftp.cpan.jp:80 (Bad hostname 'ftp.cpan.jp')]

Trying with "/usr/bin/links -source" to get
http://ftp.cpan.jp/modules/03modlist.data.gz
ERROR at dump.c:188: Host not found

System call "/usr/bin/links -source "http://ftp.cpan.jp/modules/03modlist.data.gz" > /root/.cpan/sources/modules/03modlist.data"
returned status 1 (wstat 256)
Warning: expected file [/root/.cpan/sources/modules/03modlist.data.gz] doesn't exist

Trying with "/usr/bin/wget -O -" to get
http://ftp.cpan.jp/modules/03modlist.data.gz
--13:11:00-- http://ftp.cpan.jp/modules/03modlist.data.gz
=> `-'
ftp.cpan.jp をDNSに問いあわせています... 失敗しました: 名前またはサービスが不明です.

System call "/usr/bin/wget -O - "http://ftp.cpan.jp/modules/03modlist.data.gz" > /root/.cpan/sources/modules/03modlist.data"
returned status 1 (wstat 256)
Warning: expected file [/root/.cpan/sources/modules/03modlist.data.gz] doesn't exist
Please check, if the URLs I found in your configuration file
(http://ftp.cpan.jp/) are valid. The urllist can be edited. E.g. with 'o
conf urllist push ftp://myurl/'

Could not fetch modules/03modlist.data.gz
Going to write /root/.cpan/Metadata
Warning: Cannot test GD, don't know what it is.
Try the command

i /GD/

to find objects with matching identifiers.

cpan>


ftp.cpan.jpはダメってこと!?

んじゃぁ、つなぎに行く先を変更したり増やしたりしないといかんなぁ。

対象のサイトはCPAN/SITESからピックアップ。出来ればhttpね。

CPAN/SITES
http://www.perl.com/CPAN/SITES.html


cpan> o conf urllist
urllist
http://ftp.cpan.jp/
Type 'o conf' to view configuration edit options


cpan> o conf urllist unshift http://ftp.jaist.ac.jp/pub/CPAN/

cpan> o conf urllist
urllist
http://ftp.jaist.ac.jp/pub/CPAN/
http://ftp.cpan.jp/
Type 'o conf' to view configuration edit options


cpan>


追加した後に、再度installしてみる(テストすべきでしたね)。

cpan> install GD
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
Warning: Found only 0 objects in /root/.cpan/Metadata
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
http://ftp.jaist.ac.jp/pub/CPAN/authors/01mailrc.txt.gz
Going to read /root/.cpan/sources/authors/01mailrc.txt.gz
Fetching with LWP:
http://ftp.jaist.ac.jp/pub/CPAN/modules/02packages.details.txt.gz
Going to read /root/.cpan/sources/modules/02packages.details.txt.gz
Database was generated on Mon, 26 Oct 2009 02:30:16 GMT

There's a new CPAN.pm version (v1.9402) available!
[Current version is v1.7601]
You might want to try
install Bundle::CPAN
reload cpan
without quitting the current session. It should be a seamless upgrade
while we are running...
(以下省略)


無事、入りました。

確認したサイトとともに、メモを残しておきます。



0 コメント | コメントを書く | コメントの表示
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.