How to Install Ubuntu 20.04 and VirtualBox on Your Computer

In this tutorial, we will install Ubuntu and Virtual Box on our personal computer. My machine is running Windows 10. Let’s walk through this whole process, step-by-step, so you understand how to do it no matter what operating system you have.

Ubuntu is a popular distribution (i.e. flavor) of the Linux operating system and is fully supported by ROS, the most popular framework for writing robotics software.

The process for installing Ubuntu has a lot of steps, so be patient and don’t give up if something isn’t working. Let’s get started!

You Will Need


Download the Ubuntu Image

Check Ubuntu Releases to find the latest version of Ubuntu that has long term support (LTS). As of the date of this writing, the latest version is Ubuntu 20.04 LTS (Focal Fossa), so click on that one. 


Download the 64-bit PC (AMD64) desktop image (.iso file). It is a large file (about 2.5GB) and will take quite a while to download. Just go do something else and come back to it when it is finished.

Before you install the Ubuntu you just downloaded, you need to install Virtual Box. Virtual Box extends the capabilities of your host computer (i.e. your laptop or desktop PC) by enabling you to install and run an operating system in a new environment on top of your current operating system (Windows 10 in my case). The environment the new operating system will run in is known as a virtual machine (or guest).

Install VirtualBox

Go to the VirtualBox downloads page and select the version that is compatible with your computer. Install it. Once you’re done, your screen should look like this:


Detailed installation instructions for all operating systems (Windows, Mac OS, Linux, and Solaris) can be found in the instruction manual.

You can now delete the original executable file for VirtualBox (the one with the .exe extension). You don’t need it anymore.

Create a Virtual Machine

Now that VirtualBox is installed on your computer, we need to create a new virtual machine.

Open Virtual Box and click the New button in the toolbar.


Type in a descriptive name for your operating system. You can stick with the default machine folder. The machine folder is where your virtual machines will be stored. I prefer to install it on the D drive where I have more space.


Also, select the operating system that you want to later install (Linux and Ubuntu_64 in the Type and Version fields).

Click Next to proceed.

The default memory size for me is 1024 MB. That is not sufficient for our purposes, so let’s raise it to 6470 MB, and then click Next to proceed.


Make sure “Create a virtual hard disk now” is selected, and click Create.


Select “VirtualBox Disk Image (VDI)”, and click Next.


Choose a Fixed size virtual hard disk so that you have better performance, and click Next.


Go with something like 50 GB for the hard disk space. Then click Create.


It will take several minutes to create the virtual hard disk, so be patient.


Install Ubuntu

Double-click on the left panel where you see the name of the virtual machine you just created.


A startup window will appear.

Click the Folder icon next to Empty. A popup box will appear that is titled “Optical Disk Selector.”

Click Add.


Find the Ubuntu image you downloaded earlier in this tutorial. It is a .iso file. Select it.

Click Choose.

Click Start to proceed with that Ubuntu image.

Ubuntu should start launching.


Click on “Install Ubuntu” to install Ubuntu. You should see a window that looks something like this.


Click “Continue” to save the keyboard layout. The default English one is fine.

Select “Normal installation” and “Download updates while installing Ubuntu.” Then click Continue.


Select “Erase disk and install Ubuntu”. Then click “Install Now”.


Click Continue when it asks “Write the changes to the disks?”.

You will get to a point where you will need to set your time zone. It will be a big map of the world that should automatically detect your location. Click Continue.

Type in a computer name and pick a username and password. I select the “Log in automatically” option.

When installation is complete, click “Restart Now.”


A message will say “Please remove the installation medium, then press ENTER:”. Just ignore it.

Go to File -> Close in the upper left part of the window.

Select “Power off the machine.” Click OK.

In the “Oracle VM Virtual Box Manager” window, highlight your virtual machine and click the green arrow up top that says “Start”.

You should now see your Ubuntu Linux desktop.


Click the small white arrow in the upper-right portion of the screen. “Power Off” the machine.


Alternatively, you can open up a terminal window and type the following command:

sudo shutdown -h now

Highlight your virtual machine and go to Settings → Display and change your Video Memory to 128 MB. This will give you ample video memory. Click OK.


Also go to Settings → System → Processor, and adjust the number of CPUs to 4. Then Click OK.


To make your screen larger, log back into Linux and go to your Settings. Then go to Display, and select your desired resolution.


If you have issues where your screen flips to portrait mode and gets stuck there, press CTRL + Alt + F1 to return to the login screen to fix the resolution.

Congrats! You’re done!

How to Blink an LED Using NVIDIA Jetson Nano

In this tutorial, we will blink an LED using NVIDIA Jetson Nano. I will show you how to use Python to blink an LED, and I will show you how to use C++ to blink an LED. Here is what you will build:



You have already set up your NVIDIA Jetson Nano (4GB, B01).


You Will Need

This section is the complete list of components you will need for this project (#ad).

Disclosure (#ad): As an Amazon Associate I earn from qualifying purchases.

Set Up the Hardware

The first thing we need to do is to set up the hardware. 

Gather all of the items from the “You Will Need” section and lay them out on a table.

The NVIDIA Jetson Nano board has 40  general-purpose input/output pins (GPIO). Each pin can either be an input (e.g. connecting the Jetson Nano to a sensor) or an output (e.g. an LED). GPIO pins on the Jetson Nano use 3.3V by default.


In order to get the LED to blink, we need to connect it to one of the 40 GPIO pins. Make sure you set everything up exactly like this image below:

  • Connect the 220 Ohm resistor to the positive pin of the LED (i.e. the long leg).
  • Connect the other end of this resistor to GPIO pin 7 on the Jetson Nano. 
  • Connect the negative pin of the LED (i.e. the short leg) to the GND pin on the Jetson Nano.

The connections are made using Male-Female jumper wires.

Blink an LED Using Python

Set Up the NVIDIA GPIO Library for Python

Let’s set up NVIDIA Jetson Nano GPIO.

Open a terminal, and type the following command.

sudo pip3 install Jetson.GPIO

If that command above doesn’t work, type the following command:

sudo pip install Jetson.GPIO

When I typed these commands, I got a message which a bunch of warning signs, but at the end of all that the following text was printed to the console:

“Requirement already satisfied…”

This message means that the GPIO library for Python is already installed on my Jetson Nano.

Reconfigure security permissions. Instead of your_user_name, I used automaticaddison, which is my username.

sudo groupadd -f -r gpio
sudo usermod -a -G gpio your_user_name

Reboot the computer.

sudo reboot

Let’s check to see if the library is fully setup.

>>> import Jetson.GPIO as GPIO

Here is what I see:


Write the Code

Create a new folder. Open up a new terminal, and type:

cd Documents
mkdir led_blink
cd led_blink

Let’s create a program to blink the LED. 

Create a file named

# GPIO library
import Jetson.GPIO as GPIO

# Handles time
import time 

# Pin Definition
led_pin = 7

# Set up the GPIO channel
GPIO.setup(led_pin, GPIO.OUT, initial=GPIO.HIGH) 

print("Press CTRL+C when you want the LED to stop blinking") 

# Blink the LED
while True: 
  GPIO.output(led_pin, GPIO.HIGH) 
  print("LED is ON")
  GPIO.output(led_pin, GPIO.LOW)
  print("LED is OFF")

Run the Code

You can run your program,, in the Terminal. Type this command:


If you get any errors due to security issues, you can run the file with the sudo command. 

sudo python3

You should see the LED blinking.


You should also see output in the terminal.

Press CTRL+C when you’re ready to stop the program.

To shutdown your Jetson Nano, you can type:

sudo shutdown -h now

Blink an LED Using C++

Set Up the NVIDIA GPIO Library for C++

Let’s install the C++ Jetson GPIO library, so we can see how to blink an LED using C++.

Make sure you’re connected to the Internet, and open a new terminal window.

git clone
cd JetsonGPIO/build
make all
sudo make install

Reboot your machine.

sudo reboot

See if the header file for the C++ GPIO Library for Jetson Nano is on your machine. The command below will show the path to the header file.

find /home -name JetsonGPIO.h

Write the Code

Go to the led_blink directory.

cd Documents/led_blink

Open a new C++ program.

gedit led_blink.cpp

Write the following code. We want to blink an LED every 0.5 seconds:

// Handles input and output
#include <iostream>

// For delay function
#include <chrono> 

// Handles threads of program execution
#include <thread>

// Signal handling
#include <signal.h>

#include <JetsonGPIO.h>

// Pin Definitions
int led_pin = 7;

// Flag to determine when user wants to end program
bool done = false;

// Function called by Interrupt
void signalHandler (int s){
  done = true;

int main() {

  // When CTRL+C pressed, signalHandler will be called
  // to interrupt the programs execution
  signal(SIGINT, signalHandler);

  // Pin Definitions 

  // LED pin gets set to high initially
  GPIO::setup(led_pin, GPIO::OUT, GPIO::HIGH);

  std::cout << "Press CTRL+C to stop the LED" << std::endl;

  int curr_value = GPIO::HIGH;

  // Blink LED every 0.5 seconds
  while(!done) {


    curr_value = GPIO::HIGH;

    GPIO::output(led_pin, curr_value);

    std::cout << "LED is ON" << std::endl;


    curr_value = GPIO::LOW;

    GPIO::output(led_pin, curr_value);

    std::cout << "LED is OFF" << std::endl;


  return 0;

Save the file, and close it.

See if your file is in there.


Run the Code

Compile the program.

g++ -o led_blink led_blink.cpp -lJetsonGPIO 

(That is a lowercase L in front of Jetson above)

See if the executable is in the current directory.


You should see a new file named led_blink.

If you see an error, check your program to see if it is exactly like I wrote it.

Run the program.


You should see the LED blinking every 0.5 seconds (i.e. 500 milliseconds).


Press CTRL + C when you’re finished.

That’s it. Keep building!

How to Write a C/C++ Program for NVIDIA Jetson Nano

In this tutorial, we will write a basic C++ program for NVIDIA Jetson Nano.


Check Your GCC Version

Open a terminal window, and run the following command to see the version of the GCC C/C++ compiler you have.

gcc --version

If gcc is not installed, follow the instructions in the next section.

Install the GCC/G++ Compilers 

Open a new terminal window, and type:

sudo apt-get update

Now use this command to install a bunch of packages, including GCC, G++, and GNU Make:

sudo apt install build-essential

You might see some sort of error about things being locked if you try the following command. If you do, kill all processes that are using the APT package management tool using this command:

sudo killall apt apt-get

Remove the lock files:

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*

Reconfigure the packages and update:

sudo dpkg --configure -a
sudo apt update

Now use this command to install numerous packages, including GCC, G++, and GNU Make:

sudo apt install build-essential

Press Y to continue.

Wait while the whole thing downloads.

Now, install the manual pages about using GNU/Linux for development (note: it might already be installed):

sudo apt-get install manpages-dev

Check to see if both GCC and G++ are installed.

whereis gcc
whereis g++

Check what version you have.

gcc --version
g++ --version

Install the C/C++ Debugger

In this section, we will install the C/C++ debugger. It is called GNU Debugger (GDB) and enables us to detect problems or bugs in the code that we write.

In the terminal window, type the following command:

sudo apt-get install gdb

You will be asked to type your password, and then click Enter.

Type the following command to verify that it is installed:


Type this command to quit.


Press Enter.

Exit the terminal.


Install Gedit

Install gedit, a text editor that will enable us to write code in C/C++.

Open a terminal window, and type:

sudo apt-get install gedit

Write a Hello World Program in C

Let’s write a program that does nothing but print “Hello Automatic Addison” (i.e. my version of a “Hello World” program) to the screen.

Open a new terminal window, and create a new folder.

mkdir cpp_basics

Move to that folder.

cd cpp_basics

Open a new C program.

gedit hello_automaticaddison_c.c
int main()
printf("Hello Automatic Addison\n");
return 0;

Save the file, and close it.

See if your file is in there.


Compile the program.

gcc hello_automaticaddison_c.c -o hello_automaticaddison_c

Run the program.


Here is what I see.


Write a Hello World Program in C++

Open a new C++ program.

gedit hello_automaticaddison_cpp.cpp

Write the following code.

// Simple C++ program to display "Hello Automatic Addison"
// Header file for input output functions
using namespace std;
// main function
// where the execution of program begins
int main()
    // prints hello world
    cout<<"Hello Automatic Addison";
    return 0;

Save the file, and close it.

See if your file is in there.


Compile the program. All of this is just a single command.

g++ -o hello_automaticaddison_cpp hello_automaticaddison_cpp.cpp

If you see an error, check your program to see if it is exactly like I wrote it.

Run the program.


Here is what I see.


That’s it. Keep building!