热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

实例分析对于历史Linux镜像的问题进行修复处理

在本篇内容中我们给大家总结了关于对于历史Linux镜像的问题进行修复处理知识点,有需要的朋友们跟着学习下。

历史Linux镜像的问题修复方案

历史Linux镜像创建的ECS云服务器,可能存在NTP没有配置,YUM没有配置,还可能存在最近暴漏较高的安全漏洞,请按照以下步骤进行修复,可以让您的云服务器更加安全,还可以使用阿里云提供的YUM服务进行安装软件,可以使用免费的阿里云提供的NTP进行时间同步。

1. 配置NTP

不区分发行版,先备份 /etc/ntp.conf,然后将其内容替换为如下:

# ntp.conf

#

# ntpd config for aliyun ecs.

#

# 6LAN+6LAN+3WAN

#        shijun.cao@alibaba-inc.com

#        2014.8.11

#

driftfile /var/lib/ntp/drift

pidfile  /var/run/ntpd.pid

logfile /var/log/ntp.log

# Access Control Support

restrict  default ignore

restrict -6 default ignore

restrict 127.0.0.1

restrict 192.168.0.0 mask 255.255.0.0 nomodify notrap nopeer noquery

restrict 172.16.0.0 mask 255.240.0.0 nomodify notrap nopeer noquery

restrict 100.64.0.0 mask 255.192.0.0 nomodify notrap nopeer noquery

restrict 10.0.0.0 mask 255.0.0.0 nomodify notrap nopeer noquery

restrict ntp1.aliyun.com nomodify notrap nopeer noquery

restrict ntp2.aliyun.com nomodify notrap nopeer noquery

restrict ntp3.aliyun.com nomodify notrap nopeer noquery

restrict ntp4.aliyun.com nomodify notrap nopeer noquery

restrict ntp5.aliyun.com nomodify notrap nopeer noquery

restrict ntp6.aliyun.com nomodify notrap nopeer noquery

# local clock

server 127.127.1.0

fudge 127.127.1.0 stratum 10

#public ntp server

server ntp1.aliyun.com iburst minpoll 4 maxpoll 10

server ntp2.aliyun.com iburst minpoll 4 maxpoll 10

server ntp3.aliyun.com iburst minpoll 4 maxpoll 10

server ntp4.aliyun.com iburst minpoll 4 maxpoll 10

server ntp5.aliyun.com iburst minpoll 4 maxpoll 10

server ntp6.aliyun.com iburst minpoll 4 maxpoll 10

#Private ntp server

server ntp1.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10

server ntp2.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10

server ntp3.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10

server ntp4.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10

server ntp5.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10

server ntp6.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10

#New private ntp server

server ntp7.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10

server ntp8.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10

server ntp9.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10

server ntp10.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10

server ntp11.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10

server ntp12.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10

2. 更新软件源

0 . 先确认镜像当前的 Linux 系统发行版和版本号。

如果有 lsb_release 命令,执行:

lsb_release -a

否则执行

cat /etc/issue

1 . 对于 CentOS,备份 /etc/yum.repos.d/ 下的 CentOS-Base.repo 和 epel.repo 文件,根据 CentOS 版本,执行如下相应的命令:

CentOS 5:

wget -qO /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

wget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-5.repo

CentOS 6:

wget -qO /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

wget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

CentOS 7:

wget -qO /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

wget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

repo 文件下载完成后,执行:

yum makecache

2 . 对于 Aliyun 5.7,备份 /etc/yum.repos.d/CentOS-Base.repo ,然后执行:

wget -qO /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/aliyun-5.repo

repo 文件下载完成后,执行:

yum makecache

3 . 对于 Ubuntu,备份 /etc/apt/sources.list 文件,根据发行版版本,执行命令:

ubuntu12.04:

wget -qO /etc/apt/sources.list http://mirrors.aliyun.com/repo/ubuntu1204-lts.list

ubuntu14.04:

wget -qO /etc/apt/sources.list http://mirrors.aliyun.com/repo/ubuntu1404-lts.list

然后执行:

apt-get update

4 . 对于 Debian,备份 /etc/apt/sources.list 文件,根据发行版版本,执行命令:

debian6:

wget -qO /etc/apt/sources.list http://mirrors.aliyun.com/repo/debian6-lts.list

debian7:

wget -qO /etc/apt/sources.list http://mirrors.aliyun.com/repo/debian7-lts.list

然后执行:

apt-get update

3. 安全漏洞修复补丁

主要修复目前已知的重大安全漏洞,需要升级的软件包括: bash 、glibc 、 openssl 、wget 、ntp 。

在执行如下命令之前,需要确保系统当前的软件源已经设置正确。

1 . 对于 CentOS 和 Aliyun Linux,执行:

yum update bash glibc openssl wget ntp

2 . 对于 Ubuntu 和 Debian,执行:

apt-get install bash libc6 libc-bin openssl wget ntp


推荐阅读
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • Centos7.6安装Gitlab教程及注意事项
    本文介绍了在Centos7.6系统下安装Gitlab的详细教程,并提供了一些注意事项。教程包括查看系统版本、安装必要的软件包、配置防火墙等步骤。同时,还强调了使用阿里云服务器时的特殊配置需求,以及建议至少4GB的可用RAM来运行GitLab。 ... [详细]
  • Ubuntu 9.04中安装谷歌Chromium浏览器及使用体验[图文]
    nsitionalENhttp:www.w3.orgTRxhtml1DTDxhtml1-transitional.dtd ... [详细]
  • 如何在服务器主机上实现文件共享的方法和工具
    本文介绍了在服务器主机上实现文件共享的方法和工具,包括Linux主机和Windows主机的文件传输方式,Web运维和FTP/SFTP客户端运维两种方式,以及使用WinSCP工具将文件上传至Linux云服务器的操作方法。此外,还介绍了在迁移过程中需要安装迁移Agent并输入目的端服务器所在华为云的AK/SK,以及主机迁移服务会收集的源端服务器信息。 ... [详细]
  • 成功安装Sabayon Linux在thinkpad X60上的经验分享
    本文分享了作者在国庆期间在thinkpad X60上成功安装Sabayon Linux的经验。通过修改CHOST和执行emerge命令,作者顺利完成了安装过程。Sabayon Linux是一个基于Gentoo Linux的发行版,可以将电脑快速转变为一个功能强大的系统。除了作为一个live DVD使用外,Sabayon Linux还可以被安装在硬盘上,方便用户使用。 ... [详细]
  • CentOS 7部署KVM虚拟化环境之一架构介绍
    本文介绍了CentOS 7部署KVM虚拟化环境的架构,详细解释了虚拟化技术的概念和原理,包括全虚拟化和半虚拟化。同时介绍了虚拟机的概念和虚拟化软件的作用。 ... [详细]
  • Linux防火墙配置—允许转发
    nsitionalENhttp:www.w3.orgTRxhtml1DTDxhtml1-transitional.dtd ... [详细]
  • systemd-nspawn可以创建最轻量级的容器(ns的意思就是namespace),本文的实验平台是Ubuntu16.04,x86_64机器。本文的目的是:在Ubuntu中用syst ... [详细]
  • 如何将CentOS8转换为CentOSStream
    CentOS Stream是一个持续交付的Linux发行版,它在RHEL之前处于领先地位。它将具有滚动发布,即不断进行更改。CentOS将成为一个上游版本,它将具有测试补丁和更新。 ... [详细]
  • Linux神奇漏洞:长按回车键70秒 即可轻松拿到Root权限
    一般来说获取系统root权限是很困难的,尤其是加密系统中,但西班牙安全研究员hectormarco、ismaelripoll发现,linux系统下只需按住回车键70秒钟,就能轻 ... [详细]
  • Docker安装Rabbitmq(配合宝塔)
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了Docker安装Rabbitmq(配合宝塔)相关的知识,希望对你有一定的参考价值。一、事前准备 ... [详细]
  • 系统安装Debian系统的安装方式和Ubuntu系统的安装方式几乎是一样的,毕竟Ubuntu系统是基于Debian的,就如同CentOS基于Redhat ... [详细]
  • 阿里云服务器iis设置方法与上千种Linux桌面版本相比,Linux服务器只有可怜的十几种。但想要选对适合你的企业需要的仍然不是件容易的事情,选Linux服务器首先要 ... [详细]
  • CentOS7.8下编译muduo库找不到Boost库报错的解决方法
    本文介绍了在CentOS7.8下编译muduo库时出现找不到Boost库报错的问题,并提供了解决方法。文章详细介绍了从Github上下载muduo和muduo-tutorial源代码的步骤,并指导如何编译muduo库。最后,作者提供了陈硕老师的Github链接和muduo库的简介。 ... [详细]
  • Ubuntu 用户安装 Linux Kernel 3.15 RC1
    nsitionalENhttp:www.w3.orgTRxhtml1DTDxhtml1-transitional.dtd ... [详细]
author-avatar
手机用户2502922607
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有