インストール後のシステム設定しておきたい事や設定内容変更方法などを紹介します。
下記の設定例は(linux)というユーザを作成します。
Fedora Core release 2 (Tettnang) Kernel 2.6.5-1.358 on an i686 root(管理者)でログイン linux login: root パスワードを入力 Password: [root@fedora root]# ← ログイントした 一般ユーザ(linux)の追加 [root@fedora root]# useradd linux linuxのパスワード設定 [root@fedora root]# passwd linux Changing password for user linux. パスワードの入力 New UNIX password: 確認入力(上記のパスワードと同じ物を入れる) Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@fedora root]# ログアウト [root@fedora root]# exit logout ← ログアウトした |
# vi /etc/sysconfig/i18n
デフォルトのUTF-8コードをeucJPコードにする
LANG="ja_JP.UTF-8"
↓
LANG="ja_JP.eucJP"
*:FedoraCore5以降 / CentOS5 / CentOS6 の場合、下記不要
SUPPORTED="ja_JP.UTF-8:ja_JP:ja"
↓
SUPPORTED="ja_JP.eucJP:ja_JP:ja"
*:FedoraCore5以降 / CentOS5 / CentOS6 の場合、下記不要
# vi /etc/man.config
manコマンド文字化け対応
PAGER /usr/bin/less -isr
↓
PAGER /usr/bin/lv
|
CentOS4のmanコマンド文字化け対応 CentOS4 には、lvコマンドがありませんので別途インストールする必要があります。 LV Homepageよりlvのソースを取得 [root@centos ~]# wget http://www.ff.iij4u.or.jp/~nrt/freeware/lv451.tar.gz --16:02:03-- http://www.ff.iij4u.or.jp/~nrt/freeware/lv451.tar.gz => `lv451.tar.gz' www.ff.iij4u.or.jp をDNSに問いあわせています... 210.138.144.111, 210.138.144.71, 210.138.144.79, ... www.ff.iij4u.or.jp|210.138.144.111|:80 に接続しています... 接続しました。 HTTP による接続要求を送信しました、応答を待っています... 200 OK 長さ: 605,082 (591K) [application/x-gzip] 100%[====================================>] 605,082 61.45K/s ETA 00:00 16:02:13 (61.26 KB/s) - `lv451.tar.gz' を保存しました [605082/605082] 取得したlvソースを展開 [root@centos ~]# tar xzvf lv451.tar.gz lv451/README lv451/GPL.txt lv451/index.html lv451/relnote.html : : lv451/src/rev8859.pl lv451/src/revbig5.pl lv451/src/revgb.pl lv451/src/revksc.pl lv451/src/d2uall.sh 展開したlvソースのbuild位置へ移動 [root@centos ~]# cd lv451/build/ makefileの作成 [root@centos build]# ../src/configure creating cache ./config.cache checking whether ln -s works... yes checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no : : checking return type of signal handlers... void checking for nl_langinfo and CODESET... yes updating cache ./config.cache creating ./config.status creating Makefile make(コンパイル)実行 [root@centos build]# make gcc -g -O2 -DLV_HELP_PATH=\"/usr/local/lib/lv\" -I../src -DUNIX=1 -DTERMCAP=1 -DHAVE_LIBTERMCAP=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_FCNTL_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_TERMIO_H=1 -DHAVE_UNISTD_H=1 -DHAVE_TERMIOS_H=1 -DHAVE_LOCALE_H=1 -DHAVE_SIGVEC=1 -DHAVE_TGETNUM=1 -DHAVE_SETLOCALE=1 -DGETPGRP_VOID=1 -DRETSIGTYPE=void -DHAVE_LANGINFO_CODESET=1 -c ../src/itable.c : : gcc -g -O2 -DLV_HELP_PATH=\"/usr/local/lib/lv\" -I../src -DUNIX=1 -DTERMCAP=1 -DHAVE_LIBTERMCAP=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_FCNTL_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_TERMIO_H=1 -DHAVE_UNISTD_H=1 -DHAVE_TERMIOS_H=1 -DHAVE_LOCALE_H=1 -DHAVE_SIGVEC=1 -DHAVE_TGETNUM=1 -DHAVE_SETLOCALE=1 -DGETPGRP_VOID=1 -DRETSIGTYPE=void -DHAVE_LANGINFO_CODESET=1 -c ../src/unirev.c gcc -o lv itable.o ctable.o uty.o istr.o stream.o file.o guess.o decode.o encode.o escape.o iso2022.o iso8859.o iso2cn.o iso2jp.o iso2kr.o kana.o eucjapan.o shiftjis.o big5.o hz.o raw.o fetch.o screen.o command.o display.o find.o re.o nfa.o dfa.o conv.o version.o conf.o lv.o console.o guesslocale.o utf.o unimap.o unirev.o -ltermcap install実行 [root@centos build]# make install /usr/bin/install -c -s -m 555 lv /usr/local/bin if test -f /usr/local/bin/lgrep; then \ /bin/rm -f /usr/local/bin/lgrep; \ fi (cd /usr/local/bin; ln lv lgrep) if test ! -d /usr/local/lib/lv; then \ mkdir -p /usr/local/lib/lv; \ fi /usr/bin/install -c -m 444 ../src/../lv.hlp /usr/local/lib/lv if test -d /usr/local/man -a -d /usr/local/man/man1; then \ /usr/bin/install -c -m 444 ../src/../lv.1 /usr/local/man/man1; \ fi lvを実行してみる [root@centos build]# lv # lv v.4.51 (Jan.16th,2004) # All rights reserved. Copyright (C) 1996-2004 by NARITA Tomio # ABSOLUTELY NO WARRANTY; for details type `lv -h' lvの実行パス表示 [root@centos ~]# which lv /usr/local/bin/lv man設定ファイルの変更 [root@centos ~]# vi /etc/man.config #PAGER /usr/bin/less -iRs ↓ ↓ ↓ PAGER /usr/local/bin/lv |
サービスの起動先の表示
# ls -l /etc/rc.d/rc3.d/
合計 0
lrwxrwxrwx 1 root root 19 9月 22 08:47 K05saslauthd -> ../init.d/saslauthd
lrwxrwxrwx 1 root root 16 9月 22 08:47 K10psacct -> ../init.d/psacct
:
:
lrwxrwxrwx 1 root root 23 9月 22 08:47 S00microcode_ctl -> ../init.d/microcode_ctl
lrwxrwxrwx 1 root root 18 9月 22 08:47 S08iptables -> ../init.d/iptables
lrwxrwxrwx 1 root root 17 9月 22 08:47 S10network -> ../init.d/network
lrwxrwxrwx 1 root root 16 9月 22 08:47 S12syslog -> ../init.d/syslog
lrwxrwxrwx 1 root root 16 9月 22 08:47 S20random -> ../init.d/random
lrwxrwxrwx 1 root root 16 9月 22 08:47 S24pcmcia -> ../init.d/pcmcia
lrwxrwxrwx 1 root root 16 9月 22 08:47 S28autofs -> ../init.d/autofs
lrwxrwxrwx 1 root root 14 9月 22 08:47 S55sshd -> ../init.d/sshd
lrwxrwxrwx 1 root root 20 9月 22 08:47 S56rawdevices -> ../init.d/rawdevices
lrwxrwxrwx 1 root root 16 9月 22 08:47 S56xinetd -> ../init.d/xinetd
lrwxrwxrwx 1 root root 15 9月 22 08:47 S90crond -> ../init.d/crond
lrwxrwxrwx 1 root root 17 9月 22 08:47 S95anacron -> ../init.d/anacron
lrwxrwxrwx 1 root root 13 9月 22 08:47 S95atd -> ../init.d/atd
lrwxrwxrwx 1 root root 11 9月 21 16:19 S99local -> ../rc.local
|
Sで始まる文字は起動を表しています。Sの次の2桁の数字が起動順序です。その後はサービス名を表します。
上記を見るとネットワークはS10networkで10番目に起動し、PCMCIAはS24pcmciaで24番目で、ネットワークより後方になっています。
PCMCIAはネットワークより先に起動変更します。
*:ちなみにKで始まる文字は、起動停止しているサービスを起動時に明示的に停止させます。(シャットダウン時に実行される訳ではありません)
「/etc/rc.d/init.d/killall」が全てを司り「/var/lock/subsys/」配下にサービス名が登録されていれば「stop」パラメータを付加して呼び出します。)
サービスの起動先へ移動
# cd /etc/rc.d/rc3.d/
ネットワークサービスのファイル名変更
# mv S10network S11network
PCMCIAサービスのファイル名変更
# mv S24pcmcia S10pcmcia
サービスの起動先の表示
# ls -l
合計 0
lrwxrwxrwx 1 root root 19 9月 22 08:47 K05saslauthd -> ../init.d/saslauthd
lrwxrwxrwx 1 root root 16 9月 22 08:47 K10psacct -> ../init.d/psacct
:
:
lrwxrwxrwx 1 root root 23 9月 22 08:47 S00microcode_ctl -> ../init.d/microcode_ctl
lrwxrwxrwx 1 root root 18 9月 22 08:47 S08iptables -> ../init.d/iptables
lrwxrwxrwx 1 root root 16 9月 22 08:47 S10pcmcia -> ../init.d/pcmcia
lrwxrwxrwx 1 root root 17 9月 22 08:47 S11network -> ../init.d/network
lrwxrwxrwx 1 root root 16 9月 22 08:47 S12syslog -> ../init.d/syslog
lrwxrwxrwx 1 root root 16 9月 22 08:47 S20random -> ../init.d/random
lrwxrwxrwx 1 root root 16 9月 22 08:47 S28autofs -> ../init.d/autofs
lrwxrwxrwx 1 root root 14 9月 22 08:47 S55sshd -> ../init.d/sshd
lrwxrwxrwx 1 root root 20 9月 22 08:47 S56rawdevices -> ../init.d/rawdevices
lrwxrwxrwx 1 root root 16 9月 22 08:47 S56xinetd -> ../init.d/xinetd
lrwxrwxrwx 1 root root 15 9月 22 08:47 S90crond -> ../init.d/crond
lrwxrwxrwx 1 root root 17 9月 22 08:47 S95anacron -> ../init.d/anacron
lrwxrwxrwx 1 root root 13 9月 22 08:47 S95atd -> ../init.d/atd
lrwxrwxrwx 1 root root 11 9月 21 16:19 S99local -> ../rc.local
システムを再起動
# reboot
|
vimのインストール
# yum -y install vim-enhanced
viを別名でvimに登録
# alias vi='vim'
viの別名位置確認
# which vi
alias vi='vim'
/usr/bin/vim
このままではログオフした後、再ログインすると設定が消えてしまいます。
これを防ぐには、下記ファイルへ登録します。
# vi /etc/bashrc
最終行に追加
alias vi='vim'
|
インストール時にホスト名を指定してOSのセットアップが完了した後に、「やっぱり、ホスト名が気に入らない」等で変更したい場合があると思います。
通常は、以下のコマンドを入力すればホスト名が変更されますが、OSの再起動を行うと旧ホスト名に戻ってしまいます。
変更前のホスト名表示 # hostname fedora.kajuhome.com ホスト名の変更 # hostname homeserver.kajuhome.com 変更後のホスト名表示 # hostname ホスト名が変更された homeserver.kajuhome.com OSの再起動 # reboot OS再起動後のホスト名表示 # hostname ホスト名が旧のホスト名に戻ってしまっている fedora.kajuhome.com |
以下の設定ファイルを変更する事によって、ホスト名を変更する事ができます。
設定ファイルの変更
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=fedora.kajuhome.com
↓ ↓ ↓
HOSTNAME=homeserver.kajuhome.com
GATEWAY=192.168.1.1
OSの再起動
# reboot
OS再起動後のホスト名表示
# hostname
再起動を行っても、新ホスト名になっている
homeserver.kajuhome.com
|
サーバのIPアドレスを変更するには、コマンドで「setup」から行う方法もありますが、敢えて何処に設定されているかを把握する為にもファイル編集にて行います。
現在のIPアドレス表示
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:29:DD:9A
inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe29:dd9a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2306456 errors:0 dropped:0 overruns:0 frame:0
TX packets:4077929 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:232421854 (221.6 MiB) TX bytes:603656451 (575.6 MiB)
Interrupt:9 Base address:0xd800
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:55341 errors:0 dropped:0 overruns:0 frame:0
TX packets:55341 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:10557457 (10.0 MiB) TX bytes:10557457 (10.0 MiB)
eth0のIP変更
NICが複数枚ある場合は、「ifcfg-eth」の末尾が0・1・2・・・の様になります。
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BROADCAST=192.168.1.255
HWADDR=00:0C:29:29:DD:9A
192.168.1.10に変更
IPADDR=192.168.1.10
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
TYPE=Ethernet
GATEWAY=192.168.1.1
変更したIPにするため、ネットワークサービスを再起動
# /etc/rc.d/init.d/network restart
インターフェース eth0 を終了中: [ OK ]
ループバックインターフェースを終了中 [ OK ]
ループバックインターフェイスを呼び込み中 [ OK ]
インターフェース eth0 を活性化中: [ OK ]
*:上記はコンソールで行った場合。
ターミナルで行った場合は当然、インタフェースが終了した時点で無反応になります。
(新しいIPアドレスで再接続して下さい。)
再度、IPアドレス表示
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:29:DD:9A
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::207:40ff:fe0a:80e5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:646 errors:0 dropped:0 overruns:0 frame:0
TX packets:349 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:68382 (66.7 KiB) TX bytes:128023 (125.0 KiB)
Interrupt:10 Base address:0x1080
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1049 errors:0 dropped:0 overruns:0 frame:0
TX packets:1049 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1380958 (1.3 MiB) TX bytes:1380958 (1.3 MiB)
|
ターミナルで操作時の全角文字の文字化けは、ターミナルソフトの「文字セット(キャラクターコード)」をサーバ側と合わせる事により解消しますが、CUIでのコンソール上では設定する場所は存在しません。 以下のコマンドを実行する事により、正しく全角文字を表示する事が可能です。
全角文字の文字化けが発生している状態

『kon』コマンドを実行

全角文字が正しく表示される

インストール直後のシステムには脆弱性やバグが含まれている可能性があります。
『yum(The Yellow dog Updater, Modified)のインストール[パッケージのアップグレード]』にてシステム・パッケージを最新の状態にします。