Ubuntu常用指令集
装系统
- USB启动盘工具refus:https://rufus.en.softonic.com/
- Ubuntu16.04LTS:https://www.ubuntu.org.cn/download/desktop
换源
apt-get
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo gedit /etc/apt/sources.list
阿里云源
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
清华源
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse
更新
sudo apt-get update
anaconda
sudo gedit ~/.condarc
写入以下内容
channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
show_channel_urls: true
远程连接
xrdp远程桌面
- ubuntu端
sudo apt-get install xrdp
sudo apt-get install vnc4server
sudo apt-get install xubuntu-desktop
echo "xfce4-session" >~/.xsession
sudo service xrdp restart
ifconfig
ssh
sudo apt-get install openssh-server
sudo service ssh restart
- Windows端:win搜索mstsc
配置深度学习环境
nvidia驱动
sudo gedit /etc/modprobe.d/blacklist.conf
加入
blacklist nouveau
sudo update-initramfs -u
sudo reboot
sudo lspci | grep nouveau
若无输出,则禁用成功。
Ctrl+Alt+F1
sudo service lightdm stop
sudo sh ./NVIDIA-Linux-x86_64-375.20.run
sudo nvidia-smi #查看是否成功。
- 若出现NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver错误
sudo apt-get install dkms
sudo dkms install -m nvidia -v 390.129
390.129改为自己显卡版本号 查看方式 cd/usr/src
查看
https://www.cnblogs.com/bob-jianfeng/p/11505885.html
cuda
sudo sh cuda_9.0.176_384.81_linux.run
检查是否装好
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
# 编译 可能需要sudo
make
# 运行
./deviceQuery
cudnn
tar -zxvf cudnn-9.0-linux-x64-v7.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*
anaconda
pycharm
- 加入PATH路径:export PATH="/home/vincent/pycharm-community-2019.3.3/bin:$PATH"
pytorch
conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0 -c pytorch
or
pip install torch==1.1.0 -i https://pypi.douban.com/simple/
pip install torchvision==0.3.0 -i https://pypi.douban.com/simple/
磁盘扩容
sudo apt-get install gparted
sudo gparted