In this tutorial, I'll explain how I set up Ubuntu Linux as a development server on a Debian host using Virtual Box.

Debian host specification:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

1) Install VirtualBox on Debian Host:
Install VirtualBox on Debian: (same tutorial applies to other Debian versions), or install VirtualBox from Debian Terminal

2) Install Ubuntu on Debian using VirtualBox: install Ubuntu on Debian using VirtualBox

3) Some tutorials on Installing LAMP in Debian:

a) How to setup a complete LAMP Server on Ubuntu in 2-easy steps: how to setup a complete LAMP server in 2-easy steps

b) How to setup LAMP server on Debian: how to setup a LAM server on Debian-6 Squeeze

 

Back to Ubuntu installation on VirtualBox...step#2 above:

During my Ubuntu-16.04 Server installation, I select the following packages:

ubuntu-dev-server0

... LAMP Server
... Samba File Server
... OpenSSH Server

If your Ubuntu server is already installed, type "tasksel" on terminal to choose additional packages to install.

click Continue.

You will get prompted for
MySQL root user and password

4) Accessing your Guest-OS from the Host:

By default, the Guest-OS on VirtualBox will use your Host-OS' NICs. My host-OS has 2-NICs.

This is how I setup the Guest-OS VirtualBox's network settings: (settings >> network >> network):
Adapter-1 = attached to NAT
Adapter-2 = attached to Bridged Adapter. Adapter-name(enp0s8) - my second adapter is manually configured as follows:

/etc/network/interfaces configuration is as below
source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp0s3
iface enp0s3 inet dhcp

auto enp0s8
iface enp0s8 inet static
address 192.168.150.50
netmask 255.255.255.0

5) Interface#2 IP configuration on my host:
the second adapter on my host is configured with IP below:
address 192.168.150.30
netmask 255.255.255.0

thus, communication between Guest and Host is possible. I can ping back and forth, login via SSH from Host to Guest and vice-versa.

After LAMP installation, verify that the server is running. Type the IP of your Guest-OS on your Host's web-browser, you'll get the Apache default page:

ubuntu-dev-server2

6) Install PHPMyAdmin on the Guest-OS
PHPMyAdmin can be installed with a simple command: apt-get install phpmyadmin

You will get a couple of prompts:
Package-configuration = click apache2 and ok
PHP configuration prompt: configure datatase for phpmyadmin with dbconfig-common = YES

ubuntu-dev-server3

7) Verify that PHPMyAdmin is running:
Type the <guest-os-ip-address/phpmyadmin> on your host's browser, you should see the login page of PHPMyAdmin. Confirm you can login with the username & password entered in the last part of step#3 above.

ubuntu-dev-server4

8) Configure Samba, so that we can easily move files between Host and Guest.

We need to edit the configuration file for samba located at /etc/samba/smb.conf
command: sudo nano /etc/samba/smb.conf

a) confirm that Samba is installed:
command: whereis samba
command: dpkg -l samba

b) install smbclient:
command: sudo apt-get install smbclient

c) Samba needs a samba password for the user account:
sudo smbpasswd -a <username>....username must be a valid system account

d) Create a directory to be shared: mkdir /home/<username>/<directory name to share>/

We will add a simple configuration to samba and restart the service. Refer to the below tutorials on configuring a Samba server, or using Webmin to setup and manage a Samba server:

If you need to manage several samba shares, Webmin comes in handy:

e) Restart Samba to effect the configuration:
command: sudo service smbd restart

confirm if Samba and the share is working correctly. Open your host file-manager and type this: smb://192.168.150.50/

You would be prompted for login credentials.

ubuntu-dev-server8


Confirm you can move / copy files to and fro the shared folder on the Guest-OS. I usually share my www directory, so that I have full access to move files to an fro, as well as edit files / code real-time. This is a better alternative to running an FTP client / Server between host and gues.

Enjoy!!!

Add comment


Security code
Refresh