サーバ(daemon) の設定をしていきます。基本的にすべてコンソールから、root ユーザで行うこととします。root ユーザでログイン後、 kon を実行しておきましょう。
次のように修正。
[root@square root]# vi /etc/hosts ↓
127.0.0.1 square.no-ip.org square localhost.localdomain localhost ↓ 127.0.0.1 localhost.localdomain localhost 192.168.1.1 square.no-ip.org square
[root@square root]# chkconfig telnet on ↓
xinetd を再起動する。
[root@square root]# /etc/rc.d/init.d/xinetd restart ↓
postfix を選んで、OK を押す。
[root@square root]# redhat-switch-mail-nox ↓
下記項目を追加・修正する。
[root@square root]# vi /etc/postfix/main.cf ↓
inet_interfaces = localhost
↓
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain
↓
mydestination = $myhostname, localhost.$mydomain,
ichigo.no-ip.org, square.no-ip.org
(DDNS で取得したドメインを追加する)
[root@square root]# /etc/rc.d/init.d/postfix check ↓ (定義に間違いがないか確認)
[root@square root]# /etc/rc.d/init.d/postfix start ↓
次のように修正。
[root@square root]# vi /etc/postfix/aliases ↓
保存後、下記コマンドを実行。
[root@square root]# newaliases ↓
RPM をダウンロードする。ftp://ftp.proftpd.org/distrib/packages/RPMS/ にある最新の RPM (執筆時点では、proftpd-1.2.9-1.9.i386.rpm が最新) をダウンロードする。ダウンロードが完了したら、vsftpd を停止した後、 インストールを実行する。
[root@square root]# wget ftp://ftp.proftpd.org/distrib/packages/RPMS/proftpd-1.2.9-1.9.i386.rpm ↓
[root@square root]# chkconfig vsftpd off ↓
[root@square root]# /etc/rc.d/init.d/xinetd restart ↓
[root@square root]# rpm -ivh proftpd-1.2.9-1.9.i386.rpm ↓
次のように修正。
[root@square root]# vi /etc/proftpd.conf ↓
Group
nogroup
↓
Group
nobody
DefaultRoot ~ を追加
なお、FTP ユーザのホームディレクトリは、/var/ftp なので、 通常、/var/ftp/pub/ の下にファイルをコピーしておけば、 anonymous (または ftp) ユーザでログインすれば、匿名 FTP が可能。 もちろん、アカウントを持っているユーザも利用できる。
[root@square root]# /etc/rc.d/init.d/proftpd start ↓
次のように修正。
[root@square root]# vi /etc/httpd/conf/httpd.conf ↓
#ServerName
new.host.name:80
↓
ServerName
square.no-ip.org:80
なお、httpd の DocumentRoot は、 /var/www/html なので、 /var/www/html の下に index.html などのファイルを置けばよい。
[root@square root]# chkconfig --level 35 httpd on ↓
[root@square root]# chkconfig --level 016 httpd off ↓
[root@square root]# /etc/rc.d/init.d/httpd start ↓
root # cd /usr/local/src ↓ root # tar -zxvf ./wwwcount2.5.tar.gz ↓ root # cd wwwcount2.5↓ root # ./Count-config↓ Continue [y|n]? y↓ *cgi-bin directory [/usr/local/etc/httpd/cgi-bin]: /var/www/cgi-bin↓ *Base directory [/usr/local/etc/Counter]: /var/www/Counter↓ * Config directory [/var/www/Counter/conf]: ↓ * Name of the configuration file [count.cfg]: ↓ *Data directory [/var/www/Counter/data]: ↓ *Digits directory [/var/www/Counter/digits]: ↓ *Log directory [/var/www/Counter/logs]: ↓ * Name of the log file [Count2_5.log]: ↓ Everything looks OK [y|n]? y↓ root # make all↓ root # ./Count-install↓ Continue [y|n]? y↓ *Do you know the user and group id of httpd' child process [y|n]:? y↓ *Enter user id of httpd's child process [no default]:? apache↓ *Enter group id of httpd's child process [no default]:? apache↓ root # chown apache.apache /var/www/Counter/data↓ |
root # vi /var/www/Counter/conf/count.cfg ↓ |
セクション | 変更前 | 変更後 |
[options] | auto_file_creation=No | auto_file_creation=Yes |
[ignore IPs] | 未定義 | 127.0.0.1 |
[authorized] | 例を全て消して、127.0.0.1 と LAN 内のクライアントPCのIPを追加 |
全ての行をコメント(行頭に#)したあと、以下を追加。
[root@square root]# vi /etc/ntp.conf ↓
server clock.redhat.com
server clock2.redhat.com
driftfile /etc/ntp/drift
上記の IP アドレスは、あくまでも例。 プロバイダ指定のものか、もしルータ自身がNTP サーバの機能を 持っているのであれば、ルータの IP アドレスへ変更すること。
[root@square root]# echo clock.redhat.com > /etc/ntp/step-tickers ↓
[root@square root]# chkconfig --level 35 ntpd on ↓
[root@square root]# chkconfig --level 016 ntpd off ↓
[root@square root]# /etc/rc.d/init.d/ntpd start ↓
[root@square root]# cd /usr/local/src ↓
[root@square root]# tar -zxvf irc2.10.3p5+hemp2+jp6.tar.gz ↓
[root@square root]# cd irc2.10.3p5+hemp2+jp6 ↓
[root@square root]# ./configure ↓
[root@square root]# cd i686-pc-linux-gnu ↓
[root@square root]# vi config.h ↓
vi エディタにて、下記定義をそれぞれ 0 に変更
#define SPLIT_SERV 10
↓
#define SPLIT_SERV 0
#define SPLIT_USERS 15000
↓
#define SPLIT_USERS 0
変更したら、保存して終了。
[root@square root]# make server ↓
[root@square root]# make install-server ↓
[root@square root]# chmod 755 /etc/rc.d/init.d/ircd ↓
[root@square root]# chkconfig --add ircd ↓
[root@square root]# /etc/rc.d/init.d/ircd start ↓
次に、square(UID=500) というユーザを作成する。これは、会員制 WEB & FTP サービス用のユーザアカウントとする。以下の外付けディスクもこのユーザのホームディレクトリ配下に作成する。グループも新規に square(GID=500) を作成する。
[root@square root]# useradd -g 100 -u 100 -d /home/chika chika
[root@square root]# passwd chika
Changing password for chika.
New password: ******** (表示されない)
Retype new password: ******** (表示されない)
[root@square root]# groupadd -g 500 square
[root@square root]# useradd -g 500 -u 500 -d /home/square square
[root@square root]# passwd square
Changing password for square. New password: ******** (表示されない)
Retype new password: ******** (表示されない)
[root@square root]# tail -20 /var/log/messages ↓ Jan 18 08:17:41 square kernel: hub.c: new USB device 00:10.3-3, assigned address 2
Jan 18 08:17:41 square kernel: usb.c: USB device 2 (vend/prod 0x411/0x2b) is not claimed by any active driver.
Jan 18 08:17:45 square /etc/hotplug/usb.agent: Setup usb-storage for USB product 411/2b/100
Jan 18 08:17:46 square kernel: SCSI subsystem driver Revision: 1.00
Jan 18 08:17:46 square kernel: Initializing USB Mass Storage driver...
Jan 18 08:17:46 square kernel: usb.c: registered new driver usb-storage
Jan 18 08:17:46 square kernel: scsi0 : SCSI emulation for USB Mass Storage devices
Jan 18 08:17:46 square kernel: Vendor: WDC Model: WD1600AB-00DYA0 Rev: 15.0
Jan 18 08:17:46 square kernel: Type: Direct-Access ANSI SCSI revision: 02
Jan 18 08:17:46 square kernel: USB Mass Storage support registered.
Jan 18 08:17:49 square devlabel: devlabel service started/restarted
SCSI にエミュレートされ、正常に接続されていることがわかる。
また、下記を実行してみる。
[root@square root]# cat /proc/scsi/scsi ↓ Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: WDC Model: WD1600AB-00DYA0 Rev: 15.0
Type: Direct-Access ANSI SCSI revision: 02
Linux では、scsi0→/dev/sda、scsi1→/dev/sdb、scsi2→/dev/sdc というデバイスファイル名となる。このため、今回接続したディスクは、 /dev/sda というデバイス名となる。
fdisk を実行し、ディスクのパーティションテーブルを表示する。
[root@square root]# fdisk -l /dev/sda ↓
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = シリンダ数 of 16065 * 512 = 8225280 bytes
デバイス ブート 始点 終点 ブロック ID システム /dev/sda1 2 19457 156280320 f Win95 拡張領域 (LBA) /dev/sda5 2 19457 156280288+ b Win95 FAT32
デバイス ブート 始点 終点 ブロック ID システム /dev/sda1 2 19457 156280320 f Win95 拡張領域 (LBA) /dev/sda5 2 19457 156280288+ b Win95 FAT32すべての領域が拡張領域として定義されていて、その中に論理ドライブ /dev/sda5 が、FAT32 として領域確保されている。
[root@square root]# fdisk /dev/sda ↓ このディスクのシリンダ数は 19457 に設定されています。
間違いではないのですが、1024 を超えているため、以下の場合
に問題を生じうる事を確認しましょう:
1) ブート時に実行するソフトウェア (例. バージョンが古い LILO)
2) 別の OS のブートやパーティション作成ソフト
(例. DOS FDISK, OS/2 FDISK)コマンド (m でヘルプ): d ↓
領域番号 (1-5): 5 ↓コマンド (m でヘルプ): d ↓
Selected partition 1 ↓コマンド (m でヘルプ): n ↓
コマンドアクション
e 拡張
p 基本領域 (1-4)
p ↓
領域番号 (1-4): 1 ↓
最初 シリンダ (1-19457, 初期値 1): ↓
初期値 1 を使います
終点 シリンダ または +サイズ または +サイズM または +サイズK (1-19457, 初期値 19457): ↓
初期値 19457 を使いますコマンド (m でヘルプ): w ↓
領域テーブルは交換されました!ioctl() を呼び出して領域テーブルを再読込みします。
ディスクを同期させます。[root@square root]# mkfs -t ext3 /dev/sda1 ↓
ファイルシステムの作成が終了したら、マウントポイントを作成し、 マウントをしてみる。
[root@square root]# mkdir /home/square/pub ↓
[root@square root]# mount /dev/sda1 /home/square/pub ↓
df コマンドなどで確認し、正常にマウントできていれば、 /etc/fstab を編集し、起動時にマウントできるように変更。
/dev/sda1 /home/square/pub ext3 defaults 1 2