1. 安装系统Ubuntu 16
sudo apt-get update
2. 显卡驱动NVIDIA
issue:ubuntu无法登录,显示器分辨率
# 重装驱动
sudo service lightdm stop
sudo apt-get remove --purge nvidia*
sudo sh NVIDIA-Linux-x86_64-455.23.04.run --uninstall
sudo sh NVIDIA-Linux-x86_64-455.23.04.run
sudo service lightdm start
reboot
2.1. CUDA 11.1
- 下载cuda.run
注:必须与torch版本对应
pytorch官网下载,CUDA官网下载 - 安装cuda.run
sudo sh cuda_11.1.1_455.32.00_linux.run
注意:只安装Toolkit
- 配置环境
sudo gedit ~/.bashrc
# >>> cuda wudi21.3.13
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.1/lib64
export PATH=$PATH:/usr/local/cuda-11.1/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-11.1
# <<< cuda
source ~/.bashrc
reboot
- 验证
nvcc -V
import torch
torch.cuda.is_available()
5)卸载
sudo /usr/local/cuda-11.1/bin/cuda-uninstaller
sudo rm -rf /usr/local/cuda-11.1/
2.2.cuDNN 8.1
sudo cp cuda/include/cudnn* /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn*
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
3.硬盘挂载
df -l #查询挂载
df -h
sudo fdisk -l #查询磁盘
查询磁盘
目的:挂载4T机械硬盘(未分区)/dev/sda
1)GTP分区
注:硬盘大于2T,无法fdisk分区
sudo parted /dev/sda #进入parted
mklabel gpt #将磁盘设置为gpt格式
mkpart logical 0 -1 #将磁盘所有的容量设置为GPT格式
print #查看分区结果
quit
sudo mkfs.ext4 -F /dev/sda1 #格式化磁盘为ext4的格式
2)设置开机自动挂载
sudo blkid #查看硬盘UUID
sudo gedit /etc/fstab #添加挂载磁盘
(挂载点mkdir,权限777)
UUID=79*** /dev/hard_disk ext4 defaults 0 0
Ubuntu 16.04系统挂载4T硬盘
Ubuntu 16.04挂载硬盘详细教程
3)重启
4.Miniconda3
4.1.pytorch
#验证方法
import torch
x = torch.rand(5, 3)
print(x)
torch.cuda.is_available()
>>> tensor([[0.5843, 0.3180, 0.3961],
>>> [0.2646, 0.6796, 0.2149],
>>> [0.6088, 0.4910, 0.0661],
>>> [0.4428, 0.7561, 0.9244],
>>> [0.1783, 0.8959, 0.4434]])
>>> True
0. 其它软件
- 搜狗拼音 [官方指南]
先设置系统语言,再双击deb安装包
- SSH
openssh-server,启动服务(,客户端删除密钥缓存)
- 校园网 [AutoLogin]
设置开机自启动:
1)位置sudo gedit /etc/profile
2)联网nohup pythondi /xxx/sim_verification.py > /xxx/autologin.log 2>&1 &
3)jupyternohup jupyterdi notebook --allow-root > /xxx/jupyter.log 2>&1 &
(软链接sudo ln -s /xxx/jupyter /usr/bin/jupyterdi
)
*nohup
父进程死后,不带走子进程
-
jupyter外网访问配置
注:若服务器未登录校园网账号,配置完成后,也不能外网访问
pip install jupyter
jupyter notebook --generate-config
gedit ~/.jupyter/jupyter_notebook_config.py
c.NotebookApp.allow_remote_access = True #允许远程
c.NotebookApp.ip = '*' #监听所有IP
c.NotebookApp.password = u'argon2:...' # jupyter notebook password生成
c.NotebookApp.port = 8888
-
jupyter 添加kernel:
(dj) $pip install ipykernel
(dj) $python -m ipykernel install --user --name=dj
# 给(dj)的ipykernel命名为dj
sudo wget https://github.com/geeeeeeeeek/electronic-wechat/releases/download/V2.0/linux-x64.tar.gz
sudo tar zxvf linux-x64.tar.gz
- 另外:
gong
git踩坑:https://blog.csdn.net/u013517182/article/details/93046760
kuiran: PyCharm调试
网友评论