Installing Word Press in your local server is very simple. All you have to do is to follow a set of simple instructions as given below. Installing a website locally in your server requires a set of other packages that support the different data that are in the website. Word press needs a server that has a MySQL support. Most of the users do not have this.It has to be explicitly installed. It is very easy to set up the necessary packages for installing Word Press locally in your server.
Follow the given steps :
1. Installing apache
The first step is to install apache server. It is one of the most popular HTTP web servers in the world and for this reason it is recommended for Word press. The following command can be used for downloading and installing apache server.
sudo apt-get install apache2
It can be tested whether the apache server works or not by opening the web page http://localhost/. If the page displays the message ‘It works’, then the apache server is in working condition.
2. Installing MysQL
The next step is to install MySQL. It is the database system that Word press uses to store posts, settings and other data in the blog. The following command can be used to install MySQL in your local server :
sudo apt-get install mysql-server-5.1
During the installation of MySQL a password will be asked.
3. Installing PHa P
Next, we install PHP, which is the server-side scripting language in which Word press has been scripted. It is better to install the latest version of PHP(PHP5). The command given below will help you install PHP-5.
sudo apt-get install php5 libapache2-mod-php5
After installing PHP, the apache server should be restarted which can be done by the command
sudo /etc/init.d/apache2 restart
The installation can be tested by running the following command which creates a file of the name phpinfo.php.
sudo gedit /var/www/phpinfo.php
Open the file in gedit and type the line
<?php phpinfo(); ?>
Save and close the file.
Now open up your browser window and go to http://127.0.0.1/phpinfo.php. . If everything goes correctly, then a PHP info listing page appears as shown in the image.
4. Install the MySQL Module for PHP
The next step is to install a MySQL module for PHP. The command below can be used for that :
sudo apt-get install php5-mysql
Now you are done with installing the web package servers that support Word press. Coming up is the creation of a database and installation of Word press.
5. Create a Word press data base
In order to create a database for Word press have to log in to MySQL, using the password that you created earlier while installing MySQL.The following command is used for logging in.
mysql -u root -p
You are now in the mysql > client.
We now create a database. For now, let the database name be word, the user name be worduser, and the password be 123456. Please change these fields when you see them. Create database name, user name and password of your own. Type the following three commands in the terminal.
CREATE DATABASE word; CREATE USER worduser; SET PASSWORD FOR worduser = PASSWORD(“123456”);
6. Install Word press
For installing Word press a version is needed. The latest version can be downloaded from the official website.
Create a directory in /var/www/wordpress. The name of the directory can be changed from wordpress to anything else. The following command can be used:
The files inside the downloaded package of Word press have to extracted and for this the following command can be used :
sudo tar xzvf ‘/home/Downloads/wordpress-3.0.tar.gz’ -C /var/www/
The MySQL client can gotten out of by using the exit command.
The sections about the database name, user name and password can then be edited by opening the file wp-config-sample.php using gedit.
sudo gedit /var/www/wordpress/wp-config-sample.php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for Word Press */
/** MySQL database user name */
/** MySQL database password */
/** MySQL hostname */
The file is then saved and closed.
After this open the browser and go to the web page http://127.0.0.1/wordpress and follow the instructions on the page. You can also use localhost instead of 127.0.01, that is, http://localhost/wordpress. If you get any message as Error Establishing a Database Connection, then you have done something wrong in the process.
After the installation you will get the page. Your installation will be at http://127.0.0.1/wordpress.
Finally, you have downloaded and installed WordPress in your local server !!!