Σάββατο 26 Απριλίου 2014

How to setup a Debian server in VirtualBox

      P.S: Everything i'm posting here comes from:
      http://foxfoo.com/setup-debian-server-in-virtualbox.html
      and this setup is adapted for personal use. Many thanks.

01. Install debian_cli (without gui). When “Software selection” dialog appears I select Web server, File server, Mail server, SQL server, SSH server, Standard system utilities.

02. At virtualbox when virtual machine is stopped:
      a. File -> Preferences -> Network
      b. I add to Host-only Networks the vboxnet0 (normally it comes alone once i press +).

03. During virtual machine creation, VirtualBox created a virtual network adapter using NAT. Which enables virtual machine access internet. But it bypass  host machine, so
      connection from host to virtual machine can not be established. I will use another network adapter to access virtual machine from host. When virtual machine is stopped
      i edit it’s settings not to use installation iso anymore, and i add one more network adapter, choose it’s type to “host only network” (vboxnet0). This new adapter will be used to
      comunicate with your virtual machine from your host. You can now start virtual machine again, when it starts, see if vboxnet0 adapter can be seen on host, just check
      #ifconfig (Linux) or #ipconfig (Windows) output for something similar to this:

            vboxnet0 Link encap:Ethernet HWaddr 0a:00:27:00:00:00
            inet addr:192.168.56.1 Bcast:192.168.56:.255 Mask:255.255.255.0
            inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
            UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
            RX packets:0 errors:0 dropped:0 overruns:0 frame:0
            TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000
            RX bytes:0 (0.0 B) TX bytes:3808 (3.8 KB)

    See what inet addr is given to host’s adapter to the network in which virtual machine also is accessible. Now i edit virtual machine’s /etc/network/interfaces file, so that
    connection to host could be made through eth1 network interface. The file already contains network interfaces defined:
         
            #nano /etc/network/interfaces

            # The loopback network interface
            auto lo
            iface lo inet loopback

            # The primary network interface
            allow-hotplug eth0
            iface eth0 inet dhcp

04. So i add also interface for host only networking adapter:

            # The host network interface
            auto eth1
            iface eth1 inet static
            address 192.168.56.2
            netmask 255.255.255.0

05. Note ip is 192.168.56.2, because vboxnet0 ip is 192.168.56.1 so, both IPs are on the same network. Restart the Debian virtual machine. You can now ssh to it:

            $ ssh user_name@192.168.56.2

Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου