Sometimes you may work on a remote machine and you don't have sudo permissions to install software you like. If the system administrator cannot add you to the sudoers file due to the strict security policy, then you will need to find a way to install your package. It happened to me on Ubuntu 16.04 with the graphviz package and usual
[johndoe@UbuntuXenial]% sudo apt-get install graphviz
did not work.
The solution here is to create a fake root environment with the whole system directory structure, download your *.deb packages with all dependencies, extract them to the fake root and use the LD_LIBRARY_PATH trick to make the dynamic linker/loader (ld-linux.so) load the packages and allow execution of the program. Inspiration was taken from chroot, Python virtual environment and famous LD_PRELOAD trick.
The first step would be to find all package dependencies. They are available on the Ubuntu 16.04's website: https://launchpad.net/ubuntu/xenial/amd64/graphviz/2.38.0-12ubuntu2
Here is the script which does the installation of graphviz and tests its dot program:
mkdir -p /home/johndoe/tmp
# Download the package and its dependencies
wget -c http://mirrors.edge.kernel.org/ubuntu/pool/main/g/graphviz/graphviz_2.38.0-12ubuntu2_amd64.deb
wget -c http://mirrors.edge.kernel.org/ubuntu/pool/main/g/graphviz/libcdt5_2.38.0-12ubuntu2_amd64.deb
wget -c http://mirrors.edge.kernel.org/ubuntu/pool/main/g/graphviz/libpathplan4_2.38.0-12ubuntu2_amd64.deb
wget -c http://mirrors.edge.kernel.org/ubuntu/pool/main/g/graphviz/libcgraph6_2.38.0-12ubuntu2_amd64.deb
wget -c http://mirrors.edge.kernel.org/ubuntu/pool/main/g/graphviz/libgvc6_2.38.0-12ubuntu2_amd64.deb
wget -c http://mirrors.edge.kernel.org/ubuntu/pool/main/g/graphviz/libgraphviz-dev_2.38.0-12ubuntu2_amd64.deb
# Create a fake root environment
# Extract package files
for File in `ls *.deb`
dpkg -x $File /home/johndoe/env
# Provide a path where executable files are located
# Provide a path for the loader to search for the dynamic libraries so that it can link them at runtime
# Test the executable
# Configure all plugins (PDF, PNG, SVG, etc.)
# Now you can use "dot" to convert your diagrams to image files
Exporting PATH and LD_LIBRARY_PATH environmental variables to the .bashrc file would allow to permanently allow execution of the graphviz's dot program.