Installing deb packages locally

2023-07-29

At my university there is a pool of computers running debian. Sometimes I wish to install a certain debian package, which is not installed by default.

Here is how i managed it without having root rights:

if [ -z "$1" ]; then
    echo "You need to supply package name!"
    exit
fi

apt download $1

if [ $? -eq 0 ]; then
    mkdir $1
    mv *.deb $1/$1.deb
    cd $1
else
    exit
fi

ar x $1.deb
tar xf data.tar.xz

chmod +x usr/bin/*

echo "The following binaries have been installed:"
find usr/bin/*
mybins=$(find $HOME/APT/*/usr/bin -type d | tr '\n' ':')
export PATH=$PATH:$mybins

Done! To delete a package, just do rm -rf <packagename> inside the APT/ directory.