CentOS和RedHat等系列系统 yum源配置、时间同步
一、yum源配置
1,进入yum源配置目录
cd /etc/yum.repos.d
2,备份系统自带的yum源
mv CentOS-Base.repo CentOS-Base.repo.bk
下载163网易的yum源:
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
3,更新玩yum源后,执行下边命令更新yum配置,使操作立即生效
yum makecache
yum list测试加缓存更新
4,除了网易之外,国内还有其他不错的yum源,比如中科大和搜狐的,大家可以根据自己需求下载
中科大的yum源:
wget http://centos.ustc.edu.cn/CentOS-Base.repo
sohu的yum源
wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
阿里yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
二、更新系统时间 net
一,用ntpdate从时间服务器更新时间
如果你的linux系统根本没有ntpdate这个命令
yum install ntp -y
安装完了之后,你不要做什么配置,也不需要,直接测试一下
[root@localhost ~]# ntpdate time.nist.gov
22 Oct 21:11:43 ntpdate[5014]: adjust time server 207.200.81.113 offset -0.018788 sec
如果出去上面的内容说明,同步成功了。然后在crontab里面加上以下内容。
*/10 * * * * ntpdate time.nist.gov #域名或IP
每隔十分钟同步一次。推荐几个时间服务器。
time.nist.gov
time.nuri.net
asia.pool.ntp.org
asia.pool.ntp.org
asia.pool.ntp.org
asia.pool.ntp.org
二,用ntp搭建自己的时间服务器
上面我们是利用别人的时间服务器来同步时间,这些时间服务器都是比较权威的。当我们自己搭建时间服务器就不用crontab来定时去跑。
1,安装时间服务器ntp
yum install ntp
2,配置ntp
[root@localhost ~]# cat /etc/ntp.conf |awk '{if($0 !~ /^$/ && $0 !~ /^#/) {print $0}}'
restrict default ignore //默认不允许修改或者查询ntp,并且不接收特殊封包
restrict 127.0.0.1 //给于本机所有权限
restrict 192.168.1.0 mask 255.255.255.0 notrap nomodify //给于局域网机的机器有同步时间的权限
server time.nist.gov prefer //设置时间服务器,加prefer表示优先
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
3,启动 ntp
[root@localhost ~]# /etc/init.d/ntpd start
4,查看并测试
[root@localhost ~]# netstat -upnl |grep ntpd //查看时程
[root@localhost ~]# ntpq -pn //查看同步的服务器IP
remote refid st t when poll reach delay offset jitter
==============================================================================
50.77.217.185 .INIT. 16 u - 64 0 0.000 0.000 0.000
202.90.158.4 .INIT. 16 u - 64 0 0.000 0.000 0.000
202.71.100.89 .INIT. 16 u - 64 0 0.000 0.000 0.000
202.134.1.10 .INIT. 16 u - 64 0 0.000 0.000 0.000
*127.127.1.0 .LOCL. 10 l 18 64 377 0.000 0.000 0.001
[root@localhost ~]# ntpstat //同步的结果
synchronised to local net at stratum 11
time correct to within 12 ms
polling server every 512 s
remote:即NTP主机的IP或主机名称。注意最左边的符号,如果由“+”则代表目前正在作用钟的上层NTP,如果是“*”则表示也有连上线,不过是作为次要联机的NTP主机。
refid:参考的上一层NTP主机的地址
st:即stratum阶层
when:几秒前曾做过时间同步更新的操作
poll:下次更新在几秒之后
reach:已经向上层NTP服务器要求更新的次数
delay:网络传输过程钟延迟的时间
offset:时间补偿的结果
jitter:Linux系统时间与BIOS硬件时间的差异时间
推荐第一种方法,虽然搭建个时间服务器,还是比较简单的,但是我觉得没有这个必要。如果用别人的时间服务器,每隔10分钟同步一次,可以精确到毫秒。
作者:海底苍鹰
地址:http://blog.51yip.com/server/1474.html
CentOS和RedHat等系列系统 yum源配置、时间同步的更多相关文章
- CentOS 6.5 & 7 的网络YUM源配置
中国科技大学CentOS 6.5的网络源 [base]name=CentOS-$releasever - Base#mirrorlist=http://mirrorlist.centos.org/?r ...
- 转:CentOS系统yum源配置修改、yum安装软件包源码包出错解决办法!
yum安装包时报错: Could not retrieve mirrorlist http://mirrorlist.repoforge.org/el6/mirrors-rpmforge error ...
- CentOS系统yum源配置修改、yum安装软件包源码包出错解决办法apt.sw.be couldn't connect to host
yum安装包时报错: Could not retrieve mirrorlist http://mirrorlist.repoforge.org/el6/mirrors-rpmforge error ...
- 常用的CentOS 7系统yum源集合
常用的CentOS 7系统yum源集合 yum源对于linux系统的安装有非常大的帮助了,下面小编为各位整理了常用的CentOS 7系统yum源集合了,希望这篇文章能够对各位有所帮助的哦. 记 ...
- RedHat和CentOS使用本地yum源配置
2013-04-01 11:38:30 标签:本地yum源 版权声明:原创作品,谢绝转载!否则将追究法律责任. 使用yum命令安装所需的软件,如果设备网络状况很好,当然也没必要去配置本地yum源,直接 ...
- CentOS 5/6.X 使用 EPEL YUM源
参考:http://www.linuxidc.com/Linux/2013-08/88523.htm 大纲 一.什么是EPEL? 二.与163 YUM源比较 三.CentOS 5.X 安装使用EPEL ...
- 纯净CentOS7.2 yum源配置与使用yum 安装系统工具net-tools
本节我们来讲CentOS 的yum 源配置 一.yum 简介 yum,是Yellow dog Updater, Modified 的简称,是杜克大学为了提高RPM 软件包安装性而开发的一种软件包管理器 ...
- RedHat yum源配置
RedHat yum源配置 原本以为Redhat7 和Centos7是完全一样的,可是安装完Redhat7以后,使用yum安装软件,提示红帽操作系统未注册.在网上搜索教程,最后成功解决,解决方式是将y ...
- Centos下YUM源配置及相关问题应用篇
yum源配置在工作中会经常用到,特别是安装数据库时,一个个去安装依赖包比较耗时,直接配置好yum安装即可. (特别提醒:redhat有时会提示系统未注册,要求你注册,这个只对需要连接公网的yum源产生 ...
随机推荐
- winform 版本号比较
Version now_v = new Version(strval); Version load_v = new Version(model.version.ToString()); if (now ...
- Syncthing源码解析 - 第三方库
1,AudriusButkevicius/cli 网址:https://github.com/AudriusButkevicius/cli 2,bkaradzic/go-lz4 网址:https:// ...
- linux shell中"2>&1"含义
在计划任务中经常可以看到.例如我们公司的计划任务举例: */ * * * * root cd /opt/xxxx/test_S1/html/xxxx/admin; php index.php task ...
- 1083 矩阵取数问题(DP)
1083 矩阵取数问题 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 收藏 关注 一个N*N矩阵中有不同的正整数,经过这个格子,就能获得相应价值的奖励,从左上走 ...
- 转载文章 208 个最常见 Java 面试题全解析
最近正值春招,一直在给公司招聘 Java 程序员,我从 2015 年做 TeamLeader 开始就习惯性地收集平时遇到的 Java 技术问题或周围朋友见过的面试题,经过不断筛选,终于凝练成一套实用的 ...
- jquery分页插件pagination
参考1:https://www.cnblogs.com/jingping/p/3925976.html 参考2:https://segmentfault.com/a/1190000014487357 ...
- mxonline实战-1,创建应用及相应模型
前言 环境说明:python3.5 + django2.0, 用的pycharm4.04专业版 课程视频地址 https://coding.imooc.com/learn/list/78. ...
- 记一次升级Ubuntu内核
uname -a 查看当前使用内核版本 升级指定内核 apt-get install linux-image-4.4.0-131-generic dpkg --get-selections | ...
- Laravel 的核心概念
工欲善其事,必先利其器.在开发Xblog的过程中,稍微领悟了一点Laravel的思想.确实如此,这篇文章读完你可能并不能从无到有写出一个博客,但知道Laravel的核心概念之后,当你再次写起Larav ...
- day04 --class --homework
# -*- coding: utf-8 -*- # @Time : 2018/12/24 12:10 # @Author : Endless-cloud # @Site : # @File : 04 ...