Ubuntu 18.0.4.2 Set up on VirtualBox - weaponsforge/fastractor GitHub Wiki

Content


Requirements

  1. Host Machine - Windows 64-bit OS

    NOTE: A machine with the following specs is used for this tutorial.

    • Windows 10 Pro
    • Processor: Intel(R) Core(TM) i7-6700HQ @ 2.60GHz 2.60GHz
    • RAM: 16 GB
    • GPU: GeForce GTX 1060
      • Dedicated GPU Memory: 6 GB
      • GPU Memory: 14 GB
      • Shared GPU Memory: 8 GB
  2. Oracle Virtual Box

    • Version 6.1.14 r140239 (Qt5.6.2
  3. Ubuntu OS ISO image

  4. Stable internet connection


VirtualBox Installation and Set-up

  1. Install VirtualBox using the installer.
  2. When prompted for selections, do not select anything and just choose the default settings.

Create an Ubuntu VM in VirtualBox

  1. Press the New button (beside the Settings (gears) button.
  2. Select the following for the Name and operating system options:
    • Name - (type any name for your VM)
    • Machine Folder: (select your target directory)
    • Type: Linux
    • Version: Ubuntu (64-bit)
    • Press the Next button.
  3. Set the following:
    • Memory Size: 2048 (or higher as needed, 4096)
    • Hard Disk File Type: VDI (Virtualization Disk Image)
    • Storage on physical hard disk: Dynamically allocated
    • File location and size
      • Name: enter or select your target directory and filename.
      • Virtual hard disk size in MB: 32 GB or adjust according to your needs
    • Hard Disk - Create a virtual hard disk now
  4. Press the Create button.

Install Ubuntu OS in the VM

Launch the Ubuntu OS Installer

  1. Launch VirtualBox and click your target VM from the left panel list.
  2. In the right-side panel of the VM you clicked
    • Go to Storage -> Controller: IDE Secondary Master
    • Click the [Optical Drive] Empty label
    • Select Choose a disk file...
      • Find and select the Ubuntu ISO image ubuntu-18.04.2-desktop-amd64.iso
  3. Press the Start (Show) button and wait for the Ubuntu OS installation UI to appear.

Install Ubuntu

The steps below follow from the previous section Launch the Ubuntu OS Installer.

  1. Select Install Ubuntu.
  2. Enter your desired username in the "Type here to test your keyboard" on the Keyboard layout screen.
    • IMPORTANT: keyboard strokes won't be detected on the succeeding screens, so be sure to copy your username from the next sub-step.

    • highlight the text you've entered. Right + Click and Select
    • Press Continue
  3. Select the following options In the Updates and other software screen:
    • What apps would you like to install to start with? - Normal installation
    • Other options
      • Select Download updates while installing ubuntu
      • Select Install third-party software for graphics and Wi-Fi hardware and additional media formats
    • Press Continue
  4. Select the following options in the Installation type screen:
    • Erase disk and install ubuntu
    • Press Install Now
  5. If a prompt Write the changes to disks appear, press Continue to proceed with the installation.
  6. Enter your location (or just accept the default value) in the Where are you? screen.
    • Press Continue
  7. Fill in the input fields in the Who are you? screen.
    • Paste the username you have typed earlier on Step #2 if keyboard input is not working
    • Press Continue
  8. Wait for the installation to finish.
  9. Press the Restart Now button when prompted after finishing the installation.
  10. Ubuntu will load and a message will appear: Please remove the installation medium, then press ENTER:
  • VirtualBox has already removed the Ubuntu installer ISO image at this point. Verify that it is indeed removed on VirtualBox Storage -> Controller: IDE IDE Secondary Master (this should be [Optical Drive] Empty
  • Press Enter
  1. Wait for Ubuntu to boot.
  2. View your Linux version. uname -m && cat /etc/*release

Post Installation Actions

  1. Login your Ubuntu VM
  2. Be sure you have internet connection.
    • Click the Software Updater icon to check for updates.
  3. Install the latest Ubuntu updates.
    • be sure you have internet connection.
    • wait for a few moments until the Software Updater prompt appears.
    • Press the Install Now button.
    • Look for the Software Updater button. Wait for updates to finish installing.
    • Choose to Restart Now when prompted.
  4. Install the VirtualBox Guest Additions, a set of drivers and system utilities intended to improve usability and VM performance as well as tight integration with a host OS.
    • Install the following dependencies if they are not yet already installed:
      • gcc
      • make
      • perl
      • quick install command:
sudo apt-get update
sudo apt-get install -y gcc make perl
  - install gcc 9 (and associated make) [link](https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91)  
NOTE: sudo apt autoremove (when prompted)
sudo apt-get update -y && 
sudo apt-get upgrade -y && 
sudo apt-get dist-upgrade -y && 
sudo apt-get install -y build-essential linux-headers-`uname -r`
sudo apt-get install build-essential software-properties-common -y && 
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && 
sudo apt-get update -y && 
sudo apt-get install gcc-9 g++-9 -y && 
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 && 
sudo update-alternatives --config gcc
  • install dependencies for the virtualbox guest addons (if you chose the quick install command):
sudo apt-get update
sudo apt-get install -y build-essential linux-headers-`uname -r`
  • On the running Ubuntu VM screen,
  • Press Devices
  • Select Insert Guest Additions CD Image...
  • When the "VBox_GAs_6.1.14" prompt appears, press Run
  • When prompted to restart, restart from the command line:
    sudo shutdown -r now
  1. Do not unmount "VBox_GAs_6.1.14" on succeeding sessions. Create a backup of your VM.

Connect a Shared Windows Directory

NOTE: The following steps requires to have the virtualbox guest addons installed. See previous section for more info.

  1. Boot up the Ubuntu VM carrying from the last section.
  2. Copy the windows path of your target directory to share, i.e.
    D:\DEV\Portal
  3. Open VirtualBox. Go to Settings -> Shared Folders.
  4. Press the Add button. Fill up the following input fields:
    • Folder Path: D:\DEV\Portal
    • Folder Name: (any name i.e., portal)
    • Auto-mount: (checked)
    • Mount point: /home/adminuser/portal (or any other paths)
  5. Set the shared folder directory permissions (for Ubuntu).
cd ~/
sudo adduser $USER vboxsf
sudo su
cd portal/
sudo shutdown -r now
  1. Use the following command for Centos 8 instead of sudo adduser $USER vboxsf (from #5): usermod -a -G vboxsf $USER
  2. The host folder should now be accessible inside the VM from
    /home/adminuser/portal
  3. Repeat from step #1 - #4 on every VM boot up. We will not make a permanent shared folder mount for optimization purposes.

Install Development Tools in the Ubuntu VM

  1. Install Git if its not yet installed.
sudo apt install git
git --version
  1. Install nvm

    • fetch the script and install nvm
      wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
    • restart the terminal and verify the nvm version
      nvm --version
  2. Install NodeJS using nvm.

    • list available nodejs versions
      nvm ls-remote
    • install target nodejs version
      nvm install 12.18.4
  3. Install curl
    sudo apt install curl

  4. Install cmake

    • checkout the latest cmake release version from https://github.com/Kitware/CMake/releases/
    • wget the latest cmake wget https://github.com/Kitware/CMake/releases/download/v3.18.3/cmake-3.18.3.tar.gz
    • extract the downloaded cmake archive tar -zxvf cmake-3.18.3.tar.gz
    • install cmake
cd cmake-3.18.3
./bootstrap
make
sudo make install
  • alternate (shorter) install
    ./bootstrap && make && sudo make install

References

1(https://gist.github.com/estorgio/0c76e29c0439e683caca694f338d4003) - connect a shared folder to ubuntu in virtualbox