Mostly just posting this for my own reference, but you may find it handy.
If you want to install ‘htop’ (a very good Linux process viewer) onto a server running CentOS (in my case also running WHM and cPanel), you may run into some errors.
Firstly, you need to make sure you have the DAG RPM Repository installed.
Create a new file:
[dag] name=Dag RPM Repository for Red Hat Enterprise Linux baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag gpgcheck=1 enabled=1
Then you need to add the GPG key for the repository. Run the following command:
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
Finally, install htop:
yum install htop
It should update the repository, download the software and install it.
Once it’s done, you can run ‘htop’ via the command line. If you’re installing on multiple servers and don’t want to manually reconfigure it every time, you can upload a default settings file.
Create/edit the file /root/.htoprc
Add/replace it with the following (this is my preferred htop configuration):
# Beware! This file is rewritten every time htop exits. # The parser is also very primitive, and not human-friendly. # (I know, it's in the todo list). fields=0 48 17 2 46 47 49 1 sort_key=46 sort_direction=1 hide_threads=0 hide_kernel_threads=1 hide_userland_threads=0 shadow_other_users=0 highlight_base_name=1 highlight_megabytes=1 highlight_threads=0 tree_view=0 header_margin=0 detailed_cpu_time=0 color_scheme=0 delay=15 left_meters=CPU Memory Swap left_meter_modes=1 1 1 right_meters=Tasks LoadAverage Uptime Hostname right_meter_modes=2 2 2 2
Save the file and run htop again (it may delete this file, but it will import the settings).
See this blog post for more useful information and screenshots about htop: