新装系统(CentOS7.4)环境初始化配置笔记

新装系统(CentOS7.4)环境初始化配置笔记

一、概述

设备详情:
Dell R730 服务器 (四个网卡,一根网线插在第2个网卡上)
CentOS 7.4 x64 最小安装环境

二、网络环境配置

网卡1(em1)网络配置

# /etc/sysconfig/network-scripts/ifcfg-em1

#以下为修改
BOOTPROTO=static
ONBOOT=yes

#以下为新增
IPADDR=192.168.2.110
NETMASK=255.255.255.0
GATEWAY=192.168.2.1
BROADCAST=192.168.2.255
DNS1=114.114.114
DNS2=8.8.8.8

网卡2(em2)网络配置

#/etc/sysconfig/network-scripts/ifcfg-em2

#以下为修改
BOOTPROTO=static
ONBOOT=yes

#以下为新增
IPADDR=192.168.1.110
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
BROADCAST=192.168.1.255
DNS1=114.114.114
DNS2=8.8.8.8

重启网络

$ service network restart #重启网络,使配置生效

路由配置

$ ip route show #查看当前路由情况
$ ip route add default via 192.168.1.110 dev em2 #(如果网卡2(em2)连接网络(或为外网IP),则如果要连接外网,需设置em2为默认路由)
$ ip route del default dev em1

三、安装SSH服务

$ yum -y install openssh #安装SSH服务
$ systemctl start sshd #启动SSH服务
$ systemctl status sshd #查看SSH服务状态
$ systemctl enable sshd #设置SSH服务开机自启动

四、禁用firewall切换使用iptables

# centos7开始默认使用firewall防火墙,由于本人对iptables更熟悉些,故切换使用iptables

#关闭firewall:
$ systemctl stop firewalld.service #停止firewall
$ systemctl disable firewalld.service #禁止firewall开机启动

#安装iptables防火墙
$ yum -y install iptables-services #安装
$ systemctl start iptables
$ systemctl enable iptables.service #设置防火墙开机启动
$ systemctl status iptables #查看防火墙状态

五、安装时间同步服务

$ yum install -y ntp

$ crontab -e
00 12 * * * /sbin/ntpdate cn.pool.ntp.org

六、更多软件安装

参考其他两篇文章:

posted @ 2018-02-21 17:03  一片相思林  阅读(448)  评论(0编辑  收藏  举报