#CentOS 7
#设置静态IP ONBOOT=on替换为ONBOOT=yes BOOTPROTO=dhcp替换BOOTPROTO=static
sed -i "s|ONBOOT=on|ONBOOT=yes|" /etc/sysconfig/network-scripts/ifcfg-ens160
sed -i "s|BOOTPROTO=dhcp|BOOTPROTO=static|" /etc/sysconfig/network-scripts/ifcfg-ens160
echo "IPADDR=182.11.100.2" >> /etc/sysconfig/network-scripts/ifcfg-ens160
echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-ens160
echo "GATEWAY=182.11.100.254" >> /etc/sysconfig/network-scripts/ifcfg-ens160
systemctl restart network
#01挂载本地ISO镜像
mkdir -p /etc/yum.repos.d/bak
mv /etc/yum.repos.d/CentOS* /etc/yum.repos.d/bak
cat > /etc/yum.repos.d/dvd.repo <<EOF
[OEL7]
name=OEL7
baseurl=file:///media/
gpgcheck=0
enabled=1
EOF
mount /dev/cdrom /media/
yum install nfs-utils vim telnet net-tools ntpdate lrzsz unzip gcc -y
#替换zabbix 配置文件ip182.11.100.66
sed -i "s|Server=127.0.0.1|Server=182.11.100.66|" /etc/zabbix/zabbix_agentd.conf
sed -i "s|ServerActive=127.0.0.1|ServerActive=182.11.100.66|" /etc/zabbix/zabbix_agentd.conf
#启动zabbix
systemctl enable zabbix-agent
systemctl start zabbix-agent.service
systemctl status zabbix-agent.service
CentOS 7 开机不自动启动防火墙
#将 SELINUX=enforcing 替换为SELINUX=disabled
sed -i "s|SELINUX=enforcing|SELINUX=disabled|" /etc/selinux/config
systemctl disable firewalld.service
systemctl status firewalld.service
关闭防火墙
systemctl stop firewalld.service
setenforce 0
#修改主机名-CentOS 7
hostnamectl set-hostname 'rw01'
echo -e "NETWORKING=yes\nHOSTNAME=rw01" >> /etc/sysconfig/network
#$tmp 追加空格
echo "182.11.100.2$tmp rw01" >> /etc/hosts
cat /etc/hosts
cat /etc/sysconfig/network
**
如果防火墙未关闭,可以开放端口
**
查询已经开放的端口
firewall-cmd --list-port
–开启端口
firewall-cmd --zone=public --add-port=10050/tcp --permanent
–移除端口
firewall-cmd --zone=public --remove-port=10050/tcp --permanent
–重载
firewall-cmd --reload
|