ブログ構築 WordPress
ブログサービスサービスを提供する。
WordPressはオープンソースで配布されており、Movable Typeと並んで高い人気を誇る。
目的
IE,FireFox等のWebブラウザから ブログサービスを提供可能とする。
http://192.168.0.10/wordpress/
構築条件
構築機器
- 仮想サーバ SUN VirtualBox 4.0 で構築
作成環境
OS | CentOS 6.0 64bit版 |
サーバ作成条件
サーバIP | 192.168.0.10/24 |
ホスト名 | hogehogeServer |
user | hogehoge |
userpasswd | hogehogepass |
mysqldb名 | mysql |
mysqluser名 | mysqluser |
mysqluserpasswd | mysqlpass |
作業ディレクトリ | /home/hogehoge |
手順記入ルール
- コマンド行頭記号で 「$」はユーザ権限 「#」はスーパーユーザー権限 を表示
- コマンドが長くなる場合は、行末に「\」を記述し複数行に記述。
ファイル入手
サイト
- WordPress 日本語ローカルサイト
http://ja.wordpress.org/
今回インストールしたファイル
- 今回は以下ファイルを入手
wordpress-3.2.1-ja.zip
http://ja.wordpress.org/wordpress-3.2.1-ja.zip
前準備
- CentOSインストール 実施
- yumリポジトリ設定 実施
- LAMPサーバ構築 実施
MySQLデータベース作成
(1)MySQL データベース作成
【telnet】
- スーパーユーザでログイン
$ su パスワード:
- MySQLでログイン
# mysql -u root -p
Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.1.52 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- 「wordpress」データベース作成
mysql> create database wordpress ;
Query OK, 1 row affected (0.03 sec)
- 「wordpress」ユーザ作成
mysql> grant all privileges on wordpress.* to wordpressuser@localhost identified by 'wordpresspass';
Query OK, 0 rows affected (0.00 sec)
- 終了
mysql> exit Bye
- データベース接続に問題が無いか確認
# mysql -u wordpressuser -pwordpresspass wordpress
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.1.52 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> exit Bye
インストール
【FTP】
(1) ファイル転送
【FTP】
ftp/wget等にて、ユーザエリア「/home/hogehoge」にwordpress-3.2.1-ja.zipをアップ
(2)インストール
- パッケージがあるか確認
# ls -l
-rw-rw-r-- 1 hogehoge hogehoge 4408804 11月 29 09:20 2011 wordpress-3.2.1-ja.zip
- パッケージを解凍
# unzip wordpress-3.2.1-ja.zip
Archive: wordpress-3.2.1-ja.zip creating: wordpress/ inflating: wordpress/wp-comments-post.php inflating: wordpress/wp-pass.php :
- 確認
# ls -l
drwxr-xr-x 5 root root 4096 7月 17 22:05 2011 wordpress -rw-rw-r-- 1 hogehoge hogehoge 4408804 11月 29 09:20 2011 wordpress-3.2.1-ja.zip
(3)wordpress ファイルをhtml直下にコピー
- ファイルコピー
# cp -R wordpress /var/www/html/
- コピー確認
# ls -l /var/www/html/
drwxr-xr-x 5 root root 4096 11月 29 09:25 2011 wordpress
- 所有者変更
# chown -R apache:apache /var/www/html/wordpress/
- 確認
# ls -l /var/www/html/
drwxr-xr-x 5 apache apache 4096 11月 29 09:25 2011 wordpress
設定
(1)wp-config.php ファイル設定
【telnet】
- configファイルをsampleからコピーして作成
# cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
- 確認
# ls -l /var/www/html/wordpress/
-rw-r--r-- 1 root root 4289 11月 29 09:28 2011 wp-config.php
- config編集
# vi /var/www/html/wordpress/wp-config.php
- DB名を上で作成した名前に変更
define('DB_NAME', 'database_name_here'); ↓ define('DB_NAME', 'wordpress');
- 作成したユーザ名に変更
define('DB_USER', 'username_here'); ↓ define('DB_USER', 'wordpressuser');
- 作成したパスワードに変更
define('DB_PASSWORD', 'password_here'); ↓ define('DB_PASSWORD', 'wordpresspass');
動作確認
【Web】
以下URLにアクセス
- http://192.168.0.10/wordpress/ → WordPress 設定画面が表示
Wordpress設定
- 設定例:以下のとおり設定する
サイトのタイトル hogehogeのブログ ユーザー名 hogehoge パスワード hogehogepass メールアドレス hogehoge@hogehoge.com
- 設定したユーザ名/パスワードでログイン
→ダッシュボード画面を表示
表示確認
【Web】
以下URLにアクセス
- http://192.168.0.10/wordpress/ → WordPress 画面が表示
遭遇したトラブル
http://192.168.0.10/wordpress/ にアクセスしても設定画面が出ない。
問題:
http://192.168.0.10/wordpress/ にアクセスしても設定画面が出ない。
原因:
「php-mbstring-~」インストール漏れ
★インストール後追加で読み込ませるが、漏れやすいので注意!
謝辞
テキスト作成に当たり、以下サイトを参考にさせて頂きました。ありがとうございます。
http://centossrv.com/wordpress.shtml
http://blog.cheki.net/archives/349
http://i-am.web777.net/2007/03/mysql_utf8.html