├── README.md └── ros_install.sh /README.md: -------------------------------------------------------------------------------- 1 | # Quick ROS Install 2 | 3 | Instant install script for ROS on various versions of Ubuntu Linux 4 | 5 | ## Install ROS on Ubuntu 6 | 7 | wget https://raw.githubusercontent.com/PickNikRobotics/quick-ros-install/master/ros_install.sh && chmod 755 ros_install.sh && ./ros_install.sh melodic 8 | 9 | Note: you may need these basic dependencies if, for example, you are running in a Docker container: 10 | 11 | apt-get update && apt-get install wget lsb-release sudo -y 12 | 13 | ## Install ROS with Docker 14 | 15 | The following documents how to use a Nvidia-ready Docker container. More [details](http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration). 16 | 17 | ### Install Docker 18 | 19 | If you are running a recent version of Ubuntu (e.g. 14.04, 16.04) it can be as simple as: 20 | 21 | sudo apt-get install curl 22 | curl -sSL https://get.docker.com/ | sh 23 | sudo usermod -aG docker $(whoami) 24 | 25 | And you will likely need to log out and back into your user account for the changes to take affect. 26 | 27 | ### Download Nvidia Docker Script 28 | 29 | We'll use the same approach provided by the ROS MoveIt! project for providing GPU support: 30 | 31 | wget https://raw.githubusercontent.com/ros-planning/moveit/kinetic-devel/.docker/gui-docker gui-docker 32 | chmod +x gui-docker 33 | 34 | ### Run Docker 35 | 36 | ./gui-docker -it --rm ros:kinetic-ros-base /bin/bash 37 | 38 | ### Test Docker 39 | 40 | apt-get update 41 | apt-get install ros-kinetic-rviz -y 42 | rosrun rviz rviz 43 | -------------------------------------------------------------------------------- /ros_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | # The BSD License 4 | # Copyright (c) 2018 PickNik Consulting 5 | # Copyright (c) 2014 OROCA and ROS Korea Users Group 6 | 7 | #set -x 8 | 9 | function usage { 10 | # Print out usage of this script. 11 | echo >&2 "usage: $0 [ROS distro (default: melodic)" 12 | echo >&2 " [-h|--help] Print help message." 13 | exit 0 14 | } 15 | 16 | # Parse command line. If the number of argument differs from what is expected, call `usage` function. 17 | OPT=`getopt -o h -l help -- $*` 18 | if [ $# != 1 ]; then 19 | usage 20 | fi 21 | eval set -- $OPT 22 | while [ -n "$1" ] ; do 23 | case $1 in 24 | -h|--help) usage ;; 25 | --) shift; break;; 26 | *) echo "Unknown option($1)"; usage;; 27 | esac 28 | done 29 | 30 | ROS_DISTRO=$1 31 | ROS_DISTRO=${ROS_DISTRO:="melodic"} 32 | 33 | version=`lsb_release -sc` 34 | echo "" 35 | echo "INSTALLING ROS USING quick_ros_install --------------------------------" 36 | echo "" 37 | echo "Checking the Ubuntu version" 38 | case $version in 39 | "saucy" | "trusty" | "vivid" | "wily" | "xenial" | "bionic" | "focal") 40 | ;; 41 | *) 42 | echo "ERROR: This script will only work on Ubuntu Saucy(13.10) / Trusty(14.04) / Vivid / Wily / Xenial / Bionic / Focal. Exit." 43 | exit 0 44 | esac 45 | 46 | relesenum=`grep DISTRIB_DESCRIPTION /etc/*-release | awk -F 'Ubuntu ' '{print $2}' | awk -F ' LTS' '{print $1}'` 47 | if [ "$relesenum" = "14.04.2" ] 48 | then 49 | echo "Your ubuntu version is $relesenum" 50 | echo "Intstall the libgl1-mesa-dev-lts-utopic package to solve the dependency issues for the ROS installation specifically on $relesenum" 51 | sudo apt-get install -y libgl1-mesa-dev-lts-utopic 52 | else 53 | echo "Your ubuntu version is $relesenum" 54 | fi 55 | 56 | echo "Add the ROS repository" 57 | if [ ! -e /etc/apt/sources.list.d/ros-latest.list ]; then 58 | sudo sh -c "echo \"deb http://packages.ros.org/ros/ubuntu ${version} main\" > /etc/apt/sources.list.d/ros-latest.list" 59 | fi 60 | 61 | echo "Download the ROS keys" 62 | roskey=`apt-key list | grep "ROS Builder"` && true # make sure it returns true 63 | if [ -z "$roskey" ]; then 64 | echo "No ROS key, adding" 65 | sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 66 | fi 67 | 68 | echo "Updating & upgrading all packages" 69 | sudo apt-get update 70 | sudo apt-get dist-upgrade -y 71 | 72 | echo "Installing ROS" 73 | 74 | # Support for Python 3 in Noetic 75 | if [ "$ROS_DISTRO" = "noetic" ] 76 | then 77 | sudo apt install -y \ 78 | liburdfdom-tools \ 79 | python3-rosdep \ 80 | python3-rosinstall \ 81 | python3-bloom \ 82 | python3-rosclean \ 83 | python3-wstool \ 84 | python3-pip \ 85 | python3-catkin-lint \ 86 | python3-catkin-tools \ 87 | python3-rosinstall \ 88 | ros-$ROS_DISTRO-desktop 89 | else 90 | sudo apt install -y \ 91 | liburdfdom-tools \ 92 | python-rosdep \ 93 | python-rosinstall \ 94 | python-bloom \ 95 | python-rosclean \ 96 | python-wstool \ 97 | python-pip \ 98 | python-catkin-lint \ 99 | python-catkin-tools \ 100 | python-rosinstall \ 101 | ros-$ROS_DISTRO-desktop 102 | fi 103 | 104 | # Only init if it has not already been done before 105 | if [ ! -e /etc/ros/rosdep/sources.list.d/20-default.list ]; then 106 | sudo rosdep init 107 | fi 108 | rosdep update 109 | 110 | echo "Done installing ROS" 111 | 112 | exit 0 113 | --------------------------------------------------------------------------------