Background:
I wrote this documentation as the process serves as a good template for downloading, compiling from source, installing, configuring, and finally creating a systemd style script that will start a service at boot.
Process:
Download source from their website: http://www.ptokax.org/files/0.5.2.1-nix-src.tgz
wget http://www.ptokax.org/files/0.5.2.1-nix-src.tgz
Install the dependencies:
sudo apt install make g++ zlib1g-dev libtinyxml-dev liblua5.3-dev -y
Expand the archive and change into the directory:
tar -xf 0.5.2.1-nix-src.tgz;cd PtokaX
Compile the program (I’m compiling without database support):
make clean make sudo make install
Create a new system user to run the process:
sudo adduser --system --group --no-create-home --disabled-login ptokax
Create the directory in etc for the configuration files:
sudo mkdir /etc/ptokax
Run the initial config and configure according to your tastes, give the ptokax user access.
sudo PtokaX -m -c /etc/ptokax sudo chown ptokax:ptokax -R /etc/ptokax/*
Create a new file in the directory: /lib/systemd/system/ called ptokax.service with the following in it:
[Unit] Description=PtokaX Direct Connect Hub After=network.target #Requires=apache2.service [Service] Type=forking ExecStart=/usr/local/bin/PtokaX -d -c /etc/ptokax User=ptokax Group=ptokax [Install] WantedBy=multi-user.target
Reload, enable and start the process.
sudo systemctl daemon-reload sudo systemctl enable ptokax.service sudo systemctl start ptokax.service
Test the connection:
Final Notes:
If you want to make configuration changes, stop the service first, then either run the Ptokax program as sudo with the -m -c /etc/ptokax flags to configure it, or manually edit it’s configuration files.
Further Reading:
http://wiki.ptokax.org/doku.php?id=guides:debian_bugbuntu
http://patrakov.blogspot.com.au/2011/01/writing-systemd-service-files.html
Great post! Thank you so much for this. You saved me the time I would have spent going through the official manual 🙂
A minor change: you probably want to modify the post to let readers know that the file path to ‘/usr/local/bin/PtokaX’ in ‘/lib/systemd/system/ptokax.service’ should be the location of the extracted tar file. It took a while for me to figure this out, seeing as I had extracted the file to my home directory.
No worries, glad to have helped! It’s been a while since I looked that this: My feeling is that the command ‘sudo make install’ would have copied the binaries and library files (if any) to the right places ,
in this case /usr/local/bin. Or at least that’s what I would have expected it to do! I honestly can’t remember now if I had to copy the compiled program or not :p Thanks for spotting the problem in my instructions! 🙂