Ubuntu ROS

Best 4 ways to install Ubuntu for R.O.S

Ubuntu is one of the popular Linux based (O.S) Operating System which is based on Debian Linux distribution. It is free for use and open-source. Compared to other Linux distributions, the easiness of use, regular software updates, and frequent releases made ubuntu as a favorite Linux distro in the Linux community.

Ubuntu is so popular in robotics too. The famous robotics software frameworks and libraries such as R.O.S, Open-CV, and P.C.L have full compatibility with Ubuntu.

In this post, I would like to mention 4 best ways to install Ubuntu for working with robotics frameworks such as R.O.S and Open-CV. I will also mention the pros and cons of each installation method. You can select the method you want.

Let’s look at the 4 methods in detail.

1. Installing Ubuntu in Virtual Machine( VMWare/VirtualBox):

Before getting started, let me first introduce: What is a virtual machine, Which is the best VM Software, and Which VM Software should choose for installing R.O.S.

You can see the installation of Ubuntu in VMWare and VirtualBox after this section.

What is a Virtual Machine Software

Simply, VM software is one that can emulate a physical computer system. The OS that we are going to install in a VM will detect it as a physical computer. So, we can install an OS in VM as we install it in the actual PC.

The VM Software needs a host operating system like Windows, Linux, and Mac OSX, and you can share the computing resource with the virtual/guest operating system. Using VM software, one can create a VM with a custom configuration. For example, in a VM software, one can choose, processor count, RAM size, Hard disk size, Graphics memory, USB devices, etc.

Make sure the guest OS will not conflict with host OS for the computing resource. If there is a conflict, the host OS can go down and the PC can crash. The VM resources of the guest OS should be friendlier with the host OS.


Popular Virtual Machine Software

There are different virtual machine software are available in the market, two of the popular software are

VMWare Workstation: VMWare is a globally-leading provider of virtualization and cloud infrastructure solutions. Using VMWare Workstation, we can virtually run different versions of Linux and Windows. The VMWare Workstation can install on Linux and Windows PC.

The Pro version of VMWare Workstation is not free, but there is a free version of VMWare called VMWare Workstation Player, which is having most of the features for your purpose. The player is for non-commercial use mainly for educators and students for learning and training.

Oracle VirtualBox: VirtualBox is a free and open-source VM software from Oracle Corporation. It can be installed on Windows, macOS, Linux, Solaris, and Open Solaris. Unlike, VMWare, this VM software has no pro version, and it’s completely free of cost to use. You can install Windows, Linux, macOS in Virtualbox. The complete list of guest OSes in the Virtual box is here.


Who should choose VM for installing Ubuntu?

The main advantage of using VM is, it is very safe to do experiments in Ubuntu and ROS. So it will be better to use VM for the following category of people.

  1. R.O.S Educators and Students, From my experience, most of you start learning R.O.S without prior knowledge in Linux, C++, and Python. They may be Windows users and they will be comfortable with using Windows. In that situation, the best choice is to use VM software. The advantage is that they will get the real feel of Linux without taking risk of installing Ubuntu in a real system. If you don’t do Ubuntu installation properly, it can wipe out your hard disk. So it will be the best choice for R.O.S educators and students to go for VM.
  2. Absolute beginners in Linux, Who knows how to work with Windows OS. The issue with absolute beginners is, if you try to install Ubuntu in the real PC, it may crash your system and there can be data loss. So it will be better to try the OS installation and R.O.S installation in VM first and after doing a data backup, install it in the real system.
  3. Beginners of Ubuntu and ROS, These guys may know a little bit of Ubuntu and some ROS concepts, but they are trying to follow some ROS tutorials to learn more things and experiment with ROS. The VM will be the best fit for these guys. You can safely experiment with Linux commands and with ROS installations.

    One of the possible issues that might happen for beginners of Linux and ROS are broken packages, meaning, the installation of some ubuntu packages got corrupted. This issue can even wipe out the existing software installed on Ubuntu. Using VM, you can safely switch to another without any difficulties.
  4. Robot developers Who are having existing software in their Ubuntu PC which can create conflict with the new R.OS installation. Using VM, you can do networking with guests and host OS and communicate to ROS in the guest OS if required.

Which VM software will be good for working on R.O.S?

Here is my comparison between VMWare and VirtualBox in the context of R.O.S installation and working.

VMWare is my pick for ROS: I was not a great fan of VMWare before, I was usually using VirtualBox for my ROS installation and teaching. The main reason was, I thought it was not free. I was a fan of free software so I didn’t go with VMWare. But recently I tried the Free version of VMWare called VMWare Workstation Player, I was totally impressed with its performance.

  • Better Graphics: The main impressive things with VMWare was graphics sharing and USB sharing. These things are not much improved in VirtualBox. The maximum Graphics memory that you allocate in VirtualBox is 265 MB, but in VMWare, you can allocate more memory. The graphics acceleration is pretty good compared to VirtualBox. We need good graphics acceleration when we do simulation using ROS.
  • USB Device Sharing: Regarding the USB sharing, I tried to share my USB cam to the guest OS, but it was not working properly for me. In VMWare, it worked perfectly. The USB sharing is very important when we work with R.O.S, imagine if you want to connect a USB device in your guest OS from host OS. If the VM software is not supporting much, you will be frustrated right?
  • Conclusion: If the graphics acceleration is good, we can run good robotic simulators like Gazebo in VM itself. In VMWare, I could run those simulations and visualization very smoothly, but in VirtualBox, it was not up to the level. In VMWare Player Free version, there are some options like cloning of VM is not present, but there is an easy workaround to do it. In VirtualBox cloning is there. So according to my opinion, VMWare is the best choice for working with R.O.S as well as Open-CV. VirtualBox is good, but my choice is VMWare. If you are using macOS, it will be better to stick to VirtualBox. There is no way to install a free version of VMWare in mac, instead of that, you have to purchase VMWare Fusion.

Now, we can see how to install VMWare and VirtualBox on the host operating system Windows and Linux.

Installing VMWare

Here are the instructions to install VMWare on Windows and Ubuntu Linux. If you are looking for the supported host operating system to install VMWare, you can check this guide from VMWare.

Installing VMWare on Windows 10

Installing VMWare on Windows is very easy. Just go to the download page of the VMWare Workstation Player.

Download VMWare for Windows

Just download and you can install it like normal software.

After installing, you will get the VMWare Player GUI as shown in the following figure.

Installing VMWare on Ubuntu

Installing VMWare on Ubuntu is straightforward, you can install it using simple Linux commands.

Download VMWare for Ubuntu

After downloading VMWare from the above link, you can go to the /home/<user>/Download folder and open terminal from the Download folder by right-clicking on the folder.

After taking the terminal, you can execute the following command to extract the VMWare installer. The name of the installer may differ from the following command, but the idea is to execute the bundle file you downloaded with ‘sudo‘ command, meaning the administrative (root) privileges)

sudo ./VMware-Player-15.5.2-15785246.x86_64.bundle

If the installation is successful, you can Press the ‘Super/Windows‘ key to enable the searching in Ubuntu. Just search VM and you will get the VMWare Logo.

If you click the VMWare Player, the installation wizard come like this.

If you finish the installation, you can search for VMWare again, and you will get the actual VMWare player.

Possible Issues with VMWare: VMware Workstation and Device/Credential Guard are not compatible Fix

Installing VirtualBox

Here are the instructions to install Virtual Box on Windows and Ubuntu Linux. If you are looking for the supported host operating system to install VirtualBox, you can use this guide from Virtuatopia.

Installing VMWare on Windows 10

Installing VirtualBox in Windows is very easy. Go to the download page of VirtualBox and download the installer.

Download VirtualBox for Windows

After downloading finish the installation Wizard. After installation, you will get front GUI of VirtualBox like this.

Installing VMWare on Ubuntu

You can download the VirtualBox installer file from the following link

Download VirtualBox for Ubuntu

You can download the exact VirtualBox for your Ubuntu version, I am using 18.04 LTS for this tutorial.

After installing, just go to the ~/Download folder and you can open a terminal in the Download folder by right clicking on the folder.

Use the following command to install the VirtualBox in the terminal. Make sure that you are connected to the internet. This command will install VirtualBox and it download some dependencies packages from the internet.

sudo apt-get install ./virtualbox-6.1_6.1.6-137129~Ubuntu~bionic_amd64.deb

After installing VirtualBox, just search in Ubuntu using ‘Super‘ key to find VirtualBox.

And here is the GUI of the VirtualBox in Ubuntu.


Installing Ubuntu on VMWare

The first step to install Ubuntu on VMWare is, download the ISO image of the required version of Ubuntu from their official website. You can try with the latest version of Ubuntu that is 20.04 LTS and 18.04 LTS.

Host PC Prerequisites

When you start working with virtual machines, the host OS has to share the computing resources such as processor, RAM, GPU to the guest system. In order to run both the OS smoothly, you may need a minimum system configuration. In order to run Ubuntu and ROS in the guest OS, the host OS may require the following configurations.

  • CPU: 4 Core CPU, Speed > 2.5 GHz
  • RAM: >= 6 GB DDR4
  • GPU: with >= 2 GB shared memory
  • Harddisk: NVMe SSD or SATA SSD.

I can suggest some Laptop configuration that can smoothly run R.O.S in Ubuntu using VMWare.

Acer Nitro 5 is my Laptop Rig. It is a gaming laptop, but suitable for robot programming and simulation. You can choose any gaming laptop for working with R.O.S and simulation. R.O.S will definitely work with other laptops too, but the performance will be much higher for gaming laptops.

Download Ubuntu ISO Image

Here are the download links of 20.04 and 18.04 LTS. You can download the desktop image of any of these versions below.

Download Ubuntu 20.04 LTS

Download Ubuntu 18.04 LTS

Creating a new Virtual Machine

Open the VM Player, and select the ‘Create a New Virtual Machine‘ option as shown in the figure below.

A wizard will come for creating a new VM, and the first thing you need to do in the wizard is browsing the Ubuntu ISO file, that you downloaded. In this post, I am using the ISO image of Ubuntu 20.04 LTS The step is shown below.

After browsing the ISO image of Ubuntu, you can press the Next button. In the next window, you have to enter the Ubuntu login details and login display name. The advantage of this is, VMWare will automate the installation procedure of Ubuntu. The user needs not to worry about the installation procedure, just enter the login details in the form, and the rest of the installation will be automatically done by VMWare. VMWare only supports the specific OS for automatic installation.

The next step is to assign a name to the VM that we are going to create and the path of VM in which the VM files are going to store. You can give any name as the VM name and you can assign a path for VM which at least has 20 GB for space.

The next step is to assign the size of the virtual hard disk. The OS that we are going to install is stored in the virtual hard disk. You can safely work with 20 GB size for hard disk. It is enough for installing ROS.

There are two options for creating a virtual hard disk. The first option is to store the virtual disk file as a single file. The second option is to split the disk into multiple files. The advantage of splitting is if you want to copy the hard disk file to another computer, you can easily copy the files. The problem with this configuration is, the performance will reduce if the disk size is very high.

In the next step, you will get an opportunity to customize the hardware configuration of the Virtual Machine that you are creating now. You can press the ‘Customize Hardware‘ button in order to customize the hardware configuration.

In the Customized hardware option, there are options to choose RAM size, Processor, Graphics, etc for the guest O.S. My host system has 8 Core processors, 16 GB RAM, and 4 GB dedicated graphics memory, so I am giving choosing following hardware configuration for the guest OS.

Memory: 6GB
Processors: 4, Virtualization Engine all enable
USB Controller: USB Compatibility: USB 3.0
Display: 3D Graphics enabled, Graphics Memory: 1GB

Customized configuration of VMWare

After setting all these configurations, you can close the window, and press the Finish button. When you press the Finish button, the VM will boot the OS from the ISO image and will automatically install it. It will take 15 to 25 min depends on your system performance.

After installing the OS automatically, it will restart and you can see the login window like this. Congrats, you have successfully installed Ubuntu 20.04 on VMWare.

You can enter the password you have given during the VM creation and you can enter to Ubuntu desktop.

The procedure for installing Ubuntu in VMWare is the same as Windows and Linux.


Installing Ubuntu on VirtualBox

If you understand the idea of VM creation using VMWare, you can easily migrate to VirtualBox too.

Here is the tutorial to create a new VM in Virtual Box. You can see a New button in the VirtualBox UI as shown below. This will start the Wizard to create a new VM.

The new VM wizard is shown in the image gallery below.

After doing the above steps, you can boot the VM we have just created. Here are the steps to boot Ubuntu from ISO image and install it.


2 Installing Ubuntu in External Drive

Installing Ubuntu in Virtual Machines is good for getting started. If you are confident enough to work with Ubuntu and ROS in the real system, I will suggest this method.

In this method, we are going to install Ubuntu in the real PC, but it’s not in the internal hard disk of your computer. Instead of that, we are planning to install it on an external hard drive or a pen drive. We need two pen drives or one pen drive and an external drive for this.

One pen drive is for creating Ubuntu bootable drive and the second is for installing Ubuntu. During installation, we can select the second external drive for installing the Ubuntu files.

The first step of this method is to collect thumb drive and make one as Ubuntu bootable drive

Creating Bootable Drive of Ubuntu

An OS can be booted in different ways. Common methods are booting from the DVD drive and booting from USB drives. The DVD drives are not common nowadays so the better option is to go for booting from USB drives.

Creating a bootable drive is a process of writing the ISO image file to your USB drives. There are some tools available in Windows in order to do it.

Here is a simple tutorial from the Ubuntu website in order to install Ubuntu into a USB drive using a tool called Rufus. You can do this from Windows.

Creating a bootable Ubuntu USB stick from Microsoft Windows

Here is a video tutorial to understand the steps better.

Installing Ubuntu on an external drive

After creating the bootable disc, you can start booting Ubuntu and install it on the external drive. You can either install Ubuntu by wiping out the entire space in the drive or you can create custom partitions in the drive. If you are not using your drive for any purpose, better will be completely wipeout, otherwise, you can create a partition on the drive.

In the installation type of Ubuntu installer, if you select ‘Erase disk and install Ubuntu‘, it will format your entire disk and install Ubuntu. The ‘Something else‘ option will install Ubuntu using custom partitioning.

Here is the simple tutorial for installing Ubuntu on an external drive using a custom partition.

So what is the advantage of this method?

Advantages of installing Ubuntu on external drives

  1. Safety: If you are installing Ubuntu on an external drive, your internal drive will not be affected. Even if you make any mistake in your installation, you will not lose your data and the current Windows OS will be safe.
  2. Portable: The Ubuntu OS installed in the external drive is portable, you can plug the device whenever we have to work with Ubuntu. You can even boot it from other laptops too.
  3. Comfortable to work: If you made any mistakes while playing with Ubuntu made the OS crash, it’s totally fine because it is in the external drive and the internal drive will not be affected. You can reinstall the OS in the external drive and can even recover files easily with the help of Windows which is inside the internal drive.
  4. Faster than VM: If you install Ubuntu on an external drive, you can enjoy the performance of the real PC. Working with a real PC will be faster than working with VM.

Disadvantages of installing Ubuntu on external drives

  1. If you are frequently working with Ubuntu, then one of your USB will be occupied for the external drive.
  2. The speed of the external hard disk is limited to the USB speed. If you have internal storage using SATA, it can outperform USB.
  3. The external drive will become a dependency for working with Ubuntu.

3 Installing Ubuntu in real PC using USB boot

In this method, we are actually installing Ubuntu on your internal hard drive. The method is the same as installing on the external hard drive, the only difference is, we are installing to the internal hard drive. So during the custom installation option in Ubuntu, you have to find the name of the internal hard drive. Normally /dev/sda will be your internal hard drive and there will be the partition of Windows and other custom partition which is showing as /dev/sda1, /dev/sda2, etc.

Note: This method is a little riskier than the rest of the method, please make sure that you have taken a backup of your important files before doing this. Any mistakes in the installation can wipe out the entire disk. Make sure that you have confidence in the Ubuntu installation steps before doing this method.

Here is a simple tutorial to install Ubuntu on an internal hard drive with custom partitioning.


4 Installing Ubuntu using Docker

The Docker is a type of Virtualization in the OS for managing virtualization entity called Containers. Installing Ubuntu using docker is useful when you want to isolate your robotic application. Your software will be coming with its dependencies and libraries in an entity called container. This will be helpful to port your application across different OS platforms. It is lightweight and we can port the container in any OS platform. I will prefer docker for Ubuntu for the advanced users who are planning to deploy their robotic applications. You may need some good understanding of Docker before start working on it.

Here is the simple explanation of Docker, Docker Hub, Containers, Difference between docker and VM, and working with Docker on Windows.

What is Docker?

Docker is a set of a platform as a service (PaaS) that automates the deployment of software applications inside containers by providing an additional layer of abstraction and automation of OS-level virtualization.

Wikipedia

Containers are isolated from one another and bundle their own software, libraries, and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines.

The service has both free and premium tiers. The software that hosts the containers is called Docker Engine. It was first started in 2013 and is developed by Docker, Inc.

Wikipedia

What is a container?

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.

A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries, and settings.

Container images become containers at runtime and in the case of Docker containers – images become containers when they run on Docker Engine.

Available for both Linux and Windows-based applications, containerized software will always run the same, regardless of the infrastructure.

Containers isolate software from its environment and ensure that it works uniformly despite differences for instance between development and staging.

Docker containers that run on Docker Engine:

Standard: Docker created the industry standard for containers, so they could be portable anywhere
Lightweight: Containers share the machine’s OS system kernel and therefore do not require an OS per application, driving higher server efficiencies and reducing server and licensing costs
Secure: Applications are safer in containers and Docker provides the strongest default isolation capabilities in the industry

Docker Inc

What is Docker Hub?

Docker Hub is the world’s largest repository of container images with an array of content sources including container community developers, open-source projects, and independent software vendors (ISV) building and distributing their code in containers. Users get access to free public repositories for storing and sharing images or can choose a subscription plan for private repos.

It provides the following major features:

Docker Inc
  • Repositories: Push and pull container images.
  • Teams & Organizations: Manage access to private repositories of container images.
  • Official Images: Pull and use high-quality container images provided by Docker.
  • Publisher Images: Pull and use high- quality container images provided by external vendors. Certified images also include support and guarantee compatibility with Docker Enterprise.
  • Builds: Automatically build container images from GitHub and Bitbucket and push them to Docker Hub.
  • Webhooks: Trigger actions after a successful push to a repository to integrate Docker Hub with other services.

What is the difference between Docker and Virtual Machines?

Here is the tutorial to understand the difference between Docker and Virtual Machines.

Containers

Containers are an abstraction at the app layer that packages code and dependencies together. Multiple containers can run on the same machine and share the OS kernel with other containers, each running as isolated processes in userspace. Containers take up less space than VMs (container images are typically tens of MBs in size), can handle more applications, and require fewer VMs and Operating systems.

Docker Inc

Virtual Machines

Virtual machines (VMs) are an abstraction of physical hardware turning one server into many servers. The hypervisor allows multiple VMs to run on a single machine. Each VM includes a full copy of an operating system, the application, necessary binaries, and libraries – taking up tens of GBs. VMs can also be slow to boot.

Docker Inc

How to install Docker on Windows?

Here is the Windows installer to download Docker for Windows

Download Docker Windows

After installing Docker, you can see the dashboard like this.

After installing Docker, you can sign into Docker Hub from the above dashboard. Make sure you have a created an account in Docker Hub using the following link

Docker Sign Up

After signing in Docker Dashboard, we can start playing with docker commands. From the Windows Search option, you can search for Windows Power Shell. We are going to play with docker commands using the power shell.

After getting the power shell, you can start executing following docker commands in order to confirm the installation is proper.

Display current Docker version

 docker.exe --version

Downloading Ubuntu Docker Images

This command will pull the docker image of the latest ubuntu.

docker.exe pull ubuntu

After downloading the image, you can check the list of docker images we have now.

docker.exe images

After checking the images, you can see the Ubuntu latest image with IMAGE ID and size. Now let’s run this image using the following command. The run command is used to run the docker image. The ‘ -it ‘ will start a pseudo-TTY (bash shell) for interacting with Ubuntu.

docker.exe run -it ubuntu

You can see, we could able to access the bash shell of Ubuntu when we run the docker image. You can try the Linux command in this shell.

For learning more docker commands, here are some simple tutorials

You can learn docker commands from the following video


Reference book

This post is based on the Robot Operating System for Absolute Beginners. Installing Ubuntu is the first step to start learning ROS.



Lentin Joseph

View posts by Lentin Joseph
Roboticist | Author of 8 robotics books | TEDx speaker

One Comment

  1. What about installing ROS using WSL and WSL2? I saw about that while searching for ROS and I don’t know much about ROS and ubuntu. I was thinking of running a virtual machine in my windows laptop but will I be able to do simulation of robots using such a setup? I have a laptop with i5 10th gen and 8 GB of ram with no dedicated graphics at all.

Leave a Reply