HOW TO INSTALL WORDPRESS ON LAMP STACK

Step 1: Download WordPress

#wget http://wordpress.org/latest.tar.gz

Step 2: Extracting wordpress package

After downloading the zipped package, use tar command to extract it.

#tar -xzvf latest.tar.gz 

Step 3: Create a WordPress Database and User

After we unzip the wordpress files, they will be in a directory called wordpress in the home directory.

Now we need to switch gears for a moment and create a new MySQL directory for wordpress.

Go ahead and log into the MySQL Shell:

#mysql -u root -p

Log-in using your MySQL root password,

Create a wordpress database, a user in that database, and give that user a new password. Keep in mind that all MySQL commands must end with semi-colon. First, let’s make the database.

Mysql> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.00 sec)

Then we need to create the new user. You can replace the database, name, and password, with whatever you prefer:

mysql> CREATE USER [email protected];
Query OK, 0 rows affected (0.00 sec)

Set the password for your new user:

mysql> SET PASSWORD FOR [email protected]= PASSWORD("password");
Query OK, 0 rows affected (0.00 sec)

Finish up by granting all privileges to the new user. Without this command, the wordpress installer will not be able to start up:

mysql> GRANT ALL PRIVILEGES ON wordpress.* TO [email protected] IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

Then refresh MySQL:

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

Exit out of the MySQL shell:

exit

Step 4 Setup the WordPress Configuration

The first step to is to copy the sample wordpress configuration file, located in the wordpress directory, into a new file which we will edit, creating a new usable wordpress config:

#cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php

Then open the wordpress config:

#vi ~/wordpress/wp-config.php
exit

d below and substitute in the correct name for your database, username, and password:

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

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

Save and Exit.

Step 5 Copy the Files

We are almost done uploading WordPress to the server. The final move that remains is to transfer the unzipped WordPress files to the website’s root directory.

# cp -r ~/wordpress/* /var/www/html

From here, WordPress has its own easy to follow installation form online.

However, the form does require a specific php module to run. If it is not yet installed on your server, download php-gd:

# yum install php-gd

Last of all restart Apache:

# service httpd restart

Step 6 RESULTS: Access the WordPress Installation

Once that is all done, the wordpress online installation page is up and waiting for you:

Access the page by adding /wp-admin/install.php to your site’s domain or IP address (eg. example.com/wp-admin/install.php) and fill out the short online form

Was this article helpful?

Related Articles

Leave A Comment?