Ubuntu 20.04 Install and Setup (Stand-alone or as VM) icon

Ubuntu 20.04 Install and Setup (Stand-alone or as VM)

by Danilo Ramos

Apr 5, 2023

Prerequisites

  • Intel/AMD amd64/x86 processor (>1GHz, >2GB RAM, >10GB hard drive)

The requirements for any OS vary accordingly to the final use of the desktop. For a more detailed explanation check my post Workstation Requirements.

Introduction

This is a step-by-step Ubuntu OS installation. It targets Ubuntu 20.04 LTS, but it could work as a guide for other versions.

For a quick - semi-automated installation check Ubuntu - Quick Install

Installation

  1. Download Ubuntu from Ubuntu 20.04.4 LTS (Focal Fossa)
    1. desktop Host: create a bootable USB - you can use Rufus and enable your BIOS to boot from the USB drive
    2. VirtualBox VirtualBox: create a new VM and under settings add the downloaded ISO file to Storage > IDE > Choose a disk file
    3. img VMWare Player create a new VM
  2. Boot or start the VM
  3. Run Install Ubuntu from the menu
    1. Select Minimal Installation
    2. Add user
    3. Wait
  1. Done!

First Step

Run VM and log into Ubuntu.

# right click on the middle of the screen
# -> Open in Terminal
sudo apt update -y; sudo apt upgrade -y; sudo apt autoremove -y; sudo reboot

Basic R&D setup

# For USB/UART serial access
sudo adduser $USER dialout

# Dev dirs
cd ~
mkdir -p dev tools repos

Basic Development Tools & Packages

# Required apps
sudo apt install -y build-essential git graphviz gtkwave screen tmux tree vim python3 python3-pip python3-tk meld

# Setup git credentials
git config --global user.email "yout@email"
git config --global user.name "Your Name"

Shortcut

# To do setup with devsetup scripts
sudo apt install -y git
cd ~/dev
git clone git@github.com:dramoz/devsetup.git
cd ~

# Clone repository with scripts to automate installation
~/dev/devsetup/scripts/ubuntu_setup.sh

# Note: -> split script in two, first install virtualenv, source .bashrc and then do rest
# -> create dev + hdl + ml env separately
~/dev/devsetup/scripts/dev_setup.sh

SSH Keys

Add access to GitHub with SSH key

ssh-keygen -t ed25519 -C "your@email"
# Test ssh agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub
#Goto: <https://github.com/settings/keys>

Add access to Azure DevOps with SSH key

ssh-keygen -C "your@email"
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
#Goto: <https://COMPANY.visualstudio.com/_usersSettings/keys>

Virtual Machine (Guess)

Virtual Box (Guest Additions)

# From VM menu
# -> Devices.Insert Guest Additions...
# -> Follow instructions

# Restart machine
sudo adduser $USER vboxsf
sudo reboot

VMWare

# Mouse wheel fix
sudo apt remove xserver-xorg-input-libinput && sudo apt install xserver-xorg-input-evdev

Setup Development Tools

Setup Python Virtualenv

# Python Virtual Env (just in case)
sudo apt purge -y python3-virtualenv
pip3 install virtualenv virtualenvwrapper

# Check paths
which virtualenv
/home/user/.local/bin/virtualenv

# Optional (if using devsetup)
cp ~/dev/devsetup/scripts/.bashrc ~/
source ~/.bashrc

# ------------------------------------------------------------
# Alternative:
# Update .bashrc accordingly
echo '# virtualenv and virtualenvwrapper' >> ~/.bashrc
echo 'export WORKON_HOME=${HOME}/.virtualenvs' >> ~/.bashrc
echo 'export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3' >> ~/.bashrc
echo 'export VIRTUALENVWRAPPER_VIRTUALENV=$HOME/.local/bin/virtualenv' >> ~/.bashrc
echo 'source $HOME/.local/bin/virtualenvwrapper.sh' >> ~/.bashrc
source ~/.bashrc
# ------------------------------------------------------------

Cleanup

sudo apt -y update; sudo apt -y upgrade; sudo apt -y autoremove; sudo reboot

Setup dev virtualenv (optional)

cd ~
mkvirtualenv dev
pip install -r dev/devsetup/virtualenv/full_dev_requirements.txt

Troubleshooting

  • ping name.local not working (bonjour)
    # Test 
    sudo systemctl status avahi-daemon
    # -> shows "Active: starting up..." (permanently)
    sudo apt purge avahi-daemon
    sudo reboot
    sudo apt install avahi-daemon
    sudo systemctl status avahi-daemon
    # -> should show now "Active: active (running)"
    

Additional settings

Open Settings (left click on power icon - top right corner, > Settings)

  • Power > Blanc Screen: Never

Useful Apps (optional)

Open Ubuntu Software App and install:

  • Visual Code : it takes some time as it has to install snap first
  • Brave : web browser (enable sync)
  • pyGrid

💡 Don’t forget right click on the app, Add tofavouritess

Gnome Extensions (optional)

sudo apt install gnome-shell-extensions chrome-gnome-shell
firefox --new-window <https://extensions.gnome.org/> &

Install Gnome Shell Extension (firefox plugin) 💡Click here to install browser extension. Reload webpage

Extensions

Open Tweaks App and click Extensions from applications to change extensions settings

Other Apps

balenaEtcher - Flash OS images to SD cards & USB drives

  • Jekyll (GitHub Pages) (Free hosting with GitHub Pages) GitHub Pages

    # Install dependencies
    sudo apt-get install ruby-full build-essential zlib1g-dev
      
    # Update .bashrc for Gems directory
    echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
    echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
    echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
    source ~/.bashrc
      
    # install
    gem install jekyll bundler
    

    Simple website

    # Create new website
    cd ~/dev
    jekyll new myblog
    cd myblog
      
    # Run in background
    screen -S myblog_dev
    bundle exec jekyll serve --livereload
    # ctrl + a, d  (detach screen session)
      
    # Load website
    firefox <http://127.0.0.1:4000/> &
    

Shared Folder

# https://www.techrepublic.com/article/share-directories-lan-from-ubuntu-desktop-22-04/
# Open Files
# -> goto folder
# -> right click, select "Local Network Share", enable share
# -> proceed to install App (samba)
# -> goto folder and disable share

# Add user to samba group
sudo gpasswd sambashare -a USER
sudo smbpasswd -a USER
# -> create password

# Add shared to Samba Conf.
sudo gedit /etc/samba/smb.conf
# -> add to the bottom:

[FOLDER_NAME]
path = /home/USER/FOLDER_NAME
browsable = yes
writable = yes
read only = no