WordPress is a popular blogging platform available for free. We can easily get a free or paid WordPress website (blog) using popular providers such as Hostgator and some others. But we can also built our own WordPress on top of our existing Linux distribution. On this tutorial, I am going to use Fedora 25 to install the latest WordPress 4.7.3. Its pretty fun to have our own server running WordPress on it.
Steps to install WordPress on Fedora 25
Step 1. Install LAMP Server
You will need to have Fedora 25 running LAMP (Apache, MySQL, PHP). Please read my previous tutorial to install LAMP Server on Fedora 25.
Step 2. Download WordPress
Log in to Fedora and download the latest WordPress using this command below
wget https://wordpress.org/latest.tar.gz -O wordpress.tar.gz
The command above will download the latest WordPress and then save it as wordpress.tar.gz
Step 3. Extract the file to /var/www/html
Now we need to extract the file we just downloaded to /var/www/html. Use this command below to extract it
tar -xzvf wordpress.tar.gz -C /var/www/html
It will produce a new directory called wordpress under /var/www/html directory. We can also rename this directory to something else for example “gamblisfx”.
mv /var/www/html/wordpress /var/www/html/gamblisfx
Step 4. Create MySQL Database for WordPress
Now we need to create a new MySQL Database to handle the WordPress installation and data.
#connect to MySQL Server and enter your password
mysql -u root -pEnter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.21-MariaDB MariaDB ServerCopyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
#Create new user and password
MariaDB [(none)]> create user wordpress@localhost identified by “gamblis”;
Query OK, 0 rows affected (0.00 sec)#Create new database
MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.00 sec)#Grant privileges
MariaDB [(none)]> grant all on wordpress.* to wordpress@localhost;
Query OK, 0 rows affected (0.00 sec)#Flush Privileges
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Step 4. Create Apache Virtualhost for WordPress
Now we need to modify the file /etc/httpd/conf/httpd.conf and add virtualhost to it.
nano /etc/httpd/conf/httpd.conf
Paste these lines to the bottom of the file. But don’t forget to change the red marked text with your own information.
<VirtualHost *:80>
ServerAdmin dhani@gamblisfx.com
DocumentRoot /var/www/html/
ServerName gamblisfx
ErrorLog /var/log/httpd/wordpress-error-log
CustomLog /var/log/httpd/wordpress-acces-log common
</VirtualHost>
Now restart Apache web server
systemctl restart httpd.service
Step 5. Configure WordPress Installation
Follow these steps below to configure the WordPress installation. It will use the previous MySQL user and database credentials we’ve created.
cd /var/www/html/gamblisfx
cp wp-config-sample.php wp-config.php
nano wp-config.php
Now enter your MySQL credentials
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wordpress‘);/** MySQL database username */
define(‘DB_USER’, ‘wordpress‘);/** MySQL database password */
define(‘DB_PASSWORD’, ‘gamblis‘);/** MySQL 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’, ”);
Change the red text with your own credentials. Close and save the file.
Step 6. Configure WordPress Installation
Now open a web browser and type the following address to start configure WordPress installation
http://your-server-ip-address/gamblisfx
For example in my case
http://10.34.0.192/gamblisfx
It will open the WordPress installation wizard
Enter the details for our new website.
Click Install WordPress to complete the installation. Now you can start using WordPress admin page to manage your new WordPress.
http://10.34.0.192/gamblisfx/wp-admin
Enjoy.