Sunday, October 22, 2006

Tutorial: How to setup webserver with Ubuntu Linux (LAMP)

Here is how i did it. First lets install the Apache 2 Webserver. Open the terminal and type this:
sudo apt-get install apache2
Now the webserver`s root directory is /var/www/

If you dont have write access to /var/www use the CHOWN command. Open your web browser and type the following adress: http://localhost if you want to test if the server is installed correctly.
The next step is PHP5. Type the following in your terminal:
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
This installs PHP5 and restarts the apache webserver. If you want to test the new PHP installation
gksudo gedit /var/www/phptest1.php
Insert this code into the new file
Save the file and open it with your browser. You will see detailed information about your PHP installation. Naw we are going to install MySQL database server.
sudo apt-get install apache2
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql
sudo apt-get install phpmyadmin
Now we have to edit the apache/php conf
gksudo gedit /etc/php5/apache2/php.ini

You have to uncomment this line
extension=mysql.so
Save the file and restart the server
sudo /etc/init.d/apache2 restart
Thats all. Enjoy your new webserver :)

No comments: