Minimal安裝centos 6.7之後要做的基本配置
阿新 • • 發佈:2018-06-26
iyu image AD 生成 ebo fff 增強 裝配 nag 系統版本:
[root@centos67n1 ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[root@centos67n1 ~]# uname -r
2.6.32-573.el6.x86_64
1、配置網絡連接
[root@centos67n1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 ONBOOT=yes BOOTPROTO=static IPADDR=192.168.16.61 NETMASK=255.255.255.0 BROADCAST=192.168.16.255 NETWORK=192.168.16.0 GATEWAY=192.168.16.2 #修改或添加以上內容 [root@centos67n1 ~]# vi /etc/resolv.conf nameserver 8.8.8.8 #修改DNS [root@centos67n1 ~]# service network restart #重啟網絡連接
2、配置hostname和hosts
[root@centos67n1 ~]# vi /etc/sysconfig/network
HOSTNAME=centos67n1
#修改為自己的hostname
[root@centos67n1 ~]# vi /etc/hosts
127.0.0.1 localhost centos67n1 localhost4 localhost4.localdomain4
#將第3個字段修改為上面所配置的hostname
[root@centos67n1 ~]# reboot
#重啟系統,使配置生效
3、確保連通Internet之後,安裝vim和wget
[root@centos67n1 ~]# yum -y install vim wget
4、配置阿裏yum源,並安裝epel源
[root@centos67n1 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup #備份原來的repo文件 [root@centos67n1 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo #下載阿裏的repo文件 [root@centos67n1 ~]# vim /etc/yum.repos.d/CentOS-Media.repo enabled=0 #確保不啟用CentOS-Media.repo [root@centos67n1 ~]# yum clean all [root@centos67n1 ~]# yum makecache #生成緩存 [root@centos67n1 ~]# yum -y install epel-release #安裝epel源
5、安裝bash-completion,以支持增強Tab補全
[root@centos67n1 ~]# yum -y install bash-completion
6、安裝配置NTP,自動對時,確保時間的準確性
[root@centos67n1 ~]# yum -y install ntp
[root@centos67n1 ~]# vim /etc/ntp.conf
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
#在以上4行前面加“#”註釋掉,或刪除以上4行
server 2.cn.pool.ntp.org iburst
server 1.cn.pool.ntp.org iburst
#添加以上兩行
[root@centos67n1 ~]# chkconfig ntpd on
#設置開機自動啟動NTP服務
[root@centos67n1 ~]# reboot
[root@centos67n1 ~]# service ntpd status
ntpd (pid 1347) is running...
#重啟系統,確認NTP服務自動啟動
[root@centos67n1 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*85.199.214.100 .GPS. 1 u 22 64 347 203.883 -4.243 6.467
+ntp.wdc1.us.lea 130.133.1.10 2 u 40 64 337 228.033 -1.875 15.322
#NTP自動校對時間生效
此外,在安裝系統設置時間的時候,註意不要勾選System clock uses UTC
,UTC(Universe time coordinated)即世界協調時間,也就是0時區的時間。
Minimal安裝centos 6.7之後要做的基本配置