装机文档

装机文档

  1. 重装UBUNTU时,确保PC能够上网,这样系统安装过程,会自动更新驱动。系统自动安装的显卡驱动可以打开外接显示器。手动安装的驱动基本上打不开外接显示器。
    手动安装NVIDIA显卡驱动

  2. 装好之后,卡在登录界面或者输入密码之后卡在桌面上,可以通过开机时按有限次Esc进入grub界面,选择ubuntu,然后按E,在splash后面空格再加nouveau.modeset = 0
    具体操作可参考以下链接
    注意:这一步不进行的话,后面也有可能出现这个bug,所以早晚要进行这一步操作。

  3. 安装输入法:install输入法之后需要重启才能生效
    安装搜狗输入法
    安装谷歌输入法

  4. Create related folders:

    mkdir autodrive
    cd autodrive
    mkdir thirdparty
    

    下载依赖库目录下需要的依赖库

  5. Install doxygen

    sudo apt-get install flex
    sudo apt-get install bison
    git clone https://github.com/doxygen/doxygen.git
    cd doxygen
    mkdir build
    cd build
    cmake -G ''Unix Makefiles'' ..
    make
    make install
    
  6. Install graphviz

    sudo apt install python-pydot python-pydot-ng graphviz
    
  7. 解压threadpool-0_2_5-src.zip,然后将其中的threadpool目录剪切到thirdparty/下
    在threadpool目录里执行make

    unzip threadpool-0_2_5-src.zip
    cd threadpool
    make
    
  8. Install: gcc g++ cmake cmake-curses-gui

    sudo apt-get install build-essential
    sudo apt-get install cmake-curses-gui
    
  9. 安装apr, apr-util, log4cxx
    注意安装log4cxx时,路径直接写/usr/local即可,
    log4cxx安装遇到问题可以参考这个,注意设置log4cxx的环境变量要与安装路径(/usr/local)一致(You can get these packages in Hongjing sharepoint. Do not need to redownload them!)
    APR is a library that abstracts away the details of the underlying operating system.

    some links(it is useful when you do not have these source files)
    http://logging.apache.org/log4cxx/
    http://apr.apache.org/download.cgi

    Install apr

    tar xzvf apr-1.3.3.tar.bz2
    cd apr-1.3.3
    ./configure --prefix=/usr/local/apr
    make
    (sudo) make install
    

    Install apr-util

    tar xzvf apr-util-1.3.4.tar.bz2
    cd apr-util-1.3.4
    ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
    make
    (sudo) make install
    

    Install Log4cxx

    tar xzvf apache-log4cxx-0.10.0.tar.gz
    cd apache-log4cxx-0.10.0
    ./configure --prefix=/usr/local --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
    make
    (sudo) make install
    

    Load environment variable

    export LD_LIBRARY_PATH=/usr/local/apr/lib/:/usr/local/apr-util/lib/:/usr/local/lib/
    
  10. Installgtest
    参考链接

    git clone https://github.com/google/googletest.git
    mkdir build
    cd build
    cmake ..
    make
    sudo make install
    
  11. InstallQT5.11.1
    Download the installation file here, and install in /opt(注意这里要在opt下面新建一个QT5.11.1的文件夹,安装在这里面,才能跟后面的路径对上,不会出错)
    安装

    sudo chmod 777 qt-opensource-linux-x64-5.11.1.run
    

    安装完成之后修改路径

    sudo gedit /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
    

    修改路径为:

    /opt/QT5.11.1/5.11.1/gcc_64/bin
    /opt/QT5.11.1
    

    然后把头文件库文件等拷贝到/usr/local/下

    sudo cp -rf /opt/QT5.11.1/5.11.1/gcc_64/include /usr/local/
    sudo cp -rf /opt/QT5.11.1/5.11.1/gcc_64/bin /usr/local/
    sudo cp -rf /opt/QT5.11.1/5.11.1/gcc_64/mkspecs /usr/local/
    sudo cp -rf /opt/QT5.11.1/5.11.1/gcc_64/lib /usr/local/
    sudo cp -rf /opt/QT5.11.1/5.11.1/gcc_64/plugins /usr/local/
    
  12. Install protobuf(cameera相关-ruiqi)
    在SharePoint下载压缩包protobuf-3.5.0-cpp.tgz
    解压文件

    cd protobuf-3.5.0
    ./configure -enable-shared
    make -j8
    sudo make install
    export PATH=$PATH:/usr/local/bin
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    

    测试:protoc --version查看版本,显示libprotobuf 3.5.0,成功
    注意:如果你的电脑安装了QT,请删除qt库安装目录下的gcc_64/plugins/platformthemes/libqgtk3.so,以避免编译冲突

    以下是另一个版本的说明,可参考,但是基本上上面的安装方式就够用了

    可能遇到的问题[参考](https://www.cnblogs.com/xiaoleiel/p/8324112.html), 
    要同时安装qt时,请用./configure  --disable-shared
    修改configuer文件的2514行 :源码中没有赋值,需要赋值为 -fPIC 
    if test "x$ {ac_cv_env_CFLAGS_set}" = "x"; then :   CFLAGS="-fPIC" fi 
    if test "x$ {ac_cv_env_CXXFLAGS_set}" = "x"; then :   CXXFLAGS="-fPIC"
    然后拷贝
    sudo cp src/google/protobuf/stubs/map_util.h /usr/local/include/google/protobuf/stubs/
    
  13. 下载并解压can calmcar
    注意:calmcar只需要X86Xavier两个版本即可

  14. 安装VTK之前,需要安装依赖:OpenGL Eigen OpenCV OpenNI
    Install OpenGL
    参考链接

    InstallEigen
    在SharePoint下载压缩包eigen-eigen-5a0156e40feb.tar.bz2,解压然后进入安装

    cd eigen-eigen-5a0156e40feb
    mkdir build
    cd build
    cmake ..
    make 
    sudo make install
    

    Install`OpenNI(openni2-doc openni2-utils openni-doc openni-utils)``
    暂时没装,好像没啥影响

  15. InstallOpenCV(cameera相关-ruiqi)
    a)opencv源码安装
    安装依赖

    sudo apt-get install --assume-yes ffmpeg libopencv-dev build-essential cmake git 
    libgtk2.0-dev libgtk-3-dev pkg-config python-dev python-numpy python3-numpy
    libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev
    libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer0.10-dev
    libgstreamer-plugins-base0.10-dev libgstreamer1.0-dev 
    libgstreamer-plugins-base1.0-dev libv4l-dev libtbb-dev libqt4-dev qtbase5-dev 
    libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev 
    libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip
    

    编译

    cd XXXXXX/opencv-3.4.0
    mkdir bulid
    cd bulid/
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_QT=OFF -D WITH_CUDA=OFF -D WITH_VTK=OFF ..
    sudo make -j8
    

    cmake成功后,会出现

    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/***/opencv-3.4.0/build
    

    安装+设置环境变量

    sudo make install
    sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
    sudo ldconfig
    sudo gedit /etc/bash.bashrc
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
    source /etc/bash.bashrc
    

    测试

    cd ~/opencv-3.4.0/samples/cpp/example_cmake
    cmake .
    Make
    ./opencv_example
    

    看到打开了摄像头,在左上角有一个hello opencv,即表示配置成功。

    b)opencv以及opencv-contrib安装
    注意,这个和之前的源码编译二选一,contrib模块包含了很多第三方算法,如果不需要,可以不用安装。(camera默认不需要安装)
    从SharePoint下载opencv3.4.1-contrib.zip,解压在opencv3.4.1源码文件夹中,和build文件夹平级
    安装依赖:

    sudo apt-get install build-essential
    sudo apt-get install libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-dev
    sudo apt-get install checkinstall yasm libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libfaac-dev libmp3lame-dev libtheora-dev
    sudo apt-get install libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
    sudo apt-get install libxvidcore-dev libx264-dev ffmpeg
    sudo apt-get install libatlas-base-dev gfortran
    

    编译安装:

    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_QT=OFF -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.1/modules -D WITH_CUDA=ON ..
    make -j4
    sudo make install
    sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
    sudo ldconfig
    sudo gedit /etc/bash.bashrc
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
    source /etc/bash.bashrc
    

    注意:上面修改的内容是export这一行,修改完成后source /etc/bash.bashrc在terminal里面运行一下,不是将这一行也加进bash文件,否则会导致死循环(/etc下的bash.bashrc循环调用),这时候会导致terminal打开之后是空白的,几秒钟后退出。这时候可以“ctrl+c”终止它,于是,你会看到,你的prompt(就是命令前面的那串提示符)出现了,这时,进到相应的文件,去把你的错误修正。
    测试:

    cd ~/opencv-3.4.0/smaples/cpp/example_cmake
    cmake .
    Make
    ./opencv_example
    

    看到打开了摄像头,在左上角有一个 hello opencv,即表示配置成功。

  16. InstallVTK

    mkdir build
    cd build
    ccmake ..
    

    点c 这时ccmake会检测安装环境是否正确。选择之后enter键修改一个变量 vtk_group_qt = on (原配置为off),然后再点c,如果没有错误多点几次c,这时ccmake出现了新按钮g,点g生成配置文件

    cmake .
    make -j4
    sudo make  install
    
  17. Installpcl
    首先安装依赖

    sudo apt-get update
    sudo apt-get install git build-essential linux-libc-dev
    sudo apt-get install cmake cmake-gui
    sudo apt-get install libusb-1.0-0-dev libusb-dev libudev-dev
    sudo apt-get install mpi-default-dev openmpi-bin openmpi-common
    sudo apt-get install libflann1.8 libflann-dev
    sudo apt-get install libeigen3-dev
    sudo apt-get install libboost-all-dev
    sudo apt-get install libvtk5.10-qt4 libvtk5.10 libvtk5-dev
    sudo apt-get install libqhull* libgtest-dev
    sudo apt-get install freeglut3-dev pkg-config
    sudo apt-get install libxmu-dev libxi-dev
    sudo apt-get install mono-complete
    sudo apt-get install qt-sdk openjdk-8-jdk openjdk-8-jre 
    

    链接中除了QT VTK Eigen Cmake之外其他的依赖包都需要安装。
    最好不要使用源码安装boostboost源码编译之后少两个库文件(iostream mpi
    注意:以下给出两种编译安装方式

    git clone https://github.com/PointCloudLibrary/pcl.git  
    cd pcl  
    mkdir release  
    cd release  
    cmake -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_GPU=ON -DBUILD_apps=ON -DBUILD_examples=ON -DCMAKE_INSTALL_PREFIX=/usr ..  
    make -j4 (线程数根据情况选择)
    sudo make  install  
    

    博主按照以上方式没有编译通过,采用以下方式才通过,暂时不清楚区别,大家自行选择,自求多福!

    mkdir build
    cd build
    ccmake ..
    点c 这时ccmake会检测安装环境是否正确。如果没有错误多点几次c,这时ccmake出现了新按钮g,点g生成配置文件
    cmake .
    make -j4
    sudo make  install
    
  18. 安装xsens库(MT_Software_Suite_Linux_4.8)
    执行sudo sh mtsdk_linux_4.8.sh,如果提示缺少包,则用apt-get安装一下

删除/usr/local/xsens/lib64/和/usr/local/xsens/lib32/下的所有文件
假设安装目录在/usr/local/xsens,则分别在/usr/local/xsens/public/xcommunication和/usr/local/xsens/public/xstypes下执行make,然后将libxcommunication.a和libxstypes.a移动到/usr/local/xsens/lib64/下
  1. 和赛的驱动
    首先打开README,怎么编译安装还有需要的依赖,README中都有(安装的时候注意要sudo)

    sudo make install
    
  2. Installsqlit

    ./configure
    make
    
  3. Installqp-oases

    mkdir build
    cd build
    cmake ..
    make -j4
    sudo make install
    
  4. Installappollo-common

    sh build.sh
    
  5. Installhiredis

    mkdir build
    cd build
    cmake ..
    make 
    sudo make install
    
  6. Installlibicsneo robosense
    surestar cicv_localization
    qianxun

  7. Installlinuxcan

    make
    sudo make install
    
  8. Installredis

    make
    sudo make install
    

    配置redis启动

    将redis.conf放置到/etc/redis/redis.conf位置(新建redis文件夹)
    将redis.service放置到/etc/systemd/system/redis.service位置
    sudo systemctl daemon-reload
    systemctl start redis
    
  9. Install yaml-cpp

    mkdir build
    cd build
    cmake ..
    make 
    sudo make install
    
  10. Installlibzmq

    ./configure
    make
    sudo make install
    

    安装完成后将安装目录下的zmq.hpp拷贝到/usr/local/include下面

    sudo cp ~/libzmq/zmq.hpp /usr/local/include
    
  11. ann_1.1.2 和 libunwind

  12. Pandar40P安装

  13. ‘black-seasame解压’

  14. 安装git 然后git clone以下框架源码

    common
    algorithm
    model
    adapter
    interface
    map
    calibration-api
    

    按顺序依次编译(sh build.sh)
    其他各个模块请参照各自的README

  15. 如果在线安装时出现fetch failed,也有可能时网络问题

  16. 如果需要camera模块,除了上面安装过的OpenCV 和 Protobuf,还需要库文件sesame384驱动 cuda cudnn bazel tensorflow
    安装顺序为:
    calmcar sesame等依赖库(不需要编译,直接解压在thirdparty下)
    384驱动-- cuda9.0---cudnn7
    OpenCV-3.4.0
    bazel(0.11.0)---protobuf(3.5.0)---tensorflow源码编译

  17. Install384驱动

    sudo apt-get update
    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt-get update
    sudo apt-get install nvidia-384
    sudo apt-get install mesa-common-dev
    sudo apt-get install freeglut3-dev
    

    执行完上述后,重启(reboot)
    重启后,输入:

    nvidia-smi
    

    如果出现了你的GPU列表,则说明驱动安装成功了
    装机文档_第1张图片35. Installcuda9.0

    sudo sh cuda_9.0.176_384.81_linux.run
    

    安装过程中会显示 0%
    此时一直按住回车键,直至到达 100%
    即使到达 100%没及时松手也无所谓,没什么影响。
    之后需要做几个选择:
    第一个:accept;
    遇到是否安装显卡驱动时,要选 n,因为之前已经装过 384 版驱动了;
    其余选 y 或者选默认(直接回车)。
    安装成功后会出现如下界面:

    ===========
    = Summary =
    ===========
    Driver: Not Selected
    Toolkit: Installed in /usr/local/cuda-9.0
    Samples: Installed in /home/textminer
    Please make sure that
    – PATH includes /usr/local/cuda-9.0/bin
    – LD_LIBRARY_PATH includes /usr/local/cuda-9.0/lib64, or, add /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf
    and run ldconfig as root
    To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-9.0/bin
    Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-8.0/doc/pdf for detailed information on
    setting up CUDA.
    ***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of versio
    n at least 361.00 is required for CUDA 9.0 functionality to work.
    To install the driver using this installer, run the following command, replacing with the name of this run file:
    sudo .run -silent -driver
    Logfile is /opt/temp//cuda_install_6583.log
    

    设置环境变量

    gedit ~/.bashrc
    export PATH=/usr/local/cuda-9.0/bin:$PATH
    export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH
    source ~/.bashrc
    

    (如果显示报错,请重新编辑 bashrc 文件,自己把上面的路径手动敲一遍)
    测试cuda的example:

    cd /usr/local/cuda-9.0/samples/1_Utilities/deviceQuery
    sudo make
    sudo ./deviceQuery
    

    显示 pass 则测试通过

  18. Installcudnn7
    将cudnn的安装包直接解压,例如,我解压的目录在~/Download

    cd ~/Download/cuda/include
    sudo cp cudnn.h /usr/local/cuda/include/
    cd ~/ Download /cuda/lib64
    sudo cp lib* /usr/local/cuda/lib64/
    cd /usr/local/cuda/lib64/
    sudo rm -rf libcudnn.so libcudnn.so.7
    sudo ln -s libcudnn.so.7.4.2 libcudnn.so.7 (匹配你自己下载的 cudnn 版本号, sharepoint 是 7.4.2)
    sudo ln -s libcudnn.so.7 libcudnn.so
    
  19. Installbazel
    在SharePoin下载压缩包bazel-0.11.0-installer-all-linux-x86_64.sh

    chmod 777 bazel-0.11.0-installer-all-linux-x86_64.sh
    ./bazel-0.11.0-installer-all-linux-x86_64.sh
    

    测试:
    terminal 中输入bazel –version,显示版本号为安装成功

  20. tensorflow源码编译

    git clone https://github.com/tensorflow/tensorflow
     cd tensorflow
    git checkout r1.9
    ./configure(有很多配置项,需要输入 y/n)
      • which python3.5,输入 python 的路径
      • cuda 要选择 y,输入对应的版本号
      • cudnn 如是,输入对应的版本号
      • 其他,如果有默认值就选装默认,没有的就都是 no
    编译指令,注意 monolithic 后面有个空格:
    sudo bazel build --config=opt --config=cuda –config=monolithic  tensorflow:libtensorflow_cc.so
    

    最后显示类似如下的信息,说明编译成功了:

    漫长的等待编译,大约几十分钟
    ....
    Target //tensorflow:libtensorflow_cc.so up-to-date:
    bazel-bin/tensorflow/libtensorflow_cc.so
    INFO: Elapsed time: 1192.883s, Critical Path: 174.02s
    INFO: 654 processes: 654 local.
    INFO: Build completed successfully, 656 total actions
    

    再把必要.h 头文件以及编译出来.so 的动态链接库文件复制到指定的一些路径下:

    sudo mkdir /usr/local/include/tf
    sudo cp -r bazel-genfiles/ /usr/local/include/tf/
    sudo cp -r tensorflow /usr/local/include/tf/
    sudo cp -r third_party /usr/local/include/tf/
    sudo cp bazel-bin/tensorflow/libtensorflow_cc.so /usr/local/lib/
    
  21. 安装MATLAB之后,破解的时候用standalone.lic才行

  22. 必须说明的是,重装系统后,博主原有的问题(protobuf版本链接错误)依然没有解决,以上装机方案有待商榷!

你可能感兴趣的:(Linux系统,基础知识,装机)