Skip to content

creating a linux service with systemd

kohlhaas edited this page Aug 9, 2023 · 4 revisions

The following page explains how to setup a rapla service on a linux server. Assumed you logged into your webserver console.

1. Install java jre

For installing rapla under debian or ubuntu

sudo apt-get install default-jre

Type

java -version

to check installation. At least java 1.8 is required

2. Create rapla folder

create folder /opt/rapla with the command

sudo mkdir /opt/rapla

you can change installation folder by just replacing all /opt/rapla occurances in this wiki page with your foldername.

3. Download and unzip rapla

You can do both with the follwing command

sudo wget REPLACE_WITH_DOWNLOAD_LINK_TAR_GZ -O - | sudo tar -xz -C /opt/rapla

4. Check rapla installation

sudo /opt/rapla/raplaserver.sh run

watch rapla start and wait for the following line

INFO  AbstractConnector.doStart o.e.jetty.server.AbstractConnector - Started SelectChannelConnector@0.0.0.0:8051

rapla started a webservice on port 8051. Go to your browser and type

http://your_server_ip_or_domain:8051

the rapla welcome page should appear. You can stop the server anytime with ctrl-c key in the consloe

Congratulation rapla is running. You can now setup rapla as service and securing the installation with the following steps.

5. Change the rapla admin password

login to rapla via the website and change the password.

6. Add rapla user

sudo useradd --user-group --shell /bin/false --home-dir /opt/rapla rapla

7. Secure rapla files

sudo chown -R root:rapla /opt/rapla;sudo chmod -R 750 /opt/rapla;sudo chmod -R 771 /opt/rapla/logs/;sudo chmod -R 770 /opt/rapla/data/;sudo chmod 755 /opt/rapla

8. Create service

sudo vi /etc/systemd/system/rapla.service

[Unit]
Description=Rapla Service
After=network.target

[Service]
WorkingDirectory=/opt/rapla/
User=rapla
ExecStart=/usr/bin/java -cp /opt/rapla/raplabootstrap.jar -Xmx2048M -Duser.language=de -Duser.country=DE -Djava.awt.headless=true -Djetty.home=/opt/rapla org.rapla.bootstrap.RaplaServerLoader
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

9. Install the service

sudo systemctl daemon-reload;sudo systemctl enable rapla.service

10. Start/Stop/Status:

sudo systemctl start rapla
sudo systemctl stop rapla
sudo systemctl restart rapla
sudo systemctl status rapla

Clone this wiki locally