ubuntu18.04 LTS安装ros-melodic
第一步:
$ sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
第二步:
$ sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
$ sudo apt update
第三步:
$ sudo apt-get install ros-melodic-desktop-full
第四步:
$ sudo rosdep init
这一步会出现问题:
1.sudo:rosdep:command not found
解决办法:
$ sudo apt install python-rosdep
2.cannot download default sources list from: https://raw.githubusercontent.com/ros/rosd
解决办法:
$ sudo gedit /etc/hosts
添加入以下代码行:
151.101.76.133 raw.githubusercontent.com
如果不行,分别尝试:
151.101.108.133 raw.githubusercontent.com #日本 东京
151.101.228.133 raw.githubusercontent.com #日本 东京
151.101.0.133 raw.githubusercontent.com #美国
第五步:
$ rosdep update
第六步:
$ echo "source /opt/ros/melodic/setup.bash" >>~/.bashrc
$ source ~/.bashrc
第七步:
$ sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential