WordPress requires a database on which it can store the configurations and the data. Hence, login to MySQL as root user and create WordPress user and database as shown below.
Login to MySQL
mysql -u root -p
Next, create WordPress Database
create database wordpressdemo;
Create WordPress database user. Note that in MySQL 8, you cannot create user with GRANT.
create user wpdemo@localhost identified by 'StrongP@33#';
Grant all privileges to WordPress user on WordPress database
grant all privileges on wordpressdemo.* to wpdemo@localhost;
Reload Privileges tables
flush privileges;
Enable MySQL 8 native passwords by editing the /etc/my.conf and uncommenting the line, default-authentication-plugin=mysql_native_password.
WordPress can be installed directly from Fedora 30/29 repos. However, the available version may not up-to-date. You can check it by running the command below;
dnf provides wordpress
Last metadata expiration check: 0:19:41 ago on Mon 24 Jun 2019 06:32:18 PM EAT.
wordpress-5.2.1-1.fc30.noarch : Blog tool and publishing platform
Repo : updates
Matched from:
Provide : wordpress = 5.2.1-1.fc30
As you can see, the available version is 5.2.1 while the latest version 5.2.2. Therefore, to install the latest version, download WordPress archive from the downloads page. You can simply use the wget command.
wget https://wordpress.org/latest.tar.gz
Next, extract WordPress archive contents
tar xzf latest.tar.gz -C /tmp
Copy the extracted WordPress contents to Nginx Web Server root directory.
vim /usr/share/nginx/html/kifarunix-demo.com/wp-config.php
Replace the DB_NAME, DB_USER, DB_PASSWORD with your values.
...
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpressdb' );
/** MySQL database username */
define( 'DB_USER', 'wpuser' );
/** MySQL database password */
define( 'DB_PASSWORD', 'StrongP@33#' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
...
After that, you need to define how WordPress will write to filesystem. Hence, put the line below just after the database configurations.
define('FS_METHOD', 'direct');
Next, generate authentication unique keys and salts. You can simply generate the keys and salts from WordPress Secret-Key service as follows;
We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!
Jay Decrame
Linux Certified Engineer, Technology and Linux/Unix enthusiast.
for fedora 32/33 the file is /etc/my.cnf (all mariadb files changed extention to .cnf). Thanks for this post where can I find more explanation on what you did on config.php? Never seen this kind of setup before, I’m worried about security.
What if I just simply want to install wordpress from rpm and use that setup? I have nginx running fine on a certain site and the following lines in /etc/nginx/default.d/wordpress.conf seem to indicate that I can just leave the wordpress directory under /user/share
# WordPress
location = /wordpress {
alias /usr/share/wordpress/;
}
location /wordpress/ {
root /usr/share;
index index.php;
Thank you. I suggest you update this for Fedora 31, where I can’t see /etc/my.conf . What to do ?
for fedora 32/33 the file is /etc/my.cnf (all mariadb files changed extention to .cnf). Thanks for this post where can I find more explanation on what you did on config.php? Never seen this kind of setup before, I’m worried about security.
What if I just simply want to install wordpress from rpm and use that setup? I have nginx running fine on a certain site and the following lines in /etc/nginx/default.d/wordpress.conf seem to indicate that I can just leave the wordpress directory under /user/share
# WordPress
location = /wordpress {
alias /usr/share/wordpress/;
}
location /wordpress/ {
root /usr/share;
index index.php;
But when I go to http://localhost/wordpress/wp-admin/install.php, I get “Forbidden 403 error”
Hi mate,
Well, if installing wordpress from rpm works, then fine.
For the “Forbidden 403 error”, be sure to check the nginx error logs.
Hi mate, what are the logs saying?