Natvps.id – Libretranslate is who hosts itself Machine Translation API, alternative from Google Translate. Libretranslate can be a free translator application and who hosts itself.
This article discusses the steps to install libretranslate in NAT VPS using a docker, along with the Nginx configuration for Reverse-Proxy. This article uses Ubuntu 22.04 as a reference, but you can use other distributions such as Debian and Centos. Make sure the OS used supports the docker.
Port forwarding configuration
Considering we use grout, we need to add 2 Port Forwarding Configuration on the virtualizor panel (or other VPS panels according to the provider), namely Port Forwarding HTTP and HTTPS For the domain translate libretranslate.
For example, in this article will use a domain translate.tutorial.mdinata.my.id to access libretranslate. You are free to change the domain according to your choice. Record this port and domain, because we will use it again in the deploy process.

Don’t forget to add DNS Records to go to your NAT VPS public IP, like this:

Install Docker
We will use a docker and compile a docker for spread Libretranslate.
First, install curly Using Orders:
apt update && apt install curl -y

Then, run manuscript Automatic installation from the docker by entering:
curl -fsSL get.docker.com | sh
Wait until the installation process is complete.

Install libretranslate
First, create a new folder for libretranslate.
mkdir libretranslate cd libretranslate/

Create a compose docker configuration file:
apt install nano -y # Jika belum nano docker-compose.yml
services:
libretranslate:
container_name: libretranslate
image: libretranslate/libretranslate:latest
ports:
- "5000:5000"
restart: unless-stopped
healthcheck:
test: ['CMD-SHELL', './venv/bin/python scripts/healthcheck.py']
interval: 10s
timeout: 4s
retries: 4
start_period: 5s
environment:
- LT_UPDATE_MODELS=true
- LT_LOAD_ONLY=en,id
volumes:
- libretranslate_models:/home/libretranslate/.local:rw
volumes:
libretranslate_models:

Save the file.
Run the Libretranslate using the command:
docker compose up -d

Wait until the process spread finished.
Deploy can take a few minutes because they have to download all picture from the beginning. Also, running the libretranslate for the first time it can take quite a long time because it has to download the language model for translation.
Nginx Configuration (Reverse Proxy)
So that we can access the URL through a domain like translate.tutorial.mdinata.my.idwe can use Reverse Proxy Like Nginx.
First, install Nginx through the command:
# Hapus Apache2 dan pendukungnya (biasanya terpasang secara bawaan di VPS OpenVZ) apt purge apache2* -y # Install NGINX apt install nginx -y

Create a new host configuration specifically for libretranslate:
nano /etc/nginx/sites-available/libretranslate
Then stick the following configuration:
#
server {
listen 80;
server_name translate.tutorial.mdinata.my.id;
location / {
proxy_pass
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Change translate.tutorial.mdinata.my.id with your domain.

Activate the configuration with:
ln -sf /etc/nginx/sites-available/libretranslate /etc/nginx/sites-enabled/libretranslate # Restart NGINX systemctl restart nginx

Produce SSL certificate (let’s encryption)
So that our domain can be accessed through HTTPS, we need to make a SSL certificate. We can use a free SSL certificate from Let’s Encrypt through Certbot.
Install Certbot and Nginx plugin use the command:
apt install python3-certbot python3-certbot-nginx

So, produce Certificate through Certbot with the command
certbot --nginx -d translate.tutorial.mdinata.my.id
Change translate.tutorial.mdinata.my.id with your domain.

Happy! Your current domain can be accessed via a safe connection https.
Access libretranslate
Libretranslate can be accessed through your previous domain. Example: https://translate.tutorial.mdinata.my.id.


Cover
Thus this article is about the steps to install libretranslate in NAT VPS. If you are confused or doubtful, don’t hesitate to ask questions in the telegram group @ipv6indonesia. Thank You!
Game Center
Game News
Review Film
Rumus Matematika
Anime Batch
Berita Terkini
Berita Terkini
Berita Terkini
Berita Terkini
review anime