MariaDBインストール
①インストール
|
1 |
# slackpkg upgrade mariadb |
➁MariaDB有効化と起動
|
1 2 3 4 5 6 7 8 9 10 |
# chmod +x /etc/rc.d/rc.mysqld 独自の内部データベースをセットアップするためにインストール・スクリプトを実行する # mysql_install_db MySQLユーザーに必要なMySQLファイルの所有権を与える # chown -R mysql:mysql /var/lib/mysql Mariadb起動 # /etc/rc.d/rc.mysqld start |
➂MarisDBのバージョン確認
|
1 2 |
# mariadb -V mariadb from 11.8.5-MariaDB, client 15.2 for Linux (x86_64) using readline 5.1 |
④rootユーザーのパスワードを設定
|
1 2 3 |
# mariadb-admin -u root password New password: Confirm new password: |
⑤MariaDBの起動確認
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# mariadb -u root -p Enter password: ←上記で設定したパスワード Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 11.8.5-MariaDB Source distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | | test | +--------------------+ 5 rows in set (0.000 sec) MariaDB [(none)]> exit; Bye |
⑥MariaDBのインストールのセキュリティー
MariaDBサーバーのrootユーザーのパスワードを変更しておきます。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# # mariadb-secure-installation --skip-ssl NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have your root account protected, so you can safely answer 'n'. Switch to unix_socket authentication [Y/n] Y Enabled successfully! Reloading privilege tables.. ... Success! You already have your root account protected, so you can safely answer 'n'. Change the root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB! |
以降MariaDBを起動するには
|
1 2 |
# mariadb -u root -p Enter password: ←上記⑥で変更したパスワード |
WorsPressインストール
WordPress用データベース
wordpress用ユーザー、パスワード、データベースを作成する
データベース : wp_db
ユーザー : wp_user
パスワード : ?Wabcd123
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# mariadb -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 15 Server version: 10.5.24-MariaDB Source distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database wp_db; Query OK, 1 row affected (0.000 sec) MariaDB [(none)]> create user 'wp_user'@'localhost' identified by '?Wabcd123'; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> grant all on wp_db.* to 'wp_user'@'localhost'; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> exit Bye |
WordPress インストール
WordPressダウンロードとインストール
|
1 2 |
# cd /srv/httpd/htdocs/slack.korodes.com # wget http://wordpress.org/latest.tar.gz |
|
1 |
# tar zxvf latest.tar.gz |
設定ファイルの編集
|
1 2 |
# cd /srv/httpd/htdocs/slack.korodes.com/wordpress/ # cp wp-config-sample.php wp-config.php |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# vi wp-config.php // ** Database settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'wp_db' ); ←WordPress用データベース /** Database username */ define( 'DB_USER', 'wp_user' ); ←WordPress用データベースユーザー /** Database password */ define( 'DB_PASSWORD', '?Wabcd123' ); ←WordPress用データベースユーザーパスワード 最終行に以下の分を追加します。 これをしないと、プラグインを追加するときにFTP接続情報なるものを聞かれます。 define('FS_METHOD', 'direct'); |
/srv/httpd/htdocs/[web公開ディレクトリー]の下に展開した中身を移動します(今回は/srv/httpd/htdocs/slack.korodes.com)
|
1 2 |
# cd /srv/httpd/htdocs/slack.korodes.com # mv wordpress/* . |
wordpressディレクトリの所有者をapacheにします。
これをしないとプラグインのインストールなどの際に、ディレクトリを作成できないとか言われてしまします。
|
1 2 |
# chown -R apache:apache /srv/httpd/htdocs/slack.korodes.com # chmod 775 -R /srv/httpd/htdocs/slack.korodes.com |
起動確認
ブラウザで http://<サーバー名>/wp-admin/install.php に接続すると言語の選択画面になるのでデフォルトのEnglishで進める

ユーザー名、パスワード等必要事項を入力し、インストールを開始する
Site Title : 任意のタイトル
Username : 任意のユーザー名
Password : 任意のパスワード
Your Email : 管理者のメールアドレス
を入力し、「Install WordPress」クリック

インストールが成功すると"Log In"クリック

上記で設定した[Username][Password]を入力し、[Log In]クリック

ログインに成功すると下記のようなWordPressダッシュボードが表示される

