ROS安裝教程(詳細)
總結一下這兩天安裝ROS的過程。linux
1 配置軟件庫
桌面左側欄 點search your computer,輸入updates,點 Software & Updates,將main,universe,multiuniverse,restricted全都勾上,將Download from換成中科大的 http://mirrors.ustc.edu,cn/ubuntu ubuntu
2 設置軟件源
打開/etc/apt/sources.list,將如下內容加入。編輯以前能夠先進行備份。fetch
deb http://debian.ustc.edu.cn/ubuntu/ trusty main multiverse restricted universeui
deb http://debian.ustc.edu.cn/ubuntu/ trusty-backports main multiverse restricted universeurl
deb http://debian.ustc.edu.cn/ubuntu/ trusty-proposed main multiverse restricted universespa
deb http://debian.ustc.edu.cn/ubuntu/ trusty-security main multiverse restricted universe.net
deb http://debian.ustc.edu.cn/ubuntu/ trusty-updates main multiverse restricted universerest
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty main multiverse restricted universeorm
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-backports main multiverse restricted universeserver
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-updates main multiverse restricted universe
若是是用sudo gedit /etc/apt/sources.list打開的,可能沒法編輯(文本只讀),我使用的是下面的命令
sudo nano /etc/apt/sources.list
保存以後,執行
sudo apt-get update
sudo apt-get upgrade
3 按照指導安裝
接下來的步驟參考官網教程就好。
4 遇到的問題及解決
4.1 配置軟件庫的錯誤
在關閉Software & Updates時候須要reload。若是reload結果是這樣的
又或者是你在sudo apt-get update的時候報這種錯:
W: Target Packages (universe/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:10 and /etc/apt/sources.list:64
W: Target Packages (universe/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:10 and /etc/apt/sources.list:64
W: Target Translations (universe/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:10 and /etc/apt/sources.list:64
W: Target Translations (universe/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:10 and /etc/apt/sources.list:64
說明你在sources.list裏面有兩個相同的軟件源,它們的後綴可能不同(好比有的是main,有的是restricted,有的多是包含關係如restricted 和 main restricted 等)。將多餘的刪掉。我是將重複的刪去一個,將包含與被包含的刪除被包含的。以後再從新sudo apt-get update就能夠了。
4.2 設置軟件源的錯誤
我曾在sources.list裏面將
http://packages.ros.org/ros/ubuntu $(lsb_release Release
改爲了
http://packages.ros.org/ros/ubuntu trusty
以後就變成了下面的錯誤
W: The repository 'http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/fcitx-team/nightly/ubuntu/dists/xenial/main/binary-i386/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
而後我在software&update->other software裏面把
http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial Release
的勾選去掉了,就不會報does not have a Release file的錯誤了。
4.3 按照官網教程安裝時出現的錯誤
執行到Set up your keys這一步的時候,出錯
gpg: requesting key B01FA116 from hkp server ha.pool.sks-keyservers.net
gpgkeys: key 421C365BD9FF1F717815A3895523BAEEB01FA116 can't be retrieved
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
gpg: keyserver communications error: keyserver helper general error
gpg: keyserver communications error: unknown pubkey algorithm
gpg: keyserver receive failed: unknown pubkey algorithm
受[2]的啓發,我將宿主機上的藍燈關掉了,就沒錯了。
接着我執行
sudo apt-get update
報錯
Err:15 http://10.0.0.167/files/51160000022738DE/packages.ros.org/ros/ubuntu xenial/main i386 Packages
Hash Sum mismatch
Fetched 554 kB in 1s (315 kB/s)
Reading package lists... Done
E: Failed to fetch http://10.0.0.167/files/51160000022738DE/packages.ros.org/ros/ubuntu/dists/xenial/main/binary-i386/Packages.gz Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.
網上說這個錯誤應該跟GFW有關,因而我又從新打開了藍燈,再執行一次,沒錯了
接着執行
sudo apt-get install ros-kinetic-desktop-full
報錯
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
ros-kinetic-desktop-full : Depends: ros-kinetic-desktop but it is not going to be installed
Depends: ros-kinetic-perception but it is not going to be installed
Depends: ros-kinetic-simulators but it is not going to be installed
Depends: ros-kinetic-urdf-tutorial but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
按照[3]中的方法,我執行
sudo apt-get update && sudo apt-get upgrade
在結果中出現了
The following packages have been kept back:
linux-generic-hwe-16.04 linux-headers-generic-hwe-16.04
linux-image-generic-hwe-16.04
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
因而我分別執行
sudo apt-get install linux-generic-hwe-16.04 linux-headers-generic-hwe-16.04
sudo apt-get install linux-image-generic-hwe-16.04
可是仍是沒能解決上面Depends的錯誤,因而我照[4]中的辦法來作,同時又按照[5]中的辦法手動安裝缺失的依賴包。以後再從新執行sudo apt-get install ros-kinetic-desktop-ful,這會終於成功了!