Yumリポジトリの追加
-
epel
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
-
remi
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
-
mysql
yum install -y http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
Yumアップデート
yum -y update
Apacheのインストール
1.インストール
yum -y install httpd
2.設定
vi /etc/httpd/conf/httpd.conf
- サーバー情報表示の制御
ServerTokens OS
↓
ServerTokens Prod
- エラーページでサーバー情報を表示しない
ServerSignature On
↓
ServerSignature Off
3.テストページ削除
rm -f /etc/httpd/conf.d/welcome.conf
rm -f /var/www/error/noindex.html
4.httpd起動
/etc/rc.d/init.d/httpd start
(または apachectl start)
5.httpd自動起動設定
chkconfig httpd on
MySQL5.6をインストール
1.MySQLのインストール
yum install -y mysql-community-server
2.起動&自動起動ON
service mysqld start
chkconfig mysqld on
3.rootパスワード設定
mysql -uroot -p
※パスワードは空でEnter
SET PASSWORD FOR root@localhost=PASSWORD('[指定するパスワード]');
exit
4.初期設定
mysql_secure_installation
(rootパスワード入力)
# root ユーザーのパスワードを変更するか?
Change the root password? [Y/n] n
# 匿名ユーザーを削除するか?
Remove anonymous users? [Y/n] Y
# リモートから root ユーザーのログインを禁止するか?
Disallow root login remotely? [Y/n] Y
# test データベースを削除するか?
Remove test database and access to it? [Y/n] Y
# 権限テーブルをリロードするか?
Reload privilege tables now? [Y/n] Y
5.my.cnf編集
vi /etc/my.cnf
[client]
default-character-set=utf8
[mysqld]
skip-character-set-client-handshake
character-set-server = utf8
collation-server = utf8_general_ci
init-connect = SET NAMES utf8
[mysqldump]
default-character-set=utf8
[mysql]
default-character-set=utf8
6.再起動
/etc/init.d/mysqld restart
PHP5.5をインストール
1.PHPのインストール
-
PHP本体
yum --enablerepo=remi,remi-php55 -y install php php-common php-cli php-devel
-
よく使うモジュール
yum --enablerepo=remi,remi-php55 -y install php-gd php-mbstring php-mcrypt php-xml php-pear
-
DB関連モジュール
yum --enablerepo=remi,remi-php55 -y install php-pdo php-mysqlnd php-pgsql
2.初期設定
vi /etc/php.ini
;date.timezone =
↓
date.timezone = 'Asia/Tokyo'
;mbstring.language = Japanese
↓
mbstring.language = Japanese
;mbstring.internal_encoding = UTF-8
↓
mbstring.internal_encoding = UTF-8
;mbstring.http_input = UTF-8
↓
mbstring.http_input = UTF-8