Minimal安装centos 6.7之后要做的基本配置

系统版本:

[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时区的时间。

 
 

猜你喜欢

转载自blog.51cto.com/201731/2132831
今日推荐