View on GitHub

Computer Architecture and Operating Systems

Course taught at Faculty of Computer Science of Higher School of Economics

Contents

Ubuntu in VirtualBox

  1. Run VirtualBox in your laptop.

  2. Click “New” in the VirtualBox toolbar.

    VirtualBox New

  3. In the dialog, specify machine name as “ACOS Ubuntu 20.04 LTS” and click “Continue”.

    VirtualBox New Ubuntu

  4. Allocate for the new virtual machine 2048 MB of RAM. Click “Continue”.

    VirtualBox Ubuntu Size

  5. Select “Create a virtual hard disk now” and click “Create”.

  6. Specify hard disk file type as “VDI (VirtualBox Disk Image)” and click “Continue”.

  7. Specify storage on physical hard disk as “Dynamically allocated” and click “Continue”.

  8. Specify file location and size for the virtual disk and press “Continue”. Location is default. Recommended size is 16 GB.

    VirtualBox Virtual Disk

  9. Now the virtual machine is created. The next step is to install Linux Ubuntu in it.

  10. Select the “ACOS Ubuntu 20.04 LTS” virtual machine and click “Start” in the toolbar.

    VirtualBox VM Start

  11. In the dialog that appears, select the downloaded .iso image with Linux Ubuntu distribution (e.g. ubuntu-20.04.1-desktop-amd64.iso) to start the virtual machine from. Click “Start”.

    VirtualBox Select ISA

  12. VirtualBox will run the virtual machine, which will start loading the Linux Ubuntu distribution from the .iso file.

  13. When the Ubuntu installer is loaded, click “Install Ubuntu”.

    VirtualBox Install Ubuntu

  14. Select “English (US)” for the keyboard layout and click “Continue”.

  15. Select “Minimal installation” and click “Continue”. We do not need a full installation. Many tools are useless for us. Later we will install tools that we need.

    VirtualBox Install Minimal

  16. Select installation type as “Erase disk and install Ubuntu” and click “Install Now”.

    VirtualBox Erase Disk

  17. In the appearing “Write the changes to disk?” dialog, click “Continue”.

  18. In the “Where are you?” dialog, specify “Moscow” and click “Continue”.

  19. Specify your name as “ACOS” (username will be “acos”), computer name as “acos-vm”, and password as “acos2020” (or as you wish). Click “Continue”.

    VirtualBox Ubuntu Password

  20. Wait for Ubuntu to be installed. This will take about 1 hour.

    VirtualBox Ubuntu Installing

  21. When installation is finished, restart the virtual machine.

    VirtualBox Ubuntu Restart

  22. Virtual machine “ACOS Ubuntu 20.04 LTS” will start.

    VirtualBox Ubuntu Started

  23. Network must work in the virtual machine.

    VirtualBox Ubuntu Browser

SSH and port forwarding

After Linux Ubuntu is installed in VirtualBox, we need to make sure that the network interface is enabled and set up port forwarding. We need to set up forwarding for port 22 in order to be able to connect to the Ubuntu Linux VM from our host operating system using SSH.

Configuring the virtual machine in VirtualBox:

  1. Select the “ACOS Ubuntu 20.04 LTS” virtual machine and click “Settings” in the toolbar.
  2. In the dialog, switch to the “Network” page and click “Port Forwarding”.

    VirtualBox Ubuntu Port Forwarding 1

  3. Set up a rule for port forwarding. 127.0.0.1 is the local host IP address, 2022 is the port used for forwarding, 10.0.2.15 is the IP address for the guest OS (Linux Ubuntu), 22 is the SSH port in Linux Ubuntu.

    VirtualBox Ubuntu Port Forwarding

  4. Click “OK” to apply the settings.

  5. Start the Ubuntu VM.

Set up SSH in Linux Ubuntu

  1. Open “Terminal” (Ctrl+Alt+T) and execute the following command to install and run the SSH server:

    acos@acos-vm:~$ sudo apt install openssh-server
    

Connecting to Ubuntu via SSH

After SSH server is installed, you can connect to from terminal of your host operating system using the following command:

ssh acos@localhost -p2022

VirtualBox Ubuntu Connect SSH

To disconnect, you can type the exit command.

Git

Git is a version-control system that we well use to get and put source code to GitHub.

To install it, open Terminal (Ctrl+Alt+T) in Ubuntu or connect via SSH and execute the following command:

acos@acos-vm:~$ sudo apt install git

GCC

GCC is required to compile C programs created in classes and external open-source tools that will be used in classes.

GCC can be installed using the following command:

acos@acos-vm:~$ sudo apt install gcc

Java

If you want to run the RARS simulator inside the Ubuntu virtual machine, you need to install Java. Also, you may need a Java compiler.

Execute the following commands:

acos@acos-vm:~$ sudo apt install openjdk-8-jre-headless
acos@acos-vm:~$ sudo apt install openjdk-8-jdk-headless