Sunday, 13 May 2007

Ubuntu 7.04 (Feisty Fawn) LAMP Server Setup

Automatic LAMP (Linux, Apache, MySQL and PHP) In about 15 minutes, the time it takes to install Ubuntu Feisty Server Edition, you can have a LAMP server up and ready to go. This feature, exclusive to Ubuntu Server Edition, is available at the time of installation.

The LAMP option saves the trouble of installing and integrating each of the four separate LAMP components, a process which can take hours and requires someone who is skilled in the installation and configuration of the individual applications. You get increased security, reduced time to install, and reduced risk of misconfiguration, all of which results in a lower cost of ownership.

Ubuntu LAMP server Install the following Versions

Ubuntu Feisty Fawn 7.04
Apache 2.2.3
Mysql 5.0.38
PHP 5.2.1

First you need to download server version of Ubuntu version from here after that you create a CD and start booting with the CD Once it starts booting you should see the following screen in this you need to select second option "Install to the Hard disk Option" and press enter



Choose you language and press enter you can see we have selected english in the follwoing screen

Choose your location and press enter you can see we have have selected United Kingdom in the follwoing screen

If you want to try to have your keyboard layout detected by pressing a series of keys you need to select yes option and if you don't want that and you want to choose from a list click no in this example we have selected no and press enter

Select Origin of keyboard and press enter

Select keyboard layout and press enter

Detecting hardware to find CD-ROM Drivers in progress

Scanning CD-ROM in Progress

Loading additional components progress bar



Configures the network with DHCP if there is a DHCP server in the network

Enter the Hostname of the system so in this example i enter here as ubuntulamp


Detecting Disks and Hardware in progress

Startingup the partitioner in progress

you have to partition your hard disk in this example i have selected use entire disk option if you want to edit manually you can choose manual and press enter



Warning message about data lost on your hard disk



Creating partitions in your harddisk

Write the changes to disk option here you need to select yes and press enter



Creating ext3 filesystem in progress

Configuring the clock option here if you want to leave UTC Select yes otherwise no and press enter

You need enter the Full name of the user you want to create for your server in this example i have created administrator user select continue and press enter



username for your account in this i have entered test select continue and press enter



Entered the password for test user select continue and press enter

Confirm the password for test user select continue and press enter

Installing the base system in progress

Configuring package mirror this will be related to your country option

Now it will start Installing software and here you need to select the server options if you want DNS or LAMP i have selected as LAMP for our LAMP server installation



Software Installation in Progress

Installing GRUB Boot loader in progress

Installation complete message here you need to remove your CD select continue and press enter it will reboot your server

After rebooting you can see the following screen prompt for username



This will complete the Ubuntu LAMP Server Installation and your server is ready for installing applications which supports apache,mysql and php.

Enable root Account in Ubuntu server (Not Recommended for security Reasons this is just Optional)

After the reboot you can login with your previously created username (test). Now we will enable the root account using the following command

sudo passwd root

and give root a password.

Now onwards we become root by running the following command

su

Configuring Static ip address in Ubuntu server

Ubuntu installer has configured our system to get its network settings via DHCP, Now we will change that to a static IP address for this you need to edit Edit /etc/network/interfaces and enter your ip address details (in this example setup I will use the IP address 172.19.0.10):

sudo vi /etc/network/interfaces

and enter the following save the file and exit

# The primary network interface

auto eth0
iface eth0 inet static
address 172.19.0.10
netmask 255.255.255.0
network 172.19.0.0
broadcast 172.19.0.255
gateway 172.19.0.1

Now you need to restart your network services using the following command

sudo /etc/init.d/networking restart

You need to setup manually DNS servers in resolv.conf file when you are not using DHCP.

sudo vi /etc/resolv.conf

You need to add look something like this

search domain.com

nameserver xxx.xxx.xxx.xxx

Install SSH Server

If you want to access your server remotely through SSH you need to install SSH server for this you need to run the following command

sudo apt-get install ssh openssh-server

You will be prompted to insert the installation CD again and this will complete SSH server in your Feisty lamp server.

This is really simple and easy server installation for new users and who wants a quick server.

One small Observation i have noticed in Feisty LAMP installation and Edgy,dapper LAMP installation was choosing LAMP server option is available in dapper at the time of booting your server CD and in Feisty,edgy you need to select LAMP server option at the time of software installation.

This might be useful for users who might think there is no LAMP server option at the time of start booting their Feisty server CD.

GUI Installation for Ubuntu LAMP Server

If you are a new user and not familiar with command prompt you can install GUI for your ubuntu LAMP server for this you need to make sure you have enabled Universe and multiverse repositories in /etc/apt/sources.list file once you have enable you need to use the following command to install GUI

sudo apt-get update

sudo apt-get install ubuntu-desktop

The above command will install GNOME desktop if you want to install KDE desktop use the following command

sudo apt-get install kubuntu-desktop

Now you can install webmin for their server web interface to configure apache,mysql servers.

22 comments:

Puleen Patel said...

Technically you don't need a GUI desktop to install webmin, but great walkthrough.

I've got the same setup (w/ webmin) running on a sandbox at home without any GUI desktop, simply acting as a server offering number of services.

sondre_odegard said...

Great walkthrough, didn't know you could install GUI on a server version of Ubuntu.

dirtvoyles said...

Great baby-step walk through. Just what someone like myself needs.

Now, can you make one so I can run a SAMBA share?

:)

christopher ashby said...

LOVE IT!!!

Keep'em coming!

Huygens said...

I would not recommend the suggested user name (i-e: administrator). I was pretty sure, this would be one of the name an attacker may try (with other usual suspects like 'root', 'admin', etc.). I got my suspicion confirmed here: http://www.projecthoneypot.org/dictionary_attacker_usernames.php

I would recommend nothing for login. People should choose by themselves and check the above link to verify that the user name is not listed.

James O'Hagan said...

FAB! Now, I don't have to recreate the wheel!

dh said...

I managed to install, but then the machine just hangs after 'grub loading please wait'.

Anyone got any advice?

dwh said...

Regarding SAMBA, the Debian 3.1 Gnu/Linux Bible has an excellent chapter on this, and in the same chapter nfs is covered very well (ie. implementing it works!).

Gary said...

An Additional Tip...

You can disable DHCP at the boot: prompt before installing.

When the CD starts up, hit F6 ("Other Options") to see the boot prompt. Stick this in as one of the arguments:

netcfg/disable_dhcp=true

(I've always put 'server' at the beginning, but you may not have to on the Server CD...)

Then the installer scripts will ask you and configure the Static IP info for you... Saves a minute or two and some cmd line keystrokes.

Also, while a GUI can be useful on a server, you may want a lighter-weight X system installed; either the base installs of Gnome or KDE (kdebase or kde-core), XFCE (xfce4), or perhaps one of the really lightweights like UDE or IceWM... Then you can just install the admin GUI apps you really need.

Here's some useful config info on those alternate window systems:
http://www.psychocats.net/ubuntu/minimal

Also, don't run X all the time; why waste the resources on a server? Just ssh into the box and turn it on when you need to admin the box.

(Hey, maybe even set up a 'gui user' with a login script that starts X when you login via SSH and shuts it down when the session ends. More clever than I've bothered to ever set up; if anyone knows of such a script, let us know!)

chmoder said...

I wish that you would have just wrote out how to install webmin. i asume its sudo apt-get install webmin.

that would be easy and make desktop pointless

Diana said...

How do you start the GUI interface after it is installed?

EdBoy said...

Where it says nameserver xxx.xxx.xxx.xxx, is that your IP that you put in?

Yoki said...

This is very useful how to guide, wish you can post similar how to for installing MapServer on 7.04 :D

César said...

Very Very USEFUL!

Thanks!

César said...

Where it says nameserver xxx.xxx.xxx.xxx, is that your IP that you put in?

nop, in the file etc/resolv.conf you have to replace xxx.xxx.xxx.xxx for the DNS

if you have 2 DNS , i.e. DNS1 and DNS2 (an alternative DNS) put both in the file, like this:

nameserver xxx.xxx.xxx.xxx
nameserver yyy.yyy.yyy.yyy

Bradly said...

For those like me that just want to play with the LAMP stack, you can install it on your current desktop install of Ubuntu. Open Synaptic, "Edit -> Mark Packages by Task".

Sean said...

I am a newbie, and this document was great.
But one thing that killing me was the vi editor, and it's not recommend for the beginner, use nano or pico instead.

Howard said...

wow, great doc for a n00b3r like me :) your doing all of us noobs a great service! CHEERS!

Jarrett said...

Hey there,

I'm just starting my journey into the Linux world and friend suggested this. however i am unable to get to the screen where i can select the DNS and LAMP software services. I've tried twice with no luck. i do not have this pc connected to the network yet. i have not been setting up HTTP host or whatever that screen says. i don't see it in the walkthrough. it skips from "installing base system" to "installing GRUB loader". can anyone help...

Brian said...

ubuntu 7.10 server LAMP performance issues

Configuration:

2 servers (dell SC1425) dual 3.4ghz processors 4Gig memory 73 Gig SCSI hard drive
Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6.3 Server at 192.168.10.241 Port 80

1 desktop (dell dimension 2400) 2.4 ghz celeron 266Meg memory 40 gig hard drive
Apache/2.2.3 (Ubuntu) DAV/2 PHP/5.2.1 mod_ssl/2.2.3 OpenSSL/0.9.8c Server at 192.168.10.86 Port 80

Setup:

Install ubuntu server LAMP according to most common defaults
Create and test mysql databases with MASTER-MASTER replication

Issues

Compared to an old 6.0 ubuntu server on a dell desktop 2.4ghz celeron with a 40 gig drive and 256meg of memory
the new servers are about 10 times slower when trying to access mysql and generate a webpage.

Testing

I have individually tested apache2, php and mysql queries and they are all as you would expect, much faster than the desktop
it is only when I try and run a php script to get data from mysql that the slowdown occurs.

Any help would be appreciated

ch said...

Hi, I tried to install the GUI (KDE) onto the server machine so that I can run the browser and test out some php/html webpages.

I executed "sudo apt-get install ubuntu-desktop" and "sudo apt-get install kubuntu-desktop", but it says no package found.

I tried install from the CDROM containing the ubuntu cd. I have aldy mounted the cd and did a manual search for the package, and yet none was found.

Anyone knows how do i install the x-windows on ubuntu?

thanks.

rgds,
CH

kelvin said...

Hi,
How to extend the hardisk storage space? Let say i installed to a 10GB hardisk for this ubuntu server but now i not enough space already and need to add another 20GB to the ubuntu server, how to make this? I already use it as web server now... Can i clone the existing server to a larger storage or add storage space?