MySQL5.7.6DMRが今月リリースされて、色々な機能追加や改善が施されているので、
DMRのうちに少しずつ検証してRCとGAに備えたいと思います。
とりあえず、本日は初期設定まで。

2015年3月現在
DRM

MySQL 5.7 Release Notes
http://dev.mysql.com/doc/relnotes/mysql/5.7/en/index.html

ダウンロードサイトからDMRをダウンロードしてきてあります。
mysql-5.7.6-m16-linux-glibc2.5-x86_64.tar.gz

[root@misc01 admin]# cd /usr/local/
[root@misc01 local]# ls -l
合計 545048
drwxr-xr-x. 2 root  root          6  6月 10  2014 bin
drwxr-xr-x. 2 root  root          6  6月 10  2014 etc
drwxr-xr-x. 2 root  root          6  6月 10  2014 games
drwxr-xr-x. 2 root  root          6  6月 10  2014 include
drwxr-xr-x. 2 root  root          6  6月 10  2014 lib
drwxr-xr-x. 2 root  root          6  6月 10  2014 lib64
drwxr-xr-x. 2 root  root          6  6月 10  2014 libexec
-rw-rw-r--. 1 admin admin 558127440  3月 28 06:49 mysql-5.7.6-m16-linux-glibc2.5-x86_64.tar.gz
drwxr-xr-x. 2 root  root          6  6月 10  2014 sbin
drwxr-xr-x. 5 root  root         46  3月 28 07:02 share
drwxr-xr-x. 2 root  root          6  6月 10  2014 src
[root@misc01 local]# 
[root@misc01 local]# tar xzvf mysql-5.7.6-m16-linux-glibc2.5-x86_64.tar.gz
[root@misc01 local]# groupadd mysql
[root@misc01 local]# useradd -r -g mysql mysql
[root@misc01 local]# ls -l
合計 545052
drwxr-xr-x.  2 root  root          6  6月 10  2014 bin
drwxr-xr-x.  2 root  root          6  6月 10  2014 etc
drwxr-xr-x.  2 root  root          6  6月 10  2014 games
drwxr-xr-x.  2 root  root          6  6月 10  2014 include
drwxr-xr-x.  2 root  root          6  6月 10  2014 lib
drwxr-xr-x.  2 root  root          6  6月 10  2014 lib64
drwxr-xr-x.  2 root  root          6  6月 10  2014 libexec
drwxr-xr-x. 11 root  root       4096  3月 28 08:30 mysql-5.7.6-m16-linux-glibc2.5-x86_64
-rw-rw-r--.  1 admin admin 558127440  3月 28 06:49 mysql-5.7.6-m16-linux-glibc2.5-x86_64.tar.gz
drwxr-xr-x.  2 root  root          6  6月 10  2014 sbin
drwxr-xr-x.  5 root  root         46  3月 28 07:02 share
drwxr-xr-x.  2 root  root          6  6月 10  2014 src
[root@misc01 local]# ln -s mysql-5.7.6-m16-linux-glibc2.5-x86_64 mysql
[root@misc01 local]# ls -l
合計 545052
drwxr-xr-x.  2 root  root          6  6月 10  2014 bin
drwxr-xr-x.  2 root  root          6  6月 10  2014 etc
drwxr-xr-x.  2 root  root          6  6月 10  2014 games
drwxr-xr-x.  2 root  root          6  6月 10  2014 include
drwxr-xr-x.  2 root  root          6  6月 10  2014 lib
drwxr-xr-x.  2 root  root          6  6月 10  2014 lib64
drwxr-xr-x.  2 root  root          6  6月 10  2014 libexec
lrwxrwxrwx.  1 root  root         37  3月 28 08:32 mysql -> mysql-5.7.6-m16-linux-glibc2.5-x86_64
drwxr-xr-x. 11 root  root       4096  3月 28 08:30 mysql-5.7.6-m16-linux-glibc2.5-x86_64
-rw-rw-r--.  1 admin admin 558127440  3月 28 06:49 mysql-5.7.6-m16-linux-glibc2.5-x86_64.tar.gz
drwxr-xr-x.  2 root  root          6  6月 10  2014 sbin
drwxr-xr-x.  5 root  root         46  3月 28 07:02 share
drwxr-xr-x.  2 root  root          6  6月 10  2014 src
[root@misc01 local]# 

展開して初期DBを設定します
5.7以降で設定方法が変わっていたのを忘れていました… 詳細は此方をご確認ください。
2.9.1.1 Initializing the Data Directory Using mysqld
http://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html
4.4.2 mysql_install_db — Initialize MySQL Data Directory
http://dev.mysql.com/doc/refman/5.7/en/mysql-install-db.html

初期root用のpasswordもこちらでランダムに作成されています。
初回ログイン時に変更してしまいましょう。

[root@misc01 local]# cd mysql
[root@misc01 mysql]# chown -R mysql .
[root@misc01 mysql]# chgrp -R mysql .
[root@misc01 mysql]# scripts/mysql_install_db --user=mysql
bash: scripts/mysql_install_db: そのようなファイルやディレクトリはありません
[root@misc01 mysql]# bin/mysqld --initialize --user=mysql
2015-03-27T23:40:52.379590Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-03-27T23:40:53.301410Z 0 [Warning] InnoDB: New log files created, LSN=45790
2015-03-27T23:40:53.421318Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-03-27T23:40:53.487611Z 0 [Warning] Failed to setup SSL
2015-03-27T23:40:53.487667Z 0 [Warning] SSL error: SSL context is not usable without certificate and private key
2015-03-27T23:40:53.490120Z 1 [Warning] A temporary password is generated for root@localhost: Bfd,psIvR4*e
[root@misc01 mysql]# chown -R root .
[root@misc01 mysql]# chown -R mysql data

初期設定が終わったので、起動してログインしてみます。

[root@misc01 mysql]# bin/mysqld_safe --user=mysql &
[1] 4910
[root@misc01 mysql]# 150328 08:51:25 mysqld_safe Logging to '/usr/local/mysql/data/misc01.err'.
150328 08:51:25 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

[root@misc01 mysql]#

[root@misc01 mysql]# ./bin/mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.6-m16

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 5.7.6-m16 |
+-----------+
1 row in set (0.01 sec)

mysql> 
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[root@misc01 mysql]# 

[root@misc01 mysql]# ps -ef | grep mysql
root      4910  1883  0 08:51 pts/0    00:00:00 /bin/sh bin/mysqld_safe --user=mysql
mysql     4992  4910  0 08:51 pts/0    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/misc01.err --pid-file=/usr/local/mysql/data/misc01.pid
root      5024  1883  0 08:56 pts/0    00:00:00 grep --color=auto mysql
[root@misc01 mysql]# kill 4992
[root@misc01 mysql]# 150328 08:56:32 mysqld_safe mysqld from pid file /usr/local/mysql/data/misc01.pid ended

[1]+  終了                  bin/mysqld_safe --user=mysql
[root@misc01 mysql]# ps -ef | grep mysql
root      5030  1883  0 08:56 pts/0    00:00:00 grep --color=auto mysql
[root@misc01 mysql]# 

起動ファイルのBASE, DATAディレクトリーを記入してファイルをコピー

[root@misc01 support-files]# pwd
/usr/local/mysql/support-files
[root@misc01 support-files]# vi mysql.server 
[root@misc01 support-files]# cp -p mysql.server /etc/init.d/
[root@misc01 support-files]# /etc/init.d/mysql.server start
Starting MySQL. SUCCESS! 
[root@misc01 support-files]#

MySQLにroot以外の追加の管理者アカウントを追加してみます。
GRANTでアカウントを作成するのはやめて、CREATE USERで作成した方が良いですね。

[root@misc01 support-files]# /usr/local/mysql/bin/mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.6-m16 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> GRANT ALL PRIVILEGES  ON *.* TO admin@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+------------------------------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                                            |
+---------+------+------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1287 | Using GRANT for creating new user is deprecated and will be removed in future release. Create new user with CREATE USER statement. |
+---------+------+------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

5.7からは、mysql.userテーブルからpasswordという列が無くなってますね。

mysql> select user,host,password from mysql.user;
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql> select user,host,authentication_string from mysql.user;
+-------+-----------+-------------------------------------------+
| user  | host      | authentication_string                     |
+-------+-----------+-------------------------------------------+
| root  | localhost | *A41ECFBE1191DDE4713F2B6F5A6CD5D0D0D5DC35 |
| admin | %         | *A41ECFBE1191DDE4713F2B6F5A6CD5D0D0D5DC35 |
+-------+-----------+-------------------------------------------+
2 rows in set (0.00 sec)

mysql> 

その他、アカウントのパスワード期限など、コンプライアンス対応に使えそうなフィールドが増えています。
update

※ CentOSなどでは,MariaDBさんの/etc/my.cnfがあるので初期設定時にエラーになったりするので初期設定時に削除しています。
  ここら辺、名前が被らない方がユーザー的には有難いです。


APACHEとPHPのアップグレード
Apache HTTP Server 2.4.3が出ていたので,Apacheのアップグレード対応しようと思いましたが、
2.2.xxの方が安定してそうだったので2.2.22でアップグレード。
——————–

[root@aws bin]# /usr/local/apache2/bin/httpd -v
Server version: Apache/2.2.22 (Unix)
Server built:   Sep  8 2012 22:42:21
[root@aws bin]# /usr/local/bin/php -v
PHP 5.4.6 (cli) (built: Sep  9 2012 00:34:45)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
[root@aws bin]#

—————————————————————
apacheインストール
Apache HTTP Server 2.2.22 (httpd)
http://httpd.apache.org/download.cgi#apache24
—————————————————————

apacheのダウンロード

[root@aws src]# <code>wget http://ftp.kddilabs.jp/infosystems/apache//httpd/httpd-2.2.22.tar.gz
--2012-09-08 22:33:01--  http://ftp.kddilabs.jp/infosystems/apache//httpd/httpd-2.2.22.tar.gz
Resolving ftp.kddilabs.jp... 192.26.91.193, 2001:200:601:10:206:5bff:fef0:466c
Connecting to ftp.kddilabs.jp|192.26.91.193|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7200529 (6.9M) [application/x-gzip]
Saving to: “httpd-2.2.22.tar.gz”

100%[=========================================================>] 7,200,529   3.59M/s   in 1.9s

2012-09-08 22:33:03 (3.59 MB/s) - “httpd-2.2.22.tar.gz” saved [7200529/7200529]
</code>
[root@aws src]#


[root@aws src]# ls -l
total 377160
-rw-r--r-- 1 root     root       7200529 Jan 30  2012 httpd-2.2.22.tar.gz
-rw-r--r-- 1 root     root       6137268 Aug 20 13:22 httpd-2.4.3.tar.gz
-rw-rw-r-- 1 ec2-user ec2-user 186355822 Jul  6 23:07 mysql-5.5.25a-linux2.6-x86_64.tar.gz
-rw-rw-r-- 1 ec2-user ec2-user 186504948 Aug 26 11:37 mysql-5.5.27-linux2.6-x86_64.tar.gz
[root@aws src]#


<strong>apache tarの展開</strong>
[root@aws src]# tar xzvf httpd-2.2.22.tar.gz
httpd-2.2.22/
httpd-2.2.22/emacs-style
httpd-2.2.22/httpd.dsp
httpd-2.2.22/libhttpd.dsp
httpd-2.2.22/.deps
httpd-2.2.22/Makefile.in
httpd-2.2.22/include/
httpd-2.2.22/include/scoreboard.h
httpd-2.2.22/include/ap_regkey.h
httpd-2.2.22/include/ap_compat.h
httpd-2.2.22/include/http_config.h
httpd-2.2.22/include/util_time.h
httpd-2.2.22/include/ap_mmn.h

[省略]

httpd-2.2.22/libhttpd.dep
httpd-2.2.22/configure.in
httpd-2.2.22/VERSIONING
httpd-2.2.22/README
httpd-2.2.22/LAYOUT
httpd-2.2.22/buildconf
httpd-2.2.22/.gdbinit
[root@aws src]#


[root@aws src]# ls -l
total 377164
drwxr-xr-x 11      500 ec2-user      4096 Jan 25  2012 httpd-2.2.22
-rw-r--r--  1 root     root       7200529 Jan 30  2012 httpd-2.2.22.tar.gz
-rw-r--r--  1 root     root       6137268 Aug 20 13:22 httpd-2.4.3.tar.gz
-rw-rw-r--  1 ec2-user ec2-user 186355822 Jul  6 23:07 mysql-5.5.25a-linux2.6-x86_64.tar.gz
-rw-rw-r--  1 ec2-user ec2-user 186504948 Aug 26 11:37 mysql-5.5.27-linux2.6-x86_64.tar.gz
[root@aws src]#

展開したApacheのconfigureとmake

[root@aws src]# cd httpd-2.2.22
[root@aws httpd-2.2.22]# pwd
/usr/local/src/httpd-2.2.22
[root@aws httpd-2.2.22]#

—————————————————————
■基本コンフィグでconfigureを実行
—————————————————————

<code>
./configure \
--enable-rewrite --enable-expires --enable-so \
--prefix=/usr/local/httpd-2_2_22
</code>

—————————————————————

[root@aws httpd-2.2.22]# ./configure \
> --enable-rewrite --enable-expires --enable-so \
> --prefix=/usr/local/httpd-2_2_22
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
Configuring Apache Portable Runtime library ...

checking for APR... yes
  setting CC to "gcc"
  setting CPP to "gcc -E"
  setting CFLAGS to "  -pthread"
  setting CPPFLAGS to " -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE"
  setting LDFLAGS to " "

Configuring Apache Portable Runtime Utility library...

checking for APR-util... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no

[省略]

config.status: creating docs/conf/extra/httpd-vhosts.conf
config.status: creating include/ap_config_layout.h
config.status: creating support/apxs
config.status: creating support/apachectl
config.status: creating support/dbmmanage
config.status: creating support/envvars-std
config.status: creating support/log_server_status
config.status: creating support/logresolve.pl
config.status: creating support/phf_abuse_log.cgi
config.status: creating support/split-logfile
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
[root@aws httpd-2.2.22]#

[root@aws httpd-2.2.22]# make
Making all in srclib
make[1]: Entering directory `/usr/local/src/httpd-2.2.22/srclib'
Making all in pcre
make[2]: Entering directory `/usr/local/src/httpd-2.2.22/srclib/pcre'
make[3]: Entering directory `/usr/local/src/httpd-2.2.22/srclib/pcre'

[省略]

make[1]: Leaving directory `/usr/local/src/httpd-2.2.22'
[root@aws httpd-2.2.22]#


[root@aws httpd-2.2.22]# ls -l /usr/local/
total 48
drwxr-xr-x  2 root  root  4096 May 27 09:00 bin
drwxr-xr-x  2 root  root  4096 Jan  6  2012 etc
drwxr-xr-x  2 root  root  4096 Jan  6  2012 games
drwxr-xr-x  3 root  root  4096 May 27 09:00 include
drwxr-xr-x  2 root  root  4096 May 26 23:12 lib
drwxr-xr-x  3 root  root  4096 Mar 24 17:06 lib64
drwxr-xr-x  2 root  root  4096 Jan  6  2012 libexec
lrwxrwxrwx  1 root  root    39 Aug 26 12:09 mysql -> /usr/local/mysql-5.5.27-linux2.6-x86_64
drwxrwxr-x 13 mysql mysql 4096 Jul  7 04:44 mysql-5.5.25a-linux2.6-x86_64
drwxr-xr-x 14 mysql mysql 4096 Aug 26 12:09 mysql-5.5.27-linux2.6-x86_64
drwxr-xr-x  2 root  root  4096 Jan  6  2012 sbin
drwxr-xr-x  6 root  root  4096 Mar 24 17:06 share
drwxr-xr-x  3 root  root  4096 Sep  8 22:35 src
[root@aws httpd-2.2.22]# 


[root@aws httpd-2.2.22]# make install
Making install in srclib
make[1]: Entering directory `/usr/local/src/httpd-2.2.22/srclib'
Making install in pcre
make[2]: Entering directory `/usr/local/src/httpd-2.2.22/srclib/pcre'
make[3]: Entering directory `/usr/local/src/httpd-2.2.22/srclib/pcre'
make[3]: Leaving directory `/usr/local/src/httpd-2.2.22/srclib/pcre'
make[2]: Leaving directory `/usr/local/src/httpd-2.2.22/srclib/pcre'
make[2]: Entering directory `/usr/local/src/httpd-2.2.22/srclib'
make[2]: Leaving directory `/usr/local/src/httpd-2.2.22/srclib'
make[1]: Leaving directory `/usr/local/src/httpd-2.2.22/srclib'

[省略]

mkdir /usr/local/httpd-2_2_22/build
Installing man pages and online manual
mkdir /usr/local/httpd-2_2_22/man
mkdir /usr/local/httpd-2_2_22/man/man1
mkdir /usr/local/httpd-2_2_22/man/man8
mkdir /usr/local/httpd-2_2_22/manual
make[1]: Leaving directory `/usr/local/src/httpd-2.2.22'
[root@aws httpd-2.2.22]# 



[root@aws httpd-2.2.22]# ls -l /usr/local/
total 52
drwxr-xr-x  2 root  root  4096 May 27 09:00 bin
drwxr-xr-x  2 root  root  4096 Jan  6  2012 etc
drwxr-xr-x  2 root  root  4096 Jan  6  2012 games
drwxr-xr-x 14 root  root  4096 Sep  8 22:44 httpd-2_2_22
drwxr-xr-x  3 root  root  4096 May 27 09:00 include
drwxr-xr-x  2 root  root  4096 May 26 23:12 lib
drwxr-xr-x  3 root  root  4096 Mar 24 17:06 lib64
drwxr-xr-x  2 root  root  4096 Jan  6  2012 libexec
lrwxrwxrwx  1 root  root    39 Aug 26 12:09 mysql -> /usr/local/mysql-5.5.27-linux2.6-x86_64
drwxrwxr-x 13 mysql mysql 4096 Jul  7 04:44 mysql-5.5.25a-linux2.6-x86_64
drwxr-xr-x 14 mysql mysql 4096 Aug 26 12:09 mysql-5.5.27-linux2.6-x86_64
drwxr-xr-x  2 root  root  4096 Jan  6  2012 sbin
drwxr-xr-x  6 root  root  4096 Mar 24 17:06 share
drwxr-xr-x  3 root  root  4096 Sep  8 22:35 src
[root@aws httpd-2.2.22]#

インストール後にシンボリックリンク作成
後でバージョンアップや切戻しを楽にするた為。

[root@aws local]# ln -s /usr/local/httpd-2_2_22 /usr/local/apache2
[root@aws local]# ls -l
total 52
lrwxrwxrwx  1 root  root    23 Sep  8 22:47 apache2 -> /usr/local/httpd-2_2_22
drwxr-xr-x  2 root  root  4096 May 27 09:00 bin
drwxr-xr-x  2 root  root  4096 Jan  6  2012 etc
drwxr-xr-x  2 root  root  4096 Jan  6  2012 games
drwxr-xr-x 14 root  root  4096 Sep  8 22:44 httpd-2_2_22
drwxr-xr-x  3 root  root  4096 May 27 09:00 include
drwxr-xr-x  2 root  root  4096 May 26 23:12 lib
drwxr-xr-x  3 root  root  4096 Mar 24 17:06 lib64
drwxr-xr-x  2 root  root  4096 Jan  6  2012 libexec
lrwxrwxrwx  1 root  root    39 Aug 26 12:09 mysql -> /usr/local/mysql-5.5.27-linux2.6-x86_64
drwxrwxr-x 13 mysql mysql 4096 Jul  7 04:44 mysql-5.5.25a-linux2.6-x86_64
drwxr-xr-x 14 mysql mysql 4096 Aug 26 12:09 mysql-5.5.27-linux2.6-x86_64
drwxr-xr-x  2 root  root  4096 Jan  6  2012 sbin
drwxr-xr-x  6 root  root  4096 Mar 24 17:06 share
drwxr-xr-x  3 root  root  4096 Sep  8 22:35 src
[root@aws local]#

symbolic

アカウントは既に作成済み

[root@aws local]# cat /etc/passwd | grep apache2
apache:x:558:558:Apache:/usr/local/apache2:/sbin/nologin
[root@aws local]#

※フォルダー権限等も既に設定済み。

init.dの変更・作成

----------------------------------------------------------------------------------------
[root@aws local]# vi /etc/init.d/httpd2
[root@aws local]# chmod 755 /etc/init.d/httpd2
----------------------------------------------------------------------------------------
[BASH]
#!/bin/bash
#
# Startup script for Apache Web Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server. It is used to serve \
#     HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/usr/bin:/bin
CMDPATH=/usr/local/apache2/bin/
CMD=apachectl

test -f $CMDPATH$CMD || exit 0

start()
{
    echo -n "Starting httpd ... "
    $CMDPATH$CMD start
    echo "done."
}

stop()
{
    echo -n "Stopping httpd ... "
    $CMDPATH$CMD stop
    echo "done."
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart|force-reload)
        stop
        sleep 2
        start
        ;;
    *)
        echo "Usage: /etc/rc.d/init.d/rc.httpd2 {start|stop|restart}"
        exit 1
        ;;
esac

exit 0
[/BASH]
----------------------------------------------------------------------------------------

[root@aws local]# ls -l /etc/init.d/httpd2
-rwxr-xr-x 1 root root 870 Sep  8 23:00 /etc/init.d/httpd2
[root@aws local]#

<strong>OS起動時の自動起動設定</strong>
[root@aws local]# /sbin/chkconfig httpd2 on
[root@aws local]# /sbin/chkconfig --list httpd2
httpd2          0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@aws local]#

PHPインストール・バージョンアップ
—————————————————————————————-
■PHPインストール php-5.4.6.tar.gz 13,964,954 bytes
http://jp.php.net/get/php-5.4.6.tar.gz/from/a/mirror
—————————————————————————————-

 <code>./configure \
--prefix=/usr/local/php-5.4.6 --with-config-file-path=/etc \
--with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql \
--enable-sockets</code>

—————————————————————————————-

[root@aws php-5.4.6]#  ./configure \
> --prefix=/usr/local/php-5.4.6 --with-config-file-path=/etc \
> --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql \
> --enable-sockets
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for cc... cc

[省略]

Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating main/php_config.h
config.status: executing default commands
[root@aws php-5.4.6]#

メモ:PHPインストール時にエラーが出たので依存関係解決
—————————————————————————————-
[root@aws php-5.4.6]# yum install libxml2
[root@aws php-5.4.6]# yum install libxml2-devel
—————————————————————————————-

[root@aws php-5.4.6]# make install
Installing PHP SAPI module:       apache2handler
/usr/local/httpd-2_2_22/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' libphp5.la /usr/local/httpd-2_2_22/modules
/usr/lib64/apr-1/build/libtool --mode=install cp libphp5.la /usr/local/httpd-2_2_22/modules/
libtool: install: cp .libs/libphp5.so /usr/local/httpd-2_2_22/modules/libphp5.so
libtool: install: cp .libs/libphp5.lai /usr/local/httpd-2_2_22/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /usr/local/src/php-5.4.6/libs'
chmod 755 /usr/local/httpd-2_2_22/modules/libphp5.so
[activating module `php5' in /usr/local/httpd-2_2_22/conf/httpd.conf]
Installing PHP CLI binary:        /usr/local/php-5.4.6/bin/
Installing PHP CLI man page:      /usr/local/php-5.4.6/php/man/man1/
Installing PHP CGI binary:        /usr/local/php-5.4.6/bin/
Installing build environment:     /usr/local/php-5.4.6/lib/php/build/
Installing header files:          /usr/local/php-5.4.6/include/php/
Installing helper programs:       /usr/local/php-5.4.6/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php-5.4.6/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php-5.4.6/lib/php/
[PEAR] Archive_Tar    - installed: 1.3.7
[PEAR] Console_Getopt - installed: 1.3.0
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util       - installed: 1.2.1
[PEAR] PEAR           - installed: 1.9.4

/usr/local/src/php-5.4.6/build/shtool install -c ext/phar/phar.phar /usr/local/php-5.4.6/bin
ln -s -f /usr/local/php-5.4.6/bin/phar.phar /usr/local/php-5.4.6/bin/phar
Installing PDO headers:          /usr/local/php-5.4.6/include/php/ext/pdo/
[root@aws php-5.4.6]#

[root@aws local]# <code>ln -sfn /usr/local/php-5.4.6/bin/php /usr/local/bin/php</code>
[root@aws local]# <code>ln -sfn /usr/local/php-5.4.6/bin/php-config /usr/local/bin/php-config</code>
[root@aws local]# <code>ln -sfn /usr/local/php-5.4.6/bin/phpize /usr/local/bin/phpize</code>
[root@aws local]# <code>ln -sfn /usr/local/php-5.4.6/lib/php /usr/local/lib/php</code>

<a href="http://variable.jp/wp-content/uploads/2012/09/php-symbolic.jpg"><img src="http://variable.jp/wp-content/uploads/2012/09/php-symbolic.jpg" alt="PHP" title="php-symbolic" width="633" height="256" /></a>


<strong>php.iniの設定変更(セキュリティ・MYSQL Socket調整)</strong>
[root@aws local]# cp -rp /usr/local/src/php-5.4.6/php.ini-production /etc/php.ini
[root@aws local]# vi /etc/php.ini
[root@aws local]# cat /etc/php.ini | egrep -i "expose_php|mysql.default_socket"
; expose_php = On
expose_php = Off
pdo_mysql.default_socket=
;mysql.default_socket =
mysql.default_socket = /usr/local/mysql/data/mysql.sock
[root@aws local]#

—————————————————————————————-
PHP設定メモ:
—————————————————————————————-
register_globals
http://php.net/manual/ja/ini.core.php
この機能は PHP 5.3.0 で 非推奨となり、 PHP 5.4.0 で削除されました。
register_globals は、 variables_order ディレクティブの影響を受けます。
—————————————————————————————-

—————————————————————————————-
LoadModules,Rewriteを利用する為にFollowSymLinksとAllowOverrideを設定
—————————————————————————————-

[root@aws conf]# cat httpd.conf | egrep -i "php|Options"
LoadModule php5_module modules/libphp5.so
    # Options Indexes FollowSymLinks
    Options FollowSymLinks
    DirectoryIndex index.php
    AddType application/x-httpd-php .php
[root@aws conf]#


[root@aws local]# /etc/init.d/httpd2 restart
Stopping httpd ... done.
Starting httpd ... done.
[root@aws local]#

MYSQLインストール直後のアカウント初期設定

基本的ですが、MYSQLサービスはrootでは動かさない。
MYSQLサーバー用 専用アカウントの作成

[mysql@colinux local]$ /etc/init.d/mysql.server start
Starting MySQL… SUCCESS!
[mysql@colinux local]$ ps -ef | grep mysql
root 2649 2623 0 12:17 tty1 00:00:00 su - mysql
mysql 2658 2649 0 12:17 tty1 00:00:00 -bash
mysql 2693 1 0 12:18 tty1 00:00:00 /bin/sh ./bin/mysqld_safe
--datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/colinux.pid
mysql 2821 2693 9 12:18 tty1 00:00:02 /usr/local/mysql/bin/mysqld
--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
--log-error=/usr/local/mysql/data/colinux.err
--pid-file=/usr/local/mysql/data/colinux.pid
--socket=/tmp/mysql.sock --port=3306
mysql 2836 2658 0 12:18 tty1 00:00:00 ps -ef
mysql 2837 2658 0 12:18 tty1 00:00:00 grep mysql

[mysql@colinux local]$

—————– my.cnf ———————
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
user = mysql
skip-locking
key_buffer = 16K

mysqlインストール初期状態でまずはパスワードを設定して不要なアカウントを削除

[mysql@colinux local]$ mysql -u root mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.30-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> update user set password = PASSWORD('password2009')
-> where user ='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0

mysql> delete from user where user = 'root' and host ='%';
Query OK, 0 rows affected (0.01 sec)

mysql> delete from user where user ='';
Query OK, 0 rows affected (0.00 sec)

mysql> delete from db where user ='';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql>

init_secure

パスワードの付いていないアカウントがないかダブルチェック

mysql> select user,host,password from user
-> where user = '' or password = '';
Empty set (0.00 sec)

mysql>

今後の為に、パスワードの付いてないアカウントが作成されないように制限する


mysql> select @@global.sql_mode;
+-------------------+
| @@global.sql_mode |
+-------------------+
| |
+-------------------+
1 row in set (0.00 sec)

mysql> set global sql_mode = 'NO_AUTO_CREATE_USER';
Query OK, 0 rows affected (0.00 sec)

mysql> select @@global.sql_mode;
+---------------------+
| @@global.sql_mode |
+---------------------+
| NO_AUTO_CREATE_USER |
+---------------------+
1 row in set (0.00 sec)

mysql>

no_auto_create_user

[mysql@colinux local]$ mysql -u root mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.30-log MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> select @@global.sql_mode;
+---------------------+
| @@global.sql_mode |
+---------------------+
| NO_AUTO_CREATE_USER |
+---------------------+
1 row in set (0.00 sec)

mysql> GRANT select,insert,update,delete on DB001.* to 'no_password_user';
ERROR 1133 (42000): Can't find any matching row in the user table
mysql>

上記の”NO_AUTO_CREATE_USER”モードはMYSQLサーバーを再起動したら消えます。

mysql> select @@global.sql_mode;
+-------------------+
| @@global.sql_mode |
+-------------------+
| |
+-------------------+
1 row in set (0.01 sec)

mysql>

そこでmy.cnfに”sql_mode”の設定を行い再起動しても設定が消えないようにします。

—————————————————————–
抜粋
—————————————————————–
[mysqld]
port = 3306
socket = /tmp/mysql.sock
user = mysql
skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
default-character-set=utf8
sql_mode =”NO_AUTO_CREATE_USER”
—————————————————————–

上記の設定を行い、mysqlを再起動すればパスワードの無いユーザーは
作成出来なくなります。後はルールとして周知すればOK。

sql_mode