Contents
1. MariaDB
Update the server package
1 2 |
# zypper ref # zypper up -y |
1.1 MariaDB install
①install
1 |
# zypper -n install mariadb |
②initialization
1 2 3 4 |
# vi /etc/my.cnf # Line 12 : add [mysqld] character-set-server=utf8 |
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 |
# rpm -qi mariadb Name : mariadb Version : 10.6.9 Release : 150400.3.12.1 Architecture: x86_64 Install Date: Thu Sep 15 09:59:47 2022 Group : Productivity/Databases/Servers Size : 147409338 License : SUSE-GPL-2.0-with-FLOSS-exception Signature : RSA/SHA256, Thu Sep 1 19:41:53 2022, Key ID 70af9e8139db7c82 Source RPM : mariadb-10.6.9-150400.3.12.1.src.rpm Build Date : Thu Sep 1 19:26:08 2022 Build Host : goat20 Relocations : (not relocatable) Packager : https://www.suse.com/ Vendor : SUSE LLC <https://www.suse.com/> URL : https://www.mariadb.org Summary : Server part of MariaDB Description : MariaDB is an open-source, multi-threaded, relational database management system. It's a backward compatible, drop-in replacement branch of the MySQL Community Server. This package only contains the server-side programs. Distribution: SUSE Linux Enterprise 15 |
④Start and enable MariaDB service
1 |
# systemctl start mysql |
Ensure services are started upon reboot
1 2 3 |
# systemctl enable mariadb Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service. |
Check the status of the service and make sure it is actually running
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# systemctl status mariadb ● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor p> Active: active (running) since Thu 2022-09-15 10:04:16 JST; 2min 7s ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Main PID: 18764 (mysqld) Status: "Taking your SQL requests now..." Tasks: 8 (limit: 2245) CGroup: /system.slice/mariadb.service mq 18764 /usr/sbin/mysqld --defaults-file=/etc/my.cnf --user=mysql Sep 15 10:04:15 Lepard mysql-systemd-helper[18721]: performance_schema Sep 15 10:04:15 Lepard mysql-systemd-helper[18721]: sys Sep 15 10:04:15 Lepard mysql-systemd-helper[18721]: sys.sys_config > Sep 15 10:04:15 Lepard mysql-systemd-helper[18721]: Phase 7/7: Running 'FLUSH P> Sep 15 10:04:15 Lepard mysql-systemd-helper[18721]: OK Sep 15 10:04:15 Lepard mysql-systemd-helper[18689]: Everything upgraded success> Sep 15 10:04:15 Lepard mysql-systemd-helper[18689]: Shutting down protected MyS> Sep 15 10:04:16 Lepard mysql-systemd-helper[18689]: Final cleanup Sep 15 10:04:16 Lepard mysql-systemd-helper[18764]: 2022-09-15 10:04:16 0 [Note> Sep 15 10:04:16 Lepard systemd[1]: Started MariaDB database server. |
Active: active (running) Indicates that the service is running
Change the password for the root user of the MariaDB server.
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 |
# mysql_secure_installation 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! |
⑥Check the version of MariaDB
1 2 |
# mariadb -V mariadb Ver 15.1 Distrib 10.6.9-MariaDB, for Linux (x86_64) using EditLine wrapper |
Confirmation Method #2
Log in as root user with the newly specified root password.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 13 Server version: 10.6.9-MariaDB MariaDB package 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)]> select version(); +----------------+ | version() | +----------------+ | 10.6.9-MariaDB | +----------------+ 1 row in set (0.000 sec) MariaDB [(none)]> exit; Bye |
⑦Firewalld is enabled and the service is allowed to use MariaDB remotely.
1 2 3 4 |
# firewall-cmd --add-service=mysql --permanent success # firewall-cmd --reload success |
1.2 phpMyAdmin Install
Installed phpMyAdmin and configured it to operate MariaDB via web browser
①Install
1 |
# zypper install phpMyAdmin |
②Access http://<IP address>/phpMyAdmin in your browser
The following login screen will appear
Username : root
Password: Password for the root user set in the MariaDB security installation
Go click
The following phpMyAdmin settings screen appears
1.3 MariaDB Example of database and user creation
database : wp_db
user : wp_user
password : ?WHxx333Yo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# mysql -u root -p ① Database Creation MariaDB [(none)]> create database wp_db; Query OK, 0 rows affected (0.14 sec) ②User creation *Local user MariaDB [(none)]> create user 'wp_user'@'localhost' identified with mysql_native_password by '?WHxx333Yo'; Query OK, 0 rows affected (0.14 sec) ➂Authorize users MariaDB [(none)]> grant all on wp_db.* to 'wp_user'@'localhost'; Query OK, 0 rows affected (0.14 sec) ④Authority setting reflection MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> exit; Bye |
2. WordPress Install
2.1 Required library installation
1 |
# zypper install php-gd php-pdo php-mysql php-mbstring php-simplexml php-curl apache2-mod_php7 |
2.2 WordPress Download and Installation
1 2 3 |
# cd /srv/www/htdocs/[web-published directory] # wget http://wordpress.org/latest.tar.gz # tar zxvf latest.tar.gz |
2.3 Editing Configuration Files
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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# cd wordpress/ # cp wp-config-sample.php wp-config.php # vi wp-config.php <?php /** * The base configuration for WordPress * * The wp-config.php creation script uses this file during the installation. * You don't have to use the web site, you can copy this file to "wp-config.php" * and fill in the values. * * This file contains the following configurations: * * * Database settings * * Secret keys * * Database table prefix * * ABSPATH * * @link https://wordpress.org/support/article/editing-wp-config-php/ * * @package WordPress */ // ** Database settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'wp_db' ); /** Database username */ define( 'DB_USER', 'wp_user' ); /** Database password */ define( 'DB_PASSWORD', '?WHxx333Yo' ); /** Database hostname */ define( 'DB_HOST', 'localhost' ); /** Database charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8' ); /** The database collate type. Don't change this if in doubt. */ define( 'DB_COLLATE', '' ); /**#@+ * Authentication unique keys and salts. * * Change these to different unique phrases! You can generate these using * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}. * * You can change these at any point in time to invalidate all existing cookies. * This will force all users to have to log in again. * * @since 2.6.0 */ 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' ); /**#@-*/ /** * WordPress database table prefix. * * You can have multiple installations in one database if you give each * a unique prefix. Only numbers, letters, and underscores please! */ $table_prefix = 'wp_'; /** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. * * For information on other constants that can be used for debugging, * visit the documentation. * * @link https://wordpress.org/support/article/debugging-in-wordpress/ */ define( 'WP_DEBUG', false ); /* Add any custom values between this line and the "stop editing" line. */ /* That's all, stop editing! Happy publishing. */ /** Absolute path to the WordPress directory. */ if ( ! defined( 'ABSPATH' ) ) { define( 'ABSPATH', __DIR__ . '/' ); } /** Sets up WordPress vars and included files. */ require_once ABSPATH . 'wp-settings.php'; /** 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'); |
1 2 |
# cd /srv/www/htdocs/[web public directory] # mv wordpress/* . |
1 2 3 |
# cd /srv/www/htdocs/[web public directory] # rm -Rf wordpress # rm latest.tar.gz |
1 2 |
# chown -R wwwrun:wwwrun /srv/www/htdocs/[web public directory] # chmod 775 -R /srv/www/htdocs/[web public directory] |
1 |
# systemctl restart apache2 |
2.4 Startup Confirmation
Access the WordPress administration screen in the figure below, and you will see the initial settings installation screen including "User Name" and "Password".
Site Title : Any title
Username : Any user name
Password : Any password
Your Email : Administrator's email address
Click "Install WordPress"