How to install htop on CentOS or RHEL

Question: I heard nice things about htop as an alternative to top command. When I tried to install htop with yum package manager on CentOS, I got "No package htop available" error. How can I install htop on CentOS/RHEL?

Htop vs. Top

htop is an ncurses-based real-time process viewer for Linux. While its interface is inspired by venerable top command, htop has several user-friendly features not available in top. For example, htop allows you scroll a process list horizontally or vertically to see full command lines. Also, with htop, you can kill or re-nice one or more processes at once, without entering their PIDs. Compared to top, htop launches faster because htop does not wait to collect data upon launch.

Install htop on CentOS with yum

The pre-built htop package is available from EPEL repository. So you need to enable the repository first. Then use yum command to install it.

$ sudo yum install htop

Compile htop from the Source on CentOS

Another option is to compile and install htop from the source. This option is useful when you want to install the latest version of htop.

Here is how to download the source and install htop from the source.

First, install prerequisites and download the source.

$ sudo yum groupinstall "Development Tools"
$ sudo yum install ncurses-devel
$ wget
$ tar xvfvz htop-1.0.3.tar.gz
$ cd htop-1.0.3

Run the configure script to prepare for compilation.

$ ./configure

By default, htop will be installed under /usr/local/bin. If you want to change installation location to something else (e.g., /usr/bin), run configure script with "--prefix" option instead. For example:

$ ./configure --prefix=/usr

Finally, build and install htop as follows.

$ make
$ sudo make install

After installation, launch htop by entering:

$ htop

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

2 thoughts on “How to install htop on CentOS or RHEL

  1. I got the disable-unicode error but I found out that to configure correctly htop to be installed one needs to use

    ./configure --disable-unicode CFLAGS=-I/home/User/usr/include CPPFLAGS=-I/home/User/usr/include CXXFLAGS=-I/home/User/usr/include LDFLAGS=-L/home/User/usr/lib

    where usr is the local installation directory and User is the username

Leave a comment

Your email address will not be published. Required fields are marked *