My friend, Windows user and programmer asked me lately to help him start with Linux. Normally I don’t get involved into such activities as, almost certainly, they end up in flame war and complaints for Linux systems. But this guy has a goal. He wants to play with containers stuff under Linux as he needs it for his research. So I believe he will use it to do some actual work, not only to be a h4ck3r by means of having Linux installed. Let’s get to work then.

Software

We are going to install Ubuntu as it should be quite painless, has a vast community and most of software you would like to test is supported there. Yep, sounds good.

Ubuntu will be virtualized in VirtualBox. Why? Because it’s free and is accessible for both Linux and Windows.

Obtaining software

Ubuntu can be downloaded from here. We go for LTS edition.

VirtualBox can be downloaded from project site. Choose Windows hosts.

I won’t go into details of installation process of VirtualBox, launch instalator and press next, next, next

Creating new VM

  1. We will use NAT Networking, so we have to create a network adapter at first.
    1. Navigate to File -> Preferences.
    2. Select Network.
    3. In NAT Networks tab press add new NAT network button (icon with green network card with plus on it).
    4. Optionally name the network. Make sure that DHCP is enabled for this network.
  2. To create a VM click New button in main window.
  3. Fill up a form:
    • name: [machine_name]
    • type: Linux
    • Version: Ubuntu (64-bit)
  4. On next page set up amount of memory VM should have available. Don’t set it too high. leave something for your host if you are using it as a desktop. Och, and don’t worry, this setting can be changed later.
  5. Hard disk – check create a virtual hard disk now and click create button.
  6. Choose image format in which your new disk will be kept:
    • VDI – native VirtualBox format
    • VHD – this is a Miscrosoft’s format. If you’d ever want to transport it to VirtualPC
    • VMDK – well known image format used by VMWare, qemu and many others

    I propose to go with VDI if you don’t have any further plans for this VM.

  7. Choose between:
    • Dynamically allocated – file on your host machine will grow when more data will be written in VM
    • Fixed size – allocates all space from the beginning, no performance lost and no surprise when you fill up your disk
  8. Name your disk and set it’s maximum size. For starters I suggest about 30-50GB. Och, and do yourself a favour and choose a name that will tell you what is this enormously big file on your disk.
  9. Now we will need to edit network settings. Right click on machine name and choose settings.
    1. Choose network.
    2. Choose NAT network, not NAT.
    3. Select desired network in name combo box. It should be a network that was created at the beginning of this guide.

Good job! We have a new VM now. You can go through machines settings now. One might be interested in enabling clipboard sharing and drag’n’drop in general settings. In system tab it is good to set Hardware Clock in UTC Time – Linux likes UTC.

We want to be able to boot this machine from CD with Ubuntu image we just downloaded. Find a storage section in your virtual machine overview and click on [Optical Drive]. Click on choose disk image, navigate to Ubuntu ISO and apply.

Install Ubuntu Server LTS

Yeah, this chapter is probably written in the Internet gazillion times. So I will keep it short.

A little tip on VirtualBoxs mouse focus:
If you press a mouse button inside VirtualBox graphic window, your mouse will be grabbed by software. To release mouse press right ctrl (by default). This key is also shown on far right of status bar.

  1. Start VM by pressing start button.
  2. Choose language of boot loader.
  3. Choose Install Ubuntu Server.
  4. Choose language.
  5. Choose Country.
  6. Choose locales – I prefer to use en_US.UTF-8.
  7. Skip keyboard detection
    1. Choose keyboard layout
  8. Wait for installer configuring your network.
  9. Choose name for your system.
  10. Create a system user:
    1. Choose user name for non-administrative tasks. It is a user name like ‘John Doe’, not a login name.
    2. Choose os user name (login). Ubuntu does not allow root login via SSH and presses users to use sudo for administrative tasks. This will be user with sudo capability.
    3. Set a password for that user.
    4. There is a possibility to encrypt users home directory. Let’s skip it in our case.
  11. Set up a time zone. It should be correctly set by previous entries, if not choose it manually.
  12. Prepare a disk:
    1. One can find plenty articles about disk partitioning, but let’s make it simple stupid – Guided – use entire disk.
    2. Choose disk. It should be named sda.
      Note: If you are installing system on hard drive, not in virtualbox, make double sure that you won’t destroy your data by re-partitioning your drive.
    3. You should now end up with two partitions. One swap partition and one root (/) partition. Choose finish partitioning and write changes to disk.
    4. If you are not sure if everything is ok this is the last time when you can cancel this process without making permanent changes to your hard drive. Write changes to disk.
  13. Wait until installer finish its work.
  14. If you are in need to use of a proxy, enter it now, otherwise leave the box empty.
  15. Choose no automatic updates.
  16. Choose packages. If in doubt, choose:
    • standard system utilities
    • OpenSSH server
  17. Install the GRUB boot loader to the master boot record? Yes.
  18. Press continue to reboot to your fresh system.

Post installation tasks

We have a new virtual machine with Ubuntu Server on it. Let’s make sure all is set up.

SSH access to machine

Our new box should already have ssh server installed and running. But as we used default network configuration, which is NAT, we are not able to login to this machine. To access any port there, we need to forward it. It is possible at global VirtualBox settings. Click file menu -> preferences -> network -> NAT network tab. Right click on desired network and select edit. In dialog box you will find port forwarding option. There you should be able to set new rule. For ssh access fill in:
* NameSSH access
* ProtocolTCP
* HOST IP[blank], you can set it if you want to restrict access only for given host
* Host Port9922, it is your choice you will use that port to connect to linux box
* Guest IPip, obtain it by running ifconfig on your linux box from console
* Guest Port22

From now on, you should be able to connect to your linux box by making a connection to your host on port 9922.

Leave a Reply