百度Apollo系统学习01: 安装Apollo

Apollo学习001: 安装Apollo 【百度Apollo系统学习01: 安装Apollo】本文旨在详细记录 Apollo在个人电脑的 Ubuntu 18.04 系统中的完整安装及运行过程。
硬件要求
百度Apollo系统正常需要安装在工业计算机IPC中,在个人电脑上也可以安装。由于网上没有查到具体的硬件要求,这里PO出个人笔记本电脑配置作为参考:电脑型号:神州战神z7m,CPU i7, 16G内存,GPU: GTX965m。实测可以跑通。(PS:Unbutu系统需要空间大一些,实测200个G的空间装完并且将Apollo完全编译后仅剩50G)
Apollo安装过程

  1. 安装Nvidia显卡驱动。
    sudo apt-get update sudo apt-add-repository multiverse sudo apt-get update sudo apt-get install nvidia-driver-455

    安装完毕采用nvidia-smi 命令查看显卡:
    Wed Aug 25 21:55:21 2021 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 460.73.01Driver Version: 460.73.01CUDA Version: 11.2| |-------------------------------+----------------------+----------------------+ | GPUNamePersistence-M| Bus-IdDisp.A | Volatile Uncorr. ECC | | FanTempPerfPwr:Usage/Cap|Memory-Usage | GPU-UtilCompute M. | |||MIG M. | |===============================+======================+======================| |0GeForce GTX 965MOff| 00000000:01:00.0 Off |N/A | | N/A61CP0N/A /N/A |438MiB /2002MiB |25%Default | |||N/A | +-------------------------------+----------------------+----------------------++-----------------------------------------------------------------------------+ | Processes:| |GPUGICIPIDTypeProcess nameGPU Memory | |IDIDUsage| |=============================================================================| |0N/AN/A1515G/usr/lib/xorg/Xorg216MiB | |0N/AN/A1771G/usr/bin/gnome-shell26MiB | |0N/AN/A3659G...AAAAAAAAA= --shared-files16MiB | |0N/AN/A4582G...AAAAAAAAA= --shared-files133MiB | |0N/AN/A7588G...AAAAAAAAA= --shared-files7MiB | |0N/AN/A10792G...AAAAAAAAA= --shared-files27MiB | +-----------------------------------------------------------------------------+

  2. 安装docker
    curl https://get.docker.com | sh sudo systemctl start docker && sudo systemctl enable docker

    重启 Docker 守护进程以使改动生效:
    sudo systemctl restart docker

    完成 Docker 安装后,在终端中执行下述命令并重启系统,这样可以免去每次执行 Docker 命令时需要添加 sudo 的繁琐:
    sudo groupadd docker sudo usermod -aG docker your_username

  3. 安装nvidia工具包
    如果是在物理机中安装的 Ubuntu,且机器配有 NVIDIA 显卡,在安装了驱动的前提下,还需要安装 NVIDIA 容器工具包以运行 Apollo Docker 镜像中的 CUDA:
    distribution=$(. /etc/os-release; echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get -y update sudo apt-get install -y nvidia-docker2

  4. git clone源码
    # 使用 SSH 的方式 git clone git@github.com:ApolloAuto/apollo.git# 使用 HTTPS 的方式 git clone https://github.com/ApolloAuto/apollo.git

Docker构建启动Apollo
  1. 进入到 Apollo 源码根目录,终端执行下述命令以启动 Apollo Docker 开发容器:
    ./docker/scripts/dev_start.sh

  2. 进入docker
    ./docker/scripts/dev_into.sh

  3. 容器中构建Apollo,
    ./apollo.sh build#若编译失败可多尝试几次,卡死可尝试 ./apollo.sh build_opt

  4. 启动Apollo
    ./scripts/bootstrap.sh start

    上述命令会启动 DreamView 并使能模块监控机制,在浏览器中访问 http://localhost:8888 来显示 DreamView 界面。
踩坑记录
git clone Apollo仓库遇到错误
andre@andre-CN15S:~$ git clone git clone https://github.com/ApolloAuto/apollo.git Cloning into 'apollo'... remote: Enumerating objects: 2618, done. remote: Counting objects: 100% (2618/2618), done. remote: Compressing objects: 100% (1495/1495), done. error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated. fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed

解决办法:
https://github.com/ApolloAuto...
Apollo执行 ./apollo.h build遇到错误
(16:20:38) ERROR: no such package '@com_github_grpc_grpc//bazel': java.io.IOException: Error downloading [https://apollo-system.cdn.bcebos.com/archive/6.0/v1.30.0.tar.gz, https://github.com/grpc/grpc/archive/v1.30.0.tar.gz] to /apollo/.cache/bazel/540135163923dd7d5820f3ee4b306b32/external/com_github_grpc_grpc/temp13334635335104087956/v1.30.0.tar.gz: Unknown host: github.com (16:20:38) INFO: Elapsed time: 164.995s (16:20:38) INFO: 0 processes. (16:20:38) FAILED: Build did NOT complete successfully (0 packages loaded)

解决办法: 多编译几次 就好了
安装VS code并配置C++环境
VS code安装和配置参见: https://segmentfault.com/a/11...

    推荐阅读