AWS EC2 Linuxにサクッとphp開発環境を作るシンプルなまとめ
細かい設定は抜きでとにかくガーーッと環境構築したいときのためにシンプルにまとめてみました。
レッツスタートぅ!
# Macのターミナルでsshの鍵やらも設定しておく。 vi ~/.ssh/config
# ~/.ssh/config Host hoge User ec2-user HostName alpha.hoge.com Port 22 IdentityFile ~/.ssh/hogehoge.pem
# らくらく接続〜(・3・) ssh hoge
# rootのパスワードを設定。最近はパスワード強度判定がおせっかいなほど親切。 sudo passwd root
# ec2-userのパスワード設定、アップデート、php、mysql関連をインストール。 passwd ec2-user yum update yum install httpd mysql-server php php-pear php-mysql php-mbstring php-gd php-mcrypt php-pecl-apc
# タイムゾーンの設定。 cp -i /usr/share/zoneinfo/Japan /etc/localtime
# php.iniの設定。 vi /etc/php.ini date.timezone = "Asia/Tokyo" expose_php = Off
# webmasterユーザーを追加。公開ディレクトリを作成。 useradd webmaster passwd webmaster cd /var/www/ mkdir hoge.hogehoge.com chown -R webmaster. hoge.hogehoge.com
# httpd.confの設定。 vi /etc/httpd/conf/httpd.conf
# httpd.conf #ServerTokens OS ServerTokens Prod ServerName hoge.hogehoge.com:80 #Options Indexes FollowSymLinks Options Includes ExecCGI FollowSymLinks #AllowOverride None AllowOverride All #LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%!414r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined #ServerSignature On ServerSignature Off #AddDefaultCharset UTF-8 #AddHandler cgi-script .cgi AddHandler cgi-script .cgi .pl #Options Indexes MultiViews FollowSymLinks Options MultiViews
# httpdの再起動。 /etc/rc.d/init.d/httpd start chkconfig httpd on
# mysqlの設定。 vi /etc/my.cnf
# my.cnf character-set-server = utf8
# mysqlの再起動。 /etc/rc.d/init.d/mysqld start chkconfig mysqld on
# mysqlの設定。空ENTERとパスワード入力だけで、匿名ユーザー削除、リモートからのrootログイン禁止、testデータベース削除という感じ。 mysql_secure_installation
いちおうdone!