这一部分用于服务器的远程连接
sudo apt install net-tools && sudo apt-get install openssh-server && sudo apt-get install ufw && sudo ufw enable && sudo ufw allow 22
sudo apt install vim
这一部分用于服务器的远程连接
这部分用于服务器的换源以加速conda,和软件源下载。
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo vim /etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
sudo apt update && sudo apt upgrade
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2021.05-Linux-x86_64.sh
bash Anaconda3-2021.05-Linux-x86_64.sh
conda config --set show_channel_urls yes
sudo vim .condarc
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
关闭当前终端并重新开启
这部分用于服务器的换源以加速conda,和软件源下载。
自动安装显卡驱动, 此处没有选择版本, 默认下载最新, 也可以自己选择版本进行下载
sudo ubuntu-drivers autoinstall
reboot
sudo apt-get install nvidia-cuda-toolkit
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/
conda 创建环境的命令
conda create -n ycy python=3.8 git pandas jupyter ipython pytorch torchvision torchaudio cudatoolkit=11.1 -c nvidia
conda activate ycy
import torch
torch.cuda.device_count()
exit()
jupyter配置
conda install nb_conda
sudo apt install jupyter-core
jupyter notebook --generate-config
python
from notebook.auth import passwd
passwd()
sudo vim /home/x-power/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip = '*' # 开启所有的IP访问,即可使用远程访问
c.NotebookApp.open_browser = False # 关闭启动后的自动开启浏览器
c.NotebookApp.port = 80 # 设置端口8888,也可用其他的,比如1080,8080等
c.NotebookApp.allow_remote_access = True
c.NotebookApp.allow_root = True
c.NotebookApp.enable_mathjax = True
c.NotebookApp.notebook_dir = '/home/x-power/ycypro'
c.NotebookApp.password = 'argon2:$argon2id$v=19$m=10240,t=10,p=8$MXgKgpyulDXzqNlKVSpktg$Pznz8v6fBtJD44Wt1bARhw'
nohup jupyter notebook > /home/x-power/.jupyter/log/jupyter_log.txt 2>&1 &
netstat -anp |grep 3306
sudo ufw allow 80
sudo service gdm3 stop
sudo service gdm3 start
sudo vim /etc/rc.local