Install Ubuntu Server.
Update Ubuntu with the commands:
sudo apt-get update sudo apt-get upgrade
Install pip and virtualenv with the commands:
sudo apt-get install python-pip sudo pip install virtualenv
Install RabbitMQ:
sudo apt-get install rabbitmq-server
Create RabbitMQ user:
sudo rabbitmqctl add_user kallithea kallitheapass sudo rabbitmqctl add_vhost kallitheavhost sudo rabbitmqctl set_permissions -p kallitheavhost kallithea ".*" ".*" ".*"
Install Python sources:
sudo apt-get install python-dev
Create the base directory and temporarily give yourself ownership:
sudo mkdir /opt/kallithea sudo chown `whoami` -R /opt/kallithea
Create the data directory, virtual environment, and install RhodeCode:
virtualenv --no-site-packages /opt/kallithea/venv source /opt/kallithea/venv/bin/activate (venv) pip install pastescript (venv) pip install kallithea
Create directories and the production configuraton:
mkdir /opt/kallithea/repos mkdir /opt/kallithea/data cd /opt/kallithea/data (venv) paster make-config Kallithea production.ini
Edit at least the following settings in production.ini:
[server:main] host = 0.0.0.0 [app:main] use_celery = true broker.vhost = kallitheavhost broker.user = kallithea broker.password = kallitheapass
Generate the Kallithea database and create the initial admin account:
(venv) paster setup-db production.ini
Test the system by starting Celery and Kallithea (access the server via http://127.0.0.1:5000):
(venv) paster celeryd production.ini & (venv) paster serve production.ini
Create a crontab
kallithea
file in /etc/cron.d/ directory. Add this line to the crontab file:6 * * * * /opt/kallithea/venv/bin/paster make-index /opt/kallithea/data/production.ini
Create the user to run the Kallithea daemons and set ownership on the Kallithea directory:
sudo adduser --no-create-home \ --disabled-login \ --disabled-password \ --system --group kallithea sudo chown -R kallithea:kallithea /opt/kallithea
Download the init.d script and modify USER, VENV_DIR, and DATA_DIR as necessary:
wget https://gist.github.com/UnderGreen/bb4800baa48ce7b1340c/raw/130d49685ef4dae44aeaa3d58fd5c5fc0820d5c1/kallithea-init.d.sh vim ./kallithea-init.d.sh
Test the script:
chmod +x ./kallithea-init.d.sh sudo ./kallithea-init.d.sh start ## access Kallithea via web browser sudo ./kallithea-init.d.sh stop ## verify that the Python processes have stopped
Install the script:
sudo cp ./kallithea-init.d.sh /etc/init.d/kallithea cd /etc/init.d sudo update-rc.d kallithea defaults
Test the script once more:
sudo service kallithea start sudo service kallithea stop
Install python-ldap:
sudo apt-get install libldap2-dev libsasl2-dev (venv) pip install python-ldap
Log in to Kallithea as an administrator and open
Settings --> LDAP
. Add the following settings:- Enable LDAP
Checked
- Host
dc.mydomain.local
- Port
389
- Account
<username>
- Password
<password>
- Connection Security
None
- Certificate Checks
DEMAND
- Base DN
CN=People,DC=mydomain,DC=local
- LDAP Filter
<blank>
- LDAP Search Scope
SUBTREE
- Login Attribute
sAMAccountName
- First Name Attribute
givenName
- Last Name Attribute
sn
- E-mail Attribute
mail
Add stable PPA NGINX:
sudo apt-get install python-software-properties apt-add-repository ppa:nginx/stable apt-get update apt-get install nginx
Create SSL keys:
mkdir -p /etc/nginx/ssl cd /etc/nginx/ssl/ sudo openssl genrsa -des3 -out server.key 1024 sudo openssl req -new -key server.key -out server.csr sudo cp server.key server.key.orig sudo openssl rsa -in server.key.orig -out server.key sudo openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt sudo rm server.csr sudo chmod 600 server.crt server.key
Create
/etc/nginx/sites-available/kallithea.conf
withkallithea.conf
from this repository.Create symbolic link to /etc/nginx/sites-enabled directory for file kallithea.conf
ln -s /etc/nginx/sites-available/kallithea.conf /etc/nginx/sites-enabled/
Place
kallithea-proxy.conf
from this repository into/etc/nginx/kallithea-proxy.conf
.Start kallithea and nginx:
sudo service kallithea start sudo service nginx start