I got a RedHat system access with non-root non-sudo rights account. I want to install Midnight Commander (mc) but yum requires root privileges. How can I install mc to my local home without rebuilding it, only using RPM file?

1 Answer 1


It is possible to do that and get a fully working Midnight Commander without root access. It comes down to the following steps:

  1. Get a desired version as RPM file.
  2. Unpack RPM file. Realize that RPM is just a gzip archive, which in turn holds CPIO file, which is another archive. You may find many references online how to do that. Look for "rpm2cpio" command. Search for "Extract files from an RPM package’s cpio archive". So, I assume you can unpack mc-*.rpm and get 2 directories: "etc" and "usr". Put them in a directory under your home directory, like "mc", so you get "~/mc/etc" and "~/mc/usr".
  3. Set executable rights to files in ~/mc/usr/bin, if they are not set. (use "chmod")
  4. If you now run ~/mc/usr/bin/mc, it should work (at least it runs on my RHEL 7.4), but you get warinings about not finding files and it has a limited functionality. But nevertheless, run it once to let it create local directories.
  5. Set an environment variable MC_DATADIR with "export MC_DATADIR=~/mc/usr/share/mc". You should also add it to your .bashrc file. (like "echo text_to_add >> ~/.bashrc").
  6. Add an alias to .bashrc file "alias mc=/home/vladimir.shutow/mc/usr/bin/mc". You may need to apply the changes with "source ~/.bashrc".
  7. Now, let's do some copying. Copy contents of ~/mc/etc/mc to ~/mc/usr/share/mc .
  8. Copy contents of ~/mc/usr/libexec/mc to ~/.local/share/mc .
  9. Copy file ~/mc/usr/share/mc/syntax/Syntax to ~/.config/mc/mcedit directory.
  10. If you want viewer extensions to work properly, set executable rights to all *.sh files in ~/mc/usr/libexec/mc/ext.d directory and edit ~/mc/usr/share/mc/mc.ext file in all lines referencing /usr/libexec/mc/ext.d/*.sh files to point to ~/mc/usr/libexec/mc/ext.d/*.sh instead.

Now, launching "mc" should bring you your Midnight Commander.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .