2010/02/24 (Wed)
Setting of Share Folder
フォルダ共有
共有するフォルダを作成し、ゲストOSの設定からデバイス>共有フォルダから追加する。
カーネルのインストール
# yum install kernel-devel
ゲストOSの設定からデバイス>Guest Additionsのインストールを選択し、マウントする。
# cd /mnt/
# mkdir /cdrom
# mount /dev/cdrom /mnt/cdrom
VBoxLinuxAdditions-x86.runを実行する。
# cd /mnt/cdrom
# ./VBoxLinuxAdditions-x86.run
共有フォルダをマウントする。
# mkdir /mnt/share
# mount -t vboxsf VBoxShare /mnt/share
起動時にマウントするように設定する。
# vi /etc/rc.local
マウントポイントを追加する
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
#
mount -t vboxsf share /mnt/share
Setting of Network
ネットワークアダプタ
ゲストOSの設定>ネットワークからネットワークアダプタの設定をし、 ホストとゲスト間の通信を許可し、ゲストから外部への通信を許可する設定を行う。
- アダプタ1に「ホストオンリーネットワーク」を割り当てる。
- アダプタ2に「NAT」を割り当てる。
IPアドレスを固定する
アダプタの設定
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
IPを固定にする
DEVICE=eth0
BOOTPROTO=static
HWADDR=08:00:27:2C:06:13
ONBOOT=yes
IPADDR=192.168.56.102
NETMASK=255.255.255.0
アダプタの再起動
# ifdown eth0
# ifup eth0
2009/03/31 (Tue)
SELinuxの無効化
SELinuxの状態確認
# getenforce
Enforcing
SELinux無効化
# setenforce 0
# getenforce
Permissive
SELinux設定ファイル編集
# vi /etc/sysconfig/selinux
SELINUX=enforcing
↓
SELINUX=disabled
iptables の停止
# /etc/init.d/iptables stop
iptables を停止せず、httpを通す設定を追加する場合。 /etc/sysconfig/iptables を編集
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
真ん中の行を追加する。
Apacheの起動スクリプト
#!/bin/sh
# chkconfig: 345 98 20
# description: This shell script tabke care of starting and stopping httpd.
# processname: httpd
#
# httpd This shell script takes care of starting and stopping
# httpd.
#
#
RETVAL=0
prog="/usr/local/apache2/bin/apachectl"
# See how we were called.
case "$1" in
start)
$prog startssl
RETVAL=$?
;;
stop)
$prog stop
RETVAL=$?
;;
status)
$prog status
RETVAL=$?
;;
restart|reload)
$prog restart
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $RETVAL
chkconfigで自作の起動スクリプトを登録
# chkconfig: 345 98 20
# description: This shell script tabke care of starting and stopping httpd.
# processname: httpd
起動スクリプトのヘッダにchkconfig用の記述をする。 上から、ランレベル、起動優先順位、停止優先順位
/sbin/chkconfig --add httpd
/sbin/chkconfig --level 345 httpd on
/sbin/chkconfig --list
2008/12/04 (Thu)
Setting of CentOS5
インストール後設定
以下のパッケージをインストール。
# yum install yum-fastestmirror
yum updateする。
# yum check-update
# yum update
さらに以下のパッケージをインストール。
# yum install which
# yum install yum-utils
# yum install ntp
# yum install man
# yum install gcc
# yum install make
# yum install cvs
# yum install lynx
# yum install wget
# yum install unzip
# yum install ftp
日付設定
# ntpdate ntp.nict.jp
cronで定期実行
# vi /etc/cron.daily/ntpdate.cron
以下のファイルを作る
#!/bin/sh
/usr/sbin/ntpdate ntp.nict.jp
実行権限の付与
# chmod 755 /etc/cron.daily/ntpdate.cron
一般ユーザを追加。
# useradd -m <username>
# passwd <username>
New UNIX password: ********
Retype new UNIX password: ********
passwd: all authentication tokens updated successfully