3 Star 3 Fork 2

ropon/kvm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
moban.sh 1.71 KB
一键复制 编辑 原始数据 按行查看 历史
#!/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"
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ropon/kvm.git
git@gitee.com:ropon/kvm.git
ropon
kvm
kvm
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385