我用谷歌搜索并尝试了很多解决方案,但这个问题仍然发生。
这是我的 yum.conf:
[root@localhost etc]# cat yum.conf
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=True
我尝试重新安装 epel-release:
[root@localhost ~]# dnf update
Last metadata expiration check: 0:01:38 ago on Sat 09 May 2020 01:30:20 AM EDT.
Dependencies resolved.
Nothing to do.
Complete!
[root@localhost ~]# dnf install httpd
Last metadata expiration check: 0:01:45 ago on Sat 09 May 2020 01:30:20 AM EDT.
No match for argument: httpd
Error: Unable to find a match: httpd
[root@localhost ~]# dnf provides httpd
Last metadata expiration check: 0:01:56 ago on Sat 09 May 2020 01:30:20 AM EDT.
Error: No Matches found
[root@localhost ~]# dnf install epel-release
Last metadata expiration check: 0:02:31 ago on Sat 09 May 2020 01:30:20 AM EDT.
Package epel-release-8-8.el8.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
重新启用模块:
[root@localhost ~]# dnf search httpd
Last metadata expiration check: 0:02:45 ago on Sat 09 May 2020 01:30:20 AM EDT.
====================================================================== Name & Summary Matched: httpd =======================================================================
libmicrohttpd-doc.noarch : Documentation for libmicrohttpd
libmicrohttpd-devel.i686 : Development files for libmicrohttpd
libmicrohttpd-devel.x86_64 : Development files for libmicrohttpd
lighttpd-filesystem.noarch : The basic directory layout for lighttpd
centos-logos-httpd.noarch : CentOS-related icons and pictures used by httpd
lighttpd-mod_authn_pam.x86_64 : Authentication module for lighttpd that uses PAM
lighttpd-mod_authn_gssapi.x86_64 : Authentication module for lighttpd that uses GSSAPI
keycloak-httpd-client-install.noarch : Tools to configure Apache HTTPD as Keycloak client
lighttpd-mod_mysql_vhost.x86_64 : Virtual host module for lighttpd that uses a MySQL database
lighttpd-fastcgi.x86_64 : FastCGI module and spawning helper for lighttpd and PHP configuration
lighttpd-mod_authn_mysql.x86_64 : Authentication module for lighttpd that uses a MySQL database
python3-keycloak-httpd-client-install.noarch : Tools to configure Apache HTTPD as Keycloak client
=========================================================================== Name Matched: httpd ============================================================================
lighttpd.x86_64 : Lightning fast webserver with light system requirements
httpd-devel.x86_64 : Development interfaces for the Apache HTTP server
httpd-tools.x86_64 : Tools for use with the Apache HTTP Server
httpd-manual.noarch : Documentation for the Apache HTTP server
libmicrohttpd.i686 : Lightweight library for embedding a webserver in applications
libmicrohttpd.x86_64 : Lightweight library for embedding a webserver in applications
sysusage-httpd.noarch : Apache configuration for sysusage
httpd-filesystem.noarch : The basic directory layout for the Apache HTTP server
httpd-filesystem.noarch : The basic directory layout for the Apache HTTP server
========================================================================== Summary Matched: httpd ==========================================================================
mod_dav_svn.x86_64 : Apache httpd module for Subversion server
mod_auth_mellon.x86_64 : A SAML 2.0 authentication module for the Apache Httpd Server
[root@localhost ~]# dnf module list --enabled
Last metadata expiration check: 0:03:42 ago on Sat 09 May 2020 01:30:20 AM EDT.
CentOS-8 - AppStream
Name Stream Profiles Summary
go-toolset rhel8 [d][e] common [d] Go
httpd 2.4 [d][e] common [d], devel, minimal Apache HTTP Server
mariadb 10.3 [d][e] client, server [d], galera MariaDB Module
mysql 8.0 [d][e] client, server [d] MySQL Module
perl-DBD-MySQL 4.046 [d][e] common [d] A MySQL interface for Perl
perl-DBI 1.641 [d][e] common [d] A database access API for Perl
python27 2.7 [d][e] common [d] Python programming language, version 2.7
python36 3.6 [d][e] common [d], build Python programming language, version 3.6
satellite-5-client 1.0 [d][e] common [d], gui Red Hat Satellite 5 client packages
Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-7.4 [e] common [d] [i], devel, minimal PHP scripting language
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[root@localhost ~]# dnf module disable httpd
Last metadata expiration check: 0:04:00 ago on Sat 09 May 2020 01:30:20 AM EDT.
Dependencies resolved.
============================================================================================================================================================================
Package Architecture Version Repository Size
============================================================================================================================================================================
Disabling modules:
httpd
Transaction Summary
============================================================================================================================================================================
Is this ok [y/N]: y
Complete!
[root@localhost ~]# dnf module enable httpd:2.4/common
Last metadata expiration check: 0:04:19 ago on Sat 09 May 2020 01:30:20 AM EDT.
Ignoring unnecessary profile: 'httpd/common'
Dependencies resolved.
============================================================================================================================================================================
Package Architecture Version Repository Size
============================================================================================================================================================================
Enabling module streams:
httpd 2.4
Transaction Summary
============================================================================================================================================================================
Is this ok [y/N]: y
Complete!
[root@localhost ~]# dnf module list
CentOS-8 - AppStream 3.6 kB/s | 4.3 kB 00:01
CentOS-8 - Base 6.0 kB/s | 3.9 kB 00:00
CentOS-8 - Extras 441 B/s | 1.5 kB 00:03
CentOS-8 - PowerTools 1.9 kB/s | 4.3 kB 00:02
Extra Packages for Enterprise Linux Modular 8 - x86_64 9.5 kB/s | 9.4 kB 00:00
Extra Packages for Enterprise Linux 8 - x86_64 6.1 kB/s | 9.0 kB 00:01
Node.js Packages for Enterprise Linux 8 - x86_64 9.6 kB/s | 2.5 kB 00:00
Remi's Modular repository for Enterprise Linux 8 - x86_64 417 B/s | 3.5 kB 00:08
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64 2.5 kB/s | 3.0 kB 00:01
CentOS-8 - AppStream
Name Stream Profiles Summary
389-ds 1.4 389 Directory Server (base)
ant 1.10 [d] common [d] Java build tool
container-tools rhel8 [d] common [d] Common tools and dependencies for container runtimes
container-tools 1.0 common [d] Common tools and dependencies for container runtimes
freeradius 3.0 [d] server [d] High-performance and highly configurable free RADIUS server
gimp 2.8 [d] common [d], devel gimp module
go-toolset rhel8 [d][e] common [d] Go
httpd 2.4 [d][e] common [d], devel, minimal Apache HTTP Server
idm DL1 common [d], adtrust, client, dns, server The Red Hat Enterprise Linux Identity Management system module
idm client [d] common [d] RHEL IdM long term support client module
inkscape 0.92.3 [d] common [d] Vector-based drawing program using SVG
javapackages-runtime 201801 [d] common [d] Basic runtime utilities to support Java applications
jmc rhel8 common, core Java Mission Control is a profiling and diagnostics tool for the Hotspot JVM
libselinux-python 2.8 common Python 2 bindings for libselinux
llvm-toolset rhel8 [d] common [d] LLVM
mailman 2.1 [d] common [d] Electronic mail discussion and e-newsletter lists managing software
mariadb 10.3 [d][e] client, server [d], galera MariaDB Module
maven 3.5 [d] common [d] Java project management and project comprehension tool
mercurial 4.8 [d] common [d] Mercurial -- a distributed SCM
mod_auth_openidc 2.3 Apache module suporting OpenID Connect authentication
mysql 8.0 [d][e] client, server [d] MySQL Module
nginx 1.14 [d] common [d] nginx webserver
nginx 1.16 common nginx webserver
nodejs 10 [d][x] common [d], development, minimal, s2i Javascript runtime
nodejs 12 [x] common, development, minimal, s2i Javascript runtime
parfait 0.5 common Parfait Module
perl 5.24 common [d], minimal Practical Extraction and Report Language
perl 5.26 [d] common [d], minimal Practical Extraction and Report Language
perl-App-cpanminus 1.7044 [d] common [d] Get, unpack, build and install CPAN modules
perl-DBD-MySQL 4.046 [d][e] common [d] A MySQL interface for Perl
perl-DBD-Pg 3.7 [d] common [d] A PostgreSQL interface for Perl
perl-DBD-SQLite 1.58 [d] common [d] SQLite DBI driver
perl-DBI 1.641 [d][e] common [d] A database access API for Perl
perl-FCGI 0.78 [d] common [d] FastCGI Perl bindings
perl-YAML 1.24 [d] common [d] Perl parser for YAML
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common, devel, minimal PHP scripting language
pki-core 10.6 PKI Core module for PKI 10.6 or later
pki-deps 10.6 PKI Dependencies module for PKI 10.6 or later
postgresql 9.6 client, server [d] PostgreSQL server and client module
postgresql 10 [d] client, server [d] PostgreSQL server and client module
postgresql 12 client, server PostgreSQL server and client module
python27 2.7 [d][e] common [d] Python programming language, version 2.7
python36 3.6 [d][e] common [d], build Python programming language, version 3.6
redis 5 [d] common [d] Redis persistent key-value database
rhn-tools 1.0 [d] common [d] Red Hat Satellite 5 tools for RHEL
ruby 2.5 [d] common [d] An interpreter of object-oriented scripting language
ruby 2.6 common An interpreter of object-oriented scripting language
rust-toolset rhel8 [d] common [d] Rust
satellite-5-client 1.0 [d][e] common [d], gui Red Hat Satellite 5 client packages
scala 2.10 [d] common [d] A hybrid functional/object-oriented language for the JVM
squid 4 [d] common [d] Squid - Optimising Web Delivery
subversion 1.10 [d] common [d], server Apache Subversion
swig 3.0 [d] common [d], complete Connects C/C++/Objective C to some high-level programming languages
varnish 6 [d] common [d] Varnish HTTP cache
virt rhel [d] common [d] Virtualization module
CentOS-8 - PowerTools
Name Stream Profiles Summary
javapackages-tools 201801 common Tools and macros for Java packaging support
mariadb-devel 10.3 MariaDB Module
virt-devel rhel Virtualization module
Extra Packages for Enterprise Linux Modular 8 - x86_64
Name Stream Profiles Summary
389-directory-server stable minimal, legacy, default [d] 389 Directory Server
389-directory-server testing minimal, legacy, default [d] 389 Directory Server
avocado latest minimal, default Framework with tools and libraries for Automated Testing
cobbler 3 default [d] Versatile Linux deployment server
libuv epel8-buildroot devel [d] libuv-devel for EPEL 8
nginx mainline common nginx webserver
nodejs 12 [x] development, minimal, default Javascript runtime
nodejs 13 [x] development, minimal, default Javascript runtime
Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
glpi 9.3 common [d] Free IT asset management software
glpi 9.4 [d] common [d] Free IT asset management software
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 [e] common [d] [i], devel, minimal PHP scripting language
redis remi-5.0 common [d] Redis persistent key-value database
redis remi-6.0 common [d] Redis persistent key-value database
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[root@localhost ~]# dnf install @httpd:2.4/common
Last metadata expiration check: 0:04:35 ago on Sat 09 May 2020 01:30:20 AM EDT.
Unable to resolve argument httpd:2.4/common
No match for package httpd
Error: Unable to find a match
社区回购遇到同样的问题:
[root@localhost ~]# vim /etc/yum.repos.d/nginx.repo
[root@localhost ~]# cat /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[root@localhost ~]# yum-config-manager --enable nginx-mainline
[root@localhost ~]# yum install nginx
CentOS-8 - AppStream 7.7 kB/s | 4.3 kB 00:00
CentOS-8 - Base 4.6 kB/s | 3.9 kB 00:00
CentOS-8 - Extras 1.6 kB/s | 1.5 kB 00:00
Extra Packages for Enterprise Linux Modular 8 - x86_64 2.7 kB/s | 8.7 kB 00:03
Extra Packages for Enterprise Linux 8 - x86_64 17 kB/s | 7.4 kB 00:00
nginx stable repo 485 B/s | 15 kB 00:31
nginx mainline repo 4.8 kB/s | 38 kB 00:07
No match for argument: nginx
Error: Unable to find a match: nginx
有一些我的仓库配置文件:
[root@localhost yum.repos.d]# ls
CentOS-AppStream.repo CentOS-Debuginfo.repo CentOS-HA.repo CentOS-Vault.repo epel-testing-modular.repo remi.repo
CentOS-Base.repo CentOS-Devel.repo CentOS-Media.repo epel-modular.repo epel-testing.repo remi-safe.repo
CentOS-centosplus.repo CentOS-Extras.repo CentOS-PowerTools.repo epel-playground.repo nodesource-el8.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo epel.repo remi-modular.repo
[root@localhost yum.repos.d]# cat CentOS-AppStream.repo
# CentOS-AppStream.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[AppStream]
name=CentOS-$releasever - AppStream
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[root@localhost yum.repos.d]# cat CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[BaseOS]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
一些细节。一些细节。一些细节。一些细节。一些细节。一些细节。一些细节。一些细节。一些细节。一些细节。一些细节。一些细节。一些细节。
您可以找到以下对安装 Nginx Web 服务器有用的信息。但是,Nginx 在 CentOS 8 默认存储库中不可用。因此,请按照以下步骤操作。请告诉我它是否适合您。
第1步:安装EPEL存储库
您必须在服务器上安装
EPEL
(Enterprise Linux 的额外软件包)存储库。它是一个免费的存储库,允许您连接许多其他开源软件包。使用以下命令安装EPEL
。
sudo dnf install epel-release
按
y
接受安装确认并按Enter
键。
完成 EPEL 安装后,运行以下命令查看可用的 Nginx 版本。
dnf module list nginx
第2步:启用最新的Nginx Web服务器模块
之后,您必须启用最新的Nginx模块。换句话说,你必须告诉 dnf 命令安装最新版本。因此,请使用以下命令来实现此目的。
例如,
Nginx
目前的可用版本位于 EPEL 存储库1.8
中。
sudo dnf module enable nginx:1.18
第3步:安装Nginx网络服务器
所以,我们已经安装了 EPEL 存储库。这样我们就可以直接使用dnf命令来安装了。使用以下命令安装最新版本的 Nginx。
sudo dnf -y install nginx
第四步:启动并启用Nginx服务守护进程
使用下面的命令,这将立即启动该服务,并且还会在启动时启用该服务。
sudo systemctl enable --now nginx
第五步:检查Nginx服务状态
sudo systemctl status nginx
第 6 步:配置防火墙以允许 Nginx 流量
您可以运行以下命令在防火墙中永久添加HTTP和https服务。
sudo firewall-cmd --permanent --add-service http
sudo firewall-cmd --permanent --add-service https
允许服务后,我们需要重新加载防火墙服务守护进程。
sudo firewall-cmd --reload
第7步:检查Nginx网络服务器
现在,您可以通过从 Web 浏览器访问服务器的公共 IP 或域名来测试您的 Nginx Web 服务器是否已启动并运行。
http://域名或IP
例如,如果服务器的IP地址是192.168.43.164。所以,链接看起来像
http://192.168.43.164
这就是 NGINX Web 服务器安装的内容。
但是,如果您想了解一些额外的细节,那么您可以在我的博客上找到完整的示例:
希望对你有帮助。
我正在尝试使用 Yum 安装 Nginx。
Nginx的安装说明可以在NGINX官网的下载部分找到。
sudo vi /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1
在中间,您需要更改“OS”和“OSRELEASE”项以适合您的操作系统。 我安装的是CentOS 7.0,所以我设置如下。
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
下一步
sudo yum install -y nginx
在防火墙中打开Web服务器端口。
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
运行 Nginx 并将其更改为在启动时自动启动。
systemctl start nginx
systemctl enable nginx
来源:http://blog.tjsrms.me/centos-7-nginx-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0/
这个问题困扰了我一天。 我尝试了以上所有方法,但都不起作用。 最后,我找到了解决方案: 你只需要找到你的yum.conf配置文件,比如/etc目录下的My配置文件:
vim /etc/yum.conf
注释掉文件中的这一行
# exclude=httpd nginx php mysql mairadb python-psutil python2-psutil
保存并退出。 再次运行:
dnf install -y nginx
nginx这次安装成功了