一、安装Git LFS
方法一:使用apt安装
# Required for Ubuntu 14.04 / 16.04.
$ curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
# Ubuntu 14.04 / 16.04 / 18.04.
$ sudo apt-get install git-lfs
# Ensure that git-lfs is setup correctly in your git configuration files.
# Run it only once.
$ git lfs install
方法二:从官网下载源码,解压后运行
$ sudo ./install.sh
二、下载Apollo源代码
使用如下命令下载Apollo源代码,可根据你的习惯使用Option 1
或Option 2
克隆Apollo仓库。
# Option 1: Clone the Apollo repository with SSH
$ git lfs clone git@github.com:ApolloAuto/apollo.git
# Option 2: Clone the Apollo repository with HTTPS
$ git lfs clone https://github.com/ApolloAuto/apollo.git
# Change to the "apollo" directory
$ cd apollo
# Checkout the "master" branch
$ git checkout master
$ git lfs fetch --all
# Set the environment variable "APOLLO_HOME"
$ echo "export APOLLO_HOME=$(pwd)" >> ~/.bashrc && source ~/.bashrc
三、安装docker
同样网上有很多教程,国内直接装装不了,可以换用国内镜像。具体网上搜,此步骤也很简单 。
这里提供一个方法,如果你采用步骤四中方法安装的话,将阿波罗目录下docker/setup_host/install_docker.sh中相应的位置改为https://blog.youkuaiyun.com/qq_26479655/article/details/81115510这个博客中所述的阿里镜像,同时将/etc/apt/source.list中docker相关的注释掉。
$ sudo bash docker/setup_host/setup_host.sh
$ sudo bash docker/setup_host/install_docker.sh
四、编译源码
# Start container
$ sudo bash docker/scripts/dev_start.sh
# Get into the container
$ sudo bash docker/scripts/dev_into.sh
# Build modules
$ sudo bash apollo.sh build
# Note: If you do not have a GPU, you can use the following script instead
$ bash apollo.sh build_cpu
# Note: If your computer is very slow, you can enter the following command to limit the CPU.
$ bash apollo.sh build --local_resources 2048,1.0,1.0
五、启动Apollo
$ source /apollo/scripts/apollo_base.sh
$ sudo bash scripts/bootstrap.sh
$ cyber_recorder play -f docs/demo_guide/demo_3.5.record --loop
打开浏览器,并输入localhost:8888就开可以使用Apollo Dreamview了