安装ubuntu22.04系统
首先,先压缩windows分区,按住Win + X快捷键,选择磁盘管理,压缩分区,压缩出新的分区用于安装ubuntu22.04
- windows插入系统盘,点击重启,一直按F12,选择系统盘启动方式
- 语言选择chinese–>最小化安装,且安装时不进行更新–>分区(必备的分区:swap(20G)、efi(系统启动必备)100M足够、根目录(/)一般为系统盘越大越好、家目录(/home)选择额外的硬盘挂载)
- 启动目录选择刚刚制作efi的盘符目录
- 安装等待
- 新安装的ubuntu系统需要被远程连接
- 安装 SSH 服务器
sudo apt update
sudo apt install openssh-server
- 确认 SSH 服务已启动
sudo systemctl status ssh
出现下面信息表示处于激活状态
● ssh.service - OpenBSD Secure Shell serverLoaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)Active: active (running) since Sat 2024-04-06 09:32:08 UTC; 10min ago
- 配置防火墙
sudo ufw allow ssh
ubuntu安装driver,cuda,cudnn
安装驱动Nvidia(530.41)
ERROR: Unable to find the development tool `cc` in your path; please make sure that you have the package 'gcc' installed. If gcc is installed on your system, then please check that `cc` is in your PATH.
解决方法:
- 查看gcc是否被安装
gcc --version
或者
g++ --version
如果显示命令未找到,表示未安装gcc
- 安装gcc
apt update
apt install build-essential
WARNING: The symbolic link '/usr/lib/libGL.so.1' does not exist. This is necessary for correct operation of the NVIDIA Accelerated Graphics Driver for Linux-x86_64. You can create this symbolic link manually by executing ln -sf /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/libGL.so.1.
530.41驱动地址
bash ./NVIDIA-Linux-x86_64-530.41.03.run
输入nvidia-smi命令,出现以下信息,表明成功
问题:输入nvidia-smi命令,出现信息慢
解决方法:
打开持久模式
nvidia-smi -pm 1
安装cuda11.8
cuda地址
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
sudo sh cuda_11.8.0_520.61.05_linux.run
- 添加cuda环境变量
vim ~/.bashrc
export PATH=/usr/local/cuda-11.8/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH
source ~/.bashrc
- 输入nvcc -V检查cuda变量是否成功
安装cudnn(8.9.6)
cudnn地址
选择下载的是tar包,解压后分别放到cuda相应位置就好
- 解压tar.xz文件
tar -xf cudnn-linux-x86_64-8.9.6.50_cuda11-archive.tar.xz
- 将该解压包cudnn-linux-x86_64-8.9.6.50_cuda11-archive重命名为cuda
mv cudnn-linux-x86_64-8.9.6.50_cuda11-archive cuda
- 将cuda下的头文件拷贝到/usr/local/cuda-11.8对应目录下
cp cuda/include/cudnn*.h /usr/local/cuda-11.8/include
- 将cuda下的库文件拷贝到/usr/local/cuda-11.8对应目录下
cp -P cuda/lib/libcudnn* /usr/local/cuda-11.8/lib64
- 赋予文件读取权限
chmod a+r /usr/local/cuda-11.8/include/cudnn*.h /usr/local/cuda-11.8/lib64/libcudnn*
建立软连接,将环境映射到miniconda3/envs下
cd /data/miniconda3/envs
ln -s /data/miniconda3/envs/* ./
- 执行conda activate env_name查看是否链接成功
supervisor(监督python程序)
- 安装supervisor
apt install supervisor
- 生成配置文件
echo_supervisord_conf > /etc/supervisord.conf
- 修改配置文件,指定工程配置
vim /etc/supervisord.conf
在末尾加上
[include]
files = /etc/supervisord.d/*.conf
- 启动supervisor
supervisord -c /etc/supervisord.conf
安装docker
- 安装基础docker
- 设置仓库
sudo apt update # 更新源sudo apt install ca-certificates curl gnupg lsb-release # 安装依赖curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg # 将官方Docker存储库的GPG密钥添加到系统
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null # 设置稳定的仓库。
- 安装docker-ce及配套
sudo apt update # 上一步设置仓库后,要更新源
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin # 安装docker-ce和配套
- 安装nvidia-container-toolkit
# Add the package repositories
distribution="ubuntu22.04"
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.listsudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
- 在/etc/docker/daemon.json中写入下面镜像源
{"registry-mirrors": ["https://registry.docker-cn.com","https://docker.mirrors.ustc.edu.cn","https://hub-mirror.c.163.com"]
}
- 执行命令使得添加镜像源生效,并重启docker
安装Typora
sudo systemctl daemon-reload && sudo systemctl restart docker
安装企业微信
sudo apt-get install -f -y ./ukylin-wine_70.6.3.25_amd64.deb
sudo apt-get install -f -y ./ukylin-wxwork_1.0_amd64.deb
激活pycharm
- 激活码
UX394X3HLT-eyJsaWNlbnNlSWQiOiJVWDM5NFgzSExUIiwibGljZW5zZWVOYW1lIjoiSG9uZ2lrIFVuaXZlcnNpdHntmY3snbXrjIDtlZnqtZAiLCJsaWNlbnNlZVR5cGUiOiJDTEFTU1JPT00iLCJhc3NpZ25lZU5hbWUiOiLkvJfliJvkupEg5bel5L2c5a6kIiwiYXNzaWduZWVFbWFpbCI6ImhhbmF6YXdhbWl0b0BnbWFpbC5jb20iLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiJGb3IgZWR1Y2F0aW9uYWwgdXNlIG9ubHkiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IkdPIiwicGFpZFVwVG8iOiIyMDI0LTEyLTEzIiwiZXh0ZW5kZWQiOmZhbHNlfSx7ImNvZGUiOiJSUzAiLCJwYWlkVXBUbyI6IjIwMjQtMTItMTMiLCJleHRlbmRlZCI6ZmFsc2V9LHsiY29kZSI6IkRNIiwicGFpZFVwVG8iOiIyMDI0LTEyLTEzIiwiZXh0ZW5kZWQiOmZhbHNlfSx7ImNvZGUiOiJDTCIsInBh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foUTfy1uH3T+t03k1Qkr0dqgHLxiv6QU5WrarR9tx/dapqbsSmrYapmJ7S5+ghc4FTWxXJB1cjJRh3X+gwJIHjOVW+5ZVqXTG2s2Jwi2daDt6XYeigxgL2SlQpeL5kvXNCcuSJurJVcRZFYUkzVv85XfDauqGxYqaehPcK2TzmcXOUWPfxQxLJd2TrqSiO+mseqqkNTb3ZDiYS/ZqdQoGYIUwJqXo+EDgqlmuWUhkWwCkyo4rtTZeAj+nP00v3n8JmXtO30Fip+lxpfsVR3tO1hk4Vi2kmVjXyRkW2G7D7WAVt+91ahFoSeRWlKyb4KcvGvwUaa43fWLem2hyI4di2pZdr3fcYJ3xvL5ejL3m14bKsfoOv
- 激活补充
https://zhuanlan.zhihu.com/p/682614037
生成激活码
https://blog.csdn.net/weixin_73546177/article/details/132033297
参考文档:
https://zhuanlan.zhihu.com/p/338507526
https://www.cnblogs.com/ksky-2023/p/17389977.html
https://yinguobing.com/install-cudnn8-with-tar-file/