Here is how to install Ubuntu in a virtual machine "Virtual Box" and set up an ssh server. Reference: Practical Ubuntu Linux Server for beginners
First install the free version of Virtual Box from Oracle website: https://www.virtualbox.org/ . Then open the program and let's create a new virtual machine from the button new.
Note: Ubuntu requires around 10GB of disk space and please make sure that all visualization instructions and software code protections are enabled within your BIOS.
Then we download the latest Ubuntu version from http://cdimage.ubuntu.com/daily-live/current
Now is time to start the virtual machine and open up the Ubuntu .iso file. The installation will start, where is important to choose the root partition mount point/.
Here is how to do the installation:
After finishing installation it is time to install the networking, but first please update the system by opening a terminal (Ctrl+t):
# sudo apt update
# sudo apt dist-upgradeIf you wish to install ssh server and use it within your network, this can be done the following way: To install an ssh-server in a terminal type:
# sudo apt install ssh-serverThen we have to remove the built-in network manager(which will mess with the static IP addressing we need to set) via:
# sudo apt purge network-managerAt this point you may notice that other virtual boxes could not contact your machine, this is because you have to set the virtual box networking model. So open VirtualBox Ubuntu image settings and set the virtual machine networking from NAT to BRIDGED, which means that it can use private addresses and set up servers on. Warning this will stop your internet access. Then restart the ubuntu virtual machine and is time to set up our network so type:
# sudo ifconfig eth0 192.168.0.1 netmask 255.255.255.0 upthis will set up your network interface card. If you want to make the changes persistent on the next restart you can place this information in /etc/network/interfaces file:
# sudo nano /etc/network/interfacesiface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
gateway 192.168.0.255
next you can do the same steps for other virtual installations of Ubuntu.
and try to connect to 192.168.0.1 via ssh client
# ssh 192.168.0.1 -l username
That's it. Enjoy learning !