Just a thought

Installing Web Server in Debian/Ubuntu

Posted by stringofthoughts on May 7, 2009

A Friend of mine needed help with the websites they are designing and he asked me for help. The first thing i needed was a webserver with php, python and mysql server. I ‘ve installed web server in Linux many times but i haven’t really learnt it. Everytime I need to search for steps/guidelines on Internet. So I’m just gonna make a walk through for installing web-server in Linux. There are mainly 4 things you need for a fairly good web server. Apache web server with PHP and Python support and a MySQL server for database.

We ‘ll be installing everything one by one.

Installing webserver.

$ sudo apt-get install apache2

This will install Apache web server on your system. Open a browser and type http://localhost it’ll open a webpage telling you it works!!!.I

Installing PHP support for your web server.

$ sudo apt-get install php5 libapache2-mod-php5

After installing php you need to restart your server.

$ sudo /etc/init.d/apache2 restart

To test if the php is working with your webserver.

$ sudo gedit /var/www/testphp.php

insert <?php phpinfo(); ?> in the file testphp.php. Open your browser and type http://localhost/testphp.php . If a page opens displaying the php info then you did it :).

Installing python

$ sudo spt-get install python libapache2-mod-python

Instaling perl

$ sudo apt-get install perl libapache2-mod-perl2

Python and perl are scripting languages.

If you don’t wanna do all this you can use tasksel and choose the task Web Server. It ‘ll install Apache, php, python and peron your system. Tasksel is the easy way.

Now we are gonna install MySQL server.

$ sudo apt-get install mysql-server mysql-client

Setting up root password for MySQL server

$ sudo mysqladmin -u root password “yourpasswd”

MySQL server is almost useless without php. Although you can use other languages like Ruby. So installing php-mysql to make MySQL available to PHP.

$ sudo apt-get install php5-mysql

You can access your mysql server from command line or from php but handle the database in much better ans easy way you need to install phpmyadmin. It’s a awesome tool for administering MySQl over web.

$ sudo apt-get install phpmyadmin

Well now you have installed a very feature rich web server on your system. Check my other post on configuring web server for all the configuration details.

Installing this in ubuntu is very easy. All the packages are bundled together in a task LAMP (Linux Apache MySQL PHP). So for installing web server in ubuntu.

$ sudo tasksel

It’ll show you all the tasks.(See my earlier post on tasksel for details info on tasksel.). Select LAMP by pressing space bar and just OK it. Fully featured web server will be installed in your system.


One Response to “Installing Web Server in Debian/Ubuntu”

  1. […] Comments Installing Web Serve… on Tasksel (Bundled software inst…Mounting windows dri… on Auto mount windows drives […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: