说明:这是笔者在Ubuntu20.04上亲自实践安装Slurm21.08.6,如果按照本教程会顺利安装完毕。
一、安装必要库文件
sudo su
apt-get install make hwloc libhwloc-dev libmunge-dev libmunge2 munge mariadb-server libmysqlclient-dev -y
二、启动munge服务
systemctl enable munge // 设置munge开机自启动
systemctl start munge // 启动munge服务
systemctl status munge // 查看munge状态
三、编译安装slurm
# 将slurm-21.08.6.tar.bz2源码包放置在/home/fz/package目录下
cd /home/fz/package
tar -jxvf slurm-21.08.6.tar.bz2
cd slurm-21.08.6/
./configure --prefix=/opt/slurm/21.08.6 --sysconfdir=/opt/slurm/21.08.6/etc
make -j16
make install
四、启动数据库
cp -r etc/slurm*.service /etc/systemd/system/
systemctl enable mariadb // 设置mariadb开机自启动
systemctl start mariadb // 启动mariadb服务
systemctl status mariadb // 查看mariadb状态
五、配置数据库
进入数据库
mysql
配置数据库
CREATE USER 'slurm'@'localhost' IDENTIFIED BY 'fz2022';
GRANT ALL ON *.* TO 'slurm'@'localhost';
create database slurm_fz_db;
grant all on slurm_fz_db.* to 'slurm'@'localhost' identified by 'fz2022' with grant option;
exit;
六、修改配置文件
mkdir /opt/slurm/21.08.6/etc
cp etc/slurm.conf.example /opt/slurm/21.08.6/etc/slurm.conf
cp etc/cgroup.conf.example /opt/slurm/21.08.6/etc/cgroup.conf
cp etc/slurmdbd.conf.example /opt/slurm/21.08.6/etc/slurmdbd.conf
chmod 600 slurmdbd.conf
修改slurm.conf
vim /opt/slurm/21.08.6/etc/slurm.conf
###以下为修改内容########################################################
SlurmctldHost=fz
#SlurmUser=slurm //把这一行注释掉,一定要把这一行注释掉
AccountingStorageType=accounting_storage/slurmdbd
NodeName=fz State=UNKNOWN Sockets=2 CoresPerSocket=8 CPUs=16
修改slurmdbd.conf
vim /opt/slurm/21.08.6/etc/slurmdbd.conf
###以下为修改内容########################################################
DbdHost=fz
#SlurmUser=slurm //把这一行注释掉,一定要把这一行注释掉
StorageLoc=slurm_fz_db
StoragePass=fz2022
七、启动slurm服务
systemctl enable slurmd
systemctl start slurmd
systemctl status slurmd
# systemctl stop slurmd
systemctl enable slurmdbd
systemctl start slurmdbd
systemctl status slurmdbd
# systemctl stop slurmdbd
systemctl enable slurmctld
systemctl start slurmctld
systemctl status slurmctld
# systemctl stop slurmctld
八、配置slurm
SLURMPATH=/opt/slurm/21.08.6
echo "export PATH=\$PATH:$SLURMPATH/bin:$SLURMPATH/sbin" >> /etc/bash.bashrc
source /etc/bash.bashrc