代码拉取完成,页面将自动刷新
#!/bin/bash
systemctl disable firewalld #禁用自启服务
systemctl stop firewalld
systemctl disable NetworkManager #禁用自启服务
systemctl stop NetworkManager
getenforce #查看状态
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0 #临时关闭服务
echo ' * - nofile 100000 ' >>/etc/security/limits.conf
yum -y install wget net-tools
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
hostnamectl --static set-hostname template
cat > /etc/sysconfig/network <<EOF
GATEWAY=192.168.0.1
EOF
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
TYPE=Ethernet
BOOTPROTO=static
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=
NETMASK=
EOF
cat > /etc/sysconfig/network-scripts/ifcfg-eth1 <<EOF
TYPE=Ethernet
BOOTPROTO=static
NAME=eth1
DEVICE=eth1
ONBOOT=yes
IPADDR=
NETMASK=
EOF
cat > /etc/resolv.conf <<EOF
nameserver 119.29.29.29
nameserver 114.114.114.114
EOF
cat > /root/set.sh <<EOF
#!/bin/bash
(echo "passwdtemp";sleep 1;echo "passwdtemp") | passwd > /dev/null
hostnamectl --static set-hostname vmnametemp
sed -i "s/\/root\/set.sh//g" /etc/rc.d/rc.local
tempdata=tempdisksize
if [ $tempdata -gt 0 ];then
sh /root/disk.sh
sleep 1
rm -rf /root/disk.sh
fi
rm $0
reboot
EOF
chmod +x /root/set.sh
chmod +x /etc/rc.d/rc.local
ls -la /root/set.sh
ls -la /etc/rc.d/rc.local
cat > /etc/sysconfig/grub <<EOF
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb net.ifnames=0 biosdevname=0 quiet"
GRUB_DISABLE_RECOVERY="true"
EOF
grub2-mkconfig -o /boot/grub2/grub.cfg
echo "success"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。