A Beginner s Guide t Building Virtual Web Servers Cntents Intrductin... 1 Why set up a web server?... 2 Installing Ubuntu 13.04... 2 Netwrk Set Up... 3 Installing Guest Additins... 4 Updating and Upgrading Ubuntu 13.04... 4 Installing lamp-server (Strage Requirements apprximately 121 MB)... 5 Installing MySQL Server... 6 Installing PHPmyAdmin... 6 Optinal Install t set up a gd Lamp server... 6 Hsting a website n the lcal hst server... 7 Viewing the Website n CentOS machine... 8 Cnclusin... 8 References... 9 Intrductin This paper explains hw t build a Linux web server n an Ubuntu virtual machine. In this tutrial the term web server is used t define the entire system invlved in hsting dynamic websites. This dynamic-hsting web server wuld be built n an pen surce technlgy stack called the LAMP stack. It utilizes PHP fr dynamic webpage prcessing. LAMP stands fr Linux, Apache, MySQL and PHP. These are widely-used technlgies used t create web server envirnments. Linux is the
perating system f the web server. Apache is the actual web server that prcesses requests n the web via HTTP. MySQL is the database that will be used by stre data frm the website. Lastly, PHP is the server side scripting language used t build dynamic webpages. Why set up a web server? I aim t give nvice web develpers a basic intrductin t the netwrking envirnment in which they develp in. While taking n several freelance web develpment prjects f my wn, I have cme t realize the imprtance f knwing hw t build web servers. In rder t develp a website yu have t use a develpment server, and in rder t hst a site nline yu have t deply yur website t a web server that is cnnected t the clud r t yur wn server that is cnnected t the internet. I chse t build a lamp server n a linux perating system because it is an perating system designed fr IT prfessinals t easily cnfigure and maintain. It wuld give yu additinal knwledge t set up a lamp server in a different envirnment that will give yu the versatility needed t set up unique servers fr thers. The perating system used t build the web server n is Ubuntu. Ubuntu (release 13.04) was chsen because it is ne f the mst ppular linux distributins. Ubuntu is an perating system that is cmmitted t the principles f pen surce develpment. Ubuntu is a free perating system that is cmmunity-drive; the Ubuntu cmmunity cntributes t imprve the functinality f the OS. Installing Ubuntu 13.04 The first thing yu need t d t build a LAMP server n Ubuntu is t install the Ubuntu perating system n yur machine. Dwnlad the is file fr Ubuntu 13.04 frm
the dwnlad page at Ubuntu.cm. Yu can install Ubuntu n yur machine thrugh a DVD. During the Ubuntu installatin make sure t allcate enugh disk space t the machine. Make sure that yu are cnnected t the internet s that the latest updates can be installed fr yur Ubuntu perating system. When allcating disk space fr the Ubuntu perating system make sure t increase the disk space t allw fr enugh space t allw ther files t be stred n the disk space besides the 4.5 GB that Ubuntu needs t install. Create a passwrd t lg n t yur Ubuntu accunt during the set up in rder t have a secure machine. Netwrk Set Up The Netwrk setup that is ging t be used t present the slutin t implement a web server n Ubuntu wuld be described in this sectin. The first step in setting up the netwrk n a virtual server is t set up Virtual Bx n yur Hst Cmputer. One can dwnlad it frm their website: http://virtualbx.cm/. The ruter is ging t be installed frm a pfsense ISO file. The next set up is t g t netwrk setting f the pfsense machine and add tw adaptrs; ne adapter t the NAT and ne adapter t ur internal netwrking we wuld be using. Details f this set up wuld nt be described. Then set up the a CENTOS client machine by installing frm its ISO installatin file. This is t be added t the internal netwrk. Finally, Ubuntu Machine frm its installatin ISO file has t be installed. This machine wuld als be added t ur internal Netwrk. The ruter cnnects t the hst and is able t prvide DHCP services by distributing IP addresses t the client, the CENTOS machine and the web server, the Ubuntu machine. With sme minr cnfiguratin t this netwrk, ne shuld then be able t use this set up t
hst webpages n the web server n the Ubuntu machine and view them n the CENTOS machine. Remember t always start the ruter befre bting up the client and server virtual machines. Installing Guest Additins Ubuntu T install Guest additins n Ubuntu install the updates must have been installed. See Updating and Upgrading sectin fr details n hw t update Ubuntu. T install guest additins n Ubuntu use the fllwing cmmand in any terminal windw: sud apt-get install virtualbx-guest-additins-is. Cents In rder t install guest additin in CENTOS OS use the fllwing cmmands: 1. yum install gcc y 2. yum install kernel-devel y 3. Restart CENTOS 4. In the virtual bx additin directry enter the fllwing cde: sh VBxLinuxAdditins.run 5. If guest additins are installed, type the fllwing cmmand t check whether the guest additins packages were installed: dpkg -l grep virtualbx-guest. Updating and Upgrading Ubuntu 13.04 All the cmmands in the terminal during the prcess f setting up the Lamp Server used the unix sud cmmand. T manually install updates n Ubuntu, the fllwing cmmand was used: sud apt-get update. Security updates and ther
relevant files were updated n t the perating system frm the Ubuntu archive. The next step is t manually upgrade the Ubuntu Operating System using the fllwing cmmand: sud apt-get upgrade. During the prcess, the dependency tree was built in rder t see if there were any dependencies that needed t be installed. Several files were kept back while the necessary files were upgraded when permissin t cntinue was granted. During the upgrade, the ptin t upgrade t the latest versin f Ubuntu, Ubuntu 14.0, was given, but the cntinue ptins ws selected t stay with the Ubuntu 13.04. During the upgrade, prcess sftware packages were upgraded starting frm the lwest in the dependency hierarchy. The sftware packages include prgram libraries such as libc and thers. Warning, prgrams that depend n ld versins f libraries that are being updated cannt be ran after the prgram is updated; hwever, they culd be ran befre since the ld libraries wuld be laded int memry. Als, updates will nt be in effect until after the intended prgram fr executin is restarted. Installing lamp-server (Strage Requirements apprximately 121 MB) The next step is t manually install the lamp server by using the fllwing cmmand: sud apt-get install lamp -server (dn t frget the expnent symbl at the end f the cmmand, ^ ). This cmmand installs the necessary packages t set up the lamp stack. After the dependency tree is built, the kernel wuld request t install the necessary dependency packages needed t install the lamp server which includes the fllwing packages: apache2 libapache2-md-php5 (Apache 2 server) mysql-server mysql-client (MySQL 5.5)
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 permissin t install dependencies granted, the first package is installed in the MySQl server. One will be prmpted t chse a rt passwrd fr the MySQL server which is recmmended and shuld be dne t imprve the verall security f yur lamp server. Remember t write dwn the passwrd in a secure place as ne wuld need t get access t cnfigure the mysql databases later n. The php package named php5-cmmn php5-mysql php5-readline is installed t set up the server t hst php file t allw fr the hsting f dynamic web cntent n the server the apache HTTP web server. Installing PHPmyAdmin The next step is t install phpmyadmin that allws yu t administer MySQL ver the web. Enter the fllwing cmmand t install phpmyadmin: sud apt-get install phpmyadmin. One wuld be requested t chse a web server. Select the apache web server. One wuld be prmpted t cnfigure the database using phpmyadmin by using dbcnfig-cmmn. Select Yes t cnfigure a database in phpmyadmin. Use the fllwing cmmand if yu wuld like t mdify the cnfiguratin file fr phpmyadmin: sud nan /etc/dbcnfig-cmmn/phpmyadmin.cnf. Optinal Install t set up a gd Lamp server Email Server Install an email server t allw yur server t be able t send and receive emails
Install send mail and pstfix Mail using the fllwing cmmands: sud apt-get install prftpd sud apt-get install pstfix Webmin An pen surce server management tl Install cmmands: sud nan /etc/apt/surces.list deb http://dwnlad.webmin.cm/dwnlad/repsitry sarge cntrib deb http://webmin.mirrr.smersettechslutins.c.uk/repsitry sarge cntrib wget http://www.webmin.cm/jcamern-key.asc sud apt-key add jcamern-key.asc sud apt-get update sud apt-get install webmin sud /etc/webmin/start Test if it is wrking by inputting the fllwing in a web brwser: http://lcalhst:10000/ (r if n a netwrk) http://yur-serverip:10000/ Hsting a website n the lcal hst server Use the fllwing steps t uplad the site t the lcal hst (Apache 2 server). The best way t transfer yur website frm ne lcatin t anther is by archiving the website flder int a zip file and then transferring it t the new website flder and
unzipping it there. Install the zip prgram using the fllwing cmmand: sud apt-get install zip. Lcate the rt directry f yur website flder. The default path t the directry fr the default website lcatin in Apache 2 is /var/www/. An example f a cmmand t cpy the zip file frm ne lcatin (ie. Desktp) t the Apache 2 directry (ie /var/www ) is as fllws: sud cp -R /hme/paul/desktp/prtfli-bs.zip /var/www. In standard frmat it is sud cp -R path/mvingzipflder path/destinatinflder. Using these cmmands wuld help when transferring yur website t yur apache website flder. When yu have gt the zip file in the apache flder use the fllwing cmmand in the terminal in the directry t extract the zip file: unzip ZippedFilePath ZipFileDestinatinPath. Viewing the Website n CentOS machine T view the file n the CentOS machine, get the IP address f the Ubuntu machine in the Ubuntu terminal using the cmmand: ipcnfig. The website shuld be hsted as the lcal hst the Ubuntu server (ptinally select prt 80 fr websites). Nw, in the CentOS machine, pen a brwser and type the IP address f the Ubuntu machine including the prt number 80 fr the website. The page hsted by the web server shuld lad. Cnclusin If ne fllws all the steps abve, a perfect Ubuntu server shuld be the end prduct built n the Lamp Stack that has website hsting capabilities. Sme additinal functinality can be added t the server such an ftp server t allw files t be upladed t the server remtely. With the netwrk set up n virtual bx described abve the website wuld be able t be viewed n the CentOS client. The prcesses described
serve as a basic intrductin int the techniques and prcedures invlved in hsting websites nline. This serves as intrductin t ne f the many tasks a system administratr has t carry ut. References "Hw T Install LAMP Server in Ubuntu Server 12.04 LTS." Ubuntu Server Guide RSS. N.p., n.d. Web. 28 Apr. 2014. <http://ubuntuserverguide.cm/2012/05/hw-tinstall-lamp-server-in-ubuntu-server-12-04-lts.html>. "virtualbx.rg." View tpic. N.p., n.d. Web. 28 Apr. 2014. <https://frums.virtualbx.rg/viewtpic.php?t=4960>.