必要なパッケージのインストール

sudo yum install httpd
sudo yum install php php-mysql
sudo yum install mariadb mariadb-server
sudo yum install wget

httpdの準備

httpdを起動する。

sudo systemctl start httpd
sudo systemctl enable httpd

MariaDBの準備

MariaDBの起動

$ sudo systemctl start mariadb
$ sudo systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

データベースとユーザの作成

$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress.* TO wordpress@localhost IDENTIFIED BY "wordpressユーザに設定するパスワード";
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> EXIT
Bye

WordPressの準備

WordPress の配置

WordPress をダウンロードする。

$ cd /var/www/

$ sudo wget https://ja.wordpress.org/latest-ja.tar.gz
--2017-10-08 16:53:48--  https://ja.wordpress.org/latest-ja.tar.gz
Resolving ja.wordpress.org (ja.wordpress.org)... 66.155.40.250, 66.155.40.249
Connecting to ja.wordpress.org (ja.wordpress.org)|66.155.40.250|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8652714 (8.3M) [application/octet-stream]
Saving to: 'latest-ja.tar.gz'

100%[================================================>] 8,652,714   3.63MB/s   in 2.3s

2017-10-08 16:53:51 (3.63 MB/s) - 'latest-ja.tar.gz' saved [8652714/8652714]

$ ls
cgi-bin  html  latest-ja.tar.gz

解凍する。

$ sudo tar xvfz latest-ja.tar.gz
$ sudo rm latest-ja.tar.gz
$ ll
total 4
drwxr-xr-x. 2 root   root     6 Aug 23 11:48 cgi-bin
drwxr-xr-x. 2 root   root     6 Oct  8 16:53 html
drwxr-xr-x. 5 nobody 65534 4096 Aug  7 06:05 wordpress

所有者の変更

wordpress ディレクトリ以下の所有者とグループを apache に変更する。

$ sudo chown -R apache.apache wordpress/
$ ll
total 4
drwxr-xr-x. 2 root   root      6 Aug 23 11:48 cgi-bin
drwxr-xr-x. 2 root   root      6 Oct  8 16:53 html
drwxr-xr-x. 5 apache apache 4096 Aug  7 06:05 wordpress
$ ll wordpress/
total 188
-rw-r--r--.  1 apache apache   418 Sep 24  2013 index.php
-rw-r--r--.  1 apache apache 19935 Jan  2  2017 license.txt
-rw-r--r--.  1 apache apache 10303 Aug  7 06:05 readme.html
-rw-r--r--.  1 apache apache  5447 Sep 27  2016 wp-activate.php
drwxr-xr-x.  9 apache apache  4096 Aug  7 06:05 wp-admin
-rw-r--r--.  1 apache apache   364 Dec 19  2015 wp-blog-header.php
-rw-r--r--.  1 apache apache  1627 Aug 29  2016 wp-comments-post.php
-rw-r--r--.  1 apache apache  3886 Aug  7 06:05 wp-config-sample.php
drwxr-xr-x.  5 apache apache    65 Aug  7 06:05 wp-content
-rw-r--r--.  1 apache apache  3286 May 24  2015 wp-cron.php
drwxr-xr-x. 18 apache apache  8192 Aug  7 06:05 wp-includes
-rw-r--r--.  1 apache apache  2422 Nov 20  2016 wp-links-opml.php
-rw-r--r--.  1 apache apache  3301 Oct 24  2016 wp-load.php
-rw-r--r--.  1 apache apache 34327 May 12 13:12 wp-login.php
-rw-r--r--.  1 apache apache  8048 Jan 11  2017 wp-mail.php
-rw-r--r--.  1 apache apache 16200 Apr  6  2017 wp-settings.php
-rw-r--r--.  1 apache apache 29924 Jan 24  2017 wp-signup.php
-rw-r--r--.  1 apache apache  4513 Oct 14  2016 wp-trackback.php
-rw-r--r--.  1 apache apache  3065 Aug 31  2016 xmlrpc.php

WordPress の設定

WordPress の設定ファイルを作成し、データベースを設定する。

$ sudo cp wp-config-sample.php wp-config.php
$ sudo vim wp-config.php

/** WordPress のためのデータベース名 */
define('DB_NAME', 'wordpress');

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

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

'put your unique phrase here' のとこにそれぞれランダムな値を入力する。

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');

define('AUTH_KEY',         'Shei>gh7see,W=o8Ew}aeC0ioSh.oo9pTae2fah:Lie3eGa-cae3ooH>ang.iaF');
define('SECURE_AUTH_KEY',  'coh5ahM%Biek?ie4dae8oaS>AiSh#e1yohy7aiF-ieS}eip7iej5ieP{uCh?ei7');
...

ランダムな値は、CentOSでは mkpasswd コマンドで作成することが出来る。

$ sudo yum install expect
$ mkpasswd
Um@As6sk0
$ mkpasswd -l 64 -d 16 -c 16 -C 16 -s 16
OZ*rS<Sy8fff1PcIL0\7D9~~pPcA4{lZ10u]S=6cfr6U>BA7Ar[\{{$39160n%;s

[オプション]
-l パスワードの文字数指定
-d パスワードに含まれる数字の最低数指定
-c パスワードに含まれる小文字の最低数指定
-C パスワードに含まれる大文字の最低数指定
-s パスワードに含まれる特殊文字の最低数指定

Firewallの穴あけ

$ sudo cp /usr/lib/firewalld/services/http.xml /etc/firewalld/services
$ sudo firewall-cmd --add-service=http --zone=public --permanent
success
$ sudo firewall-cmd --reload
success

WordPressに接続

127.0.0.1 に接続してみる。

あとは必要な項目を入力しインストールすれば、WordPress を利用できる。

カテゴリー: CentOSLinuxWeb

0件のコメント

コメントを残す

アバタープレースホルダー

メールアドレスが公開されることはありません。 が付いている欄は必須項目です