Body
Overview
pkget is a third party script that lets you install Ubuntu/Debian packages into your home directory without root privileges. This is useful in environments like the CAEN Ubuntu VDI pool where users don’t have sudo access.
This guide explains how to set up pkget, how to handle dependencies, and how to configure your environment so installed software runs correctly. An example installation of nmap is provided for demonstration.
1. Setting up pkget
Download and make the script executable:
wget https://raw.githubusercontent.com/0x00009b/pkget/master/pget && chmod +x pget
Keep pget in your home directory (~) for easy access.
2. Installing a package
To install a package (example: nmap):
./pget nmap
Packages and binaries are extracted into:
cd ~/.apt/usr/bin/
cdLibraries are extracted into:
cd ~/.apt/usr/lib/x86_64-linux-gnu/
You can confirm the install with:
find ~/.apt/usr/bin -name "<package-name>"
3. Running the package
You may need to run it with the full path at first, for example:
~/.apt/usr/bin/nmap --version
4. Handling missing libraries
Sometimes, installed packages depend on additional libraries not included by default. To check for missing dependencies:
ldd ~/.apt/usr/bin/<package-name> | grep "not found"
For each missing library, install the corresponding package with pget. An example for nmap is:
./pget liblinear4
./pget liblua5.3-lpeg2
This places the required .so files in:
~/.apt/usr/lib/x86_64-linux-gnu/
5. Configuring your environment
To ensure executables and libraries are found automatically, update your shell configuration.
Add the following to your ~/.bashrc:
export PATH=$HOME/.apt/usr/bin:$PATH
export LD_LIBRARY_PATH=$HOME/.apt/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
Reload the configuration:
source ~/.bashrc
Now you can run installed software normally:
nmap --version
6. Example Tested: nmap
As a test case, nmap was installed using pkget.
- Issues encountered:
- Missing liblinear.so.4 and liblua5.3-lpeg.so.2 libraries.
- Dynamic linker didn’t know where to find user-installed libraries.
- Solutions:
- Installed dependencies using pkget.
- Updated LD_LIBRARY_PATH to include ~/.apt/usr/lib/x86_64-linux-gnu/.
- Result:
- nmap runs successfully from the home directory without root privileges.