CentOS6にミドルウェアをいれてみた (Webサーバー,PHP,MySQLの導入、Pythonの更新)
初めてローカル開発環境を作ってみたのつづきその6
手順
Webサーバー
# yum install -y httpd # service httpd start # chkconfig httpd on
PHP
# yum --enablerepo=remi info php # yum --enablerepo=remi install -y php php-devel php-mysql php-mbstring php-gd # vi /etc/php.ini ... error_log = /var/log/php.log (追加) mbstring.language = Japanese (コメントを外す) mbstring.internal_encoding = EUC-JP (コメントを外し、UTF-8 へ変更) mbstring.http_input = auto (コメントを外す) mbstring.detect_order = auto (コメントを外す) expose_php = On ( Off へ変更) date.timezone = (コメントを外し、Asia/Tokyo を設定) :wq ... # service httpd restart # php -v
MySQL
# yum --enablerepo=remi info mysql-server # yum --enablerepo=remi install -y mysql-server # vi /etc/my.cnf ... (4行目あたりに下の7行を追加) character_set_server=utf8 default-storage-engine=InnoDB innodb_file_per_table [mysql] default-character-set=utf8 [mysqldump] default-character-set=utf8 :wq ... # service mysqld start # /usr/bin/mysql_secure_installation ... - Enter current password for root (enter for none): [enter] - Set root password? [Y/n] Y New password: [***入力***] Re-enter new password: [***入力***] あとはデフォルトで[enter] ... # chkconfig mysqld on # mysql -u root -p ... Enter password: [***入力***] mysql> exit ...
Python
# python --version Python 2.6.6
Python Source Releases | Python.orgで最新のtgzファイルのリンクをコピーして
# wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz # tar xvzf Python-2.7.9.tgz # cd Python-2.7.9 # ./configure --enable-shared --with-threads # make # make install # cp libpython2.7.so libpython2.7.so.1.0 /usr/lib # /sbin/ldconfig # source ~/.bash_profile # python --version Python 2.7.9
Pythonの工程はかなり時間がかかった。勉強用ならv2.6.6のままでよかったんじゃね、と後から思ったが、ソースコードから入れるのはかなり面倒くさいということが体験できたので良し。