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.
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.
Ubuntu can be downloaded from here. We go for LTS edition.
VirtualBox can be downloaded from project site. Choose
I won’t go into details of installation process of VirtualBox, launch instalator and press next, next, next…
Creating new VM
- We will use NAT Networking, so we have to create a network adapter at first.
- Navigate to File -> Preferences.
- Select Network.
- In NAT Networks tab press add new NAT network button (icon with green network card with plus on it).
- Optionally name the network. Make sure that DHCP is enabled for this network.
- To create a VM click New button in main window.
- Fill up a form:
- name: [machine_name]
- type: Linux
- Version: Ubuntu (64-bit)
- 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.
- Hard disk – check create a virtual hard disk now and click create button.
- 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.
- 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
- 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.
- Now we will need to edit network settings. Right click on machine name and choose settings.
- Choose network.
- Choose NAT network, not NAT.
- 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.
- Start VM by pressing start button.
- Choose language of boot loader.
- Choose Install Ubuntu Server.
- Choose language.
- Choose Country.
- Choose locales – I prefer to use en_US.UTF-8.
- Skip keyboard detection
- Choose keyboard layout
- Wait for installer configuring your network.
- Choose name for your system.
- Create a system user:
- Choose user name for non-administrative tasks. It is a user name like ‘John Doe’, not a login name.
- Choose os user name (login). Ubuntu does not allow root login via SSH and presses users to use
sudofor administrative tasks. This will be user with
- Set a password for that user.
- There is a possibility to encrypt users home directory. Let’s skip it in our case.
- Set up a time zone. It should be correctly set by previous entries, if not choose it manually.
- Prepare a disk:
- One can find plenty articles about disk partitioning, but let’s make it simple stupid – Guided – use entire disk.
- 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.
- You should now end up with two partitions. One swap partition and one root (/) partition. Choose finish partitioning and write changes to disk.
- 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.
- Wait until installer finish its work.
- If you are in need to use of a proxy, enter it now, otherwise leave the box empty.
- Choose no automatic updates.
- Choose packages. If in doubt, choose:
- standard system utilities
- OpenSSH server
- Install the GRUB boot loader to the master boot record? Yes.
- 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:
* Name – SSH access
* Protocol – TCP
* HOST IP – [blank], you can set it if you want to restrict access only for given host
* Host Port – 9922, it is your choice you will use that port to connect to linux box
* Guest IP – ip, obtain it by running
ifconfig on your linux box from console
* Guest Port – 22
From now on, you should be able to connect to your linux box by making a connection to your host on port 9922.