Step-by-step guide:
I will now describe the simple steps that you need to take to create and then manage the service with systemctl:
- Create the service file that will tell systemd how to manage our gophish service. We create the file by opening up a new file with the text editor of your choice
sudo vim /etc/systemd/system/gophish.service - Now it’s time to enter the following text into the new file and then save it, replace WorkingDirectory and ExecStart with the location where you installed gophish:
[Unit]
Description=gophish-service
[Service]
Type=simple
WorkingDirectory=/opt/gophish/
ExecStart=/opt/gophish/gophish
[Install]
WantedBy=multi-user.target - Now you want to reload the systemd manager configuration
sudo systemctl daemon-reload - Now we are ready to start the service and then make sure that the service is started:
sudo systemctl start gophish
sudo systemctl status gophish - Now the service is running. If you want to stop the service you can simply just run:
sudo systemctl stop gophish - If you want to start the service automatically after each reboot of the machine you run:
sudo systemctl enable gophish