Friday, May 11, 2018

How To Install WordPress On Linux Mint

How To Install WordPress On Linux Mint
How To Install WordPress On Linux Mint

If you want to install WordPress site on your computer then this article is very useful for you. In this article, I will tell you, How to install WordPress site on Linux system on localhost.

Before go to the below process you will need to ensure that you have installed LAMP.

1. Create a MySQL database

The first step is to create MySQL database with username and password. Open your command line terminal and type in:
mysql -u root -p

You will then be prompted to enter your MySQL password which you created while creating LAMP. You should be switched to the mysql console (“mysql>”).
mysql console

We’ll now create the database, a user and password. The databases will be called ‘wordpress1’ Type in:
CREATE USER wordpressuser1@localhost IDENTIFIED BY 'password1';

Ensure that ‘password1is replaced with secure passwords of your choosing.

To assign privileges for the user to use the MySQL database type in:
GRANT ALL PRIVILEGES ON wordpress1.* TO wordpressuser1@localhost;

To apply these privileges to the MySQL type in:

Exit mysql by typing:

2. Configuring Site Root Directories

We will be installing both of the sites within individual directories in the web root of our computer. We will need to change to the ‘/var/www/html/’ directory:
cd /var/www/html/

We can then create a directory for each of our sites. These will store the site files.
sudo mkdir site1

Having done this change your directory back:

3. Installing WordPress

We can now download the WordPress files which we need by typing into your command line terminal:

The above command will save WordPress to your home directory. You will then need to extract all the WordPress files and install some dependency packages:
tar xzvf latest.tar.gz
sudo apt-get update && sudo apt-get install php7.0-gd libssh2-php

To change the present working directory to WordPress type into your terminal:
cd wordpress

By typing in ls you can then see the content of your WordPress folder. It should look something like:
WordPress folder

Within the above list there is file called ‘wp-config-sample.php’. We want to create a copy of this file which is called ‘wp-config.php’. To do this type:
cp wp-config-sample.php wp-config.php

If you type in ls again you should see the wp-config.php is now added.

Copy the files to the site root directories:
sudo rsync -avP ~/wordpress/ /var/www/html/site1

Give ownership of the directories to the Apache web user and then add your linux username to the web group:
sudo chown www-data:www-data * -R
sudo usermod -a -G www-data your-linux_user_name

Change back to the main directory:

4. First Site Configuration

Change directories to the first site’s document root:
cd /var/www/html/site1

Open the WordPress configuration file for editing:
sudo nano wp-config.php

Scroll down until you find the fields below and substitute the database, username and password for your site:

// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wordpress1‘);
/** MySQL database username */
define(‘DB_USER’, ‘wordpressuser1‘);
/** MySQL database password */
define(‘DB_PASSWORD’, ‘password1‘);

Make sure that you save the file.

5. Create an uploads folder for each site

Change your directory:
cd /var/www/html/site1

Within this folder we want to create a folder for uploads by typing:
sudo mkdir wp-content/uploads

6. Setting up the WordPress sites

In order to see your new WordPress sites, simply navigate to your domain names in a web browser, i.e.

If you have configured everything correctly, you should be greeted by the WordPress welcome screen.