欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ubuntu16.04/win 双系统+ros【kinetic】_全过程入门级

程序员文章站 2024-03-08 20:57:04
...

Ubuntu/win 双系统的安装:

1.ubuntu16.04系统安装

ubuntu16.04下载地址:
中科大源
阿里云开源镜像站
兰州大学开源镜像站
 北京理工大学开源
浙大

2.给ubuntu分空间
在安装双系统前,你需要给ubuntu分出来大概100G【80个G也行,最少50个吧。。。。】的空间以便安装不会破坏你的windows的文件
右键win,打开你的磁盘管理,从你的除了系统盘之外的盘里分出100G的空间【右键你想划出空间的盘,点击压缩卷,输入压缩空间量102400】,之后不用给卷名。

3.Ubuntu16.04启动盘的写入
下载SD Card Formatter【格式化u盘的工具】,下载好后打开,
选择好u盘,
Quick format【快速格式化】
Volume label【输入硬盘卷标,让你给你的硬盘起个名称,也可以不起名直接格式化】,
Format就行啦
【注意:格式化前备份好u盘资料】

下载win32diskimager【把镜像写入u盘的工具】
选择你的ubuntu16.04镜像软件,然后选择你读写的u盘,写入就行啦

至此,u盘已经做好成为ubuntu16.04启动盘

4.ubuntu16.04的安装
插入u盘,重启电脑,疯狂按F12进入你的bios【大多数电脑是F12,个别是其他,看好电脑的类别操作】
然后在bios里往右看到最后一个选项分区,选择你的u盘【这一步是读入你的启动盘】
接着会有一个选择界面,选择第二个选项,install。。。,就能进入安装的界面啦,根据你的喜好设置语言时区之类的,之后会有一个安装Ubuntu时下载更新,不要选,会自动把你的ubuntu升级到18.04,18.04新版本不适配ros,,,下面那个图形或无线文件之类的什么的可以选,然后就到分区了
选择其他选项【要是安装过Ubuntu的话可以选择第一个重装】
你会在接下来的窗口中看到你的所有磁盘分区,找到你为你的ubuntu划分的空间,大概102400左右的就是啦,然后选择那个空间,点击的“+”创建4个主要的基础分区
Swap(相当于电脑内存):逻辑分区、大小设置为电脑内存大小,2G,4G;
/boot(引导分区):主分区:大小设置为200M;
/home(用户存储数据用):逻辑分区,要尽可能大,100G空间可以设置为85G,留10G给主分区即可。
/.(主分区):主分区,用于存放系统,相当于C盘,10G即可。
接着就继续安装就开始安装啦

二.ros环境的配置

1.换源【东大的源。。。】
安装好Ubuntu16.04后,首先需要给你的Ubuntu换源,因为国外源下载起来很慢,而且不稳定,所以需要更换国内的源
进入/etc/apt/这个文件夹
cd /etc/apt
在修改前先对 sources.list文件进行备份
sudo cp sources.list sources.list.bak
修改sources.list文件

sudo nano sources.list

修改源码【源码如下,之前的都删了改成这样就行】:
#deb cdrom:[Ubuntu 16.04.4 LTS _Xenial Xerus_ - Release amd64 (20180228)]/ xenial main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial universe
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://security.ubuntu.com/ubuntu xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
#deb-src http://mirror.neu.edu.cn/ubuntu/ xenial main restricted #Added by software-properties

deb http://mirror.neu.edu.cn/ubuntu/ xenial main restricted

#deb-src http://mirror.neu.edu.cn/ubuntu/ xenial restricted multiverse universe #Added by software-properties

deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted

#deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties

deb http://mirror.neu.edu.cn/ubuntu/ xenial universe

deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates universe

deb http://mirror.neu.edu.cn/ubuntu/ xenial multiverse

deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates multiverse

deb http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

#deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties

deb http://archive.canonical.com/ubuntu xenial partner
#deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted

#deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties

deb http://mirror.neu.edu.cn/ubuntu/ xenial-security universe

deb http://mirror.neu.edu.cn/ubuntu/ xenial-security multiverse

deb http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main multiverse universe restricted

然后ctrl+o【write out】保存,回车,然后ctrl+x退出编辑
更新源【每次换源之后都要更新一哈】
sudo apt-get update
更新软件
sudo apt-get upgrade

2.ros-kinetic的安装
方法一:脚本安装
wget https://raw.githubusercontent.com/oroca/oroca-ros-pkg/kinetic/ros_install.sh && chmod 755 ./ros_install.sh && bash ./ros_install.sh catkin_ws kinetic
如果不成功,走方法二
方法二:源码安装
1.更新源
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
2.增加key

sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116

3.更新

sudo apt-get update
  1. 安装,这里介绍Desktop-Full安装: (Recommended) : ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception
sudo apt-get install ros-kinetic-desktop-full

5.解决依赖

sudo rosdep init
rosdep update

6.环境设置

echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
  1. 安装rosinstall,便利的工具
sudo apt-get install python-rosinstall

至此,ros环境搭配成功

相关标签: ubuntu ros