安装与部署

文档将指引你在自己的设备中安装Ubuntu+ROS2运行环境、安装部署RobotChain。

Ubuntu系统镜像下载

根据你的系统及硬件平台下载相应的Ubuntu 20.04系统镜像。

系统版本镜像下载链接安装方式
RDK X3系列ubuntu-preinstalled-desktop-arm64.imgopen in new window板端
Window X86ubuntu-20.04.6-desktop-amd64.isoopen in new window虚拟机
Mac x86_64ubuntu-20.04.6-desktop-amd64.isoopen in new window虚拟机
Mac ARM64ubuntu-20.04.5-live-server-arm64.isoopen in new window虚拟机

RDK-X3系列安装Ubuntu

RDK X3、RDK X3 Module是地平线出品的AI开发板,可参照官方文档进行Ubuntu 20.04系统的安装。

RDK X3、RDK X3 Module查官方文档open in new window

虚拟机安装Ubuntu

在Window X86、Mac x86_64、Mac ARM64平台中推荐使用VMware虚拟机,安装方式大同小异,请参考下面的步骤进行操作。

1、在VMware中通过右键新建虚拟机。

2、选择自定义配置,继续下一步。

3、保持默认,继续下一步。

4、选择稍后安装系统,继续下一步。

5、操作系统选择Linux,版本选择Ubuntu 64位,继续下一步。

6、设置虚拟机名称和虚拟机配置文件存储路径(建议磁盘空间大于20G),继续下一步。

7、根据自己电脑配置合理分配虚拟机的处理器配置,继续下一步。

8、根据自己电脑配置合理分配虚拟机的内存大小,继续下一步。

9、保持默认,继续下一步。

10、设置虚拟机磁盘大小,建议20G以上,选择将磁盘拆分成多个文件,继续下一步。

11、保存默认,继续下一步并完成虚拟机配置。

12、点击刚刚创建的虚拟机,在右侧面板点击编辑虚拟机设置。

13、在弹出的配置界面中选择CD/DVD选项,然后选择刚刚下载的系统镜像文件。

14、继续切换到显示器选项,将分辨率改为一个大一点的,避免安装时候虚拟机显示不全,点击下方的确定按钮。

15、开启虚拟机

16、开始安装Ubuntu,参照下面的步骤截图进行配置即可。

17、等待安装完成,重启系统。

18、打开命令行工具更新系统并开启root用户权限。

# 更新系统
sudo apt -y update
sudo apt -y full-upgrade
# 安装vim编辑器和一些工具
sudo apt -y install vim curl
# 配置软件源加速软件下载和安装
# 先备份默认的软件源配置文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 删除默认的软件源配置文件
sudo rm -rf /etc/apt/sources.list
# 重新创建新的软件源配置文件
sudo vim /etc/apt/sources.list
# 在打开的文件编辑器中先输入`i`进入编辑模式。
# 将下面的配置复制到文件中,然后按键盘的`ESC`键并输入`:wq`回车保存
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# 更新系统
sudo apt -y update
# 如果如下以下错误,可以忽略,不影响后续的使用。
E: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/dists/focal/main/binary-i386/Packages  404  Not Found [IP: 101.6.15.130 80]
E: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/dists/focal-security/main/binary-amd64/Packages  404  Not Found [IP: 101.6.15.130 80]
E: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/dists/focal-updates/main/binary-i386/Packages  404  Not Found [IP: 101.6.15.130 80]
E: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/dists/focal-backports/main/binary-amd64/Packages  404  Not Found [IP: 101.6.15.130 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
# 安装openssh-server开启ssh登录
sudo apt -y install openssh-server
# 修改`root`密码
sudo passwd root
# 显示信息如下,先输入当前用户的密码验证后再输入新的`root`密码,如下信息:
[sudo] password for robot: 
New password: 
Retype new password: 
passwd: password updated successfully
robot@robot:~/Desktop$ 
# 修改配置允许root通过ssh登录,打开文件编辑器先输入`i`进入编辑模式。
sudo vim /etc/ssh/sshd_config
# 找到#PermitRootLogin prohibit-password配置行
# 将前面的#号删除,将prohibit-password改为yes,如下所示:
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
# 继续查找#ClientAliveInterval 0配置行
# 将前面的#号删除,将0改为60,如下所示,最后按键盘的`ESC`键并输入`:wq`回车保存
#PermitUserEnvironment no
#Compression delayed
ClientAliveInterval 60
#ClientAliveCountMax 3
#UseDNS no
# 重启ssh服务使配置生效
sudo systemctl restart sshd
# 安装net-tools用于虚拟机IP获取
sudo apt -y install net-tools
# 输入ifconfig获取虚拟机IP
ifconfig
# 如下信息,其中192.168.254.135为虚拟机的局域网IP,记住这个IP
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.254.135  netmask 255.255.255.0  broadcast 192.168.254.255
        inet6 fe80::c9ca:95f7:5526:2a60  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:bb:35:a7  txqueuelen 1000  (Ethernet)
        RX packets 665378  bytes 997306068 (997.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 56039  bytes 3673630 (3.6 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 384  bytes 36312 (36.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 384  bytes 36312 (36.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

19、关闭虚拟机,让虚拟机处于后台运行。

20、打开电脑自带的命令行终端,使用ssh登录虚拟机系统进行后续的操作。

# 其中的IP地址就是刚才获取的那个IP,输入root的密码进行ssh登录
ssh root@192.168.254.135

# 登录成功后会看到如下信息:
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-82-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status

Your Hardware Enablement Stack (HWE) is supported until April 2025.

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

root@robot:~#
root@robot:~#
root@robot:~#
root@robot:~#

安装部署RobotChain

在Ubuntu 20.04系统中执行下面的脚本即可自动化安装部署RobotChain。

➡️ RDK X3、RDK X3 Module板端

# 自动化安装部署RobotChain
sudo curl -s https://cdn.geekros.com/robotchain/install.sh|bash

➡️ Window X86、Mac x86_64、Mac ARM64虚拟机

# 自动化安装TROS(ROS2)
sudo curl -s https://cdn.geekros.com/robotchain/init.sh|bash
# 自动化安装部署RobotChain
sudo curl -s https://cdn.geekros.com/robotchain/install.sh|bash

升级或卸载RobotChain

可以通过下面的命令升级或者卸载RobotChain。

# 升级
sudo apt update -y && sudo apt install -y robotchain
# 卸载
sudo apt remove -y robotchain