• No results found

A Beginner s Guide to Building Virtual Web Servers

N/A
N/A
Protected

Academic year: 2021

Share "A Beginner s Guide to Building Virtual Web Servers"

Copied!
9
0
0

Loading.... (view fulltext now)

Full text

(1)

A Beginner’s Guide to Building

Virtual Web Servers

Contents

Introduction ... 1

Why set up a web server? ... 2

Installing Ubuntu 13.04 ... 2

Network Set Up ... 3

Installing Guest Additions ... 4

Updating and Upgrading Ubuntu 13.04 ... 4

Installing lamp-server (Storage Requirements approximately 121 MB) ... 5

Installing MySQL Server ... 6

Installing PHPmyAdmin ... 6

Optional Install to set up a good Lamp server ... 6

Hosting a website on the local host server ... 7

Viewing the Website on CentOS machine ... 8

Conclusion ... 8

References ... 9

Introduction

This paper explains how to build a Linux web server on an Ubuntu virtual machine. In this tutorial the term ‘web server’ is used to define the entire system

involved in hosting dynamic websites. This dynamic-hosting web server would be built on an open source technology stack called the LAMP stack. It utilizes PHP for dynamic webpage processing. LAMP stands for Linux, Apache, MySQL and PHP. These are widely-used technologies used to create web server environments. Linux is the

(2)

operating system of the web server. Apache is the actual ‘web server’ that processes requests on the web via HTTP. MySQL is the database that will be used by store data from the website. Lastly, PHP is the server side scripting language used to build dynamic webpages.

Why set up a web server?

I aim to give novice web developers a basic introduction to the networking environment in which they develop in. While taking on several freelance web

development projects of my own, I have come to realize the importance of knowing how to build web servers. In order to develop a website you have to use a development server, and in order to host a site online you have to deploy your website to a web server that is connected to the cloud or to your own server that is connected to the internet. I chose to build a lamp server on a linux operating system because it is an operating system designed for IT professionals to easily configure and maintain. It would give you additional knowledge to set up a lamp server in a different environment that will give you the versatility needed to set up unique servers for others. The

operating system used to build the web server on is Ubuntu. Ubuntu (release 13.04) was chosen because it is one of the most popular linux distributions. Ubuntu is an operating system that is committed to the principles of open source development. Ubuntu is a free operating system that is community-drive; the Ubuntu community contributes to improve the functionality of the OS.

Installing Ubuntu 13.04

The first thing you need to do to build a LAMP server on Ubuntu is to install the Ubuntu operating system on your machine. Download the iso file for Ubuntu 13.04 from

(3)

the download page at Ubuntu.com. You can install Ubuntu on your machine through a DVD. During the Ubuntu installation make sure to allocate enough disk space to the machine. Make sure that you are connected to the internet so that the latest updates can be installed for your Ubuntu operating system. When allocating disk space for the Ubuntu operating system make sure to increase the disk space to allow for enough space to allow other files to be stored on the disk space besides the 4.5 GB that Ubuntu needs to install. Create a password to log on to your Ubuntu account during the set up in order to have a secure machine.

Network Set Up

The Network setup that is going to be used to present the solution to implement a web server on Ubuntu would be described in this section. The first step in setting up the network on a virtual server is to set up Virtual Box on your Host Computer. One can download it from their website: http://virtualbox.com/. The router is going to be installed from a pfSense ISO file. The next set up is to go to network setting of the pfSense machine and add two adaptors; one adapter to the NAT and one adapter to our internal networking we would be using. Details of this set up would not be described. Then set up the a CENTOS client machine by installing from its ISO installation file. This is to be added to the internal network. Finally, Ubuntu Machine from its installation ISO file has to be installed. This machine would also be added to our internal Network. The router connects to the host and is able to provide DHCP services by distributing IP addresses to the client, the CENTOS machine and the web server, the Ubuntu machine. With some minor configuration to this network, one should then be able to use this set up to

(4)

host webpages on the web server on the Ubuntu machine and view them on the CENTOS machine.

Remember to always start the router before booting up the client and server virtual machines.

Installing Guest Additions Ubuntu

To install Guest additions on Ubuntu install the updates must have been installed. See Updating and Upgrading section for details on how to update Ubuntu. To install guest additions on Ubuntu use the following command in any terminal window: ‘sudo apt-get install virtualbox-guest-additions-iso’.

Centos

In order to install guest addition in CENTOS OS use the following commands: 1. ‘yum install gcc –y’

2. ‘yum install kernel-devel –y’ 3. Restart CENTOS

4. In the virtual box addition directory enter the following code: ‘sh VBoxLinuxAdditions.run’

5. If guest additions are installed, type the following command to check whether the guest additions packages were installed: ‘dpkg -l | grep virtualbox-guest’.

Updating and Upgrading Ubuntu 13.04

All the commands in the terminal during the process of setting up the Lamp Server used the unix ‘sudo’ command. To manually install updates on Ubuntu, the

(5)

relevant files were updated on to the operating system from the Ubuntu archive. The next step is to manually upgrade the Ubuntu Operating System using the following command:’sudo apt-get upgrade’. During the process, the dependency tree was built in order to see if there were any dependencies that needed to be installed. Several files were kept back while the necessary files were upgraded when permission to continue was granted. During the upgrade, the option to upgrade to the latest version of Ubuntu, Ubuntu 14.0, was given, but the continue options ws selected to stay with the Ubuntu 13.04. During the upgrade, process software packages were upgraded starting from the lowest in the dependency hierarchy. The software packages include program libraries such as libc and others. Warning, programs that depend on old versions of libraries that are being updated cannot be ran after the program is updated; however, they could be ran before since the old libraries would be loaded into memory. Also, updates will not be in effect until after the intended program for execution is restarted.

Installing lamp-server (Storage Requirements approximately 121 MB)

The next step is to manually install the lamp server by using the following command: ‘sudo apt-get install lamp -server’ (don’t forget the exponent symbol at the end of the

command, “^”). This command installs the necessary packages to set up the lamp stack. After the dependency tree is built, the kernel would request to install the

necessary dependency packages needed to install the lamp server which includes the following packages:

‘apache2 libapache2-mod-php5’ (Apache 2 server)

(6)

‘php5 php5-gd php5-mysql php5-curl php5-cli php5-cgi php5-dev’ (PHP 5)

Installing MySQL Server

After the dependency tree is built and permission to install dependencies granted, the first package is installed in the MySQl server. One will be prompted to choose a root password for the MySQL server which is recommended and should be done to improve the overall security of your lamp server. Remember to write down the password in a secure place as one would need to get access to configure the mysql databases later on. The php package named ’php5-common php5-mysql php5-readline’ is installed to set up the server to host php file to allow for the hosting of dynamic web content on the server the apache HTTP web server.

Installing PHPmyAdmin

The next step is to install phpMyAdmin that allows you to administer MySQL over the web. Enter the following command to install phpMyAdmin: ‘sudo apt-get install phpmyadmin’. One would be requested to choose a web server. Select the apache web

server. One would be prompted to configure the database using phpMyAdmin by using ‘dbconfig-common’. Select ‘Yes’ to configure a database in phpMyAdmin. Use the

following command if you would like to modify the configuration file for phpMyAdmin: ’sudo nano /etc/dbconfig-common/phpmyadmin.conf’.

Optional Install to set up a good Lamp server

Email Server

o Install an email server to allow your server to be able to send and receive emails

(7)

o Install send mail and postFix Mail using the following commands:  ‘sudo apt-get install proftpd’

‘sudo apt-get install postfix’

Webmin

o An open source server management tool o Install commands:

‘sudo nano /etc/apt/sources.list’

‘deb http://download.webmin.com/download/repository sarge contrib

deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib’

‘wget http://www.webmin.com/jcameron-key.asc’‘sudo apt-key add jcameron-key.asc’

‘sudo apt-get update’

‘sudo apt-get install webmin’‘sudo /etc/webmin/start’

o Test if it is working by inputting the following in a web browser:  http://localhost:10000/ (or if on a network)

http://your-server-ip:10000/

Hosting a website on the local host server

Use the following steps to upload the site to the local host (Apache 2 server) . The best way to transfer your website from one location to another is by archiving the website folder into a zip file and then transferring it to the new website folder and

(8)

unzipping it there. Install the zip program using the following command: ‘sudo apt-get install zip’. Locate the root directory of your website folder. The default path to

the directory for the default website location in Apache 2 is /var/www/. An example of a command to copy the zip file from one location (ie. Desktop) to the Apache 2 directory (ie /var/www ) is as follows: ‘sudo cp -R /home/paul/Desktop/Portfolio-BS.zip /var/www’.

In standard format it is ‘sudo cp -R path/movingZipFolder path/DestinationFolder’. Using

these commands would help when transferring your website to your apache website folder. When you have got the zip file in the apache folder use the following command in the terminal in the directory to extract the zip file: ‘unzip ZippedFilePath

ZipFileDestinationPath’.

Viewing the Website on CentOS machine

To view the file on the CentOS machine, get the IP address of the Ubuntu machine in the Ubuntu terminal using the command: ‘ipconfig’. The website should be hosted as

the local host the Ubuntu server (optionally select port 80 for websites). Now, in the CentOS machine, open a browser and type the IP address of the Ubuntu machine including the port number 80 for the website. The page hosted by the web server should load.

Conclusion

If one follows all the steps above, a perfect Ubuntu server should be the end product built on the Lamp Stack that has website hosting capabilities. Some additional functionality can be added to the server such an ftp server to allow files to be uploaded to the server remotely. With the network set up on virtual box described above the website would be able to be viewed on the CentOS client. The processes described

(9)

serve as a basic introduction into the techniques and procedures involved in hosting websites online. This serves as introduction to one of the many tasks a system administrator has to carry out.

References

"How To Install LAMP Server in Ubuntu Server 12.04 LTS." Ubuntu Server Guide RSS. N.p., n.d. Web. 28 Apr. 2014. <

http://ubuntuserverguide.com/2012/05/how-to-install-lamp-server-in-ubuntu-server-12-04-lts.html>.

"virtualbox.org." • View topic. N.p., n.d. Web. 28 Apr. 2014. <https://forums.virtualbox.org/viewtopic.php?t=4960>.

References

Related documents

Curve. Click Inferred Dimensions.. Select the two lines. Click to place the dimension. Type 2 in the on-screen input box. From the Dimensions Drop-down list , select

user ~ $ sudo apt-get install apache2 user ~ $ sudo a2enmod proxy. user ~ $ sudo

Figure 1 depicts the path to moving from a client server computing model to achieve application fluency in the data center with two important milestones for

The availability of a higher number of quasi orthogonal channels is, of course, beneficial for the network performance; as a matter of fact, one can think of splitting the End

sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo apt-get install g++.. #reboot for new kernel to load sudo /sbin/shutdown

The step of data extraction is responsible for extracting relational social network data and dynamic nature of relations including spatiotemporal data from the mailing lists and

Quarter-based programs will be charged for the student's first quarter (or mini-term quarter start) in attendance. Tuition and fees for subsequent quarters will be charged at

However, there would be challenges for printing antenna on high dielectric constant substrate like Silicon such as gain drop and performance degradation due to unwanted