Little Girl's Mostly Linux Blog

VirtualBoxWhatNext

Yes, but what do I do now that Ubuntu Server 8.04 is installed in VirtualBox?

This page was last updated on May 23, 2009.

Table of Contents

Introduction

Now that you’ve installed Ubuntu Server 8.04 in VirtualBox, you have a fully functioning server which you can control from the command line. At this point the server can access the internet, but you cannot yet access the server from the host machine or over a local or remote network. In this guide there are instructions on how to:

  • Install some necessary software.
  • Install a GUI and some GUI software (if you wish).
  • Install VirtualBox Guest Additions to provide some luxuries.
  • Set up the local and remote network.
  • Set up a shared folder between the host computer and the virtual machine.
  • Add users to your server.
  • Remove users from your server.
  • Set up a common folder for users to share.
  • Set up your Apache web server.
  • Make SFTP and SSH available to yourself and your users.
  • Set up MySQL.

This guide is not intended to be all-inclusive. You are encouraged to do further research elsewhere on the many things a server can be used for, the detailed usage instructions for the software presented in this document, how to back up your server, whether/how to use a firewall and any other issues that you feel are not covered.

IMPORTANT
For the purposes of this guide, host refers to your computer
and guest refers to Ubuntu Server running inside of VirtualBox.

Acknowledgements

A million thanks go to Frank Pirrone whose inspiration, education, endless patience and willingness to suffer through countless experiments made this page possible!

Requirements

  • Kubuntu or Ubuntu
  • VirtualBox
  • A copy of Ubuntu Server 8.04 installed in VirtualBox. See the Further Information section for a guide on how to do this.
  • A hardware router between your local network and the internet. See the Further Information section for why you need one and how to set one up.
  • An understanding of the sudo, gksudo and kdesu commands. See the Further Information section for more information.
  • An understanding of what a LAN, a WAN, an IP, a LAN address range and a (network) bridge are. See the Questions and Answers section for more information.

Log In

Launch Ubuntu Server in VirtualBox and log in with your username and password. You’ll be at a command line prompt.

Update The System

Type these commands at the command prompt now and from time to time (at the command prompt or in a terminal window) to keep the system up-to-date.

  1. This one ensures that your system’s information about new and updated packages is current:
  2. sudo apt-get update
  3. This one upgrades all packages that are currently installed on the system:
  4. sudo apt-get upgrade

Install Some Software


Install Some Necessary Software

These commands will install development files which you’ll need to have a fully functioning server. Type the commands one by one at the command prompt, pressing the Y key each time the install routine gives you the package details and asks if you’d like to continue:

  • sudo apt-get install linux-headers-`uname -r`
  • sudo apt-get install build-essential

Install Some Luxurious Software

This section is optional, is for those who would like to control their server from a GUI, and will require more RAM than the default setup. These commands will install X.Org X Window System, XFCE GUI Desktop, Synaptic package manager and Mousepad, which is a graphical text editor. Type the commands one by one at the command prompt, pressing the Y key each time the install routine gives you the package details and asks if you’d like to continue:

  • sudo apt-get install xorg
  • sudo apt-get install desktop-base
  • sudo apt-get install xfce4
  • sudo apt-get install xfce4-appfinder
  • sudo apt-get install xfce4-terminal
  • sudo apt-get install synaptic
  • sudo apt-get install mousepad

Install VirtualBox Guest Additions

The VirtualBox Guest Additions are device drivers and system applications that provide a bit of luxury to the experience of running a virtual machine. For the purposes of this guide, the things we’re interested in are:

  • A special mouse driver for the guest machine making it so you no longer have to press a key to free the mouse while running a virtual machine (only available if the guest is running a GUI).
  • The clipboard of the host and guest can be shared (only available if the guest is running a GUI).
  • The ability to create a folder on the host which will be available to the guest as a network share.
IMPORTANT
The 1.50 version of the Guest Additions file has been reported to not work.
You’ll want to use the 1.5.6 version. You can get that version from here.
Or find the most recent version by looking through the folders here.
  1. Right-click the CD icon at the bottom of the Ubuntu Server VirtualBox window.
  2. Select CD/DVD-ROM Image….
  3. Browse to the Guest Additions ISO file. If it’s not listed, click the Add button at the top left and browse to the file.
  4. Make sure the VBoxGuestAdditions ISO file is highlighted and click the Select button to mount the ISO file in the virtual machine.
  5. In Ubuntu Server, mount the VBoxGuestAdditions ISO by typing:
  6. sudo mount /media/cdrom
  7. You have now mounted the ISO file in the virtual machine.
  8. Run the VirtualBox Guest Additions install script by typing:
  9. sudo sh /media/cdrom/VboxLinuxAdditions.run
  10. You have now installed the VirtualBox Guest Additions.
  11. Unmount the CD or ISO by typing:
  12. sudo umount /media/cdrom
  13. Log out by typing:
  14. logout
  15. Close the Ubuntu Server window.

From now on when you start the Ubuntu Server virtual machine, shared folder support will be available. Mouse integration and the shared clipboard will be automatically enabled if you load up a GUI Desktop.

Set Up Local And Remote Networking

In order to access your server from the host machine, a local network or from the internet, you’ll need to:

  • Install some software on the host to operate a bridge.
  • Create a couple of scripts on the host to run as a bridge.
  • Edit the host machine’s interfaces file.
  • Configure VirtualBox to work with the bridge.
IMPORTANT
If you don’t know what a LAN, a WAN, an IP, a LAN address range or a (network)
bridge is, please see the Questions and Answers section before proceeding.

Install Some Software To Operate A Bridge

You’ll need to install some software to operate a bridge. This software will be used by scripts you’ll be creating to bring the bridge up and down whenever you like.

Open a terminal window on the host machine and type these two commands one by one, pressing the Y key each time the install routine gives you the package details and asks if you’d like to continue:

  • sudo apt-get install bridge-utils
  • sudo apt-get install uml-utilities

Create A Script To Bring Up A Bridge

Copy the contents of one of these scripts, open a text editor on your host machine and paste the copied script into the text editor:

  • Script to use if you use VirtualBox OSE and your host machine uses a static IP:
  • #!/bin/bash

    sudo tunctl -t tap0 -u USERNAME
    sudo chown root.vboxusers /dev/net/tun
    sudo chmod g+rw /dev/net/tun
    sudo brctl addbr br0
    sudo ifconfig eth0 0.0.0.0 promisc
    sudo brctl addif br0 eth0
    sudo ifconfig br0 HOST_IP netmask 255.255.255.0
    sudo route add default gw 192.168.1.1 br0
    sudo brctl addif br0 tap0
    sudo ifconfig tap0 up

    Note: Edit the script above by changing USERNAME to the username you use on your host machine and changing HOST_IP to your host machine’s IP number.

  • Script to use if you use VirtualBox full version and your host machine uses a static IP:
  • #!/bin/bash

    sudo VBoxTunctl -t tap0 -u USERNAME
    sudo chown root.vboxusers /dev/net/tun
    sudo chmod 0666 /dev/net/tun
    sudo brctl addbr br0
    sudo ifconfig eth0 0.0.0.0 promisc
    sudo brctl addif br0 eth0
    sudo ifconfig br0 HOST_IP netmask 255.255.255.0
    sudo route add default gw 192.168.1.1 br0
    sudo brctl addif br0 tap0
    sudo ifconfig tap0 up

    Note: Edit this script by changing USERNAME to the username you use on your host machine and changing HOST_IP to your host machine’s IP number.

  • Script to use if you use VirtualBox OSE and your host machine uses a dynamic IP (DHCP):
  • #!/bin/bash

    sudo tunctl -t tap0 -u USERNAME
    sudo chown root.vboxusers /dev/net/tun
    sudo chmod g+rw /dev/net/tun
    sudo brctl addbr br0
    sudo ifconfig eth0 0.0.0.0 promisc
    sudo brctl addif br0 eth0
    sudo dhclient br0
    sudo brctl addif br0 tap0
    sudo ifconfig tap0 up

    Note: Edit this script by changing USERNAME to the username you use on your host machine.

  • Script to use if you use VirtualBox full version and your host machine uses a dynamic IP (DHCP):
  • #!/bin/bash

    sudo VBoxTunctl -t tap0 -u USERNAME
    sudo chown root.vboxusers /dev/net/tun
    sudo chmod 0666 /dev/net/tun
    sudo brctl addbr br0
    sudo ifconfig eth0 0.0.0.0 promisc
    sudo brctl addif br0 eth0
    sudo dhclient br0
    sudo brctl addif br0 tap0
    sudo ifconfig tap0 up

    Note: Edit this script by changing USERNAME to the username you use on your host machine.

Save The Script As A File

Save the script as BridgeUp.sh on the host machine.

Create A Script To Bring Down A Bridge

Copy the contents of one of these scripts, open a text editor on your host machine and paste the copied script into the text editor:

  • Script to use if your host machine uses a static IP:
  • #!/bin/bash

    sudo ifconfig tap0 down
    sudo ifconfig br0 down
    sudo brctl delbr br0
    sudo ifconfig eth0 HOST_IP netmask 255.255.255.0 up
    sudo route add default gw 192.168.1.1 eth0

    Note: Edit this script by changing HOST_IP to your host machine’s IP number.

  • Script to use if your host machine uses a dynamic IP (DHCP):
  • #!/bin/bash

    sudo ifconfig tap0 down
    sudo ifconfig br0 down
    sudo brctl delbr br0
    sudo dhclient eth0

Save The Script As A File

Save the script as BridgeDown.sh on the host machine.

Edit The Interfaces File

In order for your host machine to use a bridge, it will need to understand what a bridge is. To do this, edit the host machine’s /etc/network/interfaces to include the bridge:

  1. Back up the interfaces file with a copy that has the current date in its name:
    sudo cp /etc/network/interfaces /etc/network/interfaces.`date +~%b-%d-%Y~%T`
    • In GNOME, type:
    • gksudo gedit /etc/network/interfaces
    • In KDE, type:
    • kdesu kate /etc/network/interfaces
  2. Go to the bottom of the file and add this section, making sure to leave a blank line between the existing contents of the file and the new section you’re adding:
  3. auto tap0
    iface tap0 inet manual
    up ifconfig tap0 up
    down ifconfig tap0 down
    
  4. Save the file and exit the editor.

Configure Ubuntu Server

Ubuntu Server will need to be configured to use a bridge:

  1. Launch VirtualBox.
  2. Select the Ubuntu Server virtual machine.
  3. Click the Settings button.
  4. Select Network on the left side of the window.
  5. Use the selector next to Attached to near the top of the window to change the setting from NAT to Host Interface.
  6. Enter tap0 into the Interface Name box.
  7. Click OK.

Finishing Touches

Put Up The Bridge

To run the BridgeUp script to put up the bridge, open a terminal window on the host machine and type:
bash BridgeUp.sh

All of its commands require root access, so you will be asked for your password.

IMPORTANT
When you launch the terminal program, it will open in your /home/username
directory by default. If you have stored the script in another location like, for
example, /home/username/scripts, then you’ll need to type this command
(substituting the location of your script file for the one in this example) to
change to that directory first:

cd /home/username/scripts

Launch Ubuntu Server

Lanch the Ubuntu Server virtual machine from VirtualBox. If you’ve installed XFCE, type startx to run the GUI Desktop.

Check The Local IP Of Ubuntu Server

To find out what Ubuntu Server’s local (LAN) IP is, type:
ifconfig
IMPORTANT
If you loaded a GUI Desktop, you’ll need to open a terminal window to run the command.

Open Up A Port In Your Router

In order for local or remote networking to access your web page, you will need to open the proper port in your router to allow traffic through. See your router’s documentation on how to access and work with your router’s configuration.

  1. Using a browser on your host machine, access your router as administrator.
  2. Find the section in your router’s configuration for port forwarding.
  3. Set up port forwarding to open port 80 (the default port for web pages) for Ubuntu Server’s LAN IP.
  4. Save the router settings.

Test Your Local Connectivity

To test whether your Ubuntu Server virtual machine can be accessed from your local (LAN) network, open a browser on the host machine and enter this address into the address bar, substituting Ubuntu Server’s local (LAN) IP for IP in this example:
http://IP
If everything is set up properly, you should end up at a page that says, “It worked!” If you instead receive a message telling you the page timed out, then go back over all the previous steps and make sure you have everything set up properly.

Check The Remote IP Of Ubuntu Server

Check your external or remote (WAN) IP in your router or go to http://whatsmyip.org/ to find out what it is. Note that your WAN IP is the IP of your router, so since you likely don’t yet have a browser installed on the guest machine, using a browser on the host machine to go to the link will give you the WAN IP.

Test Your Remote Connectivity

To test whether your Ubuntu Server virtual machine can be accessed from the Internet (WAN), open a browser on the host machine and enter this address into the address bar, substituting Ubuntu Server’s remote (WAN) IP for IP in this example:
http://IP
If everything is set up properly, you should end up at a default page that says, “It works!” If you instead receive a message telling you the page timed out, then first go back over all the previous steps and make sure you have everything set up properly. If you still receive a time-out page, see the Set Up Your Apache Web Server section for information on how to use a port other than the default port 80.

Shut Down The Server

Any time you want to take Ubuntu Server down, either type logout at the command prompt or shut down via the standard GUI interface. Once you’ve shut down the virtual machine, you’ll want to take down the bridge.

Take Down The Bridge

To run the BridgeDown script to take down the bridge, open a terminal window on the host machine and type:
bash BridgeDown.sh
All of its commands require root access, so you will be asked for your password.

IMPORTANT
When you launch the terminal program, it will open in your /home/username
directory by default. If you have stored the script in another location like, for
example, /home/username/scripts, then you’ll need to type this command
(substituting the location of your script file for the one in this example) to
change to that directory first:

cd /home/username/scripts

Set Up A Shared Folder For Host And Guest

To set up a shared folder so that you can transfer files from the host machine to the guest and vice versa, follow these steps:

Create A Shared Folder And Mount Point

  1. Create the shared folder on the host machine. Open a terminal window and type this command, substituting the path and folder name you’d like to use for the one in this example:
  2. mkdir /home/username/shareme
  3. In the Ubuntu Server virtual machine window, open up the Devices menu and then the Shared Folder menu entry.
  4. Browse to the folder you just created and select it.
  5. Click the little box for making it permanent.
  6. Save the settings.
  7. Inside the Ubuntu Server virtual machine, open a terminal and create a folder to be used as a mount point, substituting the path and folder name you’d like to use for the one in this example:
  8. mkdir /home/username/mountpoint

Manually Mount And Unmount The Shared Folder

If you’d like to manually mount and unmount the shared folder any time you like, follow these instructions:

Mount The Shared Folder

Open a terminal window in the Ubuntu Server virtual machine and type this command, substituting your paths, folder names, userID and groupID for the ones used in the example:
sudo mount -t vboxsf -o uid=1000 -o gid=1000 shareme /home/username/mountpoint
IMPORTANT
Note that no path is needed for the host machine’s shared folder – that part is handled by
VirtualBox.

Also note the use of uid=1000 and gid=1000. This part of the command ensures that the
specified user can access the shared folder.

To find out the uid and gid of a user, type this command on the guest machine at a
command prompt or in a terminal window:

cat /etc/passwd | more

Unmount The Shared Folder

To unmount the shared folder, open a terminal window on the guest machine and type:
sudo umount /home/username/mountpoint

Permanently Mount The Shared Folder

If you’d like to permanently mount the shared folder so that it automatically is shared any time you launch the Ubuntu Server virtual machine, then you’ll need to edit the /etc/init.d/rc.local file.

Open a terminal window in the Ubuntu Server virtual machine and type:
sudo nano /etc/init.d/rc.local
Use the arrow keys to move the cursor to the bottom of the file. Type this as the last line at the bottom of the file, substituting the name of your shared folder and the path to your mountpoint for the ones used in this example:
mount -t vboxsf -0 uid=1000,gid=1000 shareme /home/username/mountpoint
IMPORTANT
Note that no path is needed for the host machine’s shared folder – that part is handled by
VirtualBox.

Also note the use of uid=1000 and gid=1000. This part of the command ensures that the
specified user can access the shared folder.

To find out the uid and gid of a user, type this command on the guest machine at a
command prompt or in a terminal window:

cat /etc/passwd | more

When you’re finished, press the Ctrl and O keys at the same time. Press the Enter key to accept the file name it automatically offers. Press the Ctrl and X keys at the same time to exit.

Access The Shared Folder

You can access the mounted shared folder in a terminal by typing this command, substituting the path to your mount point for the one used in this example:
cd /home/username/mountpoint
Or you can open the folder with a file manager in the GUI Desktop.

Add And Remove Users

Add A User

To add a user to your server, open a terminal window in the Ubuntu Server virtual machine and type this command, substituting the username of the user for USERNAME in this command:
sudo adduser USERNAME
Then answer the questions that come up, giving the user a password, etc. This will create a /home/USERNAME directory for them on the system. Note that the password you assign for the user is only temporary. The user will be required to change the password immediately when he or she logs on for the first time.

Remove A User

To remove a user from your server, open a terminal window in the Ubuntu Server virtual machine and type this command, substituting the username of the user for USERNAME in this command:
sudo deluser USERNAME

Set Up A Common Folder For Users

By default all users have the ability to create and edit content in their own folders, but cannot alter the content of other users’ folders. If you’d like to create a folder in which more than one user can create and edit content, you’ll need to creat a common folder.

  1. Open a terminal window on the guest and create a new group called common by typing:
  2. sudo addgroup common
  3. Modify the user’s account, (-a) appending him or her to that (-G) group by typing this command, substituting the name of the user for USERNAME in this example:
  4. sudo usermod -a -G common USERNAME
  5. Create the common directory by typing:
  6. sudo mkdir common
  7. Set its group to the common group by typing:
  8. sudo chgrp -R common common
  9. Set its permissions to 777 by typing:
  10. sudo chmod -R 777 common
  11. Set its groupID bit so that files created there will have the properties of the creator’s username and the common group by typing:
  12. sudo chmod g+s common
  13. Open fstab for editing by typing:
  14. sudo nano /etc/fstab
  15. Add access control list capability to the file system where common is located to control how files created in that directory inherit permissions. To do this, find the line for the drive where common is located. The line will contain ext3 and relatime. Make sure acl is included in the line as in this example:
  16.   / ext3 acl,relatime
  17. When you’re finished, press the Ctrl and O keys at the same time. Press the Enter key to accept the file name it automatically offers. Press the Ctrl and X keys at the same time to exit the editor.
  18. Reboot the Ubuntu Server virtual machine to enable the acl setting by typing:
  19. sudo reboot
  20. Open a terminal window on the guest and turn on default (-d) rwx modification (-m)for the group “common” on all files created or modified in that directory by typing:
  21. sudo setfacl -d -m group:common:rwx common

Test The Common Folder

To test the common folder to be sure it’s set up properly:

  1. Open a terminal window on the guest
  2. Change to the common directory by typing this command, substituting the path to the common folder you created for the one used in this example:
  3. cd /home/common
  4. Create a test file by typing:
  5. touch test.txt
  6. Edit the new file by typing:
  7. nano test.txt
  8. Add a line of text and save the file.
  9. Save the file by pressing the Ctrl and O keys at the same time and then pressing the Enter key to accept the file name.
  10. Exit the editor by pressing the Ctrl and X keys at the same time.
  11. Change to a user who has access to the common folder by typing this command, substituting the name of the user for USERNAME in this example:
  12. su USERNAME
  13. Provide the user’s password. If this is unknown, you will either need the user to test the access for you or you can use the instructions above to create a new user and give that user access to common, deleting the user when finished with the test.
  14. While logged in as the other user, type:
  15. nano test.txt
  16. You should see the line of text you originally typed into the file.
  17. Change the line of text in the file or add a new line to the file.
  18. Save the file by pressing the Ctrl and O keys at the same time and then pressing the Enter key to accept the file name.
  19. Exit the editor by pressing the Ctrl and X keys at the same time.
  20. Change back to your username by typing this command, substituting your username for USERNAME in this example:
  21. su USERNAME
  22. View the text file by typing:
  23. cat test.txt
  24. You should see the changes you made to the file. If you don’t, go back through all the steps to make sure you did them properly.

Set Up Your Apache Web Server

Apache2 gives you a default web page that says, “It works!” You will almost certainly wish to replace or change that page. The default web page is stored in the /var/wwww folder on Ubuntu Server. Since this is a system folder, root-level privileges are required to make any changes to its contents.

Replace The Default Web Page

Replacing the default web page can be done in various ways:

  • From the command line:
    • To copy all .html pages from the shared folder to the /var/www folder, type this command on the guest machine, substituting the path to your mount point for mountpoint in the example:
    • sudo cp /home/mountpoint/*.html /var/www
    • To copy all the files in the shared folder to the /var/www folder, type this command on the guest machine, substituting the path to your mount point for mountpoint in the example:
    • sudo cp /home/mountpoint/*.* /var/www
    • In both of these examples you will be asked if you wish to overwrite index.html which is the default web page.

  • From the command line without shared folder access:
    • If you didn’t set up a shared folder and already have a web page fully made that you’d like to use, as long as you have it online somewhere you can get it from the command line. Type this command on the guest machine at the command prompt or in a terminal window, substituting the URL of the page you wish to download for ADDRESS in this example:
    • wget ADDRESS
    • For detailed help on how to work with the wget command, at a command prompt or in a terminal window, type:
    • man wget

  • From the GUI:
    • The file manager that comes with XFCE is called Thunar. To use Thunar to copy files from the shared folder to /var/www, you’ll need to launch it with root-level privileges. To do so, open a terminal window on the guest machine and type:
    • sudo thunar
    • This will launch the file manager with root-level privileges, giving you access to system folders. You can now copy or move files into the /var/www folder.

Edit The Default Web Page

If you’d like to edit the default web page instead of replacing it, this can be done from the command line or in any number of GUI text editors or HTML editors:

  • From the command line:

    If you haven’t installed a GUI Desktop, follow these instructions:

    1. Type this at a command prompt on the guest machine:
    2. sudo nano index.html
    3. Make whatever changes you like.
    4. Save the file by pressing the Ctrl and O keys at the same time.
    5. Press the Enter key to accept the path and file name if they’re correct.
    6. Exit the editor by pressing the Ctrl and X keys at the same time.

  • From the GUI:

    If you’ve installed XFCE and the Mousepad text editor, follow these instructions:

    1. Open a terminal window on the guest machine and type:
    2. sudo mousepad
    3. Make whatever changes you like.
    4. Save the file.
    5. Exit the editor.
    6. Close the terminal window.
    7. If you’ve installed some other graphical text editor or program to edit web pages with, follow steps 1 through 5, replacing mousepad with the command for your editor or program in step 1.

Visit The Default Web Page

The default web page can be accessed by opening a browser and entering this address into the address bar and substituting your server’s local (LAN) or remote (WAN) IP for IP in this example:
http://IP
IMPORTANT
If your server uses a non-default web port, you’ll need to add the port number into
the address, substituting your server’s local (LAN) or remote (WAN) IP for IP and
the port number your server uses for PORTNUMBER in this example:

http://IP:PORTNUMBER

Assign A New Port For Serving Web Pages

If you’d rather not use port 80 (the default port for web pages), you can assign a different port number to serve web pages on. To do so, you’ll need to edit the /etc/apache2/ports.conf file.

  1. On the guest machine at a command prompt or in a terminal window, type:
  2. sudo nano /etc/apache2/ports.conf
  3. Use the arrow keys to bring the cursor to the bottom of the file.
  4. Add this line to the file, replacing PORTNUMBER with the number of the port you wish to use:
  5.   Listen PORTNUMBER
  6. Save the file by pressing the Ctrl and O keys at the same time.
  7. Press the Enter key to accept the path and file name if they’re correct.
  8. Press the Ctrl and X keys at the same time to exit the editor.
  9. Restart the web server by typing:
  10. sudo /etc/init.d/apache2 restart
  11. Go into your router’s configuration and forward the new port (see your router’s documentation for how to do this).

Give Your Users Their Own Web Space

You may wish to give your users the ability to create, edit and update their own web pages. Since it would be a security risk to give them access to system folders, you can instead create a symbolic link from a folder in the user’s home folder to the web server’s folder. This way anything they change in their personal folder will immediately and automatically be linked to by the web server’s folder.

I recommended creating (or having your users create) a folder within any user’s home/username folder that has the same name as the user’s username. This will be the folder the user needs to place his or her web page (and any additional files it requires) in. If you set it up this way, then you, as the administrator, will be able to tell at a glance whose page is which in the event that you need to make any changes.

If you’ve used the above naming convention, then you can easily add any user’s web page folder to your Apache2 web server. Type this command on the guest machine at the command prompt or in a terminal window, substituting the user’s name for all instances of username:
sudo ln -s /home/username/username /var/www/username

Visit The Users’ Web Pages

The users’ web pages can be accessed by opening a browser and entering this address into the address bar and substituting your server’s local (LAN) or remote (WAN) IP for IP and the user’s username for username in this example:
http://IP/username
IMPORTANT
If your server uses a non-default web port, you’ll need to add the port number into
the address, substituting your server’s local (LAN) or remote (WAN) IP for IP, the
user’s username for username and the port number your server uses for
PORTNUMBER in this example:

http://IP:PORTNUMBER/username

Give Your Common Folder Its Own Web Space

If you have set up a common folder for your users to access, you can create a symbolic link from the common folder to the web server’s folder so you won’t need to give the users access to your system files. This way they can collaborate on the design and contents of a web page, and anything they change in the web page which is kept in the common folder will immediately and automatically be linked to by the web server’s folder. Type this command on the guest machine at the command prompt or in a terminal window, substituting the path to your common folder for /home/common and substituting the name of your common folder for common in /var/www/common in the example:
sudo ln -s /home/common /var/www/common
The common web page can be accessed by opening a browser and entering this address into the address bar and substituting your server’s local (LAN) or remote (WAN) IP for IP and the your common folder’s name for common in this example:
http://IP/common
IMPORTANT
If your server uses a non-default web port, you’ll need to add the port number into
the address, substituting your server’s local (LAN) or remote (WAN) IP for IP, the
common folder’s name for common and the port number your server uses for
PORTNUMBER in this example:

http://IP:PORTNUMBER/common

Restart The Apache Web Server

Restart the Apache web server any time you make configuration changes by typing:
sudo /etc/init.d/apache2 restart

Make SFTP And SSH Available To Yourself And Your Users

If you’d like to make Secure FTP (SFTP) and Secure Shell (SSH) available to yourself and your users, you’ll need to open port 22 from your guest machine’s IP to your router. See the router’s manual for how to do this.

SFTP

Any of your server’s users (including you) can type this command on any computer that has internet access, substituting their username for username and your server’s WAN IP for IP for those used in the example below:
sftp username@IP

The user will be prompted for their password.

You can also log onto your server from the host machine by typing this command in a terminal window, substituting your username for username and your server’s LAN IP for IP for those used in the example below:
sftp username@IP
You’ll be prompted for your password.

SSH

Any of your server’s users (including you) can type this command at the command prompt or in a terminal window on any computer that has internet access, substituting their username for username and your server’s WAN IP for IP for those used in the example below:
ssh username@IP

The user will be prompted for their password.

You can also log onto your server from the host machine by typing this command in a terminal window, substituting your username for username and your server’s LAN IP for IP for those used in the example below:
ssh username@IP
You’ll be prompted for your password.

Set Up MySQL

Administer Your MySQL Databases from the command line

See my DatabaseManagement guide for a detailed reference on MySQL administration from the command line.

Administer Your MySQL Databases with phpMyAdmin

Install phpMyAadmin

This will install an administrative interface onto the server on the guest machine. This interface will be available for use via any browser locally or remotely.

  1. Type this command at a command prompt or in a terminal window on the guest machine:
  2. sudo apt-get install phpmyadmin
  3. Select apache2 when the box pops up asking for your Web server.

Note: If you use Synaptic for this installation instead, be sure to click the details twistee to see the selection dialog.

Log On

Open a browser on the host machine or a remote computer and enter this address into the address bar, substituting your LAN or WAN IP (depending on if you are accessing the server from the host machine or a remote machine) for IP in this example:
http://IP/phpmyadmin

Enter root as the username and use the MySQL password you assigned during the Ubuntu Server install routine.

Once you log in, a page with the administrative controls for MySQL will open.

Log Off

Left-click the exit icon in the upper left corner of the screen to log off of phpMyAdmin.

Appendix

Further Information

Questions and Answers

What is a LAN?
LAN stands for Local Area Network, which basically means two or more computers or devices connected together locally (in a building or buildings) by hardware and software.

What is a WAN?
WAN stands for Wide Area Network, which basically means two or more computers or devices connected together over a large area. The entire Internet is an example of a WAN.

What is an IP address?
IP stands for Internet Protocol. Each computer or device on a LAN or WAN is assigned a number so that it can be located in the network. This number is known as an IP address. IP addresses in a LAN can be randomly assigned (Dynamic IP or DHCP) by your router or manually assigned by you (Static IP). IP addresses in a WAN can be randomly (Dynamic IP or DHCP) or statically (Static IP) assigned to your LAN by your provider.

What are the address ranges used in LANs and why do I need to know this?
There are three IP address ranges for use with Local Area Networks:

192.168.0.0 through 192.168.255.255
172.16.0.0 through 172.31.255.255
10.0.0.0 through 10.255.255.255

The first one is the most popular. The instructions in this document use 192.168.x.x. If your LAN uses one of the others, please make the appropriate substitutions using these numbers.

What is a bridge?
A bridge is a virtual ethernet device that’s treated as a real ethernet device. The bridge bypasses your usual host network settings, controlling your host and guest network settings for you. You will have full local and remote network access on the host and the guest. As soon as you take the bridge down, the bypass of your host’s network settings will be removed and your usual network settings will be fully restored.

I have a question that hasn’t been asked here. How do I ask it?
If you use the contact address at the top of this document, you will receive a reply via email and your question may be added to this section.

Troubleshooting

Most troubleshooting can be done by:

  • Making sure that you meet the requirements in the Requirements section.
  • Verifying that you have completed all of the steps in this guide.
  • Comparing your commands and files against the examples in this guide.

There’s always the possibility that something outside the scope of this document is causing trouble for you. I highly recommend that you check out the Further Information and Questions and Answers sections for further troubleshooting. If you need more help, check out my Getting Help page.



Obligatory Happy Ending

And they all lived happily ever after. The end.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Comment:

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: