wsl2下ubuntu16.04ros安装流程

说明:win10 intel芯片笔记本

1.装ubuntu16.04

1.1启用子系统

powershell 命令

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

1.2启用虚拟机功能

powershell 命令

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

1.3下载linux内核更新包

linux内核更新包,下载安装

1.4 设置wsl2为默认

powershell 命令

wsl --set-default-version 2

1.5下载ubuntu16.04发行版(微软商店没有)

Ubuntu16.04发行版

1.6手动安装

在上一步下载下来的ubuntu16.04包的文件夹内 shift按住再鼠标右键打开powershell

powershell 命令

Add-AppxPackage .\wsl-ubuntu-1604

注:此处的 .\wsl-ubuntu-1604 是下载下来的文件名 写的时候最好tab补全

1.7用户名密码设置

1.8提升权限使得windows可以访问linux权限

powershell命令

C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps\ubuntu2004.exe config --default-user root

2.ubuntu换源中科大

2.1备份源

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

2.2换中科大源

sudo vim /etc/apt/sources.list

下面的源去覆盖掉上面的源

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

注:vim命令 esc按键为了进命令模式
esc + ggdG(全删)
esc + :wq(保存退出)
esc + :q!(强行退出)


3.ubuntu汉化

3.1安装语言包

# 安装中文基础语言包
sudo apt install language-pack-zh-hans
# 安装中文桌面语言包
sudo apt install language-pack-gnome-zh-hans
sudo apt install language-pack-kde-zh-hans
# 安装中文手册页(man命令)
sudo apt install manpages-zh

3.2设置 locale

sudo vi /etc/locale.gen

找到 zh_CN.UTF-8 UTF-8 并取消注释,然后保存并退出

locale.gen...
# zh_CN.GBK GBK
zh_CN.UTF-8 UTF-8
# zh_HK BIG5-HKSCS
...

3.3编译语言

sudo locale-gen

3.4设置默认语言为中文

sudo vi /etc/default/locale

将内容修改为

localeLANG=zh_CN.UTF-8

4.ubuntu gui

注:我的笔记本有核显和独显

4.1安装驱动

英伟达 cuda
英特尔驱动

4.2wsl更新

powershell命令

wsl --update

然后重启

wsl --shutdown

4.3安装一些软件

sudo apt install gedit -y
sudo apt install gimp -y
sudo apt install nautilus -y
sudo apt install vlc -y
sudo apt install x11-apps -y

5.安装ros-kinetic

5.1添加ros软件源

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'

添加密钥

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

更新源

sudo apt update

5.2安装

sudo apt install ros-kinetic-desktop-full

5.3初始化ros并且更新

注:使用本地文件去初始化更新ros
找一个地方去下载repo
使用用户名(liuliyang)目录

git clone https://github.com/ros/rosdistro.git

下载下来的文件夹地址如下

\\wsl.localhost\Ubuntu-16.04\home\liuliyang\rosdistro

修改这个下载下来的包中\\wsl.localhost\Ubuntu-16.04\home\liuliyang\rosdistro\rosdep\source.list.d\下的文件20-default.list

# os-specific listings first
yaml file:///home/liuliyang/rosdistro/rosdep/osx-homebrew.yaml osx

# generic
yaml file:///home/liuliyang/rosdistro//rosdep/base.yaml
yaml file:///home/liuliyang/rosdistro//rosdep/python.yaml
yaml file:///home/liuliyang/rosdistro//rosdep/ruby.yaml
gbpdistro file:///home/liuliyang/rosdistro//releases/fuerte.yaml fuerte

# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

修改/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py中,这个部分

# default file to download with 'init' command in order to bootstrap
# rosdep
DEFAULT_SOURCES_LIST_URL = 'file:///home/liuliyang/rosdistro/rosdep/sources.list.d/20-default.list'
# seconds to wait before aborting download of rosdep data

继续修改
/usr/lib/python2.7/dist-packages/rosdep2/rep3.py

# location of targets file for processing gbpdistro files
REP3_TARGETS_URL = 'file:///home/liuliyang/rosdistro/releases/targets.yaml'
# seconds to wait before aborting download of gbpdistro data

/usr/lib/python2.7/dist-packages/rosdistro/init.py

# index information
DEFAULT_INDEX_URL = 'file:///home/liuliyang/rosdistro/index-v4.yaml'
def get_index_url():

然后初始化

 sudo rosdep init
 rosdep update

5.4激活脚本

 echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc 
 source ~/.bashrc

5.5测试

roscore

海龟

rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值