Introduction
Install Libretranslate
Requirements
An ubuntu 24.04 server with 4GB memory
Steps
Step 1 - Update Ubuntu, Install Python, Install Libretranslate
Since we have a new instance of Ubuntu, we need to do some updates:
apt-get update;
DEBIAN_FRONTEND='noninteractive' apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade
apt-get install -y vim curl;
apt-get install -y python3 python3-pip
apt-get install -y python3-venv python3-full
python3 -m venv libretranslate-env
source libretranslate-env/bin/activate
pip install libretranslate
Step 2 - Run Libretranslate
libretranslate --disable-web-ui --host 0.0.0.0
Step 3 - Test Translation
url -X POST -H "Content-Type: application/json" -d '{"q":["When a blind man cries", "She is the hero of the story"], "source":"en", "target":"zh-Hant"}' "http://localhost:5000/translate"