Ubuntu18.04套餐安装集锦
**1:Ubuntu18.04 安装 Anaconda3** https://blog.csdn.net/qq_15192373/article/details/81091098
2、Ubuntu18.04安装Nvida
(1)sudo add-apt-repository ppa:graphics-drivers/ppa
(2)sudo apt update
(3) 识别显卡模型和推荐的驱动程序ubuntu-drivers devices
(base) luming@luming-HP-Z440-Workstation:~$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:02.0/0000:02:00.0 ==
modalias : pci:v000010DEd000013BCsv0000103Csd00001140bc03sc00i00
vendor : NVIDIA Corporation
model : GM107GL [Quadro K1200]
driver : nvidia-driver-430 - third-party free
driver : nvidia-driver-410 - third-party free
driver : nvidia-driver-390 - third-party free
driver : nvidia-driver-435 - distro non-free
**driver : nvidia-driver-440 - third-party free recommended**
driver : nvidia-driver-415 - third-party free
driver : xserver-xorg-video-nouveau - distro free builtin
(5)sudo apt install nvidia-driver-440
完成重启电脑
(6)验证是否安装成功在终端输入:nvidia-smi
**3、Ubuntu18.04安装对应版本的cudn **
上边的图告诉我,我的可以安装cuda10.2 ,那就安装吧
进cuda的官网 https://developer.nvidia.com/cuda-downloads
按照上边的语句去安装:
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
执行完的结果图
在等待上边安装的时候,我看到这个博客里说道需要安装依赖库,我安装了
参考链接:https://blog.csdn.net/CAU_Ayao/article/details/83627342
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev
sudo apt-get install libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
添加环境变量,打开 .bashrc:
sudo gedit ~/.bashrc
在末尾添加:
export CUDA_HOME=/usr/local/cuda -10.2
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
保存退出
刷新环境变量:source ~/.bashrc
测试是否成功:nvcc -V
用Sample来测试
第一步:进入例子文件
cd /usr/local/cuda-10.2/samples/1_Utilities/deviceQuery
第二步:执行make命令
sudo make
第三步:运行Demo
./deviceQuery
结果图
**4、Ubuntu18.04安装对应的cudnn **
去官网https://developer.nvidia.com/taxonomy/term/608(注册登录)
参考这个链接
https://blog.csdn.net/zbbmm/article/details/102680387
1.安装运行环境
sudo dpkg -i '/home/luming/下载/libcudnn7_7.6.5.32-1+cuda10.2_amd64.deb'
2.安装开发包
sudo dpkg -i '/home/luming/下载/libcudnn7-dev_7.6.5.32-1+cuda10.2_amd64.deb'
3.安装示例
sudo dpkg -i '/home/luming/下载/libcudnn7-doc_7.6.5.32-1+cuda10.2_amd64.deb'
4.拷贝文件到环境配置的Home路径下
$cp -r /usr/src/cudnn_samples_v7/ /home/luming/cudnntest
5.切换路径
$ cd /home/luming/cudnntest/cudnn_samples_v7/mnistCUDNN
6.编译测试文件
sudo make
7.运行示例,如果成功则证明安装成功。 :Test Passed!
$ ./mnistCUDNN
**5、Ubuntu18.04安装opencv3.4.0 **
参考文献;
https://blog.csdn.net/u013066730/article/details/79411767
https://blog.csdn.net/baidu_34971492/article/details/81665538
https://blog.csdn.net/dyx810601/article/details/51579273
https://blog.csdn.net/qq_32408773/article/details/83346816
安装依赖包
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
安装出现E: 无法定位软件包 libjasper-dev
可参考这篇文章:https://blog.csdn.net/weixin_41053564/article/details/81254410
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install libjasper1 libjasper-dev
成功的解决了问题,其中libjasper1是libjasper-dev的依赖包
去官网下载opencv,在本教程中选用的时opencv3.4.0,其他版本的配置方法异曲同工。
下载链接http://opencv.org/releases.html,选择sources版本
(1) unzip opencv-3.4.0.zip
(2)sudo apt-get install cmake sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff4.dev libswscale-dev libjasper-dev
(3)cd进入解压后的文件夹,创建编译文件夹并进入:
mkdir build
cd build
(4)cmake(可参考这个博客:https://blog.csdn.net/dyx810601/article/details/51579273)
cmake -D CMAKE_BUILD_TYPE=bulid -D CMAKE_INSTALL_PREFIX=/usr/local -D CUDA_GENERATION=Kepler ..
结果如下:(5)sudo make
需要等待一会,有百分数进度条显示,成功的结果图
(6)sudo make install
(7)配置环境
sudo gedit /etc/ld.so.conf.d/opencv.conf
在打开的文件末尾添加 :(空文件)
/usr/local/lib
执行命令使对上面的修改生效:
sudo ldconfig
配置bash
sudo gedit /etc/bash.bashrc
在打开的文件末尾添加:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
保存和更新使得配置生效:
source /etc/bash.bashrc
sudo updatedb
(8)测试:进入opencv-3.4.3/samples/cpp/example_cmake,这里面是一些cmake官方程序,执行调用摄像头程序:
进入opencv-3.4.3/samples/cpp/example_cmake,这里面是一些cmake官方程序,执行调用摄像头程序:
cmake .
make
./opencv_example
Failed to load module "canberra-gtk-module"解决如下
sudo apt-get install libcanberra-gtk-module
来源:CSDN
作者:鹿鸣7
链接:https://blog.csdn.net/weixin_41946884/article/details/103722705