Linux 时间同步配置
一. 使用 Network Time Protocol (NTP) 服务器
1.1 服务器可链接外网时
# crontab -e
加入一行:
*/1 * * * * ntpdate 210.72.145.44
210.72.145.44 为中国国家授时中心服务器地址,这样该机每隔1分重就可以与国家授时中心进行同步了。
注意: 在使用ntpdate 命令时, ntpd 服务必须是关闭的, 否则会报the NTP socket is in use, exiting 错误。
关闭 ntpd 服务命令如下:
[root@node2 init.d]# /etc/init.d/ntpd stop
Shutting down ntpd: [ OK ]
1.2. 架设本地时间服务器
需要修改 /etc/ntp.conf文件里的几个配置就可以了,比如本地时间服务器IP 为 10.85.10.119, 配置如下:
server 210.72.145.44 prefer (中国国家授时中心服务器地址 prefer表示优先 注意把默认的server更改成这样)
server 127.127.1.0 (本地时间)
restrict 10.85.10.0 mask 255.255.255.0 nomodify (允许10..85.10.* 的IP 使用该时间服务器)
restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap noquery notrust (屏蔽其他IP过来更新时间)
其他的保持默认不动。
使NTP服务可以在系统引导的时候自动启动,执行:
# chkconfig ntpd on
启动/关闭/重启NTP的命令:
# /etc/init.d/ntpd start
# /etc/init.d/ntpd stop &nbs
相关文档:
1.Linux进入与退出系统
进入Linux系统:
必须要输入用户的账号,在系统安装过程中可以创建以下两种帐号:
1.root--超级用户帐号(系统管理员),使用这个帐号可以在系统中做任何事情。
2.普通用户--这个帐号供普通用户使用,可以进行有限的操作。
一般的Linux使用者均为普通用户,而系统管理员一般 ......
方法一、
bool ReadElemnt(string& szFileName)
{
TiXmlDocument myDocument(szFileName);
bool loadOkay = myDocument.LoadFile();
if(loadOkay == false)
return false;
TiXmlElement *rootElement = myDocument.RootElement();
if(rootEle ......
bool RemoveNode(string& szFileName)
{
TiXmlDocument myDocument(szFileName);
bool loadOkay = myDocument.LoadFile();
if(loadOkay == false)
return false;
//获得根元素
TiXmlElement *rootElemen ......
1.关机
init 0或者 halt poweroff
重新启动
init 6或者 reboot
关机的时候通知下其他用户 Shutdown
shutdown -r +5 (五分钟之后关机)
2.在Linux下可以使用长文件或目录名,需要遵循的规则
/ 禁止使用
后缀是没有实际意义的
3.touch a 建立一个文件
4.shell命令的一般格式
$cmd ......
how to install apache, PHP and MySQL on Linux
This tutorial explains the installation of Apache web server, bundled
with PHP and MySQL server on a Linux machine. The tutorial is primarily for SuSE
9.2, 9.3, 10.0 & 10.1, but most of the steps ought to be valid for all
Linux-like operating ......