How to install WordPress with LAMP Server

This tutorial will be discussing about installing LAMP Server for WordPress since WordPress is a content management system (CMS) that is based on PHP and MySQL. Several programmers nowadays prefer to program in Linux OS. Thus, it is good to know how to setup programming tools like WordPress for this OS. These are the step by step instructions.

Step 1: Install Apache Web Serve in Linux OS

Installing in Linux OS most of the time uses terminal. Open the terminal and copy this command:

sudo apt-get install apache2


Now, you already have your apache web server. Next, double check your webserver. Open your browser and type localhost. You must see the index.html of apache2.

Step 2: Install MySQL in Linux OS

As I have said earlier, installing in Linux OS is mostly by the use of terminal. Do not close your terminal and type this command:

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

MySQL will ask password to continue with the installation. Be sure to enter password and remember it. It will also ask “yes/no” questions. Always answer yes. Now you have your MySQL in Linux OS.

Step 3: Install PHP in Linux OS

Don't close your terminal yet. For the installation of PHP, type this command:

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

You already have your PHP.

Step 4: Installing WordPress

WordPress is a free and open software CMS which started in 2003 and was released by Matt Mullenwegg. This is the most popular among the three since it requires basic skills. It is a CMS for beginners. Though it is for beginners, it has a lot of plugins and themes which will make your website better looking and manageable. This CMS is easy to install, customizable, user friendly, free, flexible and has a community support. WordPress is also known for its powerful taxonomy, ability to categorize, organize and tag.

Downloading WordPress in Linux OS requires these steps. First is to download WordPress Package.
To download WordPress Package, type this code:

cd ~
wget http://wordpress.org/latest.tar.gz


This code means we go to the directory home/username and then download the compressed WordPress file.

The next step is to extract the compressed file. The command is,

tar xzvf latest.tar.gz

Type this code in the terminal. This will automatically extract the compressed file. The next thing you should do is to create database and user in MySQL. To do so, copy this command:

mysql -u root -p

This code means that you logged in to your MySQL root. After doing so, create database name in MySQL with this command:

CREATE DATABASE wordpress;

After creating the database, you should create the user. To do so, type this command in the terminal:

CREATE USER wpuser@localhost IDENTIFIED BY 'pswd';

We already have the database and the user this time but they do not have connection yet. To establish the connection between them, type this command:

GRANT ALL PRIVILEGES ON wordpress.* TO wpuser@localhost;

FLUSH PRIVILEGES;

exit

Basically, what we just did was to grant all the privileges on wordpress database to wpuser and then let the MySQL know the recent changes of privileges. And then type exit to log out to the MySQL.
After doing all this, copy the sample configuration file and change some of its lines. To do this, execute this command:

cp wp-config-sample.php wp-config.php
nano wp-config.php

Configure the database name, database password and the user. Follow the code below.

/* @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'db_name');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', '');

/** 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', '');

The next thing we have to do is to transfer the WordPress files into the localhost. To do so, execute rsync command to preserve permissions.
sudo rsync -avP ~/wordpress/ /var/www/html/wordpress

To make changes on the permissions, you should go to where your wordpress files are. If you followed this tutorial step by step, your files should now be located in /var/www/html/wordpress

cd /var/www/html/wordpress

In executing this command, you will now be able to go to the directory where your wordpress files are located. Next, execute this command:

sudo chown -R demo:www-data *

This command allows Apache to interact with the contents. For the last step, go to your browser and follow the series of instructions in making your first WordPress website. Goodluck and have fun.

Share this Article on Social Media

All of my Scripts are ready to customized as per your requirement. Feel free to contact for script customization.

Contact me at discussdesk@gmail.com

"Note : It will be charged as per your customization requirement :)"

Get Updates, Scripts & Other Tutorials to Directly to your Email

Over 20000+ Happy Readers already subscribed. (We don't send spam email). Every email subscriber can get our latest updates and download our 100+ scripts.

Comments