引き続き、MySQLとPHPのインストールを行う。
まぁ、毎度のことながら、魔法のコマンド  yum を使うんだけどね。

今回からインストール状況まで上げるのは長くなるので、要所だけ。

# yum -y install mysql-server
・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・
Total download size: 15 M
Downloading Packages:
(1/4): perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm            | 148 kB     00:00
(2/4): perl-DBI-1.52-2.el5.x86_64.rpm                    | 600 kB     00:00
(3/4): mysql-5.0.77-4.el5_5.3.x86_64.rpm                 | 4.8 MB     00:00
(4/4): mysql-server-5.0.77-4.el5_5.3.x86_64.rpm          | 9.8 MB     00:00
——————————————————————————–
Total                                            13 MB/s |  15 MB     00:01
・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・
Complete!
# yum list | grep mysql | grep install
mysql.x86_64                               5.0.77-4.el5_5.3            installed
mysql-server.x86_64                        5.0.77-4.el5_5.3            installed

で、MySQLの稼働させるための準備。

# cd /etc/
# cp -p my.cnf my.cnf.org
# cp /usr/share/mysql/my-small.cnf my.cnf

cp: overwrite `my.cnf’? y

# service mysqld start
Initializing MySQL database:  Installing MySQL system tables…
OK
Filling help tables…
OK
・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・
Support MySQL by buying support/licenses at http://shop.mysql.com
                                                           [  OK  ]
Starting MySQL:                                            [  OK  ]
# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.0.77 Source distribution

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

mysql> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| mysql              |
| test               |
+——————–+
3 rows in set (0.00 sec)
mysql> q

MySQLのrootのパスワードを設定して、ノンパスワードで入れないことを確認する。

# mysqladmin -u root password ‘*********’
# mysql -u root

ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 5
Server version: 5.0.77 Source distribution

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

mysql>

さらに不要なDatabaseとuserを削除。

mysql> drop database test;
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| mysql              |
+——————–+
2 rows in set (0.00 sec)

mysql> select user,host,password from mysql.user;
+——+———————–+——————————————-+
| user | host                  | password                                  |
+——+———————–+——————————————-+
| root | localhost             | ***************************************** |
| root | ********.sakura.ne.jp | ***************************************** |
| root | 127.0.0.1             |                                           |
|      | localhost             |                                           |
|      | ********.sakura.ne.jp |                                           |
+——+———————–+——————————————-+
5 rows in set (0.00 sec)

mysql> delete from mysql.user where password=”;
Query OK, 3 rows affected (0.00 sec)

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

mysql> select user,host,password from mysql.user;
+——+———————–+——————————————-+
| user | host                  | password                                  |
+——+———————–+——————————————-+
| root | localhost             | ***************************************** |
| root | ********.sakura.ne.jp | ***************************************** |
+——+———————–+——————————————-+
2 rows in set (0.00 sec)

mysql> q
Bye

MySQLを停止して、サーバの起動時に MySQLが起動するように設定。

# service mysqld stop
Stopping MySQL:                                            [  OK  ]

# chkconfig mysqld on
# chkconfig –list  mysqld

mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

MySQLの細かい設定については、別途行うことにして、続けてPHPのインストール。

# yum -y install php php-mysql php-mbstring php-mcrypt
・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・
Complete!
# php -v
PHP 5.1.6 (cli) (built: Mar 31 2010 02:39:17)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

むむ?現在のPHPの最新バージョンは確か5,2,14だったはず。
もしかして、updateが必要かと思い、updateを実行。

# yum update
・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・
Complete!
# php -v
PHP 5.1.6 (cli) (built: Mar 31 2010 02:39:17)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

やっぱりバージョンが変わんない。
ということは、最新版のPHPのインストールができないということだ。
便利な関数の中にはバージョンが5.2以降でないとダメなものがあるので、何とかバージョンアップしたい。
とはいえ、yum の便利さを実感しているので、わざわざ自前でコンパイルしてインストール、なんてことはやりたくはないのだ。
なので、Google先生の出番。
おお、やっぱり似たようなことをする人はいるものだ、ということであっさり解決。

# wget -q -O – http://www.atomicorp.com/installers/atomic.sh | sh
Atomic Archive installer, version 1.2
Configuring the [atomic] yum archive for this system

Installing the Atomic GPG key: OK
Downloading atomic-release-1.0-12.el5.art.noarch.rpm: OK

The Atomic Rocket Turtle archive has now been installed and configured for your system
The following channels are available:
  atomic          – [ACTIVATED] – contains the stable tree of ART packages
  atomic-testing  – [DISABLED]  – contains the testing tree of ART packages
  atomic-bleeding – [DISABLED]  – contains the development tree of ART packages

# yum update
・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・
Complete!
# php -v
PHP 5.2.14 (cli) (built: Aug 12 2010 16:03:48)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

見事にPHPのバージョンアップに成功。

ということで今日はここまで。

, ,
Trackback

no comment untill now

Add your comment now

*