Contents
Install Mysql8
1 2 |
# dnf module -y install mysql:8.0 # vi /etc/my.cnf.d/charset.cnf |
1 2 3 |
[mysqld] character-set-server = utf8mb4[client] default-character-set = utf8mb4 |
1 2 |
#systemctl enable --now mysqld Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service. |
Once completed, set the password for the root user using the "mysql_secure_installation" command
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 |
#mysql_secure_installation Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No: y There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 ←Any Please set the password for root here. New password: ← Any Mysql root password Re-enter new password: ← again Mysql root password Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y Success. By default, MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y Success. All done! |
Install WordPress
1. Create a database for WordPress.
For example, database[wp_db] database user[wp_user] password[?W123456]
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 |
# mysql -u root -p Enter password: ←Enter the root password for MySQL Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.24 Source distribution Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement #Create a dedicated database controlled by WordPress. mysql> CREATE DATABASE wp_db DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; Query OK, 1 row affected (0.00 sec) #Checking the database mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | wp_db | +--------------------+ 5 rows in set (0.00 sec) #Create an account, set a password, and grant access to the database you have created mysql>CREATE USER 'wp_user'@'localhost' IDENTIFIED WITH mysql_native_password BY '?W123456'; Query OK, 0 rows affected (0.04 sec) mysql> GRANT ALL ON wp_db.* TO 'wp_user'@'localhost'; Query OK, 0 rows affected (0.04 sec) #Reload permissions mysql> flush privileges; mysql> exit; Bye |
2 Web server configuration for WordPress
① Edit Apache configuration file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# vi /usr/local/apache2/conf/httpd.conf ●Per line301 : add <VirtualHost *:80> ServerAdmin <Administrator e-mail address> DocumentRoot /var/www/html/[FQDN for wordpress]/ ServerName [FQDN for wordpress] ErrorLog "| /usr/local/apache2/bin/rotatelogs /var/log/httpd/[FQDN for wordpress] _error_log_%Y%m%d 86400540" CustomLog "| /usr/local/apache2/bin/rotatelogs /var/log/httpd/[FQDN for wordpress] _access_log_%Y%m%d 86400 540" combined ErrorDocument 404 / </VirtualHost> <Directory "/var/www/html/[FQDN for wordpress]"> Options Indexes Includes FollowSymLinks MultiViews ExecCGI Require all granted Allow from all AddHandler server-parsed .html </Directory> |
1 |
# systemctl restart httpd.service |
3.Install WordPress
1 2 3 4 |
# mkdir /var/www/html/[FQDN for wordpress] # cd /var/www/html/[FQDN for wordpress] # wget http://ja.wordpress.org/latest-ja.tar.gz # tar xvf latest-ja.tar.gz |
4.Edit the WordPress configuration file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# cd wordpress/ # cp wp-config-sample.php wp-config.php # vi wp-config.php ※Enter the "Database Name", "User Name", and "Password" of the Wordpress database you created above. define('DB_NAME', 'wp_db'); define('DB_USER', 'wp_user'); define('DB_PASSWORD', '?W123456'); Also, add the following to the last line。 If you do not do this, you will be asked for FTP connection information when you add the plugin. define('FS_METHOD', 'direct'); |
5.Moving files
①Move the expanded contents under /var/www/html/[FQDN for wordpress].
1 2 |
# cd /var/www/html/[FQDN for wordpress] # mv wordpress/* . |
After confirming that the files have been moved, delete the wordpress directory and the downloaded latest-ja.tar.gz.
1 2 3 |
# cd /var/www/html/[FQDN for wordpress] # rm -R -f wordpress # rm latest-ja.tar.gz |
Make apache the owner of the wordpress directory.
1 |
# chown -R daemon:daemon /var/www/html/[FQDN for wordpress] |
6.Start the wordpress installation.
Access http://[FQDN for wordpress]/wp-admin/install.php with a browser, enter your user name, password, and other necessary information, and start the installation.
Your server's PHP does not seem to be able to use the MySQL extensions required for WordPress." If you see this, install the following and restart apache and mysql
1 2 3 |
# dnf install php-mysqlnd # systemctl restart mysqld # systemctl restart httpd |