RHEL6基础三十七之系统时间修正、GRUB背景图片修改

在安装完系统有时会发现系统时间与现在时间相差8小时,这是由于在安装系统时选择的时区是上海,而系统默认bios时间是utc时间,所以时间相差了8小时。这个时候的bios的时间和系统的时间是不一致的,一个代表 utc 时间,一个代表cst(+8时区),即上海时间。

当前系统时间:

[root@justin ~]# date
Mon Jan 13 07:07:48 CST 2014
[root@justin ~]# date -R
Fri, 18 Dec 2015 08:19:40 +0800

修正时间:

1、设置TUC、ARC为false,硬件时钟不于utc时间一致

[root@justin ~]# vim /etc/sysconfig/clock
# The time zone of the system is defined by the contents of /etc/localtime.
# This file is only for evaluation by system-config-date, do not rely on its
# contents elsewhere.
ZONE="Asia/Shanghai"
UTC=false
ARC=false

2、设置linux的时区设置为上海

[root@justin ~]# ln -sf /usr/share/zoneinfo/Asia/Shanghai    /etc/localtime

3、校对时间,需要先安装ntp服务器

[root@justin ~]# rpm -q ntp
package ntp is not installed
[root@justin ~]# yum -y install ntp
[root@justin ~]# rpm -q ntp
ntp-4.2.6p5-1.el6.centos.i686
[root@justin ~]# ntpdate ntp1.nl.net 
18 Dec 08:31:04 ntpdate[50047]: the NTP socket is in use, exiting
[root@justin ~]# service ntpd stop
[root@justin ~]# ntpdate ntp1.nl.net     ;ntp后面是数字1,n后面是字母l
13 Jan 15:29:40 ntpdate[1531]: step time server 193.79.237.14 offset -8.976068 sec
[root@justin ~]#

4、设置硬件时间与系统时间一致并校准

[root@justin ~]# /sbin/hwclock --systohc
[root@justin ~]#

也可以用一条命令来搞定,如果对时间要求很严格最好用同步的方式

date -s "20151218 08:30:50" &&hwclock --systohc


至此,linux系统时间和计算机硬件时间都是cst时间了,并且为上海时区。


Tips:

[root@justin ~]# hwclock --help
hwclock - query and set the hardware clock (RTC)
Usage: hwclock [function] [options...]
Functions:
  -r | --show         read hardware clock and print result #读取硬件(BIOS)时间,并显示出来
  -s | --hctosys      set the system time from the hardware clock #把目前系统时间调整为硬件时间
  -w | --systohc      set the hardware clock to the current system time #把硬件时间调整为目前系统的时间
       --systz        set the system time based on the current timezone #把系统时间设置为当时时区的时间
Options:
  -u | --utc          the hardware clock is kept in UTC #设置硬件为的UTC时间
       --localtime    the hardware clock is kept in local time #设置硬件为本地时间

修改背景图片需要使用工具imagemagick

1、安装Imagemagick

[root@justin ~]# yum install ImageMagick*
Loaded plugins: fastestmirror, product-id, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Determining fastest mirrors
...
Replaced:
  libjpeg.i686 0:6b-46.el6                                                                                   
Complete!
[root@justin ~]#

2、上传背景图片到服务器,使用convert命令处理图片,GRUB使用的图像为14色,尺寸为640x480,然后修改splashimage后面的参数

使用winscp将背景图片123.jpg上传到服务器(点击下载winscp

[root@justin src]# cd /usr/local/src/ && ls
python-iniparse-0.3.1-2.1.el6.noarch.rpm  yum-3.2.29-40.el6.centos.noarch.rpm
RPM-GPG-KEY-CentOS-6                      yum-metadata-parser-1.1.2-16.el6.i686.rpm
wx.jpg                                    yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
[root@justin src]# convert wx.jpg -resize 640x480! -colors 14 wx.xpm
[root@justin src]# gzip wx.xpm
[root@justin src]# cp wx.xpm.gz /boot/grub/
[root@justin src]# cd !$
cd /boot/grub/
[root@justin grub]# cp menu.lst menu.lstbak
[root@justin grub]# vim menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sda2
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/wx.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux (2.6.32-279.el6.i686)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-279.el6.i686 ro root=UUID=d8fe6590-fe20-451e-b5b9-dad15893db25 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-279.el6.i686.img

3、重启查看是否生效

wKioL1LTp7vQ1LZkAASJ9WLfEZY885.jpg

已生效

###########################################################

关注微信公众平台,了解最新动态

wKiom1LSBNqS9UVrAAB-ZNEallc580.jpg

Linux交流QQ群:333212786

Linux系统运维技术交流

PS:由于学习阶段部分不确定性文章会暂时隐藏,后期会公开,新公开和修正的文章会

通过微信公众平台(justin_rsdd)给出提示,欢迎关注,同时也希望得到大家的指点!

##############################################################

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值