当前位置: 首页 > 工具软件 > SLURM > 使用案例 >

[slurm] CentOS7/Ubuntu18上Slurm部署步骤(单机版)

干亮
2023-12-01

1. 关闭防火墙,禁用selinux

2. 创建munge和slurm用户

需要确认1190和1191没有被其他user占用

export MUNGEUSER=1190
groupadd -g $MUNGEUSER munge
useradd  -m -c "MUNGE Uid 'N' Gid Emporium" -d /var/lib/munge -u $MUNGEUSER -g munge -s /sbin/nologin munge
export SlurmUSER=1191
groupadd -g $SlurmUSER slurm
useradd -m -c "Slurm workload manager" -d /var/lib/slurm -u $SlurmUSER -g slurm -s /bin/bash slurm

3. 安装munge

##centos7
yum install munge munge-libs munge-devel rng-tools -y

## ubuntu18
apt install munge libmunge-dev -y

#rng 相关ubuntu跳过
rngd -r /dev/urandom
sed -i 's#^ExecStart.*#ExecStart=/sbin/rngd -f -r /dev/urandom#g'  /usr/lib/systemd/system/rngd.service
systemctl daemon-reload
systemctl start rngd
systemctl enable rngd
# 创建密钥
/usr/sbin/create-munge-key -r
dd if=/dev/urandom bs=1 count=1024 > /etc/munge/munge.key
chown munge: /etc/munge/munge.key
chmod 400 /etc/munge/munge.key

systemctl restart munge
systemctl enable munge
systemctl status munge

4. 安装slurm

# centos7
yum install gcc gcc-c++ readline-devel perl-ExtUtils-MakeMaker pam-devel rpm-build mysql-devel http-parser-devel json-c-devel libjwt  libjwt-devel python3 -y

# ubuntu18
apt-get install make hwloc libhwloc-dev libmunge-dev libmunge2 munge mariadb-server libmysqlclient-dev libhttp-parser-dev libjwt-dev libjwt0 libjson-c-dev -y


5. 文件权限修改

 mkdir -p /var/spool/slurm/ctld
chmod 0755 /var/spool/slurm/ctld
chown slurm:slurm /var/spool/slurm/ctld

mkdir -p /var/spool/slurm
chown slurm: /var/spool/slurm
mkdir -p /var/log/slurm
chown slurm: /var/log/slurm

6. 安装数据库

从https://mariadb.org/download/?t=repo-config&d=CentOS+7&v=10.3&r_m=blendbyte 获取10.3版本的repo文件
高版本需要一些依赖,arm操作系统可能没有,故选择10.3

yum install MariaDB-server MariaDB-client

在/etc/my.cnf中增加如下内容
[mysqld]
innodb_buffer_pool_size=1024M
innodb_log_file_size=64M
innodb_lock_wait_timeout=900
注: 此步骤解决slurmdbd链接数据库报错

增加数据库用户

mysql -e "CREATE USER 'slurm'@'%' identified  by 'Slurm1234'"
mysql -e "GRANT ALL ON slurm_acct_db.* TO 'slurm'@'%'"
mysql -e "CREATE USER 'slurm'@'localhost' identified  by 'Slurm1234'"
mysql -e "GRANT ALL ON slurm_acct_db.* TO 'slurm'@'localhost'"
mysql -e "CREATE USER 'slurm'@'***HOSTNAME****' identified  by 'Slurm1234'"
mysql -e "GRANT ALL ON slurm_acct_db.* TO 'slurm'@'***HOSTNAME****'"  #替换HOSTNAME

7. 编译slurm

./configure --enable-debug --with-munge --enable-slurmrestd
不需要调试就不加debug

 类似资料: