FTPクライアント - FFFTP

窓の杜』からFTPクライアントを探してみた。『インターネット・セキュリティ』>『サーバ・ネットワーク』『FTPクライアント』…数が少ない。フリーソフトは以前から使用している『FFFPT』しか無いなぁ。
Vector』から同様に探してみた。『インターネット&通信』>『LAN・Internet等』>『ファイル転送』・・・お、こっちはいっぱいあるな。『FFFTP』が一番上に来ている。これを使っている人がやっぱり多いという事だろうか。Coolマークの付いている2つめのアプリを試してみる事にしよう。

と思ったのだがやっぱり最初はFFFTPで接続確認くらいはしておこうかしら。というわけでFFFTPをダウンロード。

FFFTP - 窓の杜
http://www.forest.impress.co.jp/lib/inet/servernt/ftp/ffftp.html

バージョンは1.96b。こいつをVistaにインストールする。窓の杜のページにもVista対応ということなので問題はないだろう。インストールが完了したら起動。
接続は『新規ホスト』から『ホストの設定』タブを設定する。

  • ホストの設定名:わかりやすい名前で。自分は『サーバ名 - 接続ユーザ名』で設定する事が多い。
  • ホスト名:接続対象がVMwareのため名前解決はできないのでIPで記述
  • ユーザ名:接続ユーザ名
  • パスワード/パスフレーズ:接続ユーザのパスワード
  • ローカルの初期フォルダ:デスクトップに設定する事が多い
  • ホストの初期フォルダ:設定しない(=接続ユーザのホームディレクトリ)

上記設定をして『接続』ボタンを押すと…接続できた♪
少なくともFTPサーバとしての役割はできるようになったわけだ。

vsftpdインストール

FTPで『Vista<=>検証環境』間でファイルのやりとりをしたいのでFTPサーバを設定する。
今回インストールするのはvsftpd。『Very Secure FTPD』だそうだ。CentOS-5.2のインストール時に『FTPサーバ』を選択するとこいつがインストールされるらしい。よってまずはCDからRPMを取得してインストール。

[root@CentOS-5.2 CentOS]# ls -l *vsftpd*
-rw-r--r-- 2 root root 140505  6月 15 08:41 vsftpd-2.0.5-12.el5.i386.rpm
[root@CentOS-5.2 CentOS]# 

CDの中に発見!こいつをrpmコマンドでインストールする。

[root@CentOS-5.2 CentOS]# rpm -ivh vsftpd-2.0.5-12.el5.i386.rpm
準備中...                ########################################### [100%]
   1:vsftpd                 ########################################### [100%]
[root@CentOS-5.2 CentOS]# 
[root@CentOS-5.2 CentOS]# rpm -q vsftpd
vsftpd-2.0.5-12.el5
[root@CentOS-5.2 CentOS]# 

おぉぅ。入ってるよ。
サービスとして起動するにはserviceコマンドで実行。

[root@CentOS-5.2 CentOS]# service vsftpd start
vsftpd 用の vsftpd を起動中:                               [  OK  ]
[root@CentOS-5.2 CentOS]# 

起動した。試しに検証環境のrootユーザからlocalhostのworkerユーザへftp接続してみよう。

[root@CentOS-5.2 CentOS]# ftp localhost
Connected to CentOS-5.2.
220 (vsFTPd 2.0.5)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (localhost:root): worker
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> quit
221 Goodbye.
[root@CentOS-5.2 CentOS]# 

できた。これでVistaからも繋がるはずだよね。
VistaにもFTPクライアントを入れてあげなければ♪

コマンド/ファイル

  • コマンド
    • /bin/rpm
    • /sbin/service

innotop

試してみたい。けど今は試せない。。。だからメモだけ。

MOONGIFT: >> MySQL(InnoDB)の状態を監視する「innotop」
http://www.moongift.jp/2008/08/innotop/

SOURCEFORGE.NET: innotop
http://sourceforge.net/projects/innotop/

InnoDBに特化したmytopといったところであろうか。クエリ・ステータス情報・トランザクション情報・デッドロック等が見られるらしい。perlで作成されているのでDBI::MySqlが必要らしいが。

現在、MySQLを自由に触れるサーバ・データベース環境が仕事ではない。。。検証環境の準備が整った後にやってみよう。

データベース構築

先日インストールしたPostgreSQL-8.3のデータベースを構築する。構築する項目は下記の通り。

データ保存ディレクトリの作成

まずは何よりも最初に必要なインスタンスの構築から。
自分は『インスタンス』と呼んでしまっているのだが、世間一般的・技術的(?)には何て言うのかは正直知らない。PostgreSQLは複数のデータベースインスタンスを1台のサーバで起動する事が可能である。まぁ何よりまずはインスタンス構築まで。
構築は全てPostgreSQLを起動するユーザにて行う。これ必須。

PostgreSQLのデータを保存するディレクトリを作成する。
この検証環境はデータは全て/opt配下に配置する事にした。まずはディレクトリ作成。

[postgres@CentOS-5.2 ~]$ su - 
パスワード: **********
[root@CentOS-5.2 ~]# cd /opt
[root@CentOS-5.2 opt]# ls -l
合計 0
[root@CentOS-5.2 opt]# mkdir postgresql-8.3.3
[root@CentOS-5.2 opt]# ls -ld postgresql-8.3.3/
drwxr-xr-x 2 root root 4096  8月  8 10:11 postgresql-8.3.3/
[root@CentOS-5.2 opt]# chown postgres:postgres postgresql-8.3.3/
[root@CentOS-5.2 opt]# ls -ld postgresql-8.3.3/
drwxr-xr-x 2 postgres postgres 4096  8月  8 10:11 postgresql-8.3.3/
[root@CentOS-5.2 opt]# 

インスタンス構築(initdb)

実際のデータベースインスタンス構築。
initdbコマンドのオプションは--helpで確認する。
今回は--no-localeと--encoding、データの保存先である-Dオプションのみを指定する事にする。
ちなみにinitdbコマンドへのパスは通っていないので絶対パスで指定する。

[postgres@CentOS-5.2 postgresql-8.3.3]$ /usr/local/postgresql-8.3.3/bin/initdb --no-locale --encoding=UTF8 -D /opt/postgresql-8.3.3
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.
The default database encoding has accordingly been set to SQL_ASCII.
The default text search configuration will be set to "english".

fixing permissions on existing directory /opt/postgresql-8.3.3 ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers/max_fsm_pages ... 32MB/204800
creating configuration files ... ok
creating template1 database in /opt/postgresql-8.3.3/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    /usr/local/postgresql-8.3.3/bin/postgres -D /opt/postgresql-8.3.3
or
    /usr/local/postgresql-8.3.3/bin/pg_ctl -D /opt/postgresql-8.3.3 -l logfile start

[postgres@CentOS-5.2 postgresql-8.3.3]$ 

ディレクトリやファイルができているか確認。

[postgres@CentOS-5.2 postgresql-8.3.3]$ ls -l
合計 64
-rw------- 1 postgres postgres     4  8月  8 10:16 PG_VERSION
drwx------ 5 postgres postgres  4096  8月  8 10:16 base
drwx------ 2 postgres postgres  4096  8月  8 10:16 global
drwx------ 2 postgres postgres  4096  8月  8 10:16 pg_clog
-rw------- 1 postgres postgres  3429  8月  8 10:16 pg_hba.conf
-rw------- 1 postgres postgres  1460  8月  8 10:16 pg_ident.conf
drwx------ 4 postgres postgres  4096  8月  8 10:16 pg_multixact
drwx------ 2 postgres postgres  4096  8月  8 10:16 pg_subtrans
drwx------ 2 postgres postgres  4096  8月  8 10:16 pg_tblspc
drwx------ 2 postgres postgres  4096  8月  8 10:16 pg_twophase
drwx------ 3 postgres postgres  4096  8月  8 10:16 pg_xlog
-rw------- 1 postgres postgres 16552  8月  8 10:16 postgresql.conf
[postgres@CentOS-5.2 postgresql-8.3.3]$ 

インスタンスが構築できた。
ちなみにinitdbコマンドの-Dオプションで指定したディレクトリは・・・

[postgres@curious-52 ~]$ ls -ld /opt/postgresql-8.3.3/
drwx------ 10 postgres postgres 4096  8月  8 10:39 /opt/postgresql-8.3.3/
[postgres@curious-52 ~]$ 

パーミッションが700になってinitdbを実行したOSユーザ以外のアクセスを制限されている。

インスタンス起動

initdbコマンドを実行した時に表示されていたように起動する。

[postgres@curious-52 ~]$ /usr/local/postgresql-8.3.3/bin/pg_ctl start -D /opt/postgresql-8.3.3
server starting
[postgres@curious-52 ~]$ LOG:  database system was shut down at 2008-08-08 10:16:42 JST
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections

[postgres@curious-52 ~]$ 

上記コマンドではinitdbコマンド実行時の表示から-lオプションを抜いている。この場合ログ出力がされずに標準出力・標準エラー出力となる。

プロセスでPostgreSQLが動作しているかを確認する。

[postgres@curious-52 ~]$ ps -ef | grep postgres
root      2401  2272  0 10:09 pts/0    00:00:00 su - postgres
postgres  2402  2401  0 10:09 pts/0    00:00:00 -bash
postgres  2633     1  0 10:22 pts/0    00:00:00 /usr/local/postgresql-8.3.3/bin/postgres -D /opt/postgresql-8.3.3
postgres  2635  2633  0 10:22 ?        00:00:00 postgres: writer process                                         
postgres  2636  2633  0 10:22 ?        00:00:00 postgres: wal writer process                                     
postgres  2637  2633  0 10:22 ?        00:00:00 postgres: autovacuum launcher process                            
postgres  2638  2633  0 10:22 ?        00:00:00 postgres: stats collector process                                
postgres  2649  2402  0 10:25 pts/0    00:00:00 ps -ef
postgres  2650  2402  0 10:25 pts/0    00:00:00 grep postgres
[postgres@curious-52 ~]$ 

データベースへ接続

まずはデータベースインスタンスへ接続する。クライアントアプリケーションとしてpsqlコマンド。ポート等は設定を変えていないのでデフォルトまま。

[postgres@curious-52 ~]$ /usr/local/postgresql-8.3.3/bin/psql postgres
Welcome to psql 8.3.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

postgres=# 

上記の場合、デフォルト設定がまま使用されているので実際には下記のコマンドを実行しているものと同じ状態。もちろん下記コマンドでも接続可能なはず。

[postgres@curious-52 ~]$ /usr/local/postgresql-8.3.3/bin/psql -p 5432 -U postgres postgres
Welcome to psql 8.3.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

postgres=# 
  • Uオプションに自動に入るユーザはコマンドを実行しているOSユーザ。最後に記述しているpostgresはユーザではなく接続対象データベース名。PostgreSQLではデフォルトでpostgres, template0, template1の3つのデータベースが作成されている。それぞれ…それは別のエントリで。接続データベースを指定しない場合はコマンドを実行するOSユーザ名と同名のデータベースに接続しようとするらしい。

ユーザ作成

ユーザの作成にはcreateuserコマンドを実行する方法と、psqlで接続語にSQLで作成する方法がある。
せっかくだから両方試してみよう!

  • createuserコマンド

オプションもあるのだが、引数を何も渡さないと対話式で設定できるので今回は対話式で実行する。

[postgres@curious-52 ~]$ /usr/local/postgresql-8.3.3/bin/createuser
Enter name of role to add: dbuser1
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
[postgres@curious-52 ~]$ 
  • SQL(create user)

オプションは何も指定しないとデフォルトで作成される。

postgres=# create user dbuser2;
CREATE ROLE
postgres=# 
  • SQL(create role)

create userはもう古い!create roleを実行しろ!というマニュアルか何かを見た事がある記憶があったので実行してみた。こちらもオプションは何も指定しないで作成してみる。

postgres=# create role dbuser3;
CREATE ROLE
postgres=# 

3つの方法にて作成されたユーザの一覧をpsqlで確認する。

postgres=# \du
                               List of roles
 Role name | Superuser | Create role | Create DB | Connections | Member of 
-----------+-----------+-------------+-----------+-------------+-----------
 dbuser1   | no        | no          | no        | no limit    | {}
 dbuser2   | no        | no          | no        | no limit    | {}
 dbuser3   | no        | no          | no        | no limit    | {}
 postgres  | yes       | yes         | yes       | no limit    | {}
(4 rows)

postgres=# 

どれも同じようにユーザ(role)が作成されている事がわかる。

データベース作成

これまたcreatedbコマンドを実行する方法とSQLで実行する方法とがあるので両方試してみる。

  • createdbコマンド

createdbコマンドはcreateuserコマンドとは違って対話式にはいかないよだ。オプションは--helpで確認しましょう。
今回は--owner(-O)オプションのみを指定する事にしよう。

[postgres@curious-52 ~]$ /usr/local/postgresql-8.3.3/bin/createdb --owner=dbuser1 testdb1
[postgres@curious-52 ~]$ 
  • SQL(create database)

SQLでの実行。

postgres=# create database testdb2 with owner dbuser2;
CREATE DATABASE
postgres=# 

データベースが作成されているか確認。

postgres=# \l
        List of databases
   Name    |  Owner   | Encoding 
-----------+----------+----------
 postgres  | postgres | UTF8
 template0 | postgres | UTF8
 template1 | postgres | UTF8
 testdb1   | dbuser1  | UTF8
 testdb2   | dbuser2  | UTF8
(5 rows)

postgres=# 

構築されたようだ。

インスタンス停止

停止の方法。

[postgres@curious-52 ~]$ /usr/local/postgresql-8.3.3/bin/pg_ctl stop -D /opt/postgresql-8.3.3/
LOG:  received smart shutdown request
LOG:  autovacuum launcher shutting down
LOG:  shutting down
waiting for server to shut down....LOG:  database system is shut down
 done
server stopped
[postgres@curious-52 ~]$ 

上記オプションではPostgreSQLのプロセスが落ちない場合がある。誰かが接続していたままだったりだと落ちないようだ。その時にはオプションで「-m fast」「-m immediate」といったオプションがあるけれども詳細はまたどこかのエントリで。
PostgreSQLが停止している事をプロセスでも確認しておこう。

[postgres@curious-52 ~]$ ps -ef | grep postgres
root      2401  2272  0 10:09 pts/0    00:00:00 su - postgres
postgres  2402  2401  0 10:09 pts/0    00:00:00 -bash
postgres  2713  2402  0 10:35 pts/0    00:00:00 ps -ef
postgres  2714  2402  0 10:35 pts/0    00:00:00 grep postgres
[postgres@curious-52 ~]$ 

あやしいプロセスはいないね。

残タスク

データベースを正常に使用する為に必要な残タスクは下記の通り。

最低限これらの設定も入れてあげないとね。
特にpg_hba.confはこのエントリで設定したユーザのパスワードを有効化する為には絶対に必要。


今日は長くなったのでここまで♪

コマンド/ファイル

  • コマンド
    • /bin/mkdir
  • PostgreSQLコマンド
    • createdb
    • createuser
    • initdb
    • pg_ctl
    • psql
  • psql内部コマンド
    • \du
    • \l

PostgreSQL-8.3.3インストール

事前調査

CentOS-5.2インストール時に一緒にインストールできるPostgreSQLのバージョンを調べてみた(CD-ROMの中に入っているPostgreSQLRPMを見てみただけ)。

[worker@CentOS-5.2 ~]$ ls -l /mnt/CentOS/*postgresql*
 :
-rw-rw-r-- 2 worker worker 2990376  1月 13  2008 /mnt/CentOS/postgresql-8.1.11-1.el5_1.1.i386.rpm
 :
[worker@CentOS-5.2 ~]$ 

8.1.1かぁ。最新版を試したいのだ。yumだと?(でもyumレポジトリ?の設定は何もしてないからデフォルトまんまなんだけど…)

[worker@CentOS-5.2 ~]$ yum list postgresql
Available Packages
postgresql.i386                          8.1.11-1.el5_1.1       base            
[worker@CentOS-5.2 ~]$ 

ふむふむ。。。今回もソースからコンパイルしよう。

# 本来ならばRPMで全てを管理した方が良いのかもしれない。

# あれはソースからいれて、こっちはRPMで入れて…って管理としてはよろしくないよね。

# でも今回はあくまで検証環境だからあまり気にしない。

ダウンロード

ソースをダウンロードする。

NPO法人 日本PostgreSQLユーザ会
http://www.postgresql.jp/

[worker@CentOS-5.2 ~]$ wget ftp://ftp.sra.co.jp/pub/cmd/postgres/8.3.3/postgresql-8.3.3.tar.gz
--02:12:38--  ftp://ftp.sra.co.jp/pub/cmd/postgres/8.3.3/postgresql-8.3.3.tar.gz
           => `postgresql-8.3.3.tar.gz'
ftp.sra.co.jp をDNSに問いあわせています... 202.32.10.2
ftp.sra.co.jp|202.32.10.2|:21 に接続しています... 接続しました。
anonymous としてログインしています... ログインしました!
==> SYST ... 完了しました。    ==> PWD ... 完了しました。
==> TYPE I ... 完了しました。  ==> CWD /pub/cmd/postgres/8.3.3 ... 完了しました。
==> SIZE postgresql-8.3.3.tar.gz ... 17500570
==> PASV ... 完了しました。    ==> RETR postgresql-8.3.3.tar.gz ... 完了しました。
長さ: 17500570 (17M)

100%[========================================>] 17,500,570  48.9K/s   in 5m 45s 

02:18:27 (49.6 KB/s) - `postgresql-8.3.3.tar.gz' を保存しました [17500570]

[worker@CentOS-5.2 ~]$ 

ユーザ作成

PostgreSQLのマニュアルによるとPostgreSQLは独自の管理ユーザで起動すべしと書いてある。よって今回は新たにユーザを作成する。

[worker@CentOS-5.2 ~]$ su - 
パスワード: **********
[root@CentOS-5.2 ~]# useradd postgres

デフォルトままでpostgresユーザを作成。今回はパスワードは付けないでおく。なぜならばデータベースを起動・管理するだけのユーザなので直接postgresユーザで検証環境にログインする必要はないから。設定変更等々でファイルの編集にもpostgresユーザは必要だけれども、実稼働しているサービス環境ならいざ知らず(管理は他の人が行う事が多いだろうから)、自分しかログインしない環境においては必要ないだろう…との判断。そんな事言ったらそもそもpostgresユーザなんて必要ないんじゃね?というのは置いておく。

バイナリ展開

前回と同様に /usr/local/src 配下にソースは置いておく。作業はすべてそこで。

[root@CentOS-5.2 ~]# cd /usr/local/src/
[root@CentOS-5.2 src]# tar zxvf ~worker/postgresql-8.3.3.tar.gz 
 :
postgresql-8.3.3/config/tcl.m4
[root@CentOS-5.2 src]# chown -R postgres:postgres postgresql-8.3.3/
drwxrwxrwx 6 postgres postgres 4096  6月  9 09:58 postgresql-8.3.3/
[root@CentOS-5.2 src]# 

configure

オプションは今回もprefix以外はデフォルトままで実行する。

[root@CentOS-5.2 src]# su - postgres
[postgres@CentOS-5.2 ~]$ cd /usr/local/src/postgresql-8.3.3/
[postgres@CentOS-5.2 postgresql-8.3.3]$ ./configure --prefix=/usr/local/postgresql-8.3.3
checking build system type... i686-pc-linux-gnu
 :
config.status: linking ./src/makefiles/Makefile.linux to src/Makefile.port
[postgres@CentOS-5.2 postgresql-8.3.3]$ echo $?
0
[postgres@CentOS-5.2 postgresql-8.3.3]$ 

コンパイル

[postgres@CentOS-5.2 postgresql-8.3.3]$ make
 :
All of PostgreSQL successfully made. Ready to install.
[postgres@CentOS-5.2 postgresql-8.3.3]$ echo $?
0
[postgres@CentOS-5.2 postgresql-8.3.3]$ 

コンパイルチェック

[postgres@CentOS-5.2 postgresql-8.3.3]$ make check
make -C doc all
 :
=======================
 All 114 tests passed. 
=======================
 :
make[1]: ディレクトリ `/usr/local/src/postgresql-8.3.3/src/test' から出ます
[postgres@CentOS-5.2 postgresql-8.3.3]$ echo $?
0
[postgres@CentOS-5.2 postgresql-8.3.3]$ 

インストール

[postgres@CentOS-5.2 postgresql-8.3.3]$ su -
パスワード: **********
[root@CentOS-5.2 ~]# cd /usr/local/src/postgresql-8.3.3/
[root@CentOS-5.2 postgresql-8.3.3]# make install
 :
PostgreSQL installation complete.
[root@CentOS-5.2 postgresql-8.3.3]# echo $?
0
[root@CentOS-5.2 postgresql-8.3.3]# 

インストール完了♪
動作確認は・・・データベースの初期化とかあるから別のエントリで。


コマンド/ファイル

  • コマンド
    • /bin/ls
    • /bin/su
    • /bin/tar
    • /usr/bin/make
    • /usr/bin/wget
    • /usr/bin/yum

httpd-2.2.9インストール

CentOS-5.2に付属しているapacheは2.2.3だったので現在の最新版である2.2.9を試したい。

事前調査

バージョンを調べてみる。

  • CD
[worker]$ ls -1 *httpd*
httpd-2.2.3-11.el5_1.centos.3.i386.rpm
httpd-devel-2.2.3-11.el5_1.centos.3.i386.rpm
httpd-manual-2.2.3-11.el5_1.centos.3.i386.rpm
system-config-httpd-1.3.3.3-1.el5.noarch.rpm
[worker]$ 
  • yum(コマンドが合っているかはわからない・・・)
[worker]$ yum list | grep httpd
httpd.i386                               2.2.3-11.el5_1.centos. base            
httpd-devel.i386                         2.2.3-11.el5_1.centos. base            
httpd-manual.i386                        2.2.3-11.el5_1.centos. base            
system-config-httpd.noarch               5:1.3.3.3-1.el5        base            
[worker]$ 

ダウンロード

まずはバイナリをダウンロード。

JAPAN APACHE USER GROUP
http://www.apache.jp/

このダウンロード=>ダウンロードサイトからダウンロードするのだが、binaries/rpm/i386 配下にも2.2.3までしかない。
というわけで今回はソースからコンパイルが必要だ!

とりあえず2.2.9のソースをダウンロード

[worker]$ wget http://www.meisei-u.ac.jp/mirror/apache/httpd/httpd-2.2.9.tar.gz
--23:48:00--  http://www.meisei-u.ac.jp/mirror/apache/httpd/httpd-2.2.9.tar.gz
www.meisei-u.ac.jp をDNSに問いあわせています... 202.232.192.34
www.meisei-u.ac.jp|202.232.192.34|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 6396996 (6.1M) [application/x-gzip]
Saving to: `httpd-2.2.9.tar.gz'

100%[===========================================================>] 6,396,996   2.25K/s   in 2m 52s 

23:50:58 (36.3 KB/s) - `httpd-2.2.9.tar.gz' を保存しました [6396996/6396996]

[worker]$ 

バイナリの展開

ダウンロードが完了したのでバイナリを展開する。が、検証環境にインストールしたアプリケーションのソースをあちこちに散らしたくはないので全て/usr/local/srcの下で管理する事にする。/usr/local/srcにはworkerの権限がないのでまずはrootで展開してからworkerの持ち物とする。

[root]# cd /usr/local/src
[root]# tar zxvf ~worker/httpd-2.2.9.tar.gz
 :
 :
[root]# ls -ld httpd-2.2.9/
drwxr-xr-x 11 501 games 4096  6月 11 04:18 httpd-2.2.9
[root]# chown -R worker:worker httpd-2.2.9/
[root]# ls -ld httpd-2.2.9/
drwxr-xr-x 11 worker worker 4096  6月 11 04:18 httpd-2.2.9/
[root]# 

時間はめちゃくちゃだけど今は気にしない。
ここからはworkerで作業。

[root@CentOS-5.2 ~]# su - worker
[worker@CentOS-5.2 ~]$ cd /usr/local/src/httpd-2.2.9

configure

とりあえずほぼデフォルトのままでコンパイルをしてみる事にする。指定するのはインストール先のディレクトリだけ。他のバージョンも試してみたいので、ちゃんとどのバージョンが入っているのかパスだけで把握できるようにアプリケーション名・バージョンを含める事とする。

[worker@CentOS-5.2 httpd-2.2.9]$ ./configure --prefix=/usr/local/httpd-2.2.9
checking for chosen layout... Apache
 :
config.status: executing default commands
[worker@CentOS-5.2 httpd-2.2.9]$ echo $?
0
[worker@CentOS-5.2 httpd-2.2.9]$ 

configureが正常に終了したかリターンステータスも確認しておく。

make

実際のコンパイル

[worker@curious-52 httpd-2.2.9]$ make
Making all in srclib
 :
make[1]: ディレクトリ `/usr/local/src/httpd-2.2.9' から出ます
[worker@CentOS-5.2 httpd-2.2.9]$ echo $?
0
[worker@CentOS-5.2 httpd-2.2.9]$ 

リターンステータスもちゃんと確認。

インストール

rootでインストール

[worker@CentOS-5.2 httpd-2.2.9]$ su -
パスワード: **********
[root@CentOS-5.2 ~]# cd /usr/local/src/httpd-2.2.9/
[root@CentOS-5.2 httpd-2.2.9]# make install
Making install in srclib
 :
make[1]: ディレクトリ `/usr/local/src/httpd-2.2.9' から出ます
[root@CentOS-5.2 httpd-2.2.9]# echo $?
0
[root@CentOS-5.2 httpd-2.2.9]# 

動作確認

apache起動。rootでしか起動できないのかしら?まぁ今は動作確認程度なのでデフォルト設定のままで起動してみる。設定はまた後ほど。

[root@CentOS-5.2 ~]# /usr/local/httpd-2.2.9/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[root@CentOS-5.2 ~]# ps -ef | grep httpd
root     22587     1  0 00:25 ?        00:00:00 /usr/local/httpd-2.2.9/bin/httpd -k start
daemon   22588 22587  0 00:25 ?        00:00:00 /usr/local/httpd-2.2.9/bin/httpd -k start
daemon   22589 22587  0 00:25 ?        00:00:00 /usr/local/httpd-2.2.9/bin/httpd -k start
daemon   22590 22587  0 00:25 ?        00:00:00 /usr/local/httpd-2.2.9/bin/httpd -k start
daemon   22591 22587  0 00:25 ?        00:00:00 /usr/local/httpd-2.2.9/bin/httpd -k start
daemon   22592 22587  0 00:25 ?        00:00:00 /usr/local/httpd-2.2.9/bin/httpd -k start
root     22594 15967  0 00:25 pts/1    00:00:00 grep httpd
[root@CentOS-5.2 ~]# 

Warningが出ているけど、これは設定を何も変更していないから。
ちゃんと起動したみたい。ブラウザでもアクセスして確認してみる。

http://192.168.74.128/

『It works!』という文字がブラウザに表示されればapacheのインストールは正常にできているだろう。
apache停止。

[root@CentOS-5.2 ~]# /usr/local/httpd-2.2.9/bin/apachectl stop
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[root@CentOS-5.2 ~]# ps -ef | grep httpd
root     22636 15967  0 00:28 pts/1    00:00:00 grep httpd
[root@CentOS-5.2 ~]# 

やっぱりWarningが出てるけど、起動した時のもの一緒。プロセスも落ちてるのでOK♪


コマンド/ファイル

  • コマンド
    • /bingrep
    • /bin/ps
    • /bin/su
    • /bin/tar
    • /usr/bin/wget
    • /usr/bin/yum

CDドライブのマウント

SSHで接続したは良いものの、必要なパッケージが無かったり。。。
そんな時はCDドライブをマウントしてインストールCDから直接取得!

VMwareで既にCDドライブは有効にしているので…後はLinux側でCDドライブをマウントすれば良いだけ。
まずはマウントしているかの確認。

[root]# df
Filesystem           1K-ブロック    使用   使用可 使用% マウント位置
/dev/mapper/VolGroup00-LogVol00
                       9014656   1733984   6815368  21% /
/dev/hda1               101086     11816     84051  13% /boot
tmpfs                   257744         0    257744   0% /dev/shm
[root]# 

マウントしていないのでマウント!
マウントポイントは空のディレクトリがあるのでそれをまま使用。別途ディレクトリとして作成しても、どこでも良い。ただ自分はわかりやすさの為とCDドライブ以外を検証環境(VMware)でマウントする事がないので/mntをまま使用してしまう。

[root]# mount /dev/cdrom /mnt
mount: ブロックデバイス /dev/cdrom は書き込み禁止です、読込み専用でマウントします
[root]# 

デフォルトだときっと読み書き可でマウントしようとしているのだが、CD-ROMに入っているのはもちろん書けないやつなので『読み込み専用』でマウントされちゃうよって警告かしら。もちろんそれで問題無し。気にしない気にしない。
マウントできたかしら?

[root]# df
Filesystem           1K-ブロック    使用   使用可 使用% マウント位置
/dev/mapper/VolGroup00-LogVol00
                       9014656   1733988   6815364  21% /
/dev/hda1               101086     11816     84051  13% /boot
tmpfs                   257744         0    257744   0% /dev/shm
/dev/hdb               3926368   3926368         0 100% /mnt
[root]# 

ちゃんとマウントできてるね。
そしたら後はCDから必要なパッケージを取得するだけー。
yumでやれば?っていうのは今回はなし。また今度♪


ちなみに…マウントを外すのは

[root]# umount /mnt

コマンド/ファイル

  • コマンド
    • /bin/df
    • /bin/mount
    • /bin/umount