作业

#!/bin/bash
1.sh(){
hostnamectl set-hostname node1.example.com
nmcli connection modify ens160 ipv4.addresses 192.168.130.88/24 ipv4.gateway 192.168.130.2 ipv4.dns 114.114.114.114 ipv4.method manual autoconnect yes
}
1.sh
2.sh(){
mount /dev/sr0 /mnt
cat >> /etc/yum.repos.d/local.repo << EOF
[local]
name = local
enabled = 1
gpgcheck = 0
baseurl = file:///mnt/BaseOS
[media]
name = media
enabled = 1
gpgcheck = 0
baseurl = file:///mnt/AppStream
EOF
yum clean all
yum makecache
}
2.sh
create_users(){
groupadd user
useradd test1 -g user
useradd test2 -g user
useradd -s /sbin/nologin test3
echo "redhat" | passwd --stdin test1
echo "redhat" | passwd --stdin test2
echo "redhat" | passwd --stdin test3
}
create_users
4.sh(){
mkdir -p /root/big
sudo find /etc -type f -size +100k -exec cp {} /root/big/ \;
}
4.sh
5.sh(){
grep "sbin" /etc/man_db.conf > /root/out.txt
}
5.sh
6.sh(){
touch backup.tar
tar -czf backup.tar.gz /usr/local/
}
6.sh
7.sh(){
groupadd sudo
sudo usermod -aG sudo test1
}
7.sh
8.sh(){
yum install httpd
sed -i '45s/^/#/' /etc/httpd/conf/httpd.conf
echo "Listen 8080" >> /etc/httpd/conf/httpd.conf
echo "hello" > /var/www/html/index.html
systemctl stop firewalld
setenforce 0
systemctl restart httpd
curl 192.168.130.88:8080
}
8.sh

posted on 2024-09-22 10:27  徐俊大  阅读(4)  评论(0编辑  收藏  举报