How to install man pages on centos?

Note: This applies to Centos 7. If you are looking for a Debian answer, see this question. Those answers will not be duplicated here.

After an install of centos 7, I can’t access man pages :

# man ls
-bash: man: command not found

I tried to install it via yum

# yum install man-pages
... ok

But again:

# man ls
-bash: man: command not found

Why?

Asked By: Rémi B.

||

In order to use the man command, you must also install the man package before or after the man-pages one

# yum install man-pages
... ok
# yum install man
... ok

Now man is installed

# man ls


NAME
      ls - list directory contents

SYNOPSIS
      ls [OPTION]... [FILE]...

DESCRIPTION
      List information about the FILEs (the current directory by default).  Sort entries alphabetically if none of -cftuvSUX nor --sort.

      Mandatory arguments to long options are mandatory for short options too. ...
Answered By: Rémi B.

The syntax on CentOS 7:

# yum install man-pages man-db man

The syntax on CentOS 6:

$ sudo yum install man man-pages

Source

Answered By: simhumileco

I had the same problem in my docker container and solved it by commenting out tsflags=nodocs in the /etc/yum.conf file, then I removed the man-pages and man-db and reinstall them again. It works fine this way.

$ vi /etc/yum.conf

Search for tsflags into the file and add a comment (#) in front of it:

#tsflags=nodocs

Now remove the man-db and the man-pages if it’s already installed on your system:

$ yum remove man-pages man-db

Then install them again:

$ yum install man-pages man-db

Sorted!

Answered By: R. S

As pointed out by R. S, the CentOS official Docker images have manual page installation disabled. This is true also of the Fedora official Docker images.

The easiest way to handle this is via the following sed command, which will work on either system:

sed -i -e '/tsflags=nodocs/s/^/#/' /etc/yum.conf /etc/dnf/dnf.conf || true

This will produce an error message saying it cannot read one of the two files, but whichever one does exist will be updated to comment out the tsflags=nodocs line. The || true at the end ensures that the command returns success regardless of any errors, to avoid halting in scripts.

This can be used in a RUN command in a Dockerfile, in which case you should use it before installing any further packages. For packages you already have installed any manual pages that normally come with them will remain uninstalled and the package will have to be re-installed to bring in the manual pages. Many of the base system’s manual pages (such as ls) are in the man-pages package, but other packages, such as git include their own manual pages and also need to be reinstalled.

Removing and then re-installing packages can create dependency problems. To avoid these instead use:

yum -y reinstall man-pages git
Answered By: cjs

Since Centos 8 is EOL, you might be looking for man pages on RHEL 8

For my RHEL 8.7 docker container, I had to update yum and install man:

yum update -y
yum install man -y

then I could access man pages: man curl

Answered By: northben
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.