138 lines
2.7 KiB
ReStructuredText
138 lines
2.7 KiB
ReStructuredText
|
==================
|
||
|
translate.libre.is
|
||
|
==================
|
||
|
Natural language translation website.
|
||
|
|
||
|
`<https://translate.libre.is>`_
|
||
|
|
||
|
|
||
|
LibreTranslate
|
||
|
==============
|
||
|
LibreTranslate web translator.
|
||
|
|
||
|
`<https://libretranslate.com>`_
|
||
|
|
||
|
`<https://github.com/LibreTranslate/LibreTranslate>`_
|
||
|
|
||
|
Using user "jebba", change as appropriate.
|
||
|
|
||
|
.. code-block:: sh
|
||
|
|
||
|
sudo apt install python3-venv python-is-python3
|
||
|
mkdir -p /home/jebba/devel/LibreTranslate/server
|
||
|
cd /home/jebba/devel/LibreTranslate/server
|
||
|
python -m venv venv
|
||
|
source venv/bin/activate
|
||
|
pip install -U setuptools pip wheel
|
||
|
# Numpy workaround for closed bug (but not really fixed):
|
||
|
# https://github.com/LibreTranslate/LibreTranslate/issues/638
|
||
|
pip install numpy==1.26.4
|
||
|
pip install libretranslate
|
||
|
|
||
|
|
||
|
Note, the first time it is run, it will download the translation models.
|
||
|
The web URL won't be available until this is complete.
|
||
|
It will download (currently) 8.7 gigs of data.
|
||
|
|
||
|
Files downloaded to here:
|
||
|
|
||
|
~/.local/share/argos-translate/packages
|
||
|
|
||
|
systemd
|
||
|
=======
|
||
|
meh.
|
||
|
|
||
|
Crufty startup script:
|
||
|
|
||
|
systemd service file:
|
||
|
|
||
|
/etc/systemd/system/libretranslate.service
|
||
|
|
||
|
.. code-block:: systemd
|
||
|
|
||
|
[Unit]
|
||
|
Description=LibreTranslate
|
||
|
After=network-online.target
|
||
|
Wants=network-online.target
|
||
|
|
||
|
[Service]
|
||
|
ExecStart=/home/jebba/bin/deepcrayon-libretranslate-start
|
||
|
WorkingDirectory=/tmp
|
||
|
User=jebba
|
||
|
Group=jebba
|
||
|
Restart=no
|
||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||
|
|
||
|
[Install]
|
||
|
WantedBy=multi-user.target
|
||
|
|
||
|
Startup script cruft:
|
||
|
|
||
|
/home/jebba/bin/deepcrayon-libretranslate-start
|
||
|
|
||
|
.. code-block:: sh
|
||
|
|
||
|
#!/bin/bash
|
||
|
|
||
|
cd /home/jebba/devel/LibreTranslate/server
|
||
|
|
||
|
source venv/bin/activate
|
||
|
|
||
|
libretranslate \
|
||
|
--host 0.0.0.0 \
|
||
|
--port 8000 \
|
||
|
--frontend-language-source en \
|
||
|
--frontend-language-target es \
|
||
|
--update-models \
|
||
|
|
||
|
Then:
|
||
|
|
||
|
.. code-block:: sh
|
||
|
|
||
|
chmod +x /home/jebba/devel/LibreTranslate/server
|
||
|
sudo systemctl daemon-reload
|
||
|
sudo systemctl start libretranslate.service
|
||
|
sudo systemctl enable libretranslate.service
|
||
|
|
||
|
The first time it runs it will take awhile to start as it has to
|
||
|
download ~9 gigs of data to
|
||
|
~/.local/share/argos-translate/packages
|
||
|
|
||
|
|
||
|
Apache
|
||
|
======
|
||
|
URL:
|
||
|
|
||
|
`<http://localhost:8000/>`_
|
||
|
|
||
|
or
|
||
|
|
||
|
`<http://192.168.1.1:8000>`_
|
||
|
|
||
|
Set up Apache proxy.
|
||
|
|
||
|
.. code-block:: sh
|
||
|
|
||
|
sudo apt install python3-certbot-apache
|
||
|
sudo certbot -d translate.libre.is
|
||
|
sudo systemctl restart apache2
|
||
|
|
||
|
Set up config with proxy
|
||
|
/etc/apache2/sites-available/translate-libre-is.conf
|
||
|
|
||
|
.. code-block:: apache
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
Then set up and restart apache.
|
||
|
|
||
|
.. code-block:: sh
|
||
|
|
||
|
sudo rm /etc/apache2/sites-enabled/000-default*
|
||
|
sudo ln -s /etc/apache2/sites-available/translate-libre-is.conf \
|
||
|
/etc/apache2/sites-enabled/
|
||
|
sudo a2enmod proxy_http proxy
|
||
|
sudo systemctl restart apache2
|
||
|
|