玄箱の素のlinuxをいじる
debianにするほどでもないけど、ちょこちょこといじりたいので、玄箱設定まとめ - ブックマクロ開発にとその元になった玄箱インストールmemoを参考にインストール。
基本的なもののインストール
両ページを参考に、付属のCD-ROMのバイナリをまとめてインストールして、coreutilとgrepをインストール。grepは後者のページに書いてあるgrep-2.5.1a.tar.bz2ではなくgrep-2.5.1a.tar.gzをダウンロード、tar zxfで解凍してインストールしても無事インストールできた。
nanoのインストール
viはとても私には無理です。せめてemacs、だけど、どうせならとっつきやすいnanoを使いたい。
GNU nanoのサイトからnano-2.2.5.tar.gzを落としてきてインストール。
# tar zxf nano-2.2.5.tar.gz
# cd nano-2.2.5
# ./configure --prefix=/usr
# make
# make install
でインストールできた。自力でコンパイルできた(といってもたいしたことはやってないけど)のが妙にうれしい。
DNSの設定
DNSが設定されていないっぽいので設定。
# nano /etc/resolve.conf
# /etc/rc.d/init.d/networking restart
#
# resolv.conf This file is the resolver configuration file
# See resolver(5).
nameserver 8.8.8.8
結果。
# ping www.google.com
PING www.l.google.com (66.249.89.104): 56 data bytes
64 bytes from 66.249.89.104: icmp_seq=0 ttl=51 time=19.2 ms
64 bytes from 66.249.89.104: icmp_seq=1 ttl=51 time=18.6 ms
#
成功。
ntp関係
昨日インストールしたntpdを停める。Gan's blog - Gan's blog : 玄箱サーバーメモ by webadmを参考に。
# /etc/init.d/ntp stop
Stopping NTP server: ntpd.
# ps ax|grep ntp
26172 pts/0 S 0:00 grep ntp
#
自動起動を止める。参考:Linuxの起動と起動スクリプト
# ls /etc/rc.d/rc2.d
S01murasaki S20inetd S23ntp S89cron S91smb S99rmlogin
S20apservd S20thttpd S60lprng S90atalk S95ppc_uartd
# rm /etc/rc.d/rc2.d/S23ntp
# ls /etc/rc.d/rc2.d
S01murasaki S20inetd S60lprng S90atalk S95ppc_uartd
S20apservd S20thttpd S89cron S91smb S99rmlogin
#
ようわからんが、これでええのかな。
次にcronに登録。
# ls /etc/cron.daily
logrotate ntp passwd
ありゃ、ntpの設定がある。でも中身を読んでみるとこれはntpdのログをローテイトするもののようだ。削除するのは怖いので実行権限をはずしてみる。
# ls -l /etc/cron.daily total 12 -rwxr-xr-x 1 root root 51 Jan 10 2003 logrotate -rwxr--r-- 1 root root 1118 Apr 30 2002 ntp -rwxr-xr-x 1 root root 138 Apr 30 2002 passwd #chmod -x /etc/cron.daily/ntp # ls -l /etc/cron.daily total 12 -rwxr-xr-x 1 root root 51 Jan 10 2003 logrotate -rw-r--r-- 1 root root 1118 Apr 30 2002 ntp -rwxr-xr-x 1 root root 138 Apr 30 2002 passwd #
ntpdate.shを作成。
参考:ntpdateを使った PCの時刻合わせ cron
#!/bin/sh
/usr/sbin/ntpdate -s time-nw.nist.gov
実行権限を与え、実行してみる。
# chmod +x /etc/cron.daily/ntpdate.sh # ls -l /etc/cron.daily/ total 16 -rwxr-xr-x 1 root root 51 Jan 10 2003 logrotate -rw-r--r-- 1 root root 1118 Apr 30 2002 ntp -rwxr-xr-x 1 root root 47 Oct 7 22:41 ntpdate.sh -rwxr-xr-x 1 root root 138 Apr 30 2002 passwd # ./ntodate.sh 7 Oct 22:43:06 ntpdate[26212]: adjust time server 131.107.13.100 offset -0.044909 sec #
crontabを編集。
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=
HOME=/02 4 * * * root /etc/cron.d/calib_time.sh
22 4 * * * root run-parts /etc/cron.daily
run-partsが設定されているのでこれで不要なのかな。
cronをリスタート。
# /etc/init.d/cron restart
Re-starting periodic command scheduler: cron.
#