北理工机器人队RM视觉组ubuntu必备软件安装指南

基础软件安装

sudo apt update && sudo apt upgrade
sudo apt install git curl vim build-essential cmake make gcc g++

zsh终端安装

sudo apt install zsh  curl git vim make cmake

chsh -s /bin/zsh  

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"    

chsh -s /bin/zsh  

sudo apt install autojump

git clone https://hub.fastgit.org/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

git clone https://hub.fastgit.org/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

echo    'plugins=(git autojump zsh-autosuggestions zsh-syntax-highlighting)' >> ~/.zshrc

automatic login non-GUI

参考资料

cmake与make

sudo apt update
sudo apt install cmake make

vscode

下载deb包,安装即可。vscode download

树莓派等arm设备请访问headmelted

安装code-server,以树莓派为例,请访问bilibili

xmake

下载xmake的deb包。xmake下载
下载完成后,安装即可。
在vscode下安装xmake插件。

QT

下载地址
选择5.13.0下载安装即可。中间可能需要注册账号,按照提示注册即可。
安装命令

sudo ./[softwarename]

第三方库安装

eigen

eigen是C++开源线性代数库。

sudo apt install libeigen3-dev

cJSON安装

该c语言库仅用与安装,不需要了解如何使用。
关于cjson的安装必须按照下述的install方式,避免由于安装方式的不同造成兼容性问题。

git clone https://hub.fastgit.org/DaveGamble/cJSON.git
cd cJSON
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig

VTK安装

该第三包不必安装。

# https://vtk.org/download/ 下载相应的版本源代码并解压缩
# cd vtk 切换到对应文件夹下
mkdir build
cd build

wget https://www.vtk.org/files/release/8.2/VTKData-8.2.0.zip # 这里的版本号应当与软件版本号相适应
unzip VTKData-8.2.0.zip
rm VTKData-8.2.0.zip
mv VTK-8.2.0/.ExternalData/ ..

cmake -D VTK_USE_CUDA=ON \
      -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=/usr/local \
      -D VTK_USE_MPI=ON \
      -D VTK_WRAP_PYTHON=OFF \
      -D VTK_SMP_IMPLEMENTATION_TYPE=TBB \
      ..
make -j4
sudo make install
sudo ldconfig

yaml-cpp安装

git clone https://hub.fastgit.org/jbeder/yaml-cpp.git
cd yaml-cpp
mkdir build
cd build
cmake ..
make -j2
sudo make install

OpenCV安装

B站链接

解决无法从github下载问题

在/etc/hosts文件中增加下面语句

151.101.76.133 github-com.s3.amazonaws.com

在ubuntu下,路径是/etc/hosts.

jetson nano安装

这是在jetson nano下安装OpenCV的教程,开启了CUDA编译,支持VTK和OpenGL,在使用下述脚本安装前,先看后面的报错部分进行环境配置。同时改脚本要求提前安装VTK。在https://developer.nvidia.com/cuda-gpus可查询相关GPU的CUDA_ARCH_BIN。

# gpu_install
sudo apt update
sudo apt-get install -y libtiff5-dev libeigen3-dev
sudo apt install -y git gcc g++ make cmake libgtk2.0-dev libgoogle-glog-dev 
sudo apt install -y libtesseract-dev libgtkglext1 libgtkglext1-dev ffmpeg
sudo apt install -y libv4l-0 libv4l-dev
sudo apt install -y liblapacke-dev libopenblas-dev libgtk-3-dev libgstreamer-plugins-base1.0-dev 
sudo apt install -y libgstreamer1.0-dev libavresample-dev libgphoto2-dev libdc1394-22-dev
sudo apt-get install -y build-essential make cmake cmake-curses-gui git g++ pkg-config curl
sudo apt-get install -y libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libeigen3-dev libglew-dev libgtk2.0-dev
sudo apt-get install -y libtbb2 libtbb-dev libv4l-dev v4l-utils qv4l2 v4l2ucp
sudo apt-get install -y libdc1394-22-dev libxine2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt-get install -y libjpeg8-dev libjpeg-turbo8-dev libtiff-dev libpng-dev
sudo apt-get install -y libxvidcore-dev libx264-dev libgtk-3-dev
sudo apt-get install -y libatlas-base-dev libopenblas-dev liblapack-dev liblapacke-dev gfortran
sudo apt-get install -y qt5-default
sudo apt-get install -y python3-dev python3-testresources python3-numpy
cd opencv-3.4.7
mkdir build
cd build
cmake   -D CMAKE_BUILD_TYPE=RELEASE \
        -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D WITH_CUDA=ON \
        -D CUDA_ARCH_BIN="5.3" \
        -D CUDA_ARCH_PTX="5.3" \
        -D WITH_CUBLAS=ON \
        -D WITH_NVCUVID=ON \
        -D ENABLE_FAST_MATH=ON \
        -D CUDA_FAST_MATH=ON \
        -D ENABLE_NEON=ON \
        -D WITH_GSTREAMER=ON \
        -D WITH_LIBV4L=ON \
        -D WITH_OPENCL=OFF -DWITH_OPENCL_SVM=OFF -DWITH_OPENCLAMDFFT=OFF -DWITH_OPENCLAMDBLAS=OFF \
        -D BUILD_opencv_cudalegacy=ON \
        -D BUILD_opencv_face=OFF \
        -D BUILD_opencv_python2=OFF \
        -D BUILD_opencv_python3=ON \
        -D BUILD_TESTS=OFF \
        -D BUILD_PERF_TESTS=OFF \
        -D BUILD_EXAMPLES=OFF  \
        -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.7/modules \
        -D WITH_TBB=ON \
        -D BUILD_opencv_world=OFF \
        -D WITH_GTK_2_X=ON \
        -D OPENCV_ENABLE_NONFREE=ON \
        -D EIGEN_INCLUDE_PATH="/usr/include/eigen3" \
        -D WITH_XINE=ON \
        -D WITH_GDAL=ON \
        -D WITH_QT=ON \
        -DOPENCV_GENERATE_PKGCONFIG=ON \
        ..
make -j4
sudo make install
sudo ldconfig

编译完成后可以采用sudo make install进行安装,但是make install安装有一个问题就是需要保留build文件夹才能较为完整地卸载所安装的软件,而Opencv编译后的build文件夹有十多个G,所以十分占用空间,在这里考虑使用Checkinstall代替make install
Checkinstall是将源码转换成deb或者rpm包的工具,操作简单。在编译完成后,首先修改一下checkinstall的配置文件checkinstallrc,可以通过whereis checkinstallrc查找此文件的位置,打开文件修改BACKUP变量为0(默认为1),这个变量控制在checkinstall过程中是否保存备份文件,由于Opencv编译生成的文件太大,保存备份文件会很耗时,所以选择不保存备份文件。
修改完checkinstall的配置文件后,直接运行sudo checkinstall即可,会在build目录下生成一个.deb包,此时Opencv已经安装上了,以后如果需要删除Opencv,直接运行:sudo dpkg -r build,而如果要安装直接运行sudo dpkg -i build_xxx.deb即可。

jetson nano报错


该错误解决方案

树莓派安装

sudo apt update
sudo apt-get install -y libtiff5-dev libeigen3-dev
sudo apt install -y git gcc g++ make cmake libgtk2.0-dev libgoogle-glog-dev 
sudo apt install -y libtesseract-dev libgtkglext1 libgtkglext1-dev ffmpeg
sudo apt install -y libv4l-0 libv4l-dev
sudo apt install -y liblapacke-dev libopenblas-dev libgtk-3-dev libgstreamer-plugins-base1.0-dev 
sudo apt install -y libgstreamer1.0-dev libavresample-dev libgphoto2-dev libdc1394-22-dev
sudo apt-get install -y build-essential make cmake cmake-curses-gui git g++ pkg-config curl
sudo apt-get install -y libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libeigen3-dev libglew-dev libgtk2.0-dev
sudo apt-get install -y libtbb2 libtbb-dev libv4l-dev v4l-utils qv4l2 v4l2ucp
sudo apt-get install -y libdc1394-22-dev libxine2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt-get install -y libjpeg8-dev libjpeg-turbo8-dev libtiff-dev libpng-dev
sudo apt-get install -y libxvidcore-dev libx264-dev libgtk-3-dev
sudo apt-get install -y libatlas-base-dev libopenblas-dev liblapack-dev liblapacke-dev gfortran
sudo apt-get install -y qt5-default
sudo apt-get install -y python3-dev python3-testresources
cd opencv-3.4.7
mkdir build
cd build
cmake   -D CMAKE_BUILD_TYPE=RELEASE \
        -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D ENABLE_NEON=ON \
        -D ENABLE_FAST_MATH=ON \
        -D WITH_GSTREAMER=ON \
        -D WITH_LIBV4L=ON \
        -D BUILD_opencv_python2=OFF \
        -D BUILD_opencv_python3=ON \
        -D BUILD_TESTS=OFF \
        -D BUILD_PERF_TESTS=OFF \
        -D BUILD_EXAMPLES=OFF  \
        -D WITH_TBB=ON \
        -D BUILD_opencv_world=OFF \
        -D WITH_OPENGL=OFF \
        -D WITH_GTK_2_X=ON \
        -D OPENCV_ENABLE_NONFREE=ON \
        -D EIGEN_INCLUDE_PATH="/usr/include/eigen3" \
        -D WITH_XINE=ON \
        -D WITH_GDAL=ON \
        ..
make -j4
sudo make install
sudo ldconfig

x86 ubuntu18.04

sudo apt update
sudo apt-get install -y libtiff5-dev libeigen3-dev
sudo apt install -y git gcc g++ make cmake libgtk2.0-dev libgoogle-glog-dev 
sudo apt install -y libtesseract-dev libgtkglext1 libgtkglext1-dev ffmpeg
sudo apt install -y libv4l-0 libv4l-dev
sudo apt install -y liblapacke-dev libopenblas-dev libgtk-3-dev libgstreamer-plugins-base1.0-dev 
sudo apt install -y libgstreamer1.0-dev libavresample-dev libgphoto2-dev libdc1394-22-dev
sudo apt-get install -y build-essential make cmake cmake-curses-gui git g++ pkg-config curl
sudo apt-get install -y libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libeigen3-dev libglew-dev libgtk2.0-dev
sudo apt-get install -y libtbb2 libtbb-dev libv4l-dev v4l-utils qv4l2 v4l2ucp
sudo apt-get install -y libdc1394-22-dev libxine2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt-get install -y libjpeg8-dev libjpeg-turbo8-dev libtiff-dev libpng-dev
sudo apt-get install -y libxvidcore-dev libx264-dev libgtk-3-dev
sudo apt-get install -y libatlas-base-dev libopenblas-dev liblapack-dev liblapacke-dev gfortran
sudo apt-get install -y qt5-default
sudo apt-get install -y python3-dev python3-testresources
cd opencv-3.4.7
mkdir build
cd build
cmake   -D CMAKE_BUILD_TYPE=RELEASE \
        -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D ENABLE_FAST_MATH=ON \
        -D WITH_GSTREAMER=ON \
        -D WITH_LIBV4L=ON \
        -D BUILD_opencv_python2=OFF \
        -D BUILD_opencv_python3=ON \
        -D BUILD_TESTS=OFF \
        -D BUILD_PERF_TESTS=OFF \
        -D BUILD_EXAMPLES=OFF  \
        -D WITH_TBB=ON \
        -D BUILD_opencv_world=OFF \
        -D WITH_OPENGL=ON \
        -D WITH_GTK_2_X=ON \
        -D OPENCV_ENABLE_NONFREE=ON \
        -D EIGEN_INCLUDE_PATH="/usr/include/eigen3" \
        -D WITH_XINE=ON \
        -D WITH_GDAL=ON \
        ..
make -j4
sudo make install
sudo ldconfig

安装成功的界面

x86 ubuntu18.04 RTX2070

cmake -D CMAKE_BUILD_TYPE=RELEASE \
        -D INSTALL_PYTHON_EXAMPLES=ON \
        -D OPENCV_ENABLE_NONFREE=ON \
        -DBUILD_opencv_rgbd=OFF \
        -DBUILD_opencv_world=OFF \
        -D WITH_CUDA=ON \
        -D CUDA_VERSION=11.1 \
        -D WITH_CUDNN=ON \
        -D OPENCV_DNN_CUDA=ON \
        -D ENABLE_FAST_MATH=1 \
        -D CUDA_FAST_MATH=1 \
        -D CUDA_ARCH_BIN=8.6 \
        -D CUDA_ARCH_PTX=8.6 \
        -D OPENCV_EXTRA_MODULES_PATH=/home/client/Downloads/opencv_contrib/modules \
        -D HAVE_opencv_python3=ON \
        -D BUILD_EXAMPLES=ON \
        -D WITH_QT=ON  \
        -D WITH_CUBLAS=1 \
        -D WITH_OPENGL=ON \
        -D WITH_GSTREAMER=ON \
        -DBUILD_DOCS=ON \
        -D OPENCV_GENERATE_PKGCONFIG=ON \
        -D CUDA_CUDART_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudart.so \
        -D CUDA_CUDA_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/stubs/libcuda.so \
        -D CUDA_cublas_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcublas.so \
        -D CUDA_cudadevrt_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudadevrt.a \
        -D CUDA_cudart_static_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudart_static.a \
        -D CUDA_cufft_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcufft.so \
        -D CUDA_cupti_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcupti.so \
        -D CUDA_curand_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcurand.so \
        -D CUDA_cusolver_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcusolver.so \
        -D CUDA_cusparse_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcusparse.so \
        -D CUDA_nppc_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libnppc.so \
        -D CUDA_nppial_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libnppial.so \
        -D CUDA_nppicc_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libnppicc.so \
        -D CUDA_nppidei_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libnppidei.so \
        -D CUDA_nppif_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libnppif.so \
        -D CUDA_nppig_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libnppig.so \
        -D CUDA_nppim_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libnppim.so \
        -D CUDA_nppist_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libnppist.so \
        -D CUDA_nppisu_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libnppisu.so \
        -D CUDA_nppitc_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libnppitc.so \
        -D CUDA_npps_LIBRARY:FILEPATH=/usr/local/cuda-11.1/targets/x86_64-linux/lib/libnpps.so \
        -D CUDA_rt_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/librt.so \
        -D CUDA_nppicom_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libnppicom.so \
        -D CUDA_NVCC_EXECUTABLE:FILEPATH=/usr/local/cuda-11.1/bin/nvcc \
        -D CUDA_TOOLKIT_INCLUDE:PATH=/usr/local/cuda-11.1/include \
        -D CUDA_TOOLKIT_ROOT_DIR:PATH=/usr/local/cuda-11.1 \
        -D BUILD_opencv_python3=ON \
        -D BUILD_opencv_python2=OFF \
        -D PYTHON3_PACKAGES_PATH=/home/client/anaconda3/envs/opencv420/lib/python3.7/site-packages/numpy/core/include \
        -D PYTHON3_INCLUDE_DIR=/home/client/anaconda3/envs/opencv420/include/python3.7m \
        -D PYTHON3_EXCUTABLE=/home/client/anaconda3/envs/opencv420/bin/python3.7m \
        -D PYTHON3_NUMPY_INCLUDE_DIRS=/home/client/anaconda3/envs/opencv420/lib/python3.7/site-packages \
        -D PYTHON3_LIBRARY=/home/client/anaconda3/envs/opencv420/lib/libpython3.7m.so \
        /home/client/Downloads/opencv

flameshot

这是一个截屏软件。

sudo apt install flameshot

设置快捷键:


这里点击加号。

这里设置命令。首先要找到flameshot的位置。

然后输入

/usr/bin/flameshot gui

即可完成设置。

zeal

这是离线的API搜索引擎。
安装地址:zeal

posted @ 2019-10-08 11:32  LightningStar  阅读(2086)  评论(0编辑  收藏  举报