Friday, August 14, 2009

Installing Apache Webserver and PHP5 in Ubuntu 8.04


Bookmark and Share


If you are following my posts in this blog, you have already seen how quick and easy it is to install additional packages in Ubuntu Linux. This time I'll show you how quick and easy it is to install Apache plus PHP in Ubuntu Linux.

  1. Click Applications->Accessories->Terminal

  2. Execute apt-get to download and install apache.
    $ sudo apt-get install apache2

  3. Again execute apt-get to download and install the php5 package.
    $ sudo apt-get install php5

  4. Lastly, install also the apache-php module.
    $ sudo apt-get install libapache2-mod-php5


You have now a webserver application installed in your Ubuntu Linux with PHP support. To start your Apache Webserver, run this command:
$ sudo /etc/init.d/apache2 restart
Verify that your Apache Webserver is running by checking your process table and show only the apache process:
$ ps ax | grep apache
14606 ? Ss 0:01 /usr/sbin/apache2 -k start
14610 ? S 0:00 /usr/sbin/apache2 -k start
14611 ? S 0:00 /usr/sbin/apache2 -k start
14612 ? S 0:00 /usr/sbin/apache2 -k start
14613 ? S 0:00 /usr/sbin/apache2 -k start
14614 ? S 0:00 /usr/sbin/apache2 -k start
14617 ? S 0:00 /usr/sbin/apache2 -k start
19769 pts/3 R+ 0:00 grep apache2

So there you have it. The Apache Webserver my test machine has fork itself six times that why you have all in all seven apache2 daemon running in order to serve several clients accessing your webserver all at the same time.

You can now try to open your default website using your favorite Internet Browser by typing:
http://localhost/
or
http:///
You should then see this page:

It works!



You can either change this site by editing the index.html file from your terminal located at /var/www using your favorite text editor (ex. vi) but you must first execute $ sudo su to change from an ordinary user to a super user. Or, you copy index.html file to your home directory and edit it from there using the Text Editor application in your desktop then copy the file back to /var/www/.

Bookmark and Share

No comments:

Post a Comment