-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
unknown
committed
Jul 28, 2021
1 parent
f193c7f
commit 027e21d
Showing
129 changed files
with
4,834 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Ubuntu16.04更改apt源 | ||
|
||
⌚️: 2020年8月9日 | ||
|
||
📚参考 | ||
|
||
--- | ||
|
||
## 一、Ubuntu16.04:控制台挂载/(卸载)U盘 | ||
### 1.将U盘插入 | ||
|
||
### 2.直接回车,然后输入以下命令 | ||
``` | ||
sudo fdisk -l | ||
``` | ||
此时,会输出一大段问题,只看最后一段可以得到U盘 | ||
``` | ||
Device Boot Start End Sectors Size Id Type | ||
/dev/sdb4 * 256 7866367 7866112 3.8G b W95 FAT32 | ||
``` | ||
### 3.挂载U盘 | ||
``` | ||
sudo mount -t vfat /dev/sdb4 /media | ||
//-t 后的vfat是文件系统格式,即FAT32 | ||
//dev/sdb4是需要挂载的U盘//media是挂载点 | ||
``` | ||
### 4.进入U盘 | ||
``` | ||
cd /media | ||
``` | ||
### 5.卸载U盘 | ||
``` | ||
sudo umount /dev/sdb4 | ||
``` | ||
## 一、ubuntu16.04 server 更换apt-get阿里源 | ||
### 1.备份系统自带源 | ||
``` | ||
mv /etc/apt/sources.list /etc/apt/sources.list.bak | ||
``` | ||
### 2.修改/etc/apt/sources.list文件 | ||
``` | ||
vim /etc/apt/sources.list | ||
``` | ||
加入如下内容 | ||
``` | ||
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 | ||
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse | ||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse | ||
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse | ||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse | ||
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse | ||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse | ||
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse | ||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse | ||
# 预发布软件源,不建议启用 | ||
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse | ||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse | ||
``` | ||
### 3.更新生效 | ||
``` | ||
apt-get update | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# 一、安装CUDA(根据需求选择版本) | ||
|
||
⌚️: 2020年8月9日 | ||
|
||
📚参考 | ||
|
||
--- | ||
|
||
## 1.下载 | ||
[官方下载地址](https://developer.nvidia.com/cuda-downloads) | ||
如果是远程可以用wget下载: | ||
``` | ||
wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_410.48_linux | ||
``` | ||
## 2.安装 | ||
还是和驱动安装一样关闭图形界面: | ||
``` | ||
$sudo service lightdm stop | ||
``` | ||
|
||
按Ctrl+Alt+F1进入命令行,输入用户名密码登录(通过Ctrl+Alt+F7可返回界面) | ||
进入下载目录,给文件赋予执行权限(忘记文件名就ls) | ||
``` | ||
$sudo chmod a+x cuda_8.0.61_375.26_linux | ||
``` | ||
|
||
安装cuda,注意参数 | ||
``` | ||
$sudo ./cuda_8.0.61_375.26_linux.run --no-opengl-libs | ||
``` | ||
* –no-opengl-files 只安装驱动文件,不安装OpenGL文件。这和驱动安装时的参数不同。 | ||
![](../imgs/92.png) | ||
![](../imgs/93.png) | ||
## 3.配置环境变量(可以选择环境变量配置位置) | ||
配置环境变量的方式:(1)配置/etc/profile.或者(2)配置~/.bashrc。(3)或者export | ||
|
||
我配置的是/etc/profile,这样所有的用户都可以使用cuda。 | ||
``` | ||
$sudo vim /etc/profile | ||
# 加入 | ||
export PATH=/usr/local/cuda/bin:$PATH | ||
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH | ||
$source /etc/profile #使之生效 | ||
``` | ||
## 4.验证安装成功否-1 | ||
``` | ||
nvcc -V | ||
命令验证是否安装成功,若出现以下信息则表示安装成功: | ||
nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2016 NVIDIA Corporation Built on Tue_Jan_10_13:22:03_CST_2017 | ||
``` | ||
## 5.验证安装成功否-2 | ||
``` | ||
$cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery | ||
$sudo make | ||
$./deviceQuery | ||
``` | ||
![](../imgs/94.png) | ||
|
||
如果结果和上述信息差不多,表示已经安装成功。 | ||
## 5.卸载cuda | ||
``` | ||
$ sudo /usr/bin/nvidia-uninstall #uninstall driver | ||
``` | ||
# 二、安装cuDNN(根据需求选择版本) | ||
## 1.下载 | ||
[下载网址](https://developer.nvidia.com/cudnn) | ||
## 2.解压&复制 | ||
``` | ||
sudo tar -zxvf ./cudnn-8.0-linux-x64-v5.1.tgz | ||
sudo cp cuda/include/cudnn.h /usr/local/cuda/include | ||
sudo cp -a cuda/lib64/libcudnn* /usr/local/cuda/lib64 | ||
``` | ||
## 3.验证 | ||
``` | ||
# 查看CUDA版本 | ||
cat /usr/local/cuda/version.txt | ||
# 查看cuDNN版本 | ||
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# 安装Docker-CE | ||
|
||
⌚️: 2020年8月9日 | ||
|
||
📚参考 | ||
|
||
--- | ||
|
||
Docker 在 1.13 版本之后,从 2017 年的 3 月 1 日开始,Docker 划分为 CE 和 EE。CE 即社区版(免费,支持周期三个月),EE 即企业版,强调安全,付费使用。 | ||
|
||
|
||
Docker CE 每月发布一个 Edge 版本 (17.03, 17.04, 17.05…),每三个月发布一个 Stable 版本 (17.03, 17.06, 17.09…),Docker EE 和 Stable 版本号保持一致,但每个版本提供一年维护。 | ||
官方网站上有各种环境下的[安装指南](https://docs.docker.com/install/)。 | ||
|
||
## 一、安装Ubuntu 维护的版本 | ||
``` | ||
$ sudo apt-get update | ||
$ sudo apt-get install docker | ||
``` | ||
搞定! 但是这种方法有一个缺点:安装的不一定是最新的docker 。不过,对于docker使用没任何什么问题.(个人不建议使用这种方式安装)。 | ||
|
||
## 二、安装Docker维护的版本 | ||
docker更推荐这种方式安装。旧版本的 Docker 称为 docker 或者 docker-engine,使用以下命令卸载旧版本: | ||
``` | ||
$sudo apt remove docker docker-engine docker.io docker-ce | ||
``` | ||
### 1、 开始安装Docker CE | ||
#### step 1: 安装必要的一些系统工具,安装docker包 | ||
``` | ||
$sudo apt udpate | ||
$sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common | ||
``` | ||
|
||
#### step 2: 安装GPG证书 | ||
``` | ||
$curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
``` | ||
#### Step 3: 写入软件源信息,设置stable稳定的仓库(stable稳定版每季度发布一次,Edge版每月一次) | ||
``` | ||
$sudo add-apt-repository "http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | ||
``` | ||
#### Step 4: 更新并安装 Docker-CE | ||
``` | ||
$sudo apt-get -y update | ||
$sudo apt-get -y install docker-ce | ||
``` | ||
或 | ||
``` | ||
# 安装指定版本的Docker-CE: | ||
# Step 1: 查找Docker-CE的版本: | ||
$apt-cache madison docker-ce | ||
# Step 2: 安装指定版本的Docker-CE: (VERSION 例如上面的 17.03.1~ce-0~ubuntu-xenial) | ||
$ sudo apt-get -y install docker-ce=[VERSION] | ||
``` | ||
|
||
### 2、测试 | ||
``` | ||
$sudo docker version | ||
``` | ||
|
||
### 3、阿里云镜像加速 | ||
由于国内网络问题,后续拉取Docker镜像十分缓慢,建议安装Docker之后配置国内镜像加速,这里我依然配置为阿里的加速器。 | ||
阿里加速器:https://cr.console.aliyun.com/#/accelerator | ||
进去之后如下图,里面有你的专属加速地址,以及不同系统的配置方式,可以直接按照他所提供的方式进行配置。(PS:需要先注册) | ||
![](../imgs/91.png) | ||
我的配置如下:修改时请注意registry-mirrors修改为你自己的专属加速地址: | ||
``` | ||
vim /etc/docker/daemon.json | ||
# 将以下添加到文件中: | ||
{ | ||
"registry-mirrors":["https://hk5achwf.mirror.aliyuncs.com"] | ||
} | ||
``` | ||
重启docker: | ||
``` | ||
$sudo systemctl daemon-reload | ||
$sudo systemctl restart docker | ||
``` | ||
检查加速器是否生效: | ||
``` | ||
docker info | ||
# 如下在结果中看到如下说明配置成功了: | ||
Registry Mirrors: | ||
https://xxxxx.mirror.aliyuncs.com/ | ||
``` | ||
|
||
|
||
### 4、添加当前用户到docker的用户组 | ||
现在每次运行docker时,都需要sudo,可以用一下方法,去掉sudo。 | ||
#### 1 创建docker用户组 | ||
``` | ||
$ sudo groupadd docker | ||
``` | ||
#### 2.将当前用户加到组中 | ||
``` | ||
$ sudo usermod -aG docker $USER | ||
``` | ||
注意:这里不用更改 $USER 这个参数,$USER 这个环境变量就是指当前用户名。然后重启完电脑就以后再docker命令前面不用加sudo了。 | ||
|
||
### 5、Docker 修改镜像源地址(功能和3一样) | ||
从网上找了几个速度比较快的镜像地址: | ||
``` | ||
Docker 官方中国区:https://registry.docker-cn.com | ||
网易:http://hub-mirror.c.163.com | ||
Ustc:https://docker.mirrors.ustc.edu.cn | ||
``` | ||
**修改方法** | ||
* 1 | ||
``` | ||
直接修改,设置 –registry-mirror 参数,仅对当前的命令有效 | ||
docker run hello-world --registry-mirror=https://docker.mirrors.ustc.edu.cn | ||
``` | ||
|
||
* 2 | ||
``` | ||
修改 /etc/default/docker,加入 DOCKER_OPTS=”镜像地址”,可以有多个 | ||
DOCKER_OPTS="--registry-mirror=https://docker.mirrors.ustc.edu.cn" | ||
``` | ||
* 3 | ||
``` | ||
支持 systemctl 的系统,通过 sudo systemctl edit docker.service,会生成 etc/systemd/system/docker.service.d/override.conf 覆盖默认的参数,在该文件中加入如下内容: | ||
[Service] | ||
ExecStart= | ||
ExecStart=/usr/bin/docker -d -H fd:// --registry-mirror=https://docker.mirrors.ustc.edu.cn | ||
``` | ||
* 4 | ||
``` | ||
新版的 Docker 推荐使用 json 配置文件的方式,默认为 /etc/docker/daemon.json,非默认路径需要修改 dockerd 的 –config-file,在该文件中加入如下内容: | ||
{ | ||
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"] | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Ubuntu16.04安装NVIDIA驱动 | ||
|
||
⌚️: 2020年8月9日 | ||
|
||
📚参考 | ||
|
||
--- | ||
|
||
## 1、卸载原有的NVIDIA驱动(没装的话就跳过) | ||
``` | ||
一般方法: | ||
sudo apt remove nvidia* | ||
如果使用.run文件安装,使用--uninstall卸载(具体方法百度) | ||
``` | ||
## 2、禁用nouveau | ||
安装NVIDIA需要把系统自带的驱动禁用,打开文件: | ||
``` | ||
sudo vim /etc/modprobe.d/blacklist.conf | ||
# 在文本最后添加以下内容: | ||
blacklist nouveau | ||
option nouveau modeset=0 | ||
``` | ||
|
||
|
||
保存退出,执行以下命令生效: | ||
``` | ||
sudo update-initramfs -u | ||
``` | ||
重启电脑后输入: | ||
``` | ||
lsmod | grep nouveau | ||
``` | ||
没有任何输出说明禁用成功。 | ||
|
||
## 3、安装NVIDIA显卡驱动 | ||
首先查看自己电脑自己电脑支持的驱动版本: | ||
``` | ||
sudo apt-cache search nvidia* | ||
``` | ||
或者直接去官网下载最新版本的驱动,然后安装(建议这种方式安装) | ||
``` | ||
cd ~/Download/ | ||
sudo chmod a+x NVIDIA-Linux-x86_64-384.130.run | ||
``` | ||
安装: | ||
``` | ||
sudo ./NVIDIA-Linux-x86_64-375.20.run --no-opengl-files | ||
``` | ||
* --no-opengl-files 只安装驱动文件,不安装OpenGL文件。这个参数最重要 | ||
* --no-x-check 安装驱动时不检查X服务 | ||
* --no-nouveau-check 安装驱动时不检查nouveau | ||
* 后面两个参数可不加。 | ||
|
||
提示安装基本上都是accept,yes,当提示你nvidia-xconfig时,就视自己的电脑情况而定,如果电脑是双显卡(双独显、集显和独显)就选择不安装,如果只有一个显卡就选择安装。 | ||
|
||
安装完毕后重启验证是否安装成功: | ||
``` | ||
nvidia-smi | ||
``` | ||
出现以上类似的输出表示已经安装成功 | ||
## 4、卸载驱动 | ||
``` | ||
$ sudo /usr/bin/nvidia-uninstall #uninstall driver | ||
``` |
Oops, something went wrong.