How To Install and Configure Ubuntu 11.04 As A Web Server
In this tutorial we will install Ubuntu Server 11.04 and set it up as web server.In later articles we will use this Ubuntu server to setup websites using wordpress, joomla, drupal and a handful others.
A quick note Ubuntu 11.04 is not a long term support release so it is probably not the best practice to use as a production servers. What this means is you will only receive updates until April 2013. If you use the current long term support release, Ubuntu 10.04 you will get updates until April 2015. Visit the following URL for instructions on installing Ubuntu 10.04 Server.
Before we begin we need to download the Ubuntu Server .ISO file.
Download Ubuntu Server: http://www.ubuntu.com/download/server/download
Once you have downloaded the .iso image you will need to make a bootable USB or CD to boot off of to start installing. To learn more about how to do this visit the following URL and look at step 2.
Tips on how to make iso bootable: http://www.ubuntu.com/download/ubuntu/download
Once you have your bootable media we will now need to boot off the install media. Unfortunately there is no standard method to change the boot order from one computer manufacture to another. Basically what you are looking to do is turn your computer on and instead of booting from your hard drive boot from the USB device or CD. For some helpful information on booting from other media visit the following link.
Tips on changeing boot order: http://help.artaro.eu/index.php/home/computer-boot-order.html
Now that we have booted off the install media select your language
Select Install Ubuntu Server
Select your language
Select your country
For keyboard setting I will often select No for this option and just manually set it.
Select country of your keyboard
Select layout
Give your server a name. This will need to be unique name on your network. I am going to call my server webserver-ubuntu but you can name it whatever you want. (Example: server1, myserver, watson..etc)
Select your time zone
Since this is the only operating system that will be installed on my hard drive and I want to keep things simple, I will use the Guided – Use Entire disk and set up LVM option.
Select the hard drive to install on. Since I only have one drive this is a pretty simple choice.
Confirm writing changes.
(Note: If you are going to be dual booting this system make sure you have a complete backup. Clonezilla is a great open source tool to do this)
Set how much disk space you want this install to use. Since my hard drive is only 10.5 GB I will use that amount.
Review partition setup and confirm to have the changes written to disk
Now it is time to create a user. This user will have sudo access (Access to perform admin task.) Enter the full name of the user. (Example: Jim Bob)
Now create a username that will be used to login. This is really up to you and your naming conventions. You could create the username being just the first name or what ever you want. If there will be a lot of users managing the system make sure you have a naming convention in place to adjust for more then one person with the same name.
One other note. This should be in lowercase
Now create a password
Confirm that password
You can set encryption on your home dir. I often don't because if something goes wrong it can be a really pain to recover that data. It really depends on the type of data that will be stored.
If your network has a proxy you can set that here.
Select how you would like to have updates applied. I will select No automatic updates for production servers because it gives me more control of what and when updates are applied.
Now we can select the services we wish to install. Since we are setting up a web server we will want to select the following.
Note: To select a package use the arrow keys to highlight a package and using the spacebar to put an “*” next to the packages you wish to install.
- OpenSSH Server - The Service that allows you to connect remotely and manage your system.
- Lamp Server – (Linux Apache MySQL, and PHP) The most commonly used web service tools.
- Mail Server – Most websites will have automated task to send email for things like user registration.
Once have selected the packages hit enter to continue.
Create a password for your MySQL database. (Make this secure since this will be the password used for managing all MySQL database on the system)
Confirm password
Select Internet Site for mail settings
Enter the fully qualified name of the server. This will be your server name (example: webserver-ubuntu) and the domain. If you are not sure what that means you can make one up.
The domain could be your internal or external DNS name. Since this machine will only be inside my home network and my internal DNS domain internl.linux I will use that. If I had an external domain name such as mixeduperic.com I could use that. (Example: webserver-ubuntu.mixeduperic.com )
We will now want to setup the boot loader. Select Yes to install
The install has completed. It is now time to reboot and test out are new system.
Login using the username and password you created.
When you first login you should see something similar to the image below. This is showing how hard your system is work as well as some other information such as number of processes and IP address of your server. Often time it will let you know if you have updates available to install. Since it is a fresh install we will need to refresh the repositories.
Refresh the repositories with
sudo apt-get update
(Note: The sudo option in front of the apt-get update command basically has you run this as a full privileged user such as root or administrator on windows.)
To apply the available updates use the following command
sudo apt-get upgrade
(This will update all packages on the system except the kernel)
Enter Y to confirm installing the updates.
It looks like we will have to run another update command once this one completes.
If you look at the fourth line down you can see that not all the available updates will be installed. It is says that the linux-generic-pae, linux-headers-generic-pae, and the linux-image-generic-pae will be held back. (Kernel updates) We will need to run another update command to install the kernel updates.
sudo apt-get dist-upgrade
Once the kernel updates are applied we will want to reboot. This is usually about the only time you need to reboot your Linux system. (after a kernel update)
One your system is rebooted, log in.
Take Note of the IP address.
Go to another computer and type that address into a browser to test that apache web server is working.
If you see a page that says It Works! You now have a Ubuntu server ready to serve up web pages.
Ubuntu default web directory is stored in /var/www
Additional Help and Settings:
Static IP Address:
When working with servers it is a good idea to set a static IP address. That way you can it never changes on you. For instructions on how to set a static IP address on Ubuntu server visit:
http://mixeduperic.com/ubuntu/how-to-set-a-static-ip-address-on-a-ubuntu-server.html
Set root Password:
Linux has a user called root. (Similar to administrator on windows) By default Ubuntu has an unknown password set for that account. Every once in a while you may need to use the root id. For steps on how to set a password for the root account visit:
Start, Stop and Restart Apache and MySQL:
Sometimes when making changes to your webserver or mysql database you will need to restart these services. Some example might inlcude changing permissions on directorys or apache configuration such as virtual host. For simple steps on how to start, stop, and restart these services visit:
http://mixeduperic.com/ubuntu/how-to-start-stop-and-restart-apache-and-mysql-on-ubuntu.html
Installing phpMyAdmin
If you are looking for a nice web interface on managing your MySQL database, take a look at phpMyAdmin. It allows you to create databases, users, manage tables, and much more. For simple steps on how to install phpMyAdmin on Ubuntu visit:
http://mixeduperic.com/ubuntu/how-to-install-phpmyadmin-on-ubuntu-1004-lts-server.html
Restrict phpMyAdmin by IP
Many hackers look for servers with phpMyAdmin installed and try to brute force into the server. You can add an extra layer of security by locking phpMyAdmin down to a defined set of IP addresses.
http://mixeduperic.com/ubuntu/how-to-restrict-phpmyadmin-ip-address.html
If you enjoyed this post, please share it on your favorite social network by clicking on the “Share / Save” bar below.
