Linux

Ubuntu server comes default with a Command line interface. Of course we can install GUI in Ubuntu Server if we find command line troublesome. Here are the steps.

First navigate to the “etc/apt” directory and open a file named “sources.list.d” using the command “vi sources.list.d”. 

ugui1

Then check whether software from “universe” ad “multiverse” repositories are allowed.

ugui2

Then type the command “sudo apt-get update” to update all repositories.

ugui3

 

After updating is finished, type the command “sudo apt-get upgrade”.

ugui4

 

Then type the command “sudo apt-get install ubuntu-desktop”. It will take some time to finish all the processes.

ugui5

 

After the installation is finished, restart the server to see your GUI interface.

ugui6

 

In this article, we are going to see how to set up a web server in Ubuntu Server. Before that, I want to give  credit for this article to Mike of www.funwithlinux.net. I learnt how to install the web server from this article, made some mistakes initially but finally successful.

What is a web server? It is a server which hosts websites. Each and every website has a  server. Most web servers are set up on Linux for the primary reason that it is free. I am going to set up my web server on Ubuntu Server 12.04.

To set up a web server we are going to install four components, Apache (server software), PHP (scripting language used to create webpages), MYSQL (database), PHP-MYSQL (MySQL support in PHP ). Login as root into Ubuntu server.

In the terminal type “apt-get install apache2″ to install Apache package. Type ‘Y’ when system prompts you to continue.

uws1

 

To check whether apache packages have been installed or not type the command “wget localhost index.html” in the terminal. This will download the index.html file to the local directory. Type “ls” to see if the file has been downloaded or not. If it is present, apache has been correctly installed.

uws2

The apache2 config file is located at “/etc/apache2/”. In this same directory we have a directory named ‘conf.d’. Configuration files( files with the suffix .conf ) in this directory will be parsed by apache2 during startup.  If we intend to run multiple sites from the same server, we need to put our config files here. Let’s create a file name “shunya.com.conf”.

uws3

In the file shunya.com.conf, add the following text and save the file. The first line tells  Apache to  listen on port 80. The second line shows the ServerAdmin and is optional. The third line shows our web server’s root directory. The fourth line is host header Apache2 will listen for, as sent by the end user’s browser. The fifith line is the file used for logging errors. This line is also optional but is very helpful.  The settings not configured under <VirtualHost> tags will be inherted from apache2.conf or other configuration files. Close the file by typing “:wq”.

uws4

 

As we created the config file of our host, we need to create our root directory referenced in the config file i.e “/var/www/shunya.com”. Navigate to the directory by typing “cd /var/www/”. Create new direcory named ‘shunya.com’ by typing “mkdir shunya.com”. Make the root user the owner of the directory by typing the command “chown root:www-data /var/www/shunya.com -R”. Make this directory readable and executable by typing the command “chmod 550 /var/www/shunya.com -R”.

uws5

 

Create a file named index.php in our root directory shunya.com.

uws6

 

Edit the file as below. We will echo some Archimedes in our index.php file. Save and exit the file.

uws7

 

Next, we have to install PHP. Type the command “apt-get install php5″. Type Y at appropriate prompts.

uws8

 

Reload the apache config file by typing “service apache2 reload”. Then restart the apache service using “service apache2 restart”.

uws9

 

Let’s see if our website is working. From a remote machine which has access to ur web server open the browser and type the IP address of the web server. If we get “Eureka Eureka” displayed, then our server is working.

uws10

 

Install Mysql server by typing “apt-get install mysql-server”. 

uws11

 

The system will prompt you to set a root user password for MYSQL. Set the password and confirm it again.

uws12

 

uws13

Type the command “apt-get install php5-mysql” to install Mysql support for PHP.

uws14

 

We have set up our web server successfully.

The latest release of Ubuntu Server is the 13.04 which includes the latest features including Grizzly release of OpenStack but this release is only supported for nine months. So in this guide I am going to show how to install Ubuntu server 12.04 LTS which is supported till 2017  here. If you want a torrent download, you can get it here. After downloading the image, burn it to a CD/DVD. Load the CD/DVD to drive and boot from it. The system will prompt us to select the language. Select English or whatever language you prefer.

us1

 

Then click on “Install Ubuntu Server”.

us2

 

Then choose the language to be used for the installation process which will also be set for the installed system. I chose English.

us3

 

Then the system will ask you to select your location. This location will be used automatically set your time zone. There is a list of some countries. If your country is not displayed in the list click “Other otherwise click on your country. I selected India.

us4

 

Then the system will ask whether you want it to detect the keyboard layout. If you don’t know your keyboard layout, select “Yes otherwise select “No”.

us5

 

If you select No, it will ask you to select the keyboard layout. My selection is “English(US)”.

us6

 

us7

 

 

Then the system will start loading additional components.

us8

 

Then the system will autoconfigure your network with DHCP.

us9

 

Then the system will prompt you to enter a hostname for the computer. I named it as ubuntu.

us10

 

Then the system will ask you to create an user account. The username should start with a lowercase letter and can be a combination of letters and numbers.

us11

 

Then you are asked to set a password for the user account created. The password should contain a mixture of letters,numbers and punctuation.

us13

 

Then you are asked to verify the password by typing it once again.

us14

 

Then you are asked if you want to encrypt your home directory or not. Encryption prevents your files to be compromised even if your computer is stolen. I recommend you to select “Yes”.

us15

 

Based on the location we chose above, our time zone is selected. If your time zone is correct, select “Yes” otherwise No to change it.

us16

 

Then you are asked to choose your partitioning method.

us17

 

Then you are asked to select the disk to be partitioned.

us18

 

Then you are shown the summary of partitions to be formatted and whether you want to write the changes to the disks. Select “Yes”.

us19

 

Then installation of base system is started.

us20

 

If you want to connect with the outside world through HTTP proxy, give the information otherwise leave it blank.

us21

 

Then configuration of apt starts.

us22

 

After the configuration, installation of software starts.

us23

 

Then you are asked to select how do you manage upgrades to the system. I recommend you to select “Automatic security updates”.

us24

 

Then you are given a choice to install  predefined software applications. If you intend to set a web server,you can select LAMP server here.

us25

 

The system will install the selected features and it will clean up.

us26

 

If this the only OS on your computer, the system will ask you if you want to install the GRUB bootloader.

us27

 

After GRUB is installed, installation is completed. Remove your DVD.

us28

 

You are asked to provide your authentication.Enter the credentials you gave while installing the system and this screen below should greet you.

us29