WordPressをインストール

ブログを WordPress を使用して立ち上げたいと思い、WordPress をインストールする一部始終を記録に残しておきましたので、参考にしてください。

1.phpインストール
[root ~]# yum install php.i386
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* addons: ftp.iij.ad.jp
* base: ftp.iij.ad.jp
* epel: ftp.riken.jp
* extras: ftp.iij.ad.jp
* rpmforge: ftp-stud.fht-esslingen.de
* updates: ftp.iij.ad.jp
3653 packages excluded due to repository priority protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php.i386 0:5.1.6-27.el5_5.3 set to be updated
--> Processing Dependency: php-common = 5.1.6-27.el5_5.3 for package: php
--> Processing Dependency: php-cli = 5.1.6-27.el5_5.3 for package: php
--> Processing Dependency: libgmp.so.3 for package: php
--> Running transaction check
---> Package gmp.i386 0:4.1.4-10.el5 set to be updated
---> Package php-cli.i386 0:5.1.6-27.el5_5.3 set to be updated
---> Package php-common.i386 0:5.1.6-27.el5_5.3 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==================================================
Package            Arch         Version                  Repository       Size
==================================================
Installing:
php                i386         5.1.6-27.el5_5.3         updates         2.3 M
Installing for dependencies:
gmp                i386         4.1.4-10.el5             base            664 k
php-cli            i386         5.1.6-27.el5_5.3         updates         2.1 M
php-common         i386         5.1.6-27.el5_5.3         updates         153 k

Transaction Summary
==================================================
Install       4 Package(s)
Upgrade       0 Package(s)

Total download size: 5.2 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): php-common-5.1.6-27.el5_5.3.i386.rpm              | 153 kB     00:00
(2/4): gmp-4.1.4-10.el5.i386.rpm                         | 664 kB     00:00
(3/4): php-cli-5.1.6-27.el5_5.3.i386.rpm                 | 2.1 MB     00:00
(4/4): php-5.1.6-27.el5_5.3.i386.rpm                     | 2.3 MB     00:00
--------------------------------------------------------------------------------
Total                                           3.9 MB/s | 5.2 MB     00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : php-common                                               1/4
Installing     : gmp                                                      2/4
Installing     : php-cli                                                  3/4
Installing     : php                                                      4/4

Installed:
php.i386 0:5.1.6-27.el5_5.3

Dependency Installed:
gmp.i386 0:4.1.4-10.el5                  php-cli.i386 0:5.1.6-27.el5_5.3
php-common.i386 0:5.1.6-27.el5_5.3

Complete!
2.Apache設定変更
2-1./etc/httpd/conf.d/php.confをInclude
2-2./etc/httpd/conf/httpd.confで下記をload
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so ←すでにload済みだった
LoadModule asis_module modules/mod_asis.so
2-3.index.php追記
DirectoryIndex index.html index.html.var index.php
3.php-mysqlインストール
[root ~]# yum install php-mysql.i386
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* addons: ftp.iij.ad.jp
* base: ftp.iij.ad.jp
* epel: ftp.riken.jp
* extras: ftp.iij.ad.jp
* rpmforge: ftp-stud.fht-esslingen.de
* updates: ftp.iij.ad.jp
3655 packages excluded due to repository priority protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-mysql.i386 0:5.1.6-27.el5_5.3 set to be updated
--> Processing Dependency: php-pdo for package: php-mysql
--> Running transaction check
---> Package php-pdo.i386 0:5.1.6-27.el5_5.3 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==================================================
Package           Arch         Version                   Repository       Size
==================================================
Installing:
php-mysql         i386         5.1.6-27.el5_5.3          updates          86 k
Installing for dependencies:
php-pdo           i386         5.1.6-27.el5_5.3          updates          65 k

Transaction Summary
==================================================
Install       2 Package(s)
Upgrade       0 Package(s)

Total download size: 151 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): php-pdo-5.1.6-27.el5_5.3.i386.rpm                 |  65 kB     00:00
(2/2): php-mysql-5.1.6-27.el5_5.3.i386.rpm               |  86 kB     00:00
--------------------------------------------------------------------------------
Total                                           1.1 MB/s | 151 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : php-pdo                                                  1/2
Installing     : php-mysql                                                2/2

Installed:
php-mysql.i386 0:5.1.6-27.el5_5.3

Dependency Installed:
php-pdo.i386 0:5.1.6-27.el5_5.3

Complete!
4./etc/php.ini変更

下記を追記
extension=mysql.so

5.install.phpアクセスでエラー表示

「お使いのサーバーの PHP では WordPress に必要な MySQL 拡張を利用できないようです。」
用意したデータベースwordpressに対するユーザwordpressのhostが%ではダメ。localhostに変更。

mysql> select host,user,password from user;
+-----------+-----------+-------------------------------------------+
| host      | user      | password                                  |
+-----------+-----------+-------------------------------------------+
| localhost | wordpress |*EC13F3D2A50CDD8B3E5D76514D5FD311E6276EA5  |
+-----------+-----------+-------------------------------------------+
6.WP Multibyte Patch有効化でエラー表示

「お使いの WP Multibyte Patch を有効にするには、PHP の mbstring 関数が必要です。」
対処は、php-mbstringをインストールすること。

[root ~]# yum install php-mbstring.i386
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* addons: ftp.iij.ad.jp
* base: ftp.iij.ad.jp
* epel: ftp.riken.jp
* extras: ftp.iij.ad.jp
* rpmforge: ftp-stud.fht-esslingen.de
* updates: ftp.iij.ad.jp
3655 packages excluded due to repository priority protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-mbstring.i386 0:5.1.6-27.el5_5.3 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==================================================
Package             Arch        Version                   Repository      Size
==================================================
Installing:
php-mbstring        i386        5.1.6-27.el5_5.3          updates        995 k

Transaction Summary
==================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 995 k
Is this ok [y/N]: y
Downloading Packages:
php-mbstring-5.1.6-27.el5_5.3.i386.rpm                   | 995 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : php-mbstring                                             1/1

Installed:
php-mbstring.i386 0:5.1.6-27.el5_5.3

Complete!
7.プラグイン更新やテーマインストール時のFTP接続設定

/opt/wordpress/wp-config.phpに下記を追記。

define('FS_METHOD', 'direct');
8.プラグイン更新やテーマインストールのための設定
[root ~]# mkdir /opt/wordpress/wp-content/upgrade
[root ~]# chown root:httpd実行グループ /opt/wordpress/wp-content/upgrade
[root ~]# chown root:httpd実行グループ /opt/wordpress/wp-content/plugins
[root ~]# chown root:httpd実行グループ /opt/wordpress/wp-content/themes
[root ~]# chmod 775 /opt/wordpress/wp-content/upgrade
[root ~]# chmod 775 /opt/wordpress/wp-content/plugins
[root ~]# chmod 775 /opt/wordpress/wp-content/themes

以上でバッチリ!

ちなみに、アクセスURLのパス部分に関するhttpd.conf等でのAlias設定などは、必要に応じて別途実施。

Comments are closed.