<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>简单生活@NET &#187; 时间</title>
	<atom:link href="http://lee.kometo.com/archives/tag/%e6%97%b6%e9%97%b4/feed" rel="self" type="application/rss+xml" />
	<link>http://lee.kometo.com</link>
	<description>正确的判断来自经验，但经验往往来自错误的判断</description>
	<lastBuildDate>Mon, 06 Feb 2012 02:26:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>linux入门-系统时间设置篇</title>
		<link>http://lee.kometo.com/archives/178</link>
		<comments>http://lee.kometo.com/archives/178#comments</comments>
		<pubDate>Wed, 29 Oct 2008 16:30:36 +0000</pubDate>
		<dc:creator>Emeric lee</dc:creator>
				<category><![CDATA[IT前沿]]></category>
		<category><![CDATA[WEB应用开发]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[utc]]></category>
		<category><![CDATA[时间]]></category>

		<guid isPermaLink="false">http://lee.kometo.com/?p=178</guid>
		<description><![CDATA[是的，没错，linux的时间设置需要专门写一篇来说明！ date #显示系统当前本地时间 STEP1：设定硬件时钟（BIOS） debian/linux默认认为BIOS时间是世界时间（UTC），BOIS一般实际设置的是本地时间，所以需要修改它（特别在VmWare等虚拟机环境下） #编辑rcS，设置UTC=no，告诉系统，硬件时间是否为UTC时间 #BIOS=本地时间，UTC=no #BIOS=UTC时间，UTC=yes vim /etc/default/rcS &#160; #其它相关的命令： hwclock --show --utc #显示当前硬件时钟，硬件时钟假定为UTC时间 hwclock --show --localtime #显示当前硬件时钟，硬件时钟假定为本地时间 hwclock #也可以用来设置硬件时间 STEP2:检查设定当前系统时区 设定系统所处UTC时区,中国用的是 Asia/Shanghai。 cat /etc/timezone #显示系统当前时区 &#160; tzselect #设定系统本地时区 相关文件 /etc/timezone /etc/localtime STEP3:安装ntpdate执行时间同步 ntpdate可以使用网络时间服务器及时更新同步本机时间，这是可选的操作，如果有网络，推荐进行 #安装ntpdate apt-get install ntpdate #设置时区，确认为Asia/shanghai tzconfig #添加自动同步计划 crontab -e #添加这一行,这行的意思是每30分钟自动与时间服务器time.cuit.edu.cn来进行同步 */30 * * * * /usr/sbin/ntpdate pool.ntp.org #顺便记录两个好的ntpserver: # [...]]]></description>
			<content:encoded><![CDATA[<p>是的，没错，linux的时间设置需要专门写一篇来说明！</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #666666; font-style: italic;">#显示系统当前本地时间</span></pre></div></div>

<p><strong>STEP1：设定硬件时钟（BIOS）</strong></p>
<p style="padding-left: 30px;">debian/linux默认认为BIOS时间是世界时间（UTC），BOIS一般实际设置的是本地时间，所以需要修改它（特别在VmWare等虚拟机环境下）</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#编辑rcS，设置UTC=no，告诉系统，硬件时间是否为UTC时间</span>
<span style="color: #666666; font-style: italic;">#BIOS=本地时间，UTC=no</span>
<span style="color: #666666; font-style: italic;">#BIOS=UTC时间，UTC=yes</span>
<span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span>rcS
&nbsp;
<span style="color: #666666; font-style: italic;">#其它相关的命令：</span>
hwclock <span style="color: #660033;">--show</span> <span style="color: #660033;">--utc</span>        <span style="color: #666666; font-style: italic;">#显示当前硬件时钟，硬件时钟假定为UTC时间</span>
hwclock <span style="color: #660033;">--show</span> <span style="color: #660033;">--localtime</span>  <span style="color: #666666; font-style: italic;">#显示当前硬件时钟，硬件时钟假定为本地时间</span>
hwclock                     <span style="color: #666666; font-style: italic;">#也可以用来设置硬件时间</span></pre></div></div>

<p><span id="more-178"></span></p>
<p><strong>STEP2:检查设定当前系统时区</strong></p>
<p style="padding-left: 30px;">设定系统所处UTC时区,中国用的是 Asia/Shanghai。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>timezone    <span style="color: #666666; font-style: italic;">#显示系统当前时区</span>
&nbsp;
tzselect             <span style="color: #666666; font-style: italic;">#设定系统本地时区</span></pre></div></div>

<p style="padding-left: 30px;">相关文件<br />
 /etc/timezone<br />
 /etc/localtime</p>
<p><br class="spacer_" /></p>
<p><strong>STEP3:安装ntpdate执行时间同步 </strong></p>
<p>ntpdate可以使用网络时间服务器及时更新同步本机时间，这是可选的操作，如果有网络，推荐进行</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#安装ntpdate</span>
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ntpdate
<span style="color: #666666; font-style: italic;">#设置时区，确认为Asia/shanghai</span>
tzconfig
<span style="color: #666666; font-style: italic;">#添加自动同步计划</span>
crontab <span style="color: #660033;">-e</span>
<span style="color: #666666; font-style: italic;">#添加这一行,这行的意思是每30分钟自动与时间服务器time.cuit.edu.cn来进行同步</span>
<span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">30</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>ntpdate pool.ntp.org
<span style="color: #666666; font-style: italic;">#顺便记录两个好的ntpserver:</span>
<span style="color: #666666; font-style: italic;"># time.asia.apple.com</span>
<span style="color: #666666; font-style: italic;"># pool.ntp.org</span>
<span style="color: #666666; font-style: italic;"># time.cuit.edu.cn</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://lee.kometo.com/archives/178/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

