CentOS7 迷你安装后,自定义初始化
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7 迷你安装后,自定义初始化相关的知识,希望对你有一定的参考价值。
安装工具
yum clean all yum list yum install -y vim yum install -y gcc yum install -y gcc-c++ yum install -y gdb yum install -y cmake yum install -y openssl yum install -y man-pages yum install -y bzip2 yum install -y wget yum install -y curl yum install -y git yum install -y subvion yum install -y nc yum install -y iperf3 yum install -y ntp yum install -y tmux yum install -y psmisc yum install -y net-tools
校时:
ntpdate cn.pool.ntp.org
配置防火墙:
1,关闭并停掉firewall systemctl stop firewalld.service systemctl disable firewalld.service 2,安装iptables yum install -y iptables-services systemctl enable iptables.service systemctl restart iptables.service 按照需要开放端口,默认只开启22号端口,其他全部拒绝 vim /etc/sysconfig/iptables 3,关闭selinux setenforce 0 #使配置立即生效 cp /etc/selinux/config /etc/selinux/config.install sed -i [email protected][email protected]#[email protected] /etc/selinux/config sed -i [email protected][email protected]#[email protected] /etc/selinux/config 4,重启iptables,注意文件中不能有注释:/etc/sysconfig/iptables systemctl restart iptables.service [[email protected] ~]# iptables -L -n Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination [[email protected] ~]#
网卡设置:
方式1: [[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32 TYPE=Ethernet BOOTPROTO=dhcp DEVICE=ens32 ONBOOT=yes [[email protected] ~]# 方式2: [[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32 TYPE=Ethernet DEVICE=ens32 BOOTPROTO=static ONBOOT=yes IPADDR=172.16.66.66 NETMASK=255.255.0.0 GATEWAY=172.16.1.1 DNS1=176.80.80.80 DNS2=8.8.8.8 [[email protected] ~]# [[email protected] ~]# service network restart Restarting network (via systemctl): [ OK ] [[email protected] ~]#
以上是关于CentOS7 迷你安装后,自定义初始化的主要内容,如果未能解决你的问题,请参考以下文章