Your message has been sent.
This article has been saved to your account.
Go to my account
This article has been emailed to your Kindle.
Send this article
This article is based on the Joomla! CMS and how to make use of virtualization software to set up a fully functional web server completely isolated from other applications on your PC.
In this article by Alfonso Romero, the reader will learn about VirtualBox, a popular virtualization software, and how to integrate it with the Joomla Turnkey Linux appliance to create a full-fledged virtual web server ready to receive visitors from the Internet, thanks to the DynDNS free dynamic DNS service. It also includes information on how to open port 80 in a Cable/DSL router to forward incoming traffic so the Joomla web server can communicate with the Internet world, without risking their main PC.
|Read more about this book|
(For more resources on this subject, see here.)
Virtualization is a powerful tool that can make your PC duties easier, no matter if you're a programmer, a systems administrator, a power user, or even a beginner. Have you ever wanted to test the popular Joomla! Content Management System (CMS), but couldn't spare the time and effort to install it in your PC, along with the Apache web server and the MySQL database server? Are you afraid to install Apache, MySQL and PHP in your only PC because it could mess things up? Well, you can forget about all the hassle thanks to Oracle VirtualBox, a powerful virtualization software product that lets you create one or more virtual machines, or VMs, inside your physical PC. Each VM is completely isolated from your main PC and all the other VMs, so it's like having several computers in one physical package, but you don't need the extra space to accommodate all the additional LCDs and PC cases. Cool, huh?
In this article I'm going to show you one of the quickest ways to set up a fully-functional web server right from your own home/office. And why would you need to do something like that? Well, if you want to create a website to establish your own presence on the Internet, there are some costs involved. First of all, you need to pay for a web hosting service and a domain name. So, if you want to learn how to create websites, this would be a perfect way to do it, since all the software we´ll use is free, and with the DynDNS dynamic DNS service, you don't need to pay for a domain name because you can also use one for free. Furthermore, since you're going to host your website on your virtual machine, you can also forget about the web hosting fee. Are these reasons good enough to start experimenting with virtual machines? I'm pretty sure they are!
I decided to use the Joomla! Content Management System (CMS) because it has all you need to establish your Internet presence. The TurnkeyLinux Joomla! virtual appliance includes everything you need to have a website running right out of the box, so you won't have to go through the hassle of installing all the required web server software (Apache, MySQL, PHP, etc.). And in case something goes wrong, you can just wipe out your virtual machine and start again from scratch. How about that?
The first steps in the tutorial will tell you how to create a virtual machine (VM) with VirtualBox, how to get a preconfigured ISO image from the TurnkeyLinux website with all the necessary stuff to install the Apache web server, the MySQL database server and the Joomla! CMS in your VM.
Oh, and if you're wondering how to make your web server available on the Internet, don't worry: I'll also show you how to get a free DynDNS account, and how to configure your Cable/DSL router to open port 80 (the HTTP web server port). That way, visitors from the Internet will be able to navigate in your brand-new Joomla! website.
You'll need a PC or Mac system with Windows/Linux/Mac OS X installed, at least 1 GB of RAM and a Cable/DSL connection to the Internet, so you can configure your Cable/DSL router to let your virtual machine work as a full-fledged web server.
Download the most recent version of Oracle VirtualBox from the official website:
Once the download is completed, follow the instructions included in the User Manual to install VirtualBox in your specific operating system.
Downloading the Turnkey Joomla Appliance
You can download the Joomla appliance from the TurnkeyLinux website. Just click on the following link to start downloading it to your computer: http://www.turnkeylinux.org/download?file=turnkey-joomla-11.0-lucid-x86.iso.
Creating a new virtual machine
Open VirtualBox, click on New to open the New Virtual Machine Wizard and then click on Next. Type MyJoomlaVM in the Name field, select Linux as the Operating System and Ubuntu as the Version, and click on Next to continue:
The Memory dialog will show up next. Select at least 384 MB (you can press the Left and Right arrow keys to increase/decrease the memory value) in the Base Memory Size slider (depending on the total memory available in your PC) and click Next to continue:
Leave the default values in the Virtual Hard Disk window and click Next four times to finish configuring your virtual machine with the default values. Then click Finish twice in the Summary dialogs that will show up afterwards, and you’ll be taken back to the VirtualBox main screen. Your MyJoomlaVM virtual machine will appear in the virtual machine list, as shown below:
Now we need to tweak some network settings so your virtual machine can behave as a real PC with its own IP address. Click the Settings button to open the MyJoomlaVM – Settings window, and then select the Network section:
Make sure the Adapter 1 tab is selected; then click on the Attached to list box and select Bridged Adapter instead of NAT:
Click on the OK button to close the MyJoomlaVM – Settings window and return to the VirtualBox main screen.
Installing the Joomla TurnkeyLinux appliance
To start your virtual machine, double click on its name in the virtual machines’ list or select it and click on the Start button:
The first time you open a virtual machine, the First Run Wizard dialog shows up. This wizard helps you to install an operating system to your virtual machine. Click Next to go to the Select Installation Media window, where you can select a media source to install an operating system in your virtual machine. In this case you’re going to select the Turnkey Joomla ISO live CD image you downloaded before. Click on the folder icon located at the right-side of the Media Source list box:
The Choose a virtual CD/DVD disk file dialog will open up. Use this dialog to locate and select the Joomla Turnkey ISO image your previously downloaded; then click on Open to return to the Select Installation Media dialog and click Next to continue.
The Summary window will appear next, showing the media you selected. Click on Finish to exit the First Run Wizard and start your virtual machine.
Wait until the TurnkeyLinux boot screen shows up; then make sure the Install to hard disk option is highlighted and hit Enter to proceed (you can also wait until installation begins automatically):
Wait until the Debian Installer Live screen appears. Use the keyboard to select the Guided – use the entire disk option and hit Enter to continue:
The next screen will ask you if you want to write the changes to disk. Select Yes and hit Enter to continue.
The Debian Installer will start installing Ubuntu and the Joomla appliance in your virtual machine. After a while, a screen will appear asking if you want to install the GRUB boot loader to the master boot record. Select Yes and hit Enter to continue.
The next screen will tell you that the installation is complete, and will ask if you want to restart your computer (virtual machine). Make sure Yes is selected and hit Enter to continue.
Wait until your virtual machine boots up and asks you to type a new password for the root account. Type a secure password and hit Enter to continue. Type the password again and hit Enter to proceed.
Now the system will ask for the MySQL server 'root' account’s password. Type a password of your choice and hit Enter. Repeat the procedure to confirm the password.
Finally, the system will ask you to type a password for the Joomla 'admin' account. Choose a secure password, type it and hit Enter. Once again, repeat the procedure to confirm the password.
The next step is to write the email address for the Joomla 'admin' account. Type a real email address and hit Enter to proceed.
Next you’ll see a Link TKLBAM to the Turnkey Hub screen. In this case we’re not going to use the Turnkey Hub (a backup/restore system), so don’t type anything and hit Enter to continue.
The next screen that will show up is Security Updates. You can leave the default option (Install) and hit Enter to proceed.
(Be patient while the security updates get installed in your virtual machine; sometimes it can take several minutes.) Once the security updates finish installing in your virtual machine, the JOOMLA appliance services screen will pop up, and your virtual machine will be ready to roll:
Write down the IP address assigned to your Joomla virtual machine (in the above picture it’s 192.168.1.79, but your IP address may vary). Then, open a web browser and type http://youripaddress (remember to replace youripaddress with the IP address you wrote down) to verify your Joomla virtual machine is working. The next screen should appear in your browser:
Finally, you need to unmount the TurnkeyLinux Joomla ISO image from your machine’s virtual drive. This is to avoid booting up the ISO image again instead of booting up from your hard drive. Go to the Devices menu and select CD/DVD Devices > Remove disk from virtual drive:
That’s it for now. Now let’s see how to get a free domain name and configure your Cable/DSL router to accept incoming connections for your Joomla virtual machine.
eBook Price: $29.99
Book Price: $49.99
|Read more about this book|
(For more resources on this subject, see here.)
Getting a Free Domain Name for your Joomla server
To host a web site, you need a domain name. Did you know there are several free services out there that let you use a domain name so you can host your own web server from your home/office? Well, keep reading to find out how to get your own free domain name!
Open a web browser window and type http://www.dyndns.com in the Address bar to go to the DynDNS.com website. Scroll down the page until you find the Free Domain Name section; then type a hostname (in my case, I used alromerojoomla), select a free subdomain like dyndns.org and click on Add to continue:
DynDNS will send you a verification email next. Open your email client, locate the email message sent by DynDNS and click on the confirmation link to verify your account. You’ll be taken to the DynDNS.com website, where you’ll have to click on an activation link to get back to the Shopping cart. Click on Next to continue:
Next you’ll see the Free Services screen, with your dynamic hostname in the Dynamic DNS Hosts list. Click on Activate Services to continue. Now your dynamic hostname will be activated, as shown below:
The Host Services page will show your new dynamic hostname, along with the IP address assigned to your Cable/DSL router. Now we need to configure your router so your Joomla web server can be accessed from anywhere in the world!
Setting up your router to forward port 80
Most homes and small offices are connected to the Internet via a Cable/DSL router. This small box also includes a firewall to protect you from outsiders that could harm your computer if it were open to the world.
If you want to host a web server from your home/office, you’ll need to open port 80 in your router and redirect all incoming traffic to your virtual machine, so people from outside your home/office can access your Joomla website. In this example I’ll show you how to access your router and tell it to forward port 80 to your Joomla! virtual machine, so it can act as a Web server.
First of all, you need to find out the IP address of your router. You can look in your router’s manual for instructions on how to access its configuration webpage. To illustrate the process, I’m going to show you how I opened port 80 in my own router, a 2Wire® Gateway 2701HG-T.
In Windows you can open a Command Prompt window and type the ipconfig command. (In Linux you can use the route -n command, and look for the IP address in the Gateway column.
Then all you need to do is locate the IP address in Default Gateway:
In the above picture you can see the Default Gateway’s IP address is 192.168.1.254. So all you need to do is open a web browser window and type http://yourrouteripaddress to go to your router’s home page:
Now you have to go to your router’s firewall. In this example, you can click on the Firewall icon located at the upper-right side of the screen.
The View Firewall Summary webpage will show up next. Click on the Firewall Settings link to proceed:
Next you’ll be taken to the Edit Firewall Settings page. The first step is to select the IP address of your Joomla virtual machine –the one you wrote down before, remember? Or you can go to your virtual machine’s window to look at the IP address shown and then select it from the list box in your router’s page (in my case it’s 192.168.1.67).
The second step is to click the Allow individual application(s) radio button. Then select the Web Server application from the list and click on ADD. The Web Server application will be added to the Hosted Applications list:
Now scroll down the page until you locate the DONE button and click on it to finish your router’s configuration. The View Firewall Summary page will show that your Joomla virtual machine is configured as a Web server:
At this point, anyone connected to the Internet from outside your home/office will be able to access your Joomla web server. Due to some technical restrictions, your router won’t allow any PC from inside your home/office to access the Joomla web server with the free domain name from DynDNS, but don’t worry, in the next section I’ll show you how to access your Joomla web server from your own PC or from any other PC inside your home/office.
Accessing your Joomla virtual machine via its hostname from any PC inside your home/office
First of all, go to your Joomla virtual machine window (JOOMLA appliance services), select the Advanced Menu option and hit Enter. The Turnkey Linux JOOMLA Advanced Menu will pop up. Select the Quit option and hit Enter to proceed:
The Do you really want to quit? screen will appear next. Select Yes and hit Enter to continue. You’ll be taken to the login terminal screen.
Type root in the root@joomla login prompt and then type the root password you entered when setting up your Joomla virtual appliance. Next, type apt-get install dhcp3-client and hit Enter. Type Y and hit Enter at the Do you want to continue [Y/n] prompt to install the dhcp3-client package.
Wait until the root@joomla prompt shows back again; then type nano /etc/hostname and hit Enter to edit the hostname file. A text editor will open with the hostname of your Joomla virtual machine on it (the default name is joomla):
Replace joomla with the dynamic hostname you created in your DynDNS account. In my case I used alromeromx.dyndns.org, so it should look like this:
To save the changes you made to the /etc/hostname file, press Ctrl+X, type Y and hit Enter. You’ll be taken back to the root@joomla login prompt. You’ll need to restart your Joomla virtual machine to reflect changes, so type shutdown –r now and hit Enter.
Wait until your Joomla virtual machine restarts, and the JOOMLA appliance services screen shows back again. Now you can try accessing it from your host through a web browser window, but this time you’ll be able to use its hostname instead of its IP:
That’s all for now, thanks a lot and I really hope you enjoyed going through this tutorial as much as I did when writing it! It would be great if you could leave your comments, I’m always open to suggestions for improvement, or if you have questions or trouble with any of the steps involved, I’ll be delighted to help!
- Joomla! 1.5 Templates Cookbook [Book]
- Installing VirtualBox on Linux [Article]
- Installing and Configuring Joomla! 1.5 [Article]
- Joomla! Installation on a Virtual Server on the Net [Article]
- Creating Your First Virtual Machine: Ubuntu Linux [Article]
- Develop PHP Web Applications with NetBeans, VirtualBox and Turnkey LAMP Appliance [Article]
eBook Price: $29.99
Book Price: $49.99
About the Author :
Alfonso Romero is a freelance computer consultant and translator from Mexico. He's been working with Linux and open source software since 1999. He started operating his first web server (Apache) from a PC at home, offering free hosting services to experiment with Postfix, Squirrel Mail, MySQL, Apache, Tomcat, and Virtual Hosting. Since then, he's been working as a computer consultant for several clients in Mexico – writing Java, C++, and Web applications. Since 2000, he has worked for Pearson Education in Mexico as a computer books freelance translator and consultant. His latest book translations are the Spanish versions of Java How to Program, Seventh Edition, from Deitel & Deitel, and C++ How to Program, Sixth Edition, also from Deitel & Deitel. Al enjoys writing tutorials and teaching about Java, C++, PHP, the Apache Web server, Tomcat, MySQL, Web applications like Apache Roller, and all of the wonderful open source applications used today, and when he's not experimenting with new trends in Open Source applications, he enjoys playing his electric guitar.