#关闭selinux和firewalld,配置网络

getenforce
setenforce 0
vi /etc/selinux/config
SELINUX=disabled
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld

#查看ip地址

ip add

#启动和关闭网卡

ifup
ifdown

#配置网卡

vi /etc/sysconfig/network-scripts/ifcfg-eno16777728
BOOTPROTO=static
IPADDR=192.168.1.99
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.100
NM_CONTROLLED=no

#单独添加DNS服务器地址

echo 'DNS1=192.168.1.100'>>/etc/sysconfig/network-script/ifcfg-eno16777728

#DNS服务器添加记录

vi /var/named/example.zone
vi /var/named/192.168.1.zone

#配置hostname

vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=lin26.example.local

#重启network服务

systemctl restart network

#使用本地repo

mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/*.* /etc/yum.repos.d/backup
vi /etc/yum.repos.d/lin01.repo
[base]
name=lin01
baseurl=http://lin01.example.local/cdrom
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
yum clean all
yum update

#使用阿里云repo

vi /etc/yum.repos.d/aliyun.repo
[base]
name=aliyun
baseurl=http://mirrors.aliyun.com/centos/7/os/x86_64/
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
yum clean all
yum update

#配置时区和时间同步

tzselect
yum install -y ntpdate
#和服务器的时间差不能超过1天
ntpdate -d lin01.example.local
vi /etc/crontab
00 */1 * * * root /usr/sbin/ntpdate lin01.example.local;/sbin/hwclock -w

#手动设置时间

date -s 11/16/2015
date -s 18:28:00
hwclock -w

#安装net-tools,查看启动的服务和端口

yum install -y net-tools
netstat -ntupl

#关机,重启,取消操作

shutdown -P
shutdown -r
shutdown -c
reboot

#关机前把数据从buffer写到磁盘确保完整性

sync