安装ubuntu18.04:
本机器型号安装ubuntu没有什么疑难杂症,跟着网上大佬的教程,下载镜像文件,做启动盘安装即可。
分区方案:
efi 2G
swap 16G
/ 500G
启动引导选择efi的那个分区
有独显的记得进入编辑启动项 在quite splash 后加 =nomodeset
按F10 进入 try ubuntu 然后安装。
换源
sudo gedit /etc/apt/sources.list
把原文档用下列内容替换
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
禁用nouveau
sudo gedit /etc/modprobe.d/blacklist.conf
在最后一行加入
blacklist nouveau
options nouveau modeset=0
更新,重启
sudo update-initramfs -u
reboot
装N卡驱动
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
ubuntu-drivers devices
查看本机可装显卡驱动,推荐安装最后有recommend的那个。
sudo apt install nvidia-driver-440
如果该命令无法安装,添加源后再次执行
deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse
装完检查
df -h
如果几个Loop都是100%
执行
sudo apt autoremove --purge snapd
清除后再次检查。
重启,一般来说能直接进ubuntu就没有问题了
检查驱动
nvidia-smi
装pip
sudo apt update
sudo apt-get install python-pip
sudo apt-get install python3-pip
装完之后检查
pip --version
pip3 --version
pip换源
mkdir ~/.pip
cd ~/.pip && touch pip.conf
sudo gedit pip.conf
复制粘贴下面
[global]
index-url = http://pypi.douban.com/simple
[install]
use-mirrors =true
mirrors =http://pypi.douban.com/simple/
trusted-host =pypi.douban.com
装chrome
百度搜索chrome,官网下载
CUDA+cudnn+装pytorch
一定要先去pytorch官网看,能直接用pip下载的需要CUDA几!!
自己下包实在是太慢了!
gcc g++降级(有的可以不用)
sudo apt-get install gcc-4.8
sudo apt-get install g++-4.8
ls -l gcc*
sudo mv gcc gcc.bak #备份
sudo ln -s gcc-4.8 gcc #重新链接
ls -l g++*
sudo mv g++ g++.bak
sudo ln -s g++-4.8 g++
gcc -v g++ -v #查看版本号
- 装CUDA
官网下载
sudo sh cuda_10.1.130_410.48_linux.run(文件名自己换) --no-opengl-libs
双显卡一定要加–no-opengl-libs 不然会在登陆界面无限循环
10.0以前的版本是加–no-opengl-files
安装完成后 在bashrc文件内加上
export CUDA_HOME=/usr/local/cuda(或者cuda10.1 看自己版本)
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
测试
测试:
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery
最后result=pass 成功。
安装CUDNN
官网注册下载
tar -zxvf cudnn-10.1-linux-x64-v7.6.5.32(文件名自己改).tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.1_amd64.deb
sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.1_amd64.deb
sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.1_amd64.deb
测试:
cp -r /usr/src/cudnn_samples_v7 $HOME
cd $HOME/cudnn_samples_v7/mnistCUDNN
make clean && make
./mnistCUDNN
test passed 成功。
安装tensorflow
装tensorflow
pip3 install tensorflow-gpu==1.13.1
测试:
python3
import tensorflow as tf
hello=tf.constant("Hello,Tensorflow!")
sess=tf.Session()
print(sess.run(hello))
安装ros
设置源
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
加key
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
更新
sudo apt-get update
安装ros和一些工具包
sudo apt install ros-melodic-desktop-full
sudo apt-get install ros-melodic-rqt
sudo apt-get install ros-melodic-rqt-common-plugins
装完后在bashrc文件添加
source /opt/ros/melodic/setup.bash
建立工作空间
在~目录下
mkdir catkin_ws
cd catkin_ws
mkdir src
catkin_make
安装rbx1
sudo apt-get install ros-melodic-arbotix ros-melodic-openni-camera \
ros-melodic-rosbridge-suite \
ros-melodic-rgbd-launch \
ros-melodic-turtlebot-* ros-melodic-kobuki-* ros-melodic-moveit-python \
python-pygraph python-pygraphviz python-easygui \
mini-httpd ros-melodic-laser-pipeline ros-melodic-ar-track-alvar \
ros-melodic-laser-filters \
ros-melodic-depthimage-to-laserscan ros-melodic-shape-msgs \
ros-melodic-gazebo-ros ros-melodic-gazebo-ros-pkgs \
ros-melodic-gazebo-msgs ros-melodic-gazebo-plugins \
ros-melodic-gazebo-ros-control ros-melodic-cmake-modules \
ros-melodic-smach ros-melodic-smach-ros ros-melodic-grasping-msgs \
ros-melodic-executive-smach ros-melodic-smach-viewer \
ros-melodic-tf2-web-republisher \
ros-melodic-move-base-msgs ros-melodic-fake-localization \
graphviz-dev libgraphviz-dev gv python-scipy liburdfdom-tools \
ros-melodic-ar-track-alvar* \
ros-melodic-map-server ros-melodic-move-base* \
ros-melodic-simple-grasping
cd catkin_ws
cd src
git clone https://github.com/pirobot/rbx1.git
或者保存到自己的gitee下git
git clone https://gitee.com/different_way/rbx1.git
cd ..
catkin_make
装kinect1驱动以及ros接口
在~目录下
git clone https://gitee.com/different_way/kinect_driver.git
跟着里面的readme安装
还是在~目录下
git clone https://gitee.com/different_way/libfreenect.git
cd libfreenect
mkdir build
cd build
cmake ..
make
sudo make install
在工作空间的src文件夹下
git clone https://gitee.com/different_way/freenect_stack.git
cd ..
catkin_make
双系统时间不对解决办法
在ubuntu下
安装时间校准服务
sudo apt-get install ntpdate
sudo ntpdate time.windows.com
sudo hwclock --localtime --systohc