The story so far.......................
The idea is to show the steps to setup a Virtual Linux Box (with GUI) for remote access as a "learning environment" for an end user - so they don't have to setup new hardware etc to play with Linux.
This first section will be quick and dirty, we will assume you have the following running:
An Ubuntu 12.04 Server 64 bit or similar with these items installed and running:
LAMP
OpenSSH-Server
VirtualBox (4.1.24 in our case)
phpVirtualBox
First is to install the selected linux onto our VirtualBox Server via phpVirtualBox.
The selected Linux is this case is "Linux Mint 13 XFCE" - good desktop linux with lightweight GUI better for remote RDP access.
1. Download the iso - in my case from a mirror:
> wget http://mirror.aarnet.edu.au/pub/linuxmint//stable/13/linuxmint-13-xfce-dvd-32bit.iso
2. login to phpVirtualBox and create a new machine:
Lets go with the following config (similar to an AWS micro instance):
RAM: 640mb
HDD: 8gb (VDI - Dymanic)
Other settings:
Turn Floppy off (a waist of time)
Enable VT-x if available on your system (Hardware Virtualisation)
Set the Video RAM to 32mb
Make sure remote display is set to your desired port (in our case 9001)
Authentication to whatever you would like - in this case I will leave it open (DANGEROUS) as I will be allowing ONLY one fixed IP to access it in the router ** may change this after setup **.
mount the iso image ready for install
Enable Audio
Enable Bridged Networking (port br0 in our case) using what ever your preferred Card is (Pcnet-FAST)
Check your config and hit the start button - fire up your RDP client at this stage and connect to the booting virtual machine (<ip>:9001)
3. When the systems boots, double click on the install icon (CD)
Work through the install wizard - select region, format drive, etc...
Select desired computer name, user name and password (and login method - auto or manual)
reboot when finished.
4. Update and configuration
Login with username and password
Start by running the basic system updates - Shield icon in the dock - admin password required.
Or use the command line if you like - sudo apt-get update, sudo apt-get upgrade - but the GUI is nice and easy for the basics.
Set a fixed IP for routing - DHCP is not usable with most home routers running multiple connections.
In our case local network is 192.168.0.0, Server is 192.168.0.100, Router is 192.168.0.1
So pick an suitable IP for your machine (192.168.0.40) is this case.
You can check this with 'ifconfig' in terminal or fire up the web browser.
Reboot or shutdown at this time would be good after all those updates - a good time to remove the iso from the virtual machine in phpvirtualbox as well.
5. Since we want this to be a server as well - Add required services and software - web server, ssh server etc.
Fire up a terminal to install the extra software (xterm) from the menu.
Run a 'sudo apt-get update' just for good measure first.
Install OpenSSH-Server, LAMP, Midnight Commander
> sudo apt-get install openssh-server
You can test this locally if you like > ssh -l <username> 192.168.0.40
Install the LAMP server - Web, SQL & PHP.
> sudo apt-get install lamp-server^
You will be asked to set a MySQL root password - do so and note it down.
Fire up the web browser and check that apache is working - http://192.168.0.40
You should get:
Install Midnight Commander (mc) - old school :-) great from the command line for file manipulation (norton commander clone).
> sudo apt-get install mc
Add any other software you would like.... Programming tools etc...
If you did not do it earlier - sudo apt-get upgrade - would be an idea now, just to make sure its al up to date - reboot if required.
6. Add a good administration tool - 'webmin' in our example - will allow external server type administration without the GUI.
Fire up the terminal again and enter the following (use your editor of choice 'nano' is easy):
> sudo nano
/etc/apt/sources.list.d/webmin.sources.list
Copy these lines into the file
above and save - <Ctrl> X in nano
deb
http://download.webmin.com/download/repository sarge contrib
You will also need to fetch and install his PGP key with which the repository is signed:
wget
http://www.webmin.com/jcameron-key.asc
sudo apt-key add
jcameron-key.asc
You will now be able to install with the commands :
sudo apt-get update
sudo
apt-get install webmin
And last of all, we need to create a password so that we can log in to webmin:
sudo
/usr/share/webmin/changepass.pl /etc/webmin root <yourpassword>
** please note: you may need to
confirm a security certificate - depending on your web browser,
once saved you are fine to connect and reconnect **
Login: https://localhost:10000/
Best to change the default port and user names etc in webmin at this time.
For this example I will use: port 10010 (to keep it inline with other webmin's on the network and easily routable for external access) and set a username the same as the GUI login.
Many other options can be set and applications installed but this gives you a basic system for a learner to build on - only one step to go.
7. Connect it to the outside world.
This is a little beyond the scope of this paper, but the basics are:
Port forwarding in the router for: TCP 10010 -> 192.168.0.40 (Webmin)
TCP 22 -> 192.168.0.40 (SSH)
TCP 80 -> 192.168.0.40 (HTTP)
and for the RDP (server) TCP 9001 -> 192.168.0.100 (VirtualBox RDP)
So, to connect to:
Webmin Enter the following in a browser: https://<external address>:10010
Web Server Enter the following in a browser: http//<external address>
RDP Enter the following into RDP Client: <external address>:9001
SSH (Terminal)
Will depend on the machine you are connecting from,
for Linux or Mac: ssh -l <username> <external address>
or use 'putty' on Windows with the same details
eg: ssh -l mark myexternalip.com
These are the setting actually used in my test system (so the virtual machine has unique ports that can be connected to):
Port forwarding in the router for: TCP 10010 -> 192.168.0.40 (Webmin)
TCP 2222 -> 192.168.0.40 (SSH)
TCP 81 -> 192.168.0.40 (HTTP)
and for the RDP (server) TCP 9001 -> 192.168.0.100 (VirtualBox RDP)
So, to connect to these ports:
Webmin Enter the following in a browser: https://<external address>:10010
Web Server Enter the following in a browser: http//<external address>:81
RDP Enter the following into RDP Client: <external address>:9001
SSH (Terminal)
Will depend on the machine you are connecting from,
for Linux or Mac: ssh -p 2222 -l <username> <external address>
or use 'putty' on Windows with the same details
eg: ssh -p 2222 -l mark myexternalip.com
System should be good enough to practice just about anything, I have even installed VirtualBox inside the Virtual Linux machine with no problem - slow but proves the point.
Suggested things to add:
An MTA (Mail transport Agent) - SSMTP, postfix configured for an external mail account such as gmail
Wordpress - Great web development tool/platform
* Document produced as training / learning materials and is derived
from many sources and some original content. All sourced material is
subject to those individuals copywrite. Please feel free to use or
update this example as required.