Centos7.2初始化和升级更新命令

第一部分:CentOS7.2初始化

1、更新yum源

[root@localhost ~]# yum install wget -y

[root@localhost ~]# cd /etc/yum.repos.d/

[root@localhost yum.repos.d]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

[root@localhost yum.repos.d]# yum clean

[root@localhost yum.repos.d]# yum makecache

 

2、下载安装包

[root@localhost yum.repos.d]# yum install epel-release -y

[root@localhost yum.repos.d]# yum install wget zip unzip rsync lrzsz vim-enhanced ntpdate tree lsof dstat net-tools -y

 

3、关闭防火墙

[root@localhost yum.repos.d]# systemctl stop firewalld.service
[root@localhost yum.repos.d]# systemctl disable firewalld.service

[root@localhost yum.repos.d]# sed -i s#^SELINUX=enforcing#SELINUX=disabled# /etc/selinux/config

[root@localhost yum.repos.d]# source /etc/sysconfig/selinux

[root@docker ~]# ntpdate s1a.time.edu.cn

[root@docker ~]# hwclock -w

 

4、修改主机名

[root@localhost yum.repos.d]# hostnamectl set-hostname docker

 

第二部分:升级系统版本

Linux中升级更新命令yum upgrade和yum update的区别

参考:http://www.jb51.net/LINUXjishu/342419.html

 

升级过程建议使用国内阿里云源地址:以为Centos7.2升级为例

[root@centos72 ~]# yum install wget net-tools

更新阿里云源地址,覆盖CentOS-Base.repo文件,先备份文件

[root@centos72 yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo

[root@centos72 yum.repos.d]# yum clean all

[root@centos72 yum.repos.d]# yum makecache

[root@centos72 yum.repos.d]# yum update 此处耗时较长,共计330个安装包

[root@centos72 yum.repos.d]# yum install epel-release -y

 

升级前:

系统版本: CentOS Linux release 7.2.1511 (Core)

内核版本: 3.10.0-327.el7.x86_64

 

yum -y update 升级后

系统版本: CentOS Linux release 7.4.1708 (Core)

内核版本: 3.10.0-693.5.2.el7.x86_64

 

跨大版本升级:CentOS5-CentOS7,涉及到源码包更新。

posted @ 2017-12-17 20:14  wang_wei123  阅读(1477)  评论(0编辑  收藏  举报