当前位置: 首页 > article >正文

Linux服务器初次使用需要的环境配置

一、划分磁盘

1.查看磁盘

sudo fdisk -l
Disk /dev/sda: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors   //新增的硬盘
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
sudo fdisk /dev/sda
kz@amax:~$ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
The size of this disk is 3.7 TiB (4000787030016 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).

Created a new DOS disklabel with disk identifier 0x988e6975.

2.选择使用gpt分区

Command (m for help): p
Disk /dev/sda: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x988e6975

Command (m for help): g
Created a new GPT disklabel (GUID: 082550F4-E534-CE4B-826C-A64238B60FDA).

Command (m for help): p
Disk /dev/sda: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 082550F4-E534-CE4B-826C-A64238B60FDA

3.新建分区

Command (m for help): n
Partition number (1-128, default 1):
First sector (2048-7814037134, default 2048): 2048
Last sector, +sectors or +size{K,M,G,T,P} (2048-7814037134, default 7814037134): 2930263039

Created a new partition 1 of type 'Linux filesystem' and of size 1.4 TiB.

4.再次打印划分结果

Command (m for help): p
Disk /dev/sda: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 082550F4-E534-CE4B-826C-A64238B60FDA

Device          Start        End    Sectors   Size Type
/dev/sda1        2048 2930263039 2930260992   1.4T Linux filesystem
/dev/sda2  2930264064 5860525056 2930260993   1.4T Linux filesystem
/dev/sda3  5860526080 7814037134 1953511055 931.5G Linux filesystem

5.保存并退出

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

6.格式化新增的分区

kz@amax:~$ sudo mkfs.xfs /dev/sda1
[sudo] password for kz:
meta-data=/dev/sda1              isize=512    agcount=4, agsize=91570656 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=0, rmapbt=0, reflink=0
data     =                       bsize=4096   blocks=366282624, imaxpct=5
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=178848, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
kz@amax:~$ sudo mkfs.xfs /dev/sda2
meta-data=/dev/sda2              isize=512    agcount=4, agsize=91570656 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=0, rmapbt=0, reflink=0
data     =                       bsize=4096   blocks=366282624, imaxpct=5
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=178848, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
kz@amax:~$ sudo mkfs.xfs /dev/sda3
meta-data=/dev/sda3              isize=512    agcount=4, agsize=61047221 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=0, rmapbt=0, reflink=0
data     =                       bsize=4096   blocks=244188881, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=119232, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

7.将新的分区表变更同步至操作系统

kz@amax:~$ sudo partprobe

8.挂载新建的分区

sudo mount /dev/sda1 /home/kz/

9.设置新添加的磁盘分区开机自动挂载

sudo vim /etc/fstab
添加内容
/dev/sda1       /home/kz        xfs     defaults        0       0

二、安装cuda

1.确认你有cuda的gpu

lspci | grep -i nvidia

2.查看你的Linux版本

uname -m && cat /etc/*release

3.查看gcc版本

gcc –version

4. 安装zlib1g

sudo apt-get install zlib1g

5.打开cuda官网https://developer.nvidia.com/cuda-toolkit-archive
下载相应版本安装包

wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run
sudo sh cuda_11.7.0_515.43.04_linux.run

6.更改环境变量

sudo vim ~/.bashrc
在最后两行写入
export PATH=/usr/local/cuda-11.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.2/targets/x86_64-linux/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

7.更新

source ~/.bashrc

8.查看是否安装成功

nvcc -V

三、安装cudnn

1.在官网下载安装包
https://developer.nvidia.com/rdp/cudnn-archive
2.sudo dpkg -i cudnn-local-repo-$distro-8.x.x.x_1.0-1_amd64.deb
3. sudo cp /var/cudnn-local-repo-*/cudnn-local-*-keyring.gpg /usr/share/keyrings/
4. sudo apt-get update
5. sudo apt-get install libcudnn8=8.x.x.x-1+cudaX.Y
6.sudo apt-get install libcudnn8-dev=8.x.x.x-1+cudaX.Y
7. sudo apt-get install libcudnn8-samples=8.x.x.x-1+cudaX.Y
8.验证

cp -r /usr/src/cudnn_samples_v8/ $HOME
cd  $HOME/cudnn_samples_v8/mnistCUDNN
make clean && make
./mnistCUDNN

若成功会显示Test passed!

四、安装Anaconda

1.在官网下载安装包
https://www.anaconda.com/download#downloads
2.安装
bash Anaconda3-2022.05-Linux-x86_64.sh(一直yes即可)
3.创建自己的环境

conda create -n wl python=3.8 anaconda

五、安装屏幕

sudo apt-get install screen

http://www.kler.cn/a/155654.html

相关文章:

  • WebSocket和HTTP协议的性能比较与选择
  • [前端]NodeJS常见面试题目
  • BERT配置详解1:构建强大的自然语言处理模型
  • vue2.x elementui 固定顶部、左侧菜单与面包屑,自适应 iframe 页面布局
  • 外星人入侵
  • 【css】html里面的图片宽度设为百分比,高度要与宽度一样
  • LASSO vs GridSearchCV
  • 12.03 二叉树简单题2
  • LeetCode刷题---路径问题
  • Hdoop学习笔记(HDP)-Part.08 部署Ambari集群
  • 如何获取唐诗三百首中的名句列表接口
  • 面试篇算法:(一:排序算法)
  • bean依赖属性配置
  • 常见的攻击防护
  • 正是阶段高等数学复习--函数极限的计算
  • Javaweb之Vue组件库Element案例异步数据加载的详细解析
  • HelpLook可以作为wordpress的替代品,帮助企业快速搭建博客
  • pikachu靶场:php反序列化漏洞
  • Mac下更新python
  • 后端Long型数据传到前端js后精度丢失的问题
  • 02.PostgreSQL 查询处理期间发生了什么?
  • 单片机学习11——矩阵键盘
  • 【无标题】我们只能用成功来摧毁我们,原来的自己只会破败自己的事情。
  • redis实现消息延迟队列
  • 使用Redis构建任务队列
  • Hdoop学习笔记(HDP)-Part.02 核心组件原理