码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS6.5基本命令汇总

时间:2017-11-15 23:40:00      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:centos6.5基本命令汇总

CentOS6.5基本命令汇总


1 更改系统默认语言

1)编辑/etc/sysconfig/i18n文档,修改成如下内容:

LANG="en_US.UTF-8"

SYSFONT="latarcyrheb-sun16"

2)重新登陆服务器

# logout


2 root账号远程登录配置

1)编辑/etc/ssh/sshd_config文档,修改成如下内容:

PermitRootLogin yes

2)重启ssh服务

# service sshd restart


3 配置IP地址

1)编辑 /etc/sysconfig/network-scripts/ifcfg-eth0文档,修改内容:

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=none

IPADDR=192.168.0.11

NETMASK=255.255.255.0

GATEWAY=192.168.0.1

DNS1=202.106.0.20

DNS2=8.8.8.8

2)重启网络服务

# service network restart

3)验证

# ifconfig -a   或 ip a



4 配置名称解析

1)配置主机名称,编辑 vim /etc/sysconfig/network 文档,修改成如下内容:

NETWORKING=yes

HOSTNAME=controller

2)编辑 /etc/hosts 文档,修改成如下内容:

192.168.0.11 controller

192.168.0.21 network

192.168.0.31 compute1

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

3)重新启动服务器

# reboot


5 安装配置时钟服务

1)安装时钟服务

# yum install ntp -y 

手动测试

[root@controller /]# ntpdate -u 1.cn.pool.ntp.org

27 Dec 19:08:54 ntpdate[2830]: adjust time server 202.112.29.82 offset -0.023451 sec

[root@controller /]# ntpdate -u 2.cn.pool.ntp.org

27 Dec 19:09:24 ntpdate[2833]: adjust time server 202.112.29.82 offset -0.002941 sec

[root@controller /]# ntpdate -u ch.pool.ntp.org

27 Dec 19:09:44 ntpdate[2837]: adjust time server 212.101.3.211 offset 0.026939 sec

2)编辑 /etc/ntp.conf文档,修改内容 如下:

server 1.cn.pool.ntp.org iburst

server 2.cn.pool.ntp.org

server ch.pool.ntp.org

restrict -4 default kod notrap nomodify

restrict -6 default kod notrap nomodify

3)重启NTP服务

# service ntpd start

# chkconfig ntpd on

4)验证

[root@controller /]# ntpq -c peers

     remote           refid      st t when poll reach   delay   offset  jitter

==============================================================================

 dns1.synet.edu. 202.118.1.46     2 u  151   64    1   49.251   10.920 121.391

*202.118.1.130   202.118.1.47     2 u  100   64  242   44.748  -103.54  44.451

 192.33.96.102   .PPS.            1 u  158   64   14  201.205  -24.854  55.618

[root@controller /]# ntpq -c assoc


ind assid status  conf reach auth condition  last_event cnt

===========================================================

  1  4125  9044   yes   yes  none    reject   reachable  4

  2  4126  963a   yes   yes  none  sys.peer    sys_peer  3

  3  4127  9024   yes   yes  none    reject   reachable  2


6 升级系统

# apt-get update

# apt-get dist-upgrade -y


CentOS6.5基本命令汇总

标签:centos6.5基本命令汇总

原文地址:http://435263.blog.51cto.com/425263/1982165

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!