一、准备工作
控制面板——程序——程序和功能——启动或关闭Windows功能
二、安装Ubuntu 22.04.1 LTS
1. 下载Ubuntu 22.04.1 LTS
打开Microsoft Store,搜索并下载Ubuntu 22.04.1 LTS
(安装Windows Subsystem for Linux前一定要先安装Ubuntu,否则移动Ubuntu位置会报错)
2. 移动到非系统盘
三、启动Ubuntu遇到的报错及解决方案
报错:
WslRegisterDistribution failed with error: 0x800701bc
解决方案:
下载安装适用于 x64 计算机的最新 WSL2 Linux 内核更新包
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
安装后
报错:
adduser: Please enter a username matching the regular expression configured
via the NAME_REGEX[_SYSTEM] configuration variable. Use the `–force–badname‘
option to relax this check or reconfigure NAME_REGEX.
解决方案:
四、换源
Ubuntu默认的软件源在国外,可能会造成下载软件卡顿,因此需要换源,这里我选择更换为阿里源。
# 备份原来的软件源
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 编辑软件源
sudo nano /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
3.更改后
# 更新软件源
sudo apt-get update -y
# 升级所有软件
sudo apt-get upgrade -y
五、安装ROS
1. 设置编码
sudo apt update
sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
2. 添加源
1.通过检查此命令的输出,确保已启用Ubuntu Universe存储库。
apt-cache policy | grep universe
①正常情况
sudo apt install software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install curl gnupg lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
①正常情况
②报错:curl: (7) Failed to connect to raw.githubusercontent.com port 443 after 0 ms: Connection refused
sudo nano /etc/hosts
加上一行
199.232.28.133 raw.githubusercontent.com
3. 安装ROS
sudo apt update
sudo apt upgrade
sudo apt install ros-humble-desktop
4. 设置环境变量
source /opt/ros/humble/setup.bash
echo " source /opt/ros/humble/setup.bash" >> ~/.bashrc
5. 测试
ros2 run demo_nodes_cpp talker
ros2 run demo_nodes_py listener
原文地址:https://blog.csdn.net/m0_63834988/article/details/128672234
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_45132.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!