This tutorial will be discussing 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 set up programming tools like WordPress for this OS. These are the step by step instructions.
Step 1: Install Apache Web Server 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 a 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 the password to continue with the installation. Be sure to enter the 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 Mullenweg. 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 community support. WordPress is also known for its powerful taxonomy, ability to categorize, organize, and tag.
Downloading WordPress in Linux OS requires these steps. The first is to download WordPress Package.
To download WordPress Package, type this code:
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 create a 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 a 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 [email protected] IDENTIFIED BY 'pswd';
We already have the database and the user this time but they do not have a connection yet. To establish the connection between them, type this command:
GRANT ALL PRIVILEGES ON WordPress.* TO [email protected];
Basically, what we just did was to grant all the privileges on the WordPress database to wp user 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
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 */
/** MySQL database username */
/** MySQL database password */
/** MySQL hostname */
/** Database Charset to use in creating database tables. */
/** The Database Collate type. Don't change this if in doubt. */
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
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. Good luck and have fun.