インストールしたもののメモです。
OSインストール
Index of /Linux/centos/5/isos/i386. CentOS5.7を今回は使用しました。 ISOファイルをダウンロードして、最小構成でインストール。
VMWare Toolsインストール
VMWare上のCentOSは時間がずれるのでVMWare Toolsをインストール。 VMWare Serverの管理画面から[Install VMware Tools...]を選択します。 選択すると、CDドライブにインストール用のファイルがセットされます。
[root@localhost ~]# mount /dev/cdrom /mnt/ [root@localhost ~]# cd /mnt/ [root@localhost ~]# /etc/yum.conf gpgcheck=0 ← 0に変更 [root@localhost ~]# cp VMwareTools-7.7.6-203138.i386.rpm /tmp/ [root@localhost ~]# cd /tmp/ [root@localhost ~]# yum localinstall VMwareTools-7.7.6-203138.i386.rpm [root@localhost ~]# /etc/yum.conf gpgcheck=1 ← 元に戻す 一旦、サーバを停止しvmxファイルを変更します。 tools.syncTime = "TRUE" ← TRUEに変更 サーバを再度起動し、grubの設定を変更します。 このパラメータの追加(divider=10)はCentOS5.7では合った方が精度が良いよ?とナレッジに記載あったので追加しました。 VMware KB: Timekeeping best practices for Linux guests. [root@localhost ~]# vi /boot/grub/grub.conf kernel /vmlinuz-2.6.18-274.el5 ro root=/dev/VolGroup00/LogVol00 divider=10ntpdインストール
[root@localhost ~]# yum install ntp [root@localhost ~]# vi /etc/ntp.conf tinker panic 0 restrict 127.0.0.1 restrict default kod nomodify notrap server 0.vmware.pool.ntp.org server 1.vmware.pool.ntp.org server 2.vmware.pool.ntp.org driftfile /var/lib/ntp/drift [root@localhost ~]# vi /etc/ntp/step-tickers 0.vmware.pool.ntp.org 1.vmware.pool.ntp.org [root@localhost ~]# service ntpd start [root@localhost ~]# chkconfig ntpd onインストールと設定
まずはifconfigでipを確認して、puttyまたはpoderosaで接続する。
viコマンドでvimを使うようにする
何かとvimの方が便利なので、aliasで設定
[root@localhost ~]# vi /etc/bashrc alias vi='vim' ← 追加 [root@localhost ~]# source /etc/bashrc不要なサービス停止
yum自動アップデート停止
[root@localhost ~]# /etc/rc.d/init.d/yum-updatesd stop yum-updates を停止中: [ OK ] [root@localhost ~]# yum remove yum-updatesdSELinuxを無効化
[root@localhost ~]# vi /etc/sysconfig/selinux #SELINUX=enforcing SELINUX=disablediptables停止・自動起動無効
[root@localhost ~]# service iptables stop [root@localhost ~]# chkconfig iptables offRPMリポジトリを追加
[root@localhost ~]# rpm -import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka [root@localhost ~]# vi /etc/yum.repos.d/utterramblings.repo [utterramblings] name=Jason's Utter Ramblings Repo baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/ enabled=0 gpgcheck=1 gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka enabled=0にしているので、通常のyumコマンドではこのリポジトリは使われない。 使う場合は [root@localhost ~]# yum --enablerepo=utterramblings install パッケージ [root@localhost ~]# yum --enablerepo=utterramblings update パッケージ とする。 再起動 [root@localhost ~]# rebootApache,PHP,MySQLインストール
[root@localhost ~]# yum --enablerepo=utterramblings install httpd httpd-devel php php-mbstring php-devel php-mcrypt php-pear php-mysql php-gd mysql-serverApache,MySQLの起動と自動起動設定
[root@localhost ~]# chkconfig httpd on [root@localhost ~]# chkconfig mysqld on [root@localhost ~]# service httpd start [root@localhost ~]# service mysqld startMySQLのユーザ設定
rootのパスワードを設定して、パスワードがブランクのユーザを削除
[root@localhost ~]# mysql -u root mysql> set password for root@localhost=password('password'); mysql> exit [root@localhost ~]# mysql -u root -p mysql> DELETE FROM mysql.user WHERE Password = ''; mysql> exitApacheの設定
sampleユーザ追加
[root@localhost ~]# adduser sample [root@localhost ~]# su - sample [root@localhost ~]# chmod 755 /home/sample/ [sample@localhost ~]$ mkdir ~/public_html [sample@localhost ~]$ vi ~/public_html/phpinfo.php ← 確認用 バーチャルホスト設定 [bash] [root@localhost ~]# vi /etc/httpd/conf.d/vhosts.conf NameVirtualHost *:80# sample DocumentRoot /home/sample/public_html ServerName test.sample.com Options Indexes FollowSymLinks MultiViews Includes ExecCGI AddType text/html .shtml AddHandler server-parsed .shtml AddHandler cgi-script .cgi .pl AllowOverride All Order allow,deny Allow from all 確認 [root@localhost ~]# httpd -S VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:80 is a NameVirtualHost default server test.sample.com (/etc/httpd/conf.d/vhosts.conf:5) port 80 namevhost test.sample.com (/etc/httpd/conf.d/vhosts.conf:5) Syntax OKWindowsのhostsファイル変更
C:\Windows\System32\drivers\etc\hosts
192.168.1.3 test.sample.com http://test.sample.com/phpinfo.phpにアクセスして確認. ここまでで一通り開発環境が出来ました。 ソースのアップはrsync等で同期すると簡単にできると思います。 Windowsからrsyncを利用する方法も書きました。 suusuke - blog - Windows で rsync を使用する.追加
ここからは有ると便利な設定等を追記していきます。
PHP Xdebugインストール
gcc,gcc-c++インストール
[root@localhost ~]# yum -y install gcc gcc-c++Xdebugインストール
既にphp-devel,php-pearはインストールしてある状態なのでpeclコマンドでインストール。
[root@localhost ~]# pecl install xdebug .... Build process completed successfully Installing '/usr/lib/php/modules/xdebug.so' install ok: channel://pecl.php.net/xdebug-2.1.2 configuration option "php_ini" is not set to php.ini location You should add "extension=xdebug.so" to php.ini /usr/lib/php/modules/xdebug.soにxdebug.soがインストールされました。php.iniに追記
/etc/php.ini
zend_extension="/usr/lib/php/modules/xdebug.so"