Category: How to..., Installation, Linux Projects - Hands On — UbuntuLinuxHelp @ 11:39 am —

This tutorial is meant for Linux newbies who want to try and build a Ubuntu Server box as a web server and torrent client. It is a step by step instruction on how to do this in VMWare on Windows XP to get the feel of it. I wrote this after, being a Linux newbie myself, a lot of trial-and-error and googling. Hope this helps you!

The virtual machine you create here isn’t really meant to work as a server at home. Apache MySQL, PHP and Torrentflux are available for Windows as well, so that would work just the same.

I was playing with the idea of getting some old PC and installing an Ubuntu LAMP server. A stand-alone web server, separate from my desktop-machine. While this box would be on all the time it could, as well, download some torrents. But before really buying a new PC I wanted to see how it would turn out. To see if it is what I had in mind. That’s why I made it in VMware and afterwards made this tutorial.

Required downloads

If you don’t have VMWare:
VMWare Player
VMX Builder (it’s on the bottom of the page)
Ubuntu 6.06 Server get the “PC (Intel x86) server install CD” (no need to burn it to a CD, the iso is enough)

Step 1: Installing VMWare Player and VMXBuilder

This step is out of scope of this how-to, if there are a lot of questions about it I might try to explain this. VMXBuilder is a handy tool to create virtual machines that you can use with VMWare player. See the VMX Builder page for installation notes.

Step 2: Creating a Virtual machine for VMWare

Start VMXBuilder.
Choose: File - Create new virtual machine
Choose your Machine-location (I used c:\vms\UbuntuServer)
Enter a display name for the VM
For the options tab use the following Options:

VM Options

There is no need to change anything else.
For the hardware tab there’s a little more to do.

Add network

Give the machine some more memory (it’s important to leave sufficient memory for your host OS). My machine has 1 GB internal memory, i gave the VM 400 MB of it.
Add a network adapter via new hardware.
In the same way add a Hard Disk and a DVD/CD-ROM drive.
Optionally install more (like USB, but that’s up to you).
The network is standard configured the right way (it will be a machine on your network and have it’s own IP-address).

Network

Create a hard disk: choose ‘Create new’

HDD

In the screen I use the following settings (I don’t have VMWare and do have config in my path)

Create HD

I choose a 4GB disk size, this is enough for your Ubuntu installation. On your hard disk this ‘virtual hard disk’ will only occupy as much space as it needs but it won’t exceed 4GB. When everything goes okay a message box showing your current disk information should appear

Finally set up the CD-ROM player to use your downloaded iso of ubuntu server ‘ubuntu-6.06-server-i386.iso’.

lamp-conniso Ubuntu LAMP Server With Torrentflux In VMware

Save your Virtual Machine.

Step 3: Start your virtual machine and install Ubuntu

(If you have some sort of firewall installed on your host PC this might be the moment to temporarily disable it. )

If at any time during this install it seems to have stopped, try again without using your PC at the same time or maybe with any of the screen-savers. I’ve had some problems with that in the past. (Reboot the machine)

Make sure you have a working Internet connection.

Start VMWare Player
Open your Ubuntu Server machine (look for the vmx file in your virtual machine folder)
When the machine is booting up: left-click with your mouse in your machine.

When the Ubuntu-menu appears, choose: “Install a LAMP Server”

Install menu

For this tutorial we’ll choose “English” as the language and for the country, “United States’. Step through some other install screens, most of them are pretty obvious. Choose a meaningful servername, optionally set-up a proxy server.

When it comes to partitioning your disk, don’t worry, this virtual machine only knows of your virtual hard disk. Everything else is safe. Select this option: “Erase entire disk: IDE1 slave…”

Install disk

Write the changes to disk and answer the questions about your time-zone.
Walk through the username and password screens. Wait until the installation completes.

If everything went fine you will see this:

Install finish

(There’s no need to remove a cd since you’re using an iso.)
Press continue, the machine reboots.

Step 4: Getting it to work

After rebooting the machine (here) seems to get stuck at “booting the kernel” (Image below).

Stuck

If that happens to you, here is one fix…

This procedure needs an internet connection, so make sure you have a working one!

Reboot your machine by exiting the machine (press <ctrl><alt>) and choose “Troubleshoot” -> “Reset”.

Reboot

Left-click with your mouse in your machine.
And press <Esc> to enter the boot-menu, choose CD-ROM

After booting from the CD, your’re back in the install menu. In this menu choose ‘Rescue a broken system’

Rescue

Walk through the familiar looking screens until you get to this screen:

Rescue mode

Choose /dev/discs/disc0/part1
Choose Execute a shell in /dev/discs/disc0/part1
and continue in the next screen.

You are now in a console environment where you can execute commands. Enter:

sudo apt-get install linux-686

When asked to continue choose ‘Y’
When this is done: Congratulations: you just installed a new kernel for linux!
At the prompt type:

exit

You return to the rescue operations screen where you choose ‘Reboot the system’ Now you should be able to get to the logon screen.

Logon

Note

As you probably realize by now: Ubuntu Server does not have a graphical interface. I think that’s a good thing (this is a server, not a desktop!) so I’ll continue this how-to by using the command line.
For some commands you need super-user rights, the command ’sudo’ gives you them. A command started with sudo always asks for a password use your own password.

Step 5 (Optional): Make system up-to-date

Logon with your username and password.

sudo apt-get update
sudo apt-get upgrade

In my case this screen appeared:

Upgrade

Press Y …Wait patiently until everything is done installing…

Step 6: Downloading Torrentflux 2.1

On your host, find out a working link for downloading Torrentflux at http://prdownloads.sourceforge.net/torrentflux/torrentflux_2.1.tar.gz?download
Choose a location near you and choose download. Cancel the download and write down your link, which will look something like mine, shown below in blue:

Download link

Back on your machine type:

wget <full link to download>

Or in my case it’s:

wget http://belnet.dl.sourceforge.net/sourceforge/torrentflux/torrentflux_2.1.tar.gz

If you need to use a proxy server begin with setting up your proxy server in you current environment:

http_proxy=http://<proxyhost>:<proxyport>;export http_proxy

or if you want this to be permanent: edit the /etc/wgetrc and fill the proxy settings there.
To edit the /etc/wgetrc file you need to know how to use vi, which is beyond the scope of this how-to.

Result:

Download torrent

Step 7: Installing Torrentflux

All right, we downloaded Torrentflux, now on to installing it. Set mysql root password:

mysqladmin -u root -p password <YourNewPassword>

When asked for a password: just press <Enter>, it’s the current mysql root password which isn’t assigned yet.

Unpack Torrentflux:

tar zxvf torrentflux_2.1.tar.gz
cd torrentflux_2.1
mysqladmin -u root -p create torrentflux
<YourNewPassword>
cd sql
mysql -u root -p torrentflux < mysql_torrentflux.sql
<YourNewPassword>
cd ../html

Create DB
Set up the config.php:

vi config.php

Now edit the settings as below:

Config PHP
Consult a vi manual to find out how vi works. (Googling will give you the basic commands you need – It’s not hard).

After saving your updated config.php file copy the files to your web server root directory:

sudo mkdir /var/www/tf
sudo cp -rf * /var/www/tf

Create a folder to save the downloaded torrents

cd /home
sudo mkdir shared
sudo chmod 777 shared
cd shared
mkdir torrent
chmod 777 torrent

Create torrent folder

Step 8: Test!

If everything went okay it’s time to try if it’s working, and to set up the last bits in Torrentflux. To find out what the IP address your new server is:

ip address

Look for the eth0 network card:
in my case the ip address is: 172.16.50.83

IP address

On your host: open your webbrowser and go to:

http://<ip_address>/tf - In my case that’s

http://172.16.50.83/tf

You will see this screen:

Torrent Login

Login with: root and mysql password: <YourNewPassword>

As a final step: change the path to: /home/shared/torrent and press “Update settings”

Changed path

Configuring Torrentflux further is beyond the scope of this how-to.

Congratulations, you now have a working webserver with Apache, MySql, PHP and Torrentflux.

Step 9 (Optional): Installing SSH

Torrentflux has a nice system to download your files from your server but I prefer some sort of secure ftp-connection.
I installed openssh for this, this is how:

sudo apt-get install openssh-server

No need to start it or anything. it’s ready for use with e.g. WinSCP or PuTTY.

Step 10: Shutdown your Ubuntu server

sudo shutdown -h now

If you don’t want to shutdown but simply log-off:

exit

[Creative Commons Attribution License]
This page is licensed under a Creative Commons License, by Calvin.

1 person has left a comment

#1

Great tutorial, thank you very much. It worked perfectly.

Simon P. wrote on October 2, 2008 - 5:46 pm
You can leave a response, or trackback from your own site.

Write Your Comment

Comment Guidelines: Basic XHTML is allowed (a href, strong, em, code). All line breaks and paragraphs will be generated automatically.

You should have a name, right? 
Your email address, I promised I won't tell it to anyone. 
If you have a web site or blog, you can type the URL right here. 
This is where you type your comments. 
Remember my information for the next time I visit.