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