INSTALLING LINUX AND ROS

Ashok Kumar
3 min readMay 22, 2020

In this article, we are going to install UBUNTU on a Virtual Machine and then install ROS melodic onto the Virtual Machine.

VIRTUAL MACHINE

A virtual machine is a software that runs a second OS on your main host machine but without a hard disk partition. This way, one can run multiple VM’s with different operating systems, and even can be moved between different host machines. There are many VM software, notably Oracle’s VirtualBox, or Parallels, or VMWare. You can use any software you like, but I would prefer parallels as it is fast and stable for simulations using Gazebo which we will come across later in the blog.

Press the following for the download links:

Parallels(trial)

VMWare(trial)

VirtualBox(free)

Set up the software, they are pretty much straight forward.

…..….

LINUX

Coming to the operating system, we are going to use UBUNTU 18.04, as it seems to be stable for the ROS API.

UBUNTU ISO

…..….

Setup the OS on the VirtualMachine Software.

ROS SETUP

Now, lets set up the main backbone for the whole publication. One could typically follow the setup instruction on ros.org, but I would prefer a different approach so that the workspace is always connected to ROS and you don’t need to define it every time you work on it. We are installing ROS MELODIC as at the moment it has the most prolonged support.

Step-1

Setting up source space, so that the VM can accept software from ROS.

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

Step-2

Setting up the key, for your installation

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

Step-3

Now to the main installation.

sudo apt-get update

^^ To make sure the index of the operating system is up-to-date with all the software.

Now the system is ready to install ROS. There are many version of ROS MELODIC, a full desktop version install, then a version with barebones software. It will be preferred if the full desktop version is installed so it wouldn’t be a headache at the later stages.

sudo apt install ros-melodic-desktop-full

This will take time, be patient.

now the next step is to initialise rosdep, it helps you to instal other packages and dependencies for ROS.

sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential

sudo apt install python-rosdep

sudo rosdep init
rosdep update

Now major part of the installation is done, but we still have to enable all the downloaded software.

gedit .bashrc

In the bashrc file, add this specific line at the end

source /opt/ros/melodic/setup.bash

now save the file, and then

source .bashrc

now ROS is enabled every time a new terminal window is opened.

Now creating a workspace where you would do the majority of your work.

in a new terminal window

mkdir -p ~/catkin_ws/src

mkdir = make directory

catkin_ws = name of you workspace

src = the folder with all the code in the workspace

now go to the root of the folder by

cd catkin_ws

and create the source files for ROS by

catkin_make

Now the workspace is ready to develop ROBOTS!!

But wait, now every time you open the workspace to develop, you have to initialise ROS to the specific workspace, to counter that, lets define this workspace as your default workspace.

gedit .bashrc

and then in the bottom most line add this

source /home/<username>/catkin_ws/devel/setup.bash

now the workspace if your default workspace.

To test that, in a terminal window type

roscd

if it leads to catkin_ws, then the whole installation is correct.

Next we will be learning about the basic elements of ROS.

--

--