How to run LT on Ubuntu 22 as service

I want to use LT internally on my Ubuntu 22 server, so I don`t want to expose it to internet. So, I don’t need any integration with my NGINX server or so. I installed LT as described in READ.ME

pip install libretranslate

Now, I can run it from the command line, where I get message

Running on http://127.0.0.1:5000

which is great. But I need LT to run as a service automatically when the system starts up. Is there a way, how to do it?

You could probably follow this guide to setup a systemd service for LT: https://medium.com/codex/setup-a-python-script-as-a-service-through-systemctl-systemd-f0cc55a42267

I have a script for configuring LibreTranslate for SystemD here:

If you want LibreTranslate to only be available on your local PC you can configure your firewall to block port 5000.

1 Like