VMware ServerでCentOSをWindowsで
http://labs.unoh.net/2006/11/vmwarecentos.html にあるエントリを読んで、かねてから開発環境をどうにかしたいと思っていたので、真似して入れてみました。
基本的には上記エントリのとおりです(わかりやすい説明ありがとうございます)。こちらで変更したのはおおよそ以下のとおりです。
GuestOSの容量
非力なマシン(Pentium Mのメモリ512MB、ディスク60GB)のため、デフォルトのまま。
CentOSインストール時
また、以下を追加。
ブート後の設定
DHCP起動をstaticに変更
VMware Serverでは、NATを選択していると、使用していないネットワークを探し出しNAT用にNetwork Addressを付与するとのこと(NATはVMnet8に割り当てられている。VMware Serverをバージョンアップしたりするとsubnet値が変わるので注意:2007/04/28)。ここでは192.168.116.0/24であり、
- 192.168.116.1 はHost OSのIPアドレス
- 192.168.116.2 はGuest OSで指定するdefault gateway IPアドレス
- 192.168.116.128 - 254 はGuest OSのためのDHCPプールIPアドレス(VMwareのHost -> Virtual Network Settings -> DHCP で変更可能)
なので、staticに付与したい場合は上記以外を付与する(VMware Serverをバージョンアップしたりしてsubnet値が変わったら以下も変更する。/etc/resolv.confもね)。
# vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=static HWADDR=00:0C:29:8C:E4:E6 ONBOOT=yes TYPE=Ethernet IPADDR=192.168.116.10 NETMASK=255.255.255.0 GATEWAY=192.168.116.2
ネットワークはすぐつながるんだろうか?と心配していたのは杞憂だった。インストールで指定したDHCPでも、上記staticでもまったく問題ない。
余計なサービス停止
# for i in cups isdn kudzu gpm smartd pcmcia apmd nfslock xfs > do /sbin/chkconfig $i off; done #
コンパイル用RPMの追加
インストールに使用したisoイメージ(ftp://ftp.riken.jp/Linux/caos/centos/4/isos/i386/CentOS-4.4.ServerCD-i386.iso)はServerCDなので、開発ツールをチェックしてもコンパイラなどはインストールされない。よって、セルフコンパイルしたい場合は、ftp://ftp.riken.jp/Linux/caos/centos/4/os/i386/CentOS/RPMS 配下から取得する。
なお、ftp://ftp.riken.jp/Linux/caos/centos/4/isos/i386 配下の、
ftp://ftp.riken.jp/Linux/caos/centos/4/isos/i386/CentOS-4.4-i386-bin1of4.iso
ftp://ftp.riken.jp/Linux/caos/centos/4/isos/i386/CentOS-4.4-i386-bin2of4.iso
ftp://ftp.riken.jp/Linux/caos/centos/4/isos/i386/CentOS-4.4-i386-bin3of4.iso
ftp://ftp.riken.jp/Linux/caos/centos/4/isos/i386/CentOS-4.4-i386-bin4of4.iso
がDisk1からDisk4のCDイメージ。
# wget ftp://ftp.riken.jp/Linux/caos/centos/4/os/i386/CentOS/RPMS/bison-1.875c-2.i386.rpm # wget ftp://ftp.riken.jp/Linux/caos/centos/4/os/i386/CentOS/RPMS/flex-2.5.4a-33.i386.rpm # wget ftp://ftp.riken.jp/Linux/caos/centos/4/os/i386/CentOS/RPMS/cpp-3.4.6-3.i386.rpm (これはServerCD中のRPMSにもある) # wget ftp://ftp.riken.jp/Linux/caos/centos/4/os/i386/CentOS/RPMS/glibc-kernheaders-2.4-9.1.98.EL.i386.rpm # wget ftp://ftp.riken.jp/Linux/caos/centos/4/os/i386/CentOS/RPMS/glibc-headers-2.3.4-2.25.i386.rpm # wget ftp://ftp.riken.jp/Linux/caos/centos/4/os/i386/CentOS/RPMS/glibc-devel-2.3.4-2.25.i386.rpm # wget ftp://ftp.riken.jp/Linux/caos/centos/4/os/i386/CentOS/RPMS/gcc-3.4.6-3.i386.rpm 以下はPHPのコンパイルで必要。 # wget ftp://ftp.riken.jp/Linux/caos/centos/4/os/i386/CentOS/RPMS/libstdc++-devel-3.4.6-3.i386.rpm # wget ftp://ftp.riken.jp/Linux/caos/centos/4/os/i386/CentOS/RPMS/gcc-c++-3.4.6-3.i386.rpm # wget ftp://ftp.riken.jp/Linux/caos/centos/4/os/i386/CentOS/RPMS/libxml2-devel-2.6.16-6.i386.rpm # wget ftp://ftp.riken.jp/Linux/caos/centos/4/os/i386/CentOS/RPMS/libjpeg-devel-6b-33.i386.rpm # wget ftp://ftp.riken.jp/Linux/caos/centos/4/os/i386/CentOS/RPMS/libpng-devel-1.2.7-1.el4.2.i386.rpm # rpm -i bison-1.875c-2.i386.rpm # rpm -i flex-2.5.4a-33.i386.rpm # rpm -i cpp-3.4.6-3.i386.rpm # rpm -i glibc-kernheaders-2.4-9.1.98.EL.i386.rpm # rpm -i glibc-headers-2.3.4-2.25.i386.rpm # rpm -i glibc-devel-2.3.4-2.25.i386.rpm # rpm -i gcc-3.4.6-3.i386.rpm # rpm -i libstdc++-devel-3.4.6-3.i386.rpm # rpm -i gcc-c++-3.4.6-3.i386.rpm # rpm -i libxml2-devel-2.6.16-6.i386.rpm # rpm -i libjpeg-devel-6b-33.i386.rpm # rpm -i libpng-devel-1.2.7-1.el4.2.i386.rpm
ためしに、ruby, Apache, PHPをコンパイル、インストール。
- ruby 1.8.5
# ./configure # make # make test # make install
- Apache 2.2.3
# ./configure --enable-so --enable-rewrite # make # make install
- PHP 5.2.0
# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-gd --with-gd-jis-conv --with-mysql --enable-mbstring --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr # make # make install
非力なマシンだが、Apacheのコンパイルは2分ぐらいで終わるし、なにより、普段使っているPCでCentOSでの開発ができることはすばらしい。