No package httpd available, when installing Apache in CentOS


Hello guys, in this tutorial I’ll show you how to fix the issue ‘No package httpd available’, Apache is included in default centOS  repository but if your image is customized there are chances server administrators have blocked you from updating or installing httpd service. In this wiki I’ll show you how you can unblock yourself and install httpd service yourself.

Prerequisite to install httpd service

  1. root Access
  2. Text editor of your choice (nano or vi/vim)
  3. Linux VM


Error with httpd installation

login to your VM with root or su/sudo yourself to install apache/httpd service with following command :

yum install httpd

and the error will look similar to :

Loaded plugins: fastestmirror, universal-hooks
Loading mirror speeds from cached hostfile
* EA4:
* cpanel-plugins:
* base:
* extras:
* updates:
No package httpd available.
Error: Nothing to do
[[email protected] etc]#


Video tutorial to fix httpd issue


Possible solutions to fix ‘No package httpd available’

Solution 1 :

Check centOS base repo for missing or broken links, sometimes this repo file has missing mirror list. Following is the command to print centOS base repo config file

cat /etc/yum.repos.d/CentOS-Base.repo

and the result is

[[email protected] home]# cat /etc/yum.repos.d/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.

name=CentOS-$releasever – Base

#released updates
name=CentOS-$releasever – Updates

#additional packages that may be useful
name=CentOS-$releasever – Extras

#additional packages that extend functionality of existing packages
name=CentOS-$releasever – Plus


seems all the links are okay and this can’t be the possible solution in our case.


Solution 2 :

check yum conifg itself to see, if system administrator has blocked httpd service, following is the command

cat /etc/yum.conf


exclude=bind-chroot courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* nsd* p0f php* pr
oftpd* pure-ftpd* spamassassin*

# This is the default, if you make this bigger yum won’t see if the metadata
# is newer on the remote and so you’ll “gain” the bandwidth of not having to
# download the new metadata and “pay” for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don’t keep old packages around. If you don’t like this checking
# interupting your command line usage, it’s much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d


there we go, httpd* is included in exclude list of main repo files, you need to remove from exclude list using your favorite text editor and save file

vim /etc/yum.conf
#Remove httpd* from the exclude list

in my case, my exclude should look similar to
exclude=bind-chroot courier* dovecot* exim* filesystem mod_ssl* mydns* nsd* p0f php* proftpd* pure-ftpd* spamassassin*

now, when you try to install httpd, centOS should find files from the repo

[[email protected] home]# yum install httpd
Loaded plugins: fastestmirror, universal-hooks
Loading mirror speeds from cached hostfile
* EA4:
* cpanel-plugins:
* base:
* extras:
* updates:
EA4 | 2.9 kB 00:00:00
cpanel-plugins | 2.9 kB 00:00:00
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
mysql-connectors-community | 2.6 kB 00:00:00
mysql-tools-community | 2.6 kB 00:00:00
mysql57-community | 2.6 kB 00:00:00
updates | 2.9 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-97.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-97.el7.centos for package: httpd-2.4.6-97.el7.c
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-97.el7.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved
Package Arch Version Repository Size
httpd x86_64 2.4.6-97.el7.centos updates 2.7 M
Installing for dependencies:
httpd-tools x86_64 2.4.6-97.el7.centos updates 93 k
Transaction Summary
Install 1 Package (+1 Dependent package)
Total download size: 2.8 M
Installed size: 9.5 M
Is this ok [y/d/N]: y

This should address the httpd issue, hope you guys like the tutorial 🙂


Leave a comment