LoginSignup
3
3

More than 5 years have passed since last update.

CentOSにWordPressのインストール

Last updated at Posted at 2015-07-31

PHPとMySQLはインストール済み。

データベースの作成

WordPress用のデータベースとユーザを作成します。

mysql> create database データベース名;
mysql> grant all privileges on データベース名.* to ユーザー名@localhost identified by 'パスワード';
mysql> flush privileges;

WordPressのダウンロード

WordPressの最新版をダウンロードして解凍します。

# cd /var/www/html
# curl -LO http://ja.wordpress.org/latest-ja.tar.gz
# tar xvzf latest-ja.tar.gz

設定ファイルを作成

wp-config-sample.phpがひな形として用意されています。これをもとにwp-config.phpを作成します。

# cd wordpress
# cp wp-config-sample.php wp-config.php
# vi wp-config.php

設定したデータベース名、ユーザー名、パスワードに書き換えます。

wp-config.php
/** WordPress のためのデータベース名 */
define('DB_NAME', 'database_name_here');

/** MySQL データベースのユーザー名 */
define('DB_USER', 'username_here');

/** MySQL データベースのパスワード */
define('DB_PASSWORD', 'password_here');

セキュリティのためのキーを入力します。
https://api.wordpress.org/secret-key/1.1/salt/
にアクセスしてキーを取得できるので以下の部分を書き換えます。

wp-config.php
define('AUTH_KEY',         'put your unique phrase here');
define('SECURE_AUTH_KEY',  'put your unique phrase here');
define('LOGGED_IN_KEY',    'put your unique phrase here');
define('NONCE_KEY',        'put your unique phrase here');
define('AUTH_SALT',        'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT',   'put your unique phrase here');
define('NONCE_SALT',       'put your unique phrase here');

設定ファイルwp-config.phpは以上で設定完了です。

WordPressのインストール

ブラウザでWordPressを配置したアドレスにアクセスします。
初回は設定画面が現れるので入力していくとインストールは完了します。

パーマリンク設定

パーマリンクをカスタマイズするときはhttpd.confを設定します。

vi /etc/httpd/conf/httpd.conf

httpd.confファイルの末尾に以下を追加します。

httpd.conf
<Directory /var/www/html/wordpress>
    AllowOverride All
</Directory>

パーマリンク設定をしていないとURLが自動的に書き換えられずページが表示されないことがあります。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3