创建 root
sudo passwd root su root
参考博客
https://blog.csdn.net/weixin_38661447/article/details/106796349
华为镜像元 配置
sudo cp -a /etc/apt/sources.list /etc/apt/sources.list.bak sudo sed -i "s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list sudo sed -i "s@http://.*security.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list apt-get update
更新 vim 防止 方向键 乱码
关闭 nouveau
vim /etc/modprobe.d/blacklist.conf sudo echo " blacklist nouveau " >> /etc/modprobe.d/blacklist.conf blacklist nouveau update-initramfs -u 检查 lsmod | grep nouveau //无输出表示成功
安装 gpu 驱动
10.2 440
参考
https://blog.csdn.net/qq_43373608/article/details/103314435
添加驱动源
add-apt-repository ppa:graphics-drivers/ppa apt-get update apt install nvidia-driver-440 -y
安装 cuda10.2
wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run sh cuda_10.2.89_440.33.01_linux.run 配置环境变量 vi ~/.bashrc export PATH="/usr/local/cuda-10.2/bin:$PATH" export LD_LIBRARY_PATH="/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH" 下载 https://developer.nvidia.com/cudnn
安装runtime库
dpkg -i '/home/zhao/下载/libcudnn8_8.0.3.33-1+cuda10.2_amd64.deb'
安装developer库
dpkg -i '/home/zhao/下载/libcudnn8-dev_8.0.3.33-1+cuda10.2_amd64.deb'
安装代码示例和《cuDNN库用户指南》
dpkg -i '/home/zhao/下载/libcudnn8-samples_8.0.3.33-1+cuda10.2_amd64.deb'
安装 docker nvidiaruntime
apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - apt-key fingerprint 0EBFCD88 add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" apt-get update apt-get install docker-ce -y systemctl enable docker systemctl start docker docker run hello-world
取消 docker root 权限
sudo groupadd docker sudo gpasswd -a $USER docker #将登陆用户加入到docker用户组中 newgrp docker #更新用户组
安装 nvidia-container-toolkit
#Add the package repositories distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list apt-get update && sudo apt-get install -y nvidia-container-toolkit systemctl restart docker
docker gpu 镜像
https://tensorflow.google.cn/install/docker https://www.cnblogs.com/g2thend/p/12256018.html docker pull tensorflow/tensorflow:latest-gpu-jupyter docker run --gpus all --rm nvidia/cuda nvidia-smi docker run --gpus all -p 8888:8888 tensorflow/tensorflow:latest-gpu-jupyter //挂载目录之前 先把 目录 权限打开 docker run --gpus all -p 8888:8888 --name user1 --privileged=true -e PASSWORD=your_jupyter_passwd -v 公共目录:/home/x -v 私有目录:/home/y tensorflow/tensorflow:latest-gpu-jupyter docker run --gpus all -p 8888:8888 --name user1 --privileged=true -e PASSWORD=your_jupyter_passwd -v 公共目录:/home/x -v 私有目录:/home/y tensorflow/tensorflow:latest-gpu-jupyter docker run --gpus all -p 8888:8888 --name user1 --privileged=true -e PASSWORD=your_jupyter_passwd -v 公共目录:/home/x -v 私有目录:/home/y tensorflow/tensorflow:latest-gpu-jupyter docker run -d --gpus all -p 18888:8888 --name llhtfgpu23 --privileged=true -v /home/zhao/students:/tf/public -v /home/zhao/llh:/tf/myself tensorflow/tensorflow:latest-gpu-jupyter docker logs llhtfgpu23
备份系统
sudo root cd / todayDate=$(date +'%Y%m%d') tar -cvpzf backup${todayDate}.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup${todayDate}.tgz --exclude=/mnt --exclude=/sys --exclude=/media /
还原系统
先从 u 盘 系统 启动
// 注意备份系统的时间
sudo tar xvpfz backup.tgz
创建被排除的目录
sudo mkdir proc lost+found mnt sys media blkid /dev/sdb1 vi /etc/fstab grub-install /dev/sdb update-grub2