最新消息:阿里云双12优惠,史上最低折扣。

超全centos7安装源配置教程,本地、阿里云yum源,epel源安装配置

服务器配置 aliyun 198浏览

常用centos关机命令一览

shutdown命令: shutdown [OPTIONS…] [TIME] [WALL…] shutdown -h now ##立即关机 shutdown -h 20 ##20分钟后关机 s … 常用centos关机命令一览

本文主要介绍Centos7操作系统内配置yum源,epel源。公网yum源我们这边使用阿里云的,大家也可以改成其他的源;本地yum源使用安装镜像内的资源。

本地yum源:

本地yum源适合无法连入公网的内网服务器或者未调通网络前临时使用。

1.挂载镜像,并将文件传入服务器

mount /dev/sr0 mkdir -p /opt/yum cp -r /mnt/Packages /mnt/repodata /opt/yum

这是为了当服务器再次需要本地yum源时免去二次去机房挂载光盘的情况。

2.备份原始yum配置,并创建新的本地yum文件

cd /etc/yum.repos.d mkdir backup mv ./Centos* ./backup/. touch base.repo

local.repo配置如下:

[base] name=base baseurl=file:///opt/yum gpgcheck=0 enable=1

3.清空并重建yum缓存

yum clean all yum makecache yum list

配置到这里,本地yum源就已经建好了,即使后面没有光盘支持,本地yum源也能够起作用。

配置阿里云yum源:

当服务器有公网带宽时,一般推荐配置公网yum源,目前国内体验比较好的源有阿里云、腾讯云、华为云、163等,我们这边已配置阿里云的为例给大家说明。

1.备份原始yum配置

cd /etc/yum.repos.d mkdir backup mv ./Centos* ./backup/. touch base.repo

2.下载阿里云开源yum专用配置

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

3.清空并重建yum缓存

yum clean all yum makecache yum list

配置epel源:

epel源内包含很多第三方软件,配置完epel后相当于给服务器增加了一个第三方的软件安装源;非常适合运维工作时使用。

1.安装yum install -y epel-release

yum install -y yum install -y epel-release

2.备份原始配置

mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup

3.下载阿里云epel配置

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

4.清空并重建缓存

yum clean all yum makecache yum list

转载请注明:小猪云服务器租用推荐 » 超全centos7安装源配置教程,本地、阿里云yum源,epel源安装配置