CentOSにLAMP環境をコピペで構築するメモ(PHP5.2バージョン)

NO IMAGE

久々に0からに近い環境構築なのでめもめも。((ソースインストールが嫌いなので基本yumだけで何とかします))

yum

centosはyum自体が古いので必ず最初に更新を
(省略)

PHP(5.2系)

utterramblingsを追加((モジュール追加時に必ず–enablerepo=utterramblingsが必要となる))

rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
vim /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

MySQLからインストール

yum -y --enablerepo=utterramblings install mysql mysql-server 

ようやくPHPのインストール

yum -y --enablerepo=utterramblings install php php-devel php-comon php-gd php-mbstring php-pdo php-mycrypt php-mysql php-ncurses php-xml

vim /etc/php.ini

自分で必須だと思うとこだけ

error_reporting = E_ALL & ~E_NOTICE
error_log = syslog

register_globals = Off
magic_quotes_gpc = Off

default_charset = "UTF-8"

[mbstring]
mbstring.language = Japanese
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.http_output = UTF-8
mbstring.encoding_translation = On
mbstring.detect_order = auto
mbstring.func_overload = 0

[Date]
date.timezone = Asia/Tokyo

再起動

service httpd restart

phpmyadmin

最新バージョンはここで探す
http://www.phpmyadmin.net/home_page/downloads.php

wget http://sourceforge.net/projects/phpmyadmin/files%2FphpMyAdmin%2F3.3.7%2FphpMyAdmin-3.3.7-all-languages.tar.gz
tar xvf phpMyAdmin-3.3.7-all-languages.tar.gz
mv phpMyAdmin-3.3.7-all-languages pma

MySQL

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# To enable the InnoDB Plugin, uncomment the 2 next lines
#ignore-builtin-innodb
#plugin-load=innodb=ha_innodb_plugin.so

# To enable InnoDB-related INFORMATION_SCHEMA tables
# Join the following options to above directive
  ;innodb_trx=ha_innodb_plugin.so
  ;innodb_locks=ha_innodb_plugin.so
  ;innodb_cmp=ha_innodb_plugin.so
  ;innodb_cmp_reset=ha_innodb_plugin.so
  ;innodb_cmpmem=ha_innodb_plugin.so
  ;innodb_cmpmem_reset=ha_innodb_plugin.so

old_passwords=1
default-character-set = utf8
skip-character-set-client-handshake #ec-cube文字化け対策

[mysql.server]
user=mysql
basedir=/var/lib
default-character-set = utf8

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
default-character-set = utf8

[mysql]
default-character-set = utf8

mysql起動

service mysqld start
chkconfig mysqld on

パスワードの設定

mysql -u root

mysql> set password for [email protected]=password('rootパスワード');
mysql> set password for [email protected]'hostname'=password('rootパスワード');
mysql> set password for [email protected]=password('rootパスワード');

ログイン方法

mysql -uroot -pパスワード

Subversion

yumデフォルトでinstallされるのは1.4系ですが何かと困るので1.6系をいれます((1.4系が入ってる場合はyum remove subversion))

yum install subversion --enablerepo=rpmforge