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 using GDebi(http://nairabytes.net/linux/install-virtualbox-using-gdebi-in-debian): (same tutorial applies to other Debian versions), or install VirtualBox from Debian Terminal(http://nairabytes.net/linux/how-to-install-virtual-box-from-debian-terminal)

2) Install Ubuntu on Debian using VirtualBox: install Ubuntu on Debian using VirtualBox(http://nairabytes.net/linux/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(http://nairabytes.net/linux/how-to-setup-a-complete-lamp-server-on-ubuntu-in-2-two-easy-steps)

b) How to setup LAMP server on Debian: how to setup a LAM server on Debian-6 Squeeze(http://nairabytes.net/linux/how-to-setup-a-lamp-server-on-debian-6-0-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-1

... 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-1

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-1

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-1

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:

Tutorial: How to configure Samba Server share on Debian-9 Stretch Linux(http://nairabytes.net/linux/how-to-configure-samba-server-share-on-debian-9-stretch-linux)

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

Tutorial: How to Install Webmin on Ubuntu(http://nairabytes.net/linux/how-to-install-webmin-on-ubuntu-release-12-04-5)

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!!!

You have no rights to post comments