Install PeerGuardian on Ubuntu without a GUI (For Servers)
Wednesday, June 8th, 2016Installing PeerGuardian on an Ubuntu Server w/out GUI
Install prereqs:
sudo apt-get install libdbus-1-dev zlib1g-dev iptables libnetfilter-queue-dev libnfnetlink-dev g++
Download and unzip PGL Source:
cd ~/Downloads wget -N "http://downloads.sourceforge.net/project/peerguardian/PeerGuardian%20Linux/2.3.1/pgl-2.3.1.tar.gz" -O "pgl.tar.gz" tar -zxvf pgl.tar.gz cd pgl-2.3.1
For Ubuntu 12.04 and Older:
wget -N "http://downloads.sourceforge.net/project/peerguardian/PeerGuardian%20Linux/2.2.4/pgl-2.2.4.tar.gz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fpeerguardian%2Ffiles%2FPeerGuardian%2520Linux%2F2.2.4%2F&ts=1465430792&use_mirror=heanet" -O pgl.tar.gz tar -zxvf pgl.tar.gz cd pgl-2.2.4
Configure PGL for Non GUI:
./configure --sysconfdir=/etc --localstatedir=/var --without-qt4 --disable-dbus --enable-lowmem --with-lsb=/lib/lsb/init-functions
For Ubuntu 16.04+:
./configure --sysconfdir=/etc --localstatedir=/var --without-qt4 --disable-dbus --enable-lowmem --with-systemd
Install It:
make sudo make install
Set it to start on boot:
sudo update-rc.d pgl defaults
Set it to start on boot for Ubuntu 16.04+:
sudo systemctl enable pgl
Edit the blocklists file with entries from iblocklist.com:
sudo nano /etc/pgl/blocklists.list
Edit the configuration file to whitelist all outgoing connections (adjusting IP network information as needed):
sudo nano /etc/pgl/pglcmd.conf
It should appear similar to:
# pglcmd.conf - configuration file for pglcmd # This file is sourced by a shell script. Any line which starts with a # (hash) # is a comment and is ignored. If you set the same variable several times, # then only the last line will be used.# Refer to pglcmd.defaults (/usr/lib/pgl/pglcmd.defaults) # for the complete set of possible configuration variables with comments.# Do a "pglcmd restart" (sometimes even "reload" is enough) when you have # edited this file.WHITE_TCP_OUT="0:65535" WHITE_UDP_OUT="0:65535" NFQUEUE_NUMBER="60091" WHITE_LOCAL="1" WHITE_IP_IN="1.1.1.1/28" WHITE_IP_OUT="1.1.1.1/28"
Update the lists:
sudo pglcmd update
Restart pglcmd:
sudo pglcmd restart
Restart the service:
sudo service pgl restart
Log Locations:
On an improperly configured installation, it could be in "/usr/local/var/log/pgl/pgld.log"
But usually, it's in "/var/log/pgl/pgld.log"
More Configuration Locations:
Normal: /usr/local/lib/pgl/pglcmd.defaults (pglcmd configuration) and /var/lib/pgl/master_blocklist.p2p (master IP blacklist from remote lists)
Improperly Configured: /usr/local/lib/pgl/pglcmd.defaults (pglcmd configuration) and /usr/local/var/lib/pgl/master_blocklist.p2p (master IP blacklist from remote lists)
Boom, you’re done!