初始化CENTOS7常规配置(个人使用)
虚拟机
大版本:16
下载地址:https://www.vmware.com/products/workstation-pro/workstation-pro-evaluation.html
VMWARE16许可证:*****-*****-*****-*****-*****、*****-*****-*****-*****-*****、*****-*****-*****-*****-*****
CENTOS7镜像
系统安装
略
系统初始化设置
修改主机名:hostnamectl set-hostname xxx
配置静态IP:vim /etc/sysconfig/network-scripts/ifcfg-ens32;配置完成后需要重启网络:systemctl restart network
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static // 将dhcp修改为static 将动态IP修改为静态IP DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens32 UUID=31456e7b-b701-4886-8b78-993c82e3ed69 DEVICE=ens32 ONBOOT=yes //设置为开机启用网络配置 IPADDR=192.168.136.111 // 自定义的静态IP地址 NETMASK=255.255.255.0 // 配置子网掩码 GATEWAY=192.168.136.2 // 配置网关 DNS1=114.114.114.114 // 配置DNS域名解析 ,国内网络一般是114.114.114.114 国外网络一般是8.8.8.8
关掉防火墙:
systemctl status firewalld.service // 查看防火墙状态 systemctl stop firewalld.service // 关掉防火墙 systemctl disable firewalld.service // 关掉防火墙开机自启
关掉SELINUX:
[root@node01 webapps]# sestatus // 查看selinux状态 SELinux status: disabled You have new mail in /var/spool/mail/root [root@node01 webapps]# vim /etc/sysconfig/selinux # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled // 设置为disable永久性关闭selinux # SELINUXTYPE= can take one of three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
定时同步阿里云服务器时间:
yum -y install ntpdate crontab -e */1 * * * * /usr/sbin/ntpdate time1.aliyun.com
集群多机器之间设置免密登录:
ssh-keygen -t rsa // 三台机器在root用户下,执行以下命令将公钥拷贝到node01服务器上面去 ssh-copy-id node01 // node01在root用户下,执行以下命令,将authorized_keys拷贝到node02与node03服务器 cd /root/.ssh/ scp authorized_keys node02:$PWD scp authorized_keys node03:$PWD
机器重启:init 6