Ubuntu 9.10 (Karmic Koala) server editionの初期設定メモ。
インストールを始める前に、仮想マシンのキーマップ設定を修正しておく。 /etc/libvirt/qemu/にある各設定ファイル内の/domain/devices/graphics/@keymapの値をen-usからjaに変える。
<graphics type='vnc' port='-1' autoport='yes' keymap='ja'/>]]>
| Virtual disk1 vda 10GB | |||||
| #1 | primary | 512M | ext4 | /boot | Mount option: defaults |
| #5 | logical | (max) | ext4 | /usr | Mount option: defaults |
| Virtual disk2 vdb 10GB | |||||
| #1 | primary | (max) | ext4 | / | Mount option: defaults |
| #5 | logical | 512M | swap | - | |
sudo apt-get install console-data
インストール中に設定画面(Configuring console-data)が現れる。 この画面で、
キーマップが正しくないなど、再設定が必要な場合は、
sudo dpkg-reconfigure console-data
で再設定する。
好みのエディタに変更する。
$ sudo update-alternatives --config editor There are 4 choices for the alternative editor (providing /usr/bin/editor). Selection Path Priority Status ------------------------------------------------------------ * 0 /bin/nano 40 auto mode 1 /bin/ed -100 manual mode 2 /bin/nano 40 manual mode 3 /usr/bin/vim.basic 30 manual mode 4 /usr/bin/vim.tiny 10 manual mode Press enter to keep the current choice[*], or type selection number: 3 update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode.
以下の内容で作成。
set encoding=utf-8
set fileencoding=utf-8
"set fileencodings=iso-2022-jp,cp932,shift-jis,euc-jp,utf-8,utf-16,ucs-2le,ucs-2,japan
set fileencodings=utf-8,utf-16,japan
set backspace=2
set tabstop=2
set shiftwidth=4
set expandtab
highlight tabs ctermbg=green guibg=green
set list
set number
set ruler
set smartindent
以下の内容を追記。
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
PS1='\!> \[\033[0;33m\]\u\[\033[m\]@\[\033[0;36m\]\h\[\033[m\] [\[\033[0;32m\]\t\[\033[m\] \w]\$ '
case $TERM in
kterm|xterm|cygwin)
TITLEBAR="\u@\h:\w"
PS1="\[\033]0;${TITLEBAR}\007\]${PS1}"
;;
esac
root宛のメール送信先を変更する。
# 以下を追記
root: root@<mail-server>
変更を反映する。
sudo newaliases
ホストマシンのapt-cacherを読みにいくよう、/etc/apt/apt.conf.d/01proxyにプロキシの設定を追記する。
Acquire::http::Proxy "http://<apt-cacher-server>:3142";
起動時にGRUB 2のメニュー画面が表示されるようにする。 GRUB_HIDDEN_TIMEOUTをコメントアウトし、GRUB_TIMEOUTにタイムアウト秒数を指定する。
#GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT="5"
変更内容を反映する。
$ sudo update-grub2 Generating grub.cfg ... Found linux image: /boot/vmlinuz-2.6.31-14-generic-pae Found initrd image: /boot/initrd.img-2.6.31-14-generic-pae Found memtest86+ image: /memtest86+.bin done
sudo apt-get install xinetd telnetd
以下を追記。
in.telnetd : 127.0.0.1 192.168.0.0/24
ALL : ALL
/etc/xinetd.d/telnetを作成。
service telnet
{
disable = no
flags = REUSE
socket_type = stream
user = telnetd
wait = no
server = /usr/sbin/in.telnetd
server_args = -h
only_from = 192.168.0.0/24 127.0.0.1
log_on_failure += USERID
}
xinetdを再起動。
sudo /etc/init.d/xinetd restart
sudo apt-get install nfs-common
マウントポイントを作成。
sudo mkdir -p /srv/nfs
/etc/fstabを編集後、マウントする。
sudo vi /etc/fstab sudo mount -a
マウントされたかどうか確認する。
cat /etc/mtab ls -l /srv/nfs
sudo apt-get install munin-node
/etc/munin/pluginsから必要なプラグインだけを残す。
sudo unlink xxx sudo ln -s /usr/share/munin/plugins/xxx
データを収集するマシンのみからのアクセスを許可するように変更する。
allow ^192\.168\.0\.10$
munin-nodeを再起動。
sudo /etc/init.d/munin-node restart
データを収集するマシンからtelnetで接続できるか試す。
$ telnet server1.example.com 4949 Trying 192.168.0.20... Connected to server1.example.com. Escape character is '^]'. # munin node at server1.example.com nodes server1.example.com . quit Connection closed by foreign host.
sudo apt-get install awstats
/etc/awstats以下の設定ファイルを編集後、ログが読み込まれデータが正しく収集されるかテストする。
sudo -u www-data /usr/share/doc/awstats/examples/awstats_updateall.pl now -awstatsprog=/usr/lib/cgi-bin/awstats.pl -confdir="/etc/awstats/" ls /var/lib/awstats
cronの設定を作成。
0,30 * * * * www-data /usr/share/doc/awstats/examples/awstats_updateall.pl now -awstatsprog=/usr/lib/cgi-bin/awstats.pl -confdir="/etc/awstats/" > /dev/null
必要に応じてHTTPサーバの設定を更新したのち、「http://サーバ名/awstats/awstats.pl?config=設定ファイル名」を開いて収集されたデータが表示されるか確かめる。