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?
It is possible to do that and get a fully working Midnight Commander without root access. It comes down to the following steps:
- Get a desired version as RPM file.
- 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".
- Set executable rights to files in ~/mc/usr/bin, if they are not set. (use "chmod")
- 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.
- 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").
- 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".
- Now, let's do some copying. Copy contents of ~/mc/etc/mc to ~/mc/usr/share/mc .
- Copy contents of ~/mc/usr/libexec/mc to ~/.local/share/mc .
- Copy file ~/mc/usr/share/mc/syntax/Syntax to ~/.config/mc/mcedit directory.
- 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.