dnf install oracle-epel-release-el9 yum-utils device-mapper-persistent-data lvm2 openssh-server dnf install -y https://download.ceph.com/rpm-quincy/el9/noarch/ceph-release-1-1.el9.noarch.rpm dnf install cephadm ceph-common ceph-base nfs-utils cat < /root/cluster.yaml service_type: host addr: $(hostname -I | awk '{print $1}') hostname: $(hostname -s) location: root: default datacenter: DC1 labels: - osd - mon - mgr - mds --- service_type: mon placement: label: "mon" --- service_type: mds service_id: cephfs placement: label: "mds" --- service_type: mgr service_name: mgr placement: label: "mgr" --- service_type: osd service_id: osds placement: label: "osd" data_devices: all: true EOF systemctl disable firewalld systemctl stop firewalls sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config sed -i 's/^#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config systemctl daemon-reload systemctl restart sshd echo 'root:'passw0rd''|chpasswd adduser cephdeploy echo 'cephdeploy:'passw0rd''|chpasswd echo "cephdeploy ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/cephdeploy cat << 'EOF' | tee /root/add_node.sh #!/bin/bash read -p "New Hostname: " HOSTNAME read -p "New Hostname IP: " HOST_IP sudo -u ubuntu ssh-copy-id ubuntu@localhost ssh-copy-id -f -i /etc/ceph/ceph.pub ubuntu@$HOST_IP scp /etc/ceph/* root@$HOST_IP:/etc/ceph/ ceph orch host add $HOSTNAME $HOST_IP --labels osd echo "Wait for Server is installed 15 Seconds..." sleep 15 echo "Add all Disks to the Cluster" ceph orch apply osd --all-available-devices EOF chmod +x /root/add_node.sh mkdir /home/cephdeploy/.ssh chmod -R 700 /home/cephdeploy/.ssh ssh-keygen -t rsa -b 4096 -f /home/cephdeploy/.ssh/id_rsa -N "" cat /home/cephdeploy/.ssh/id_rsa.pub >> /home/cephdeploy/.ssh/authorized_keys ssh-keyscan -H localhost >> /home/cephdeploy/.ssh/known_hosts chown -R cephdeploy:cephdeploy /home/cephdeploy/.ssh chmod -R 600 /home/cephdeploy/.ssh/* hostnamectl set-hostname ceph1 cat < /etc/hosts $(hostname -I | awk '{print $1}') ceph1 EOF cephadm bootstrap --initial-dashboard-password "passw0rd" --ssh-user=cephdeploy --mon-ip $(hostname -I|awk '{print $1}') --apply-spec /root/cluster.yaml #/usr/sbin/cephadm shell --fsid $(cat /etc/ceph/ceph.conf |grep 'fsid'| awk -F'=' '{print $2}') -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.client.admin.keyring ceph config set mgr mgr/cephadm/manage_etc_ceph_ceph_conf true ceph osd getcrushmap -o crushmap.cm crushtool --decompile crushmap.cm -o crushmap.txt sed -i s/"step chooseleaf firstn 0 type host"/"step chooseleaf firstn 0 type osd"/g crushmap.txt crushtool --compile crushmap.txt -o new_crushmap.cm ceph osd setcrushmap -i new_crushmap.cm ceph osd pool create cephfs0_data replicated ceph osd pool create cephfs0_metadata replicated ceph fs new cephfs0 cephfs0_metadata cephfs0_data ceph orch apply mds cephfs0 1 ceph fs authorize cephfs0 client.user / rw | tee /etc/ceph/ceph.client.user.keyring mkdir -p /mnt/cephfs0 cat <> /etc/fstab $(hostname -I | awk '{print $1}'):/ /mnt/cephfs0 ceph name=user,noatime,nodiratime,_netdev 0 0 EOF systemctl daemon-reload mount -a mkdir -p /mnt/nfs ceph nfs cluster create nfs-cephfs0 $(hostname -s) ceph nfs export create cephfs nfs-cephfs0 /export cephfs0 mount -t nfs -o vers=4 $(hostname -I | awk '{print $1}'):/export /mnt/nfs #systemctl list-units | grep nfs