Starting YaCy on boot with systemd

YaCy is a self-hosted web search engine, that can be used to index web pages. It can also be used as an intranet search appliance. For example, it has been used to index content from the 30C3 Conference. An unique feature is that YaCy can be run as a decentralised peer-to-peer network. You can install it on your desktop computer (Windows, Mac, Linux) and make it available to the YaCy network.

Of course, you also can run it on a server. If you are running a Linux server and you want to automatically start YaCy on boot you have to add it to systemd. Most Linux distributions use systemd (or will start using it in the upcoming major release).

You probably do not want to run YaCy as root, so first add a new user. Use --system to create an system account without login:
sudo adduser --system yacy

[Update] Some systems use useradd instead:
sudo useradd --system yacy

Switch to the new user:
su - yacy

Download YaCy from the web site:

Unpack the downloaded file:
tar -xvf yacy_v1.72_20140506_9000.tar.gz

YaCy should now be in:

Of course, you can use a different location if you want.

Be sure Java is already installed on your server. Test if YaCy will start:
cd yacy

If YaCy works correctly, you can add a service file to systemd:

Description=YaCy search server



Type forking is required to run scripts. The systemd path may be different, depending on your distribution.

To test your setup, run:
sudo systemctl status yacy

To start the service on boot, run:
sudo systemctl enable yacy

If you get a message like: Failed to issue method call: Invalid argument
Try: sudo systemctl enable yacy.service

To start YaCy manually, run:
sudo systemctl start yacy

To stop YaCy manually, run:
sudo systemctl stop yacy