Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

可能是目前最详细简明的CentOS7安装与管理教程(5):添加常用 yum 源(软件包) #7

Open
gaoac opened this issue Apr 6, 2020 · 0 comments
Labels
Linux linux服务器知识

Comments

@gaoac
Copy link
Owner

gaoac commented Apr 6, 2020

linux 下软件安装方式有很多,比如 RMP、YUM、源代码安装等。其中 CentOS 内置的 yum 命令安装非常的简单实用,能自动帮助我们解决依赖,在此推荐 yum 方式安装软件应用,但 CentOS 最小化安装后,内置的 yum 源可用的软件偏少或者版本过低,通常我们需要使用一些第三方的 yum 源,这里向大家推荐两个比较常用和权威的 yum 源,EPEL 和 REMI。

EPEL

EPEL 是 Extra Packages for Enterprise Linux 的缩写(EPEL),是用于 Fedora-based Red Hat Enterprise Linux (RHEL) 的一个高质量软件源,所以同时也适用于 CentOS 或者 Scientific Linux 等发行版。

REMI

Remi repository 是包含最新版本 PHP 和 MySQL 包的 Linux 源,由 Remi 提供维护。有个这个源之后,使用 YUM 安装或更新 PHP、MySQL、phpMyAdmin 等服务器相关程序的时候就非常方便了。

首先查看目前系统中已存在的 yum 源:yum repolist

image

可以看到目前系统 yum 源有三个,接下来我们开始添加新的 yum 源。

由于现在安装 REMI 源的时候会自动安装 EPEL 作为依赖包。所以我们只需要直接安装 REMI 即可:yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

image

然后确认,安装完毕

image

再次查看yum repolist

image

可以看到,我们已经多出了两个 yum 源(后续可继续增加其他源,这里就不再补充了)。

可在cd /etc/yum.repos.d 中查看对应 repo 文件。

接下来在安装软件之前,我们先来熟悉下 yum 常用命令:

yum repolist all: 显示所有仓库

yum repolist 或 yum repolist enabled: 显示可用仓库

yum repolist disabled:显示禁用仓库

yum list 或 yum list all:显示所有的程序包

yum list available:显示可安装的程序包

yum list updates:显示可更新程序包

yum list installed:显示已安装程序包

yum list recent: 显示最近新增的程序包

yum search xxx:搜索 xxx 程序包

yum install xxx :安装 xxx 程序包

yum update xxx :升级 xxx 程序包

yum remove xxx 或 yum erase xxx:卸载 xxx 程序包

yum info xxx:查看程序包 xxx 信息

yum deplist xxx:查看程序包 xxx 依赖

yum clean all :清理本地缓存

yum clean plugins :清除插件缓存

yum makecache:构建缓存

yum history:查看 yum 事务历史

我们先执行命令:yum makecache 把服务器的包信息下载到本地电脑缓存起来,以提高搜索 、安装软件的速度,如图:

image

@gaoac gaoac added the Linux linux服务器知识 label Apr 6, 2020
@gaoac gaoac changed the title 可能是目前最详细简明的CentOS7安装与管理教程(6):添加常用 yum 源(软件包) 可能是目前最详细简明的CentOS7安装与管理教程(5):添加常用 yum 源(软件包) Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linux linux服务器知识
Projects
None yet
Development

No branches or pull requests

1 participant