On Red Hat-based systems (like RHEL, CentOS, or Fedora), you can install packages as a non-root user in a few ways, depending on your permissions and the package format. Here are the most common methods:
dnf or yum with --user (for RPM packages)If you have sudo privileges, you can install RPM packages system-wide, but if you want to install packages only for your user, you can use:
bashdnf install --user <package-name>
or
bashyum install --user <package-name>
This installs the package in your user's ~/.local directory.
pip (for Python packages)If the package is a Python package, you can install it locally for your user with:
bashpip install --user <package-name>
This installs the package in ~/.local/lib/pythonX.Y/site-packages/.
cargo (for Rust packages)For Rust packages, use:
bashcargo install --path <package-name>
This installs binaries in ~/.cargo/bin/.
npm (for Node.js packages)For Node.js packages, use:
bashnpm install -g --prefix=$HOME/.local <package-name>
This installs the package in ~/.local/lib/node_modules/.
conda (for Anaconda/Miniconda packages)If you use Conda, you can create a local environment and install packages there:
bashconda create --name myenv conda activate myenv conda install <package-name>
flatpak (for Flatpak packages)If Flatpak is installed, you can install packages as a non-root user:
bashflatpak install --user <package-name>
This installs the package in ~/.local/share/flatpak/.
If you have an RPM file and want to install it locally, you can use:
bashrpm2cpio <package>.rpm | cpio -idmv
This extracts the files to your current directory. You can then manually place them in ~/.local/.
appimage or snap (if supported).AppImage file, make it executable, and run it.bashsnap install --classic <package-name>
~/.local/bin is in your PATH to run locally installed binaries.sudo; user installations are limited to your account.Le Chat can make mistakes. Check answers. Learn more