• RSS
  • subscribe
  • twitter

How to Setup a LAMP Server on Ubuntu – Locally run and test WordPress on LAMP Server

Many think that setting up a local Web Server is costly, and can be done by professionals only. It is not true. Nowadays it easy to setup one yourself, without spending a dime and without any headache. Why would a non professional or blogger need a Web Server? You can test new WordPress themes, plugins, and try to find solutions to issues before loading them on your main Server.

The LAMP Server is made up of;a Linux distro, Apache web server, MySQL database and PHP. So we’ll install Apache2, MySQL Server, and PHP scripting language on the Ubuntu/Debian Linux platform. A minimum 256MB of RAM is needed if you don’t want to have issues with the mysql server.

Install Apache together with PHP 4 or PHP 5. From your terminal do
sudo apt-get install apache2 php5 libapache2-mod-php5 If you prefer PHP4 then replace the ‘5’ with ‘4’ Restart apache with sudo /etc/init.d/apache2 restart
You’ll find the Apache configuration file at: /etc/apache2/apache2.conf and the web folder at /var/www
Check if PHP was properly installed by carrying-out this simple test. Create a file called test.php in your web folder /var/www and place this function in it <?php phpinfo(); ?> Point your browser to this page e.g http://localhost/test.php. If all is set and done, then you’ll see the PHP settings, with a heading like “PHP Version 5.2.4-2ubuntu5”

Install MYSQL Database Server
This is the sequential database server that WordPress uses to store all your personal configurations, articles and more. You certainly need it to get WordPress fully operational. Many other CMS blogging portals use it.
Now install mysql 5 and client; sudo apt-get install mysql-server
Since we’ll be running PHP4 or PHP5 then we need to install the correspondent php module for mysql 5;
sudo apt-get install mysql-server mysql-client php5-mysqlChange ‘5’ to ‘4’ if you’re using PHP4.
You’ll find the mysql configuration file at /etc/mysql/my.cnf

Change the root password during the installation if you find it necessary, you can do so later with

mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET Password=”Your new-password” WHERE user=’root’ ;
mysql> FLUSH PRIVILEGES;

It is advisable to create a new account to connect to your mysql databases, this way you avoid using your root account. The best way to get this done is with phpMyAdmin. phpMyAdmin is a simple GUI administration interface that makes things easier when trying to set-up accounts, databases and tables on MySQL database.

To install it do; sudo apt-get install phpmyadmin. You’ll find the configuration file located at /etc/phpmyadmin.
To complete the installation of phpmyadmin under Apache2, add the following line in the Apache configuration file at /etc/apache2/apache2.conf Include /etc/phpmyadmin/apache.conf (preferably at the end of that file where you’ll find other Include syntaxes)

Next restart Apache with sudo /etc/init.d/apache2 restart.

Now test your phpmyadmin installation- point your browser to phpmyadmin e.g http://localhost/phpmyadmin. You shall be taken to the login page, use your root account to get in.

Finally to get WordPress on your newly created web server, all you have to do is
1)Download WordPress and unzip
2)Load the WordPress folder in /var/www
3)Login into phpMyAdmin as root and create a database called wordpress
4)In the WordPress folder that is /var/www/wordpress edit the wp-config-sample.php and rename it wp-config.php
5)Now point your browser to your wordpress e.g http://127.0.1.1/wordpress/
6) Fill-in the form, You’re done. Enjoy

Remember that all the applications above mentioned are Open Source, released under the GPL/GNU license and have no cost.