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)

Install of CentOS5

インストール時設定

  • linux text
  • Choose a Language --> English
  • Keyboard Type --> us
  • Installation Method --> HTTP
  • Configure TCP/IP --> Enable IPv4 support Dynamic IP configuration (DHCP)
  • HTTP Setup --> ftp.riken.jp / Linux/centos/5/os/i386
  • Welcome to CentOS
  • Warning --> Yes
  • Partitioning Type --> Remove all partitions on selected drives and create default layout.
  • Warning --> Yes
  • Review Partition Layout --> Yes
  • Partitioning --> OK
  • Low Memory --> Yes
  • Boot Loader Configuration --> Use GRUB Boot Loader
  • Boot Loader Configuration --> OK
  • Boot Loader Configuration --> OK
  • Boot Loader Configuration --> OK
  • Boot Loader Configuration --> OK
  • Configure Network Interface --> No
  • Hostname Configuration --> automatically via DHCP / manually
  • Time Zone Selection --> Asia/Tokyo
  • Root Password --> **
  • Package selection --> [*] Customize software selection
  • Package Group selection --> [*] Editors
  • Installation to begin --> OK
  • Complete --> Reboot (デバイス->CD/DVD-ROMのマウント解除後)
  • shutdown -h now
  • ネットワーク -> アダプタ1 -> ホストインターフェース