====================== クラリネットサーバ 再構築のコマンド手順   2010/6版 ====================== 【基本的な注意事項】 ・putty で直接リモートログインで実行すること(仮想コンソールでは機能不全) ・OSインストール時の選択によっては一部不要もあり(重複を恐れず) [1] 再起動後、ユーザ追加・FW停止・yum設定ーーーー # useradd ezm # passwd ezm xxxxxx 【※ 2回、直接入力の方がよい!コピペではなく】 # chkconfig iptables off # chkconfig --list iptables # yum -y install yum-fastestmirror 【★インストール済だった】 # yum -y update [2] 追加パッケージ/mysqld,httpd常時起動ーーーーーーーーーーーーーーー # yum install vim-enhanced 【★インストール済だった】 # cd /root # vi .bashrc --- alias vi='vim' 【一行追加】 # yum -y install php-gd php php-mbstring php-mysql 【※まとめてインストール、 httpdはここで追加された!】 # yum -y install postfix 【★★OpenPNEのメール配信に必要(自動で入らない!)】 # rpm -q sendmail 【インストール済かチェック】 【※実は、sendmailがインストール済だった!---- 最初のパケージ選択のやり方かも!!】 # yum -y install mod_ssl 【★ssl用】 # yum -y install rsync 【★リモート同期コマンド】 # yum -y install mysql-server 【※インストール済みだった!】 # /etc/rc.d/init.d/mysqld start # chkconfig mysqld on # chkconfig --list mysqld # /etc/rc.d/init.d/httpd start # chkconfig httpd on # chkconfig --list httpd # /etc/rc.d/init.d/postfix start # chkconfig postfix on # chkconfig --list postfix # /etc/rc.d/init.d/iptables status 【※ファイアウォール停止 を確認】 # vi /etc/sysconfig/selinux --- SELINUX=disabled 【一行変更】 [3] mysql 設定/DB作成(Wordpress & OpenPNE)ーーーーーーーーーーーーーーー # mysql -u root select user,host,password from mysql.user; set password for root@localhost=password('xxxxxxxx'); select user,host,password from mysql.user; select user,host from mysql.user; delete from mysql.user where user=''; select user,host from mysql.user; show databases; drop database test; exit --- # mysql -u root -p xxxxxxxx 【直接入力の方がよい!コピペではなく】 grant all on *.* to kurari identified by 'kurari'; flush privileges; CREATE DATABASE `wordpress` DEFAULT CHARACTER SET utf8; grant all on *.* to openpne@localhost identified by 'kuraric'; flush privileges; CREATE DATABASE `openpne` DEFAULT CHARACTER SET utf8; show databases; exit # reboot 【ここで一度再起動しておく】 [4] backupデータの転送/recovery ーーーーーーーーーーーーーーーーーー # cd /home/ezm/ # scp -rp root@192.168.1.xxx:/home/ezm/backup/ . 【※アドレス注意】 yes 【初接続の際は、確認】 xxxxxxxx 【root パスワードを直接入力】 # cd backup/ # ./recovery.sh [5] OpenPNEの設定調整 # echo "Alias /sns /var/www/OpenPNE/public_html" > /etc/httpd/conf.d/openpne.conf [6] 最終調整 (1)サーバ本体の hosts 設定変更 【自分のIPアドレスに】 # vi /etc/hosts --- 192.168.1.xxx kurarinet.com 【一行追加、アドレス注意】 (2) 定期ジョブの設定【バックアップは環境により別途調整】 # crontab -e ーー(追加 1行目はバックアップ用、2-5行はOpenPNE用)ーーーー 00 05 * * * /backup/backup.sh 00 6 * * * /bin/sh /var/www/OpenPNE/bin/tool_send_dairy_news.cron /var/www/OpenPNE/bin/ /usr/bin/php 00 6 * * * /bin/sh /var/www/OpenPNE/bin/tool_send_birthday_mail.cron /var/www/OpenPNE/bin/ /usr/bin/php 00 6 * * * /bin/sh /var/www/OpenPNE/bin/tool_send_schedule_mail.cron /var/www/OpenPNE/bin/ /usr/bin/php */20 * * * * /bin/sh /var/www/OpenPNE/bin/tool_rss_cache.cron /var/www/OpenPNE/bin/ /usr/bin/php ーーーーーーーーーーーーーーーーーーーーー 【別途調整】 (3) サーバの時計合わせ # yum -y install ntp # vi /etc/ntp.conf ーーーーーーーーーーーーーーーーーーーーーー #追加(LAN内の時刻の問合せに応答) restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap # Hosts on local network are less restricted. #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). #server 0.centos.pool.ntp.org #server 1.centos.pool.ntp.org #server 2.centos.pool.ntp.org ーーーーーーーーーーーーーーーーーーーーーー [7] 接続試験 (1)準備 ・試験用PC側の hosts ファイルの内容を変更 C:\Windows\System32\drivers\etc\hosts ---- 192.168.1.xxx kurarinet.com ・ブラウザを再起動する (2)チェック画面 ・トップ、履歴、システム構成 【必要により更新】 ・カウンター、時計 ・Wordpress(管理者ログイン) ・OpenPNE 書き込みテスト(管理者ログイン) ・旧掲示板等  一部文字化けはやむ無し?! (3)バックアップ関係 【別途調整】 [8] 切替え作業 ・事前告知 ・バックアップ更新(切替直前に、手動で実施) ・ルータ設定変更 以上