您的位置:首页 > 其它

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

2013-12-04 15:47 507 查看
在安装完系统有时会发现系统时间与现在时间相差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、重启查看是否生效



已生效
[b][b][b][b][b][b][b][b][b]############################[b][b][b][b][b][b][b][b][b][b]###############################[/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b]
[b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b] 关注微信公众平台,了解最新动态[/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b]
[b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b]

[/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b]
[b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b]Linux交流QQ群:333212786[/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b]



[b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b]PS:由于学习阶段部分不确定性文章会暂时隐藏[/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b],后期会公开,新公开和修正的文章会[/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b]
[b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b][b]通过微信公众平台(justin_rsdd)给出提示,欢迎关注,同时也希望得到大家的指点![/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b]
[b][b][b][b][b][b][b][b][b]####################################[b][b][b][b][b][b][b][b][b][b]##########################[/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b][/b]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  uniq grep awk