1. 修改主机名

  1. vim /etc/hostname
  2. hostname name

2. 配置网络

# ip地址配置
vim /etc/sysconfig/network-scripts/ifcfg-ens33  #修改配置文件
    BOOTPROTO=static                 #可以设置dhcp自动获取
  IPADDR=192.168.2.44
  NATMASK=255.255.255.0
  GATEWAY=192.168.2.1
  ONBOOT=yes

# dns配置
vim /etc/resolv.conf
nameserver 8.8.8.8
nameserver 114.114.114.114

# 本地hosts配置
vim /etc/hosts
192.168.120.22 Master
192.168.120.21 Node1

systemctl restart network        #重启网络

3. 必要时关闭防火墙和selinux

# 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
#或者 systemctl disable --now firewalld

# 关闭selinux
setenforce 0
vim /etc/sysconfig/selinux
    SELINUX=disabled
#或者 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux

4. 配置yum源

# 挂载光盘
mkdir -p /media/iso 
mount /dev/sr0 /media/iso
vim /etc/fstab
    /dev/sr0 /media/iso iso9660 defaults 0 0 
# 或者 echo "/dev/sr0 /media/iso iso9660 defaults 0 0" >> /etc/fstab
mount -a

#配置本地yum源
rm -rf  /etc/yum.repos.d/*
vim /etc/yum.repos.d/CentOS7.repo
    [CentOS7]
    name=local_yum
    baseurl=file:///media/iso
    enable=1
    gpgcheck=1
    gpgkey=file:///media/iso/RPM-GPG-KEY-CentOS-7

# 网络源(阿里源+epel源)[wget最小化没有]
wget http://mirrors.aliyun.com/repo/Centos-7.repo && mv ./Centos-7.repo /etc/yum.repos.d/
wget http://mirrors.aliyun.com/repo/epel-7.repo && mv ./epel-7.repo /etc/yum.repos.d/

# 更新yum源
yum clean all
yum makecache   #将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度

5.需要安装的软件

# bash-completion(命令补全)  vim(编辑器)  wget(通过网络下载资源)  git(下载)
# gcc gcc-c++(编译工具) 
# lrzsz(远程与本地上传下载) tree(树目录) net-tools(ifconfig route命令)
# ntpdate(时间同步工具)
yum -y install bash-completion vim wget
yum -y install gcc gcc-c++
yum -y install lrzsz tree net-tools ntpdate
yum -y install nmap sysstat dos2unix openssl openssh bash

6.定时自动更新系统时间

ntpdate -u ntp.aliyun.com
/usr/sbin/ntpdate ntp.aliyun.com>>/var/log/ntp.log 2>&1;/sbin/hwclock-w

7.重启系统

reboot