Skip to content

Instantly share code, notes, and snippets.

@pvandervelde
Last active August 5, 2022 13:46
Show Gist options
  • Save pvandervelde/02e11bf1ab0f3b95dbc8061fb3b73bcb to your computer and use it in GitHub Desktop.
Save pvandervelde/02e11bf1ab0f3b95dbc8061fb3b73bcb to your computer and use it in GitHub Desktop.

Create a ROS Galactic VM with Ubuntu 20.04

Create a VM with the Ubuntu 20.04 installer. Make sure to connect the VM to the LAN, so that any physical robots can connect to it.

Install XRDP

sudo apt install xrdp

Ensure that xrdp is enabled and running after a reboot

 sudo systemctl enable --now xrdp

If you are going to be connecting to the VM from a windows machine open the RDP port in the firewall

sudo ufw allow from 192.168.0.0/16 to any port 3389 proto tcp

Allow remote desktop users to handle package management. This is to prevent many, many, many authentication required dialogs from appearing. Create a file called /etc/polkit-1/localauthority/50-local.d/45-allow-package-management.pkla with the following content

[Allow Package Management all Users]
Identity=unix-user:*
Action=org.debian.apt.*;io.snapcraft.*;org.freedesktop.packagekit.*;com.ubuntu.update-notifier.*
ResultAny=no
ResultInactive=no
ResultActive=yes

Install zsh

NOTE: Picked zsh because it has better highlighting and completion, but also catkin generates zsh scripts.

Install zsh:

sudo apt-get install zsh

Make zsh default

chsh -s /bin/zsh

Install Powerline fonts

sudo apt-get install fonts-powerline

Install git

sudo apt install git

Install oh-my-zsh

sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

Install autosuggestions

git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

Install highlighting

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Update the plugins line in the .zshrc file

plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

Install VS Code

Install the MS package repository

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg

Configure apt https transport

sudo apt install apt-transport-https
sudo apt update

Install VS Code

sudo apt install code

Additional python packages

sudo apt install python3-pip

Install argument completion so that we can use it with the ROS2 command line

pip3 install argcomplete

Install ROS Galactic

Add the ROS2 keys

sudo apt update && sudo apt install curl gnupg lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

Add the repository

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update

Install the ROS packages

sudo apt install ros-galactic-desktop ros-galactic-navigation2 ros-galactic-octomap \
ros-galactic-ros-environment libroscpp-dev ros-galactic-tf2 \
python3-catkin build-essential cmake python3-rosinstall python3-wstool python3-rosdep

Install the build tools

sudo apt install python3-colcon-common-extensions

Source the colcon autocomplete script (in /usr/share/colcon_argcomplete/hook/colcon-argcomplete.zsh) in your .zshrc file

Install Ignition (Gazebo)

Install some of the tools

sudo apt-get update
sudo apt-get install lsb-release wget gnupg

Then install Ignition (example given for installing the 'Fortress' version)

sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
sudo apt-get update
sudo apt-get install ignition-fortress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment