Pootle Install Guide for Ubuntu/Debian (Local server)
Because of some difficult dependencies which are āoptionalā because they are difficult to install, but essential for functionality, we are going to use the system python, and install the difficult dependencies using apt-get.
sudo apt-get install python-virtualenv python-lxml python-levenshtein python-lucene
Next we create a virtual environment using virtualenv, which allows accessing system packages:
mkdir ~/pootle
cd ~/pootle
virtualenv --system-site-packages -p /usr/bin/python2.7 env
source ./env/bin/activate
Finally we can install and configure pootle
pip install Pootle==2.5.1.3
pootle init
pootle setup
pootle createsuperuser
It is best to run the above commands individually as they might ask questions. Enter a username and password which pleases you for the createsuperuser step.
Run the server like this:
cd ~/pootle
source ./env/bin/activate
pootle start
Point your browser to http://localhost:8000, you can expect that the first page load will take a long time (~1 minute) as it builds assets and stuff. But if it dumps loads of error messages into the terminal then something went terribly wrong.
If everything went well you can now log in with your admin account.
Running the server automatically
Run the following code in the terminal to create a ādaemonizeā script which can start the server automatically.
echo '#!/bin/bash
HOME='$HOME'
cd $HOME/pootle
source env/bin/activate
pootle start' > daemonize-pootle.sh
chmod +x daemonize-pootle.sh
This script can be added to startup applications so it starts when you log in.
Overall this installation should be adequate for a single user. None of the performance optimizations are installed but this is highly unlikely to matter when only one user is using it.
Upgrade to MySQL
To improve performance, it is recommend to use MySQL, although in places pootle claims to support postgresql, it does not!
The procedure to use MySQL is quite simple.
Save your data (optional)
Assuming you already have pootle set up the way you like it with SQLite, you can save the data in this way:
cd ~/pootle
source env/bin/activate
pootle dumpdata -n > ./data.json
Weāll make use of data.json
after installing and configuring MySQL.
Install MySQL-server
sudo apt-get install mysql-server
I recommend reading and following the instructions here for installing and securing MySQL, especially under the āInitial Setupā section - the rest doesnāt really matter.
Create account and database
First get a MySQL prompt:
mysql -u root -p
Enter the root password you set earlier when prompted.
Now enter the following commands:
CREATE USER pootle IDENTIFIED BY 'pootle';
CREATE DATABASE pootledb CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON pootledb.* TO pootle@localhost IDENTIFIED BY 'pootle';
FLUSH PRIVILEGES;
exit
Configure Pootle
Edit ~/.pootle/pootle.conf
(consider making a backup copy first!), the DATABASES section should look something like this:
# Database backend settings
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
# Database name
'NAME': 'pootledb',
'USER': 'pootle',
'PASSWORD': 'pootle',
'HOST': 'localhost',
'PORT': '3389',
}
}
Now that pootle is configured, restart:
cd ~/pootle
source env/bin/activate
pip install python-mysql
killall shart.sh
Initialize and load the data:
pootle syncdb
pootle migrate
pootle loaddata ./data.json
Loading the data might take several minutes.
Once done, run:
./start.sh
Pootle should now be running the same as before, except backed by MySQL instead of SQLite.