I've been postponing this for a long time. Every time I would have to configure an Ubuntu box as a Trac server, I would start gathering documentation again, reminding myself that I should just write the steps down so that I wouldn't need to look for them next time. Well, this time I finally did it.Basic Server Installation- Install Ubuntu Server (include the LAMP server option).
- Comment out CD-ROM from the apt sources file (/etc/apt/sources.list)
- sudo apt-get update; sudo apt-get upgrade
- sudo apt-get install openssh-server
- Log off locally and log on remotely via SSH.
Configure text editor (optional)Since we are about to start installing & configuring our server software, make sure your favourite text editor is installed:
- a. sudo apt-get install vim; vi ~/.vimrc
- b. sudo apt-get install emacs; ...
- c. ??? -- use your preferred editor
Install packages- sudo apt-get install ssl-cert subversion trac buildbot libapache2-svn libapache-mod-dav apache2 libapache2-mod-python libapache2-mod-python-doc
Configure ApacheEnable SSL:- sudo a2enmod ssl
- sudo sh -c "echo 'Listen 443' >> /etc/apache2/ports.conf"
Generate Certificate:- sudo apt-get install ssl-cert
- sudo mkdir /etc/apache2/ssl
- sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
Create Virtual Host:sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/$SITENAME
sudo vim /etc/apache2/sites-available/$SITENAME
Change:
NameVirtualHost *:443
add:
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM
Enable the site:- sudo a2ensite $SITENAME
- sudo /etc/init.d/apache2 restart
Add basic authentication.
For first user:
sudo htpasswd -c -m /etc/apache2/dav_svn.passwd $AUTH_USER
for rest of users:
sudo htpasswd -m /etc/apache2/dav_svn.passwd $AUTH_USER2
Enable and configure WebDAV and SVN:Add to /etc/apache2/mods-available/dav_svn.conf:
DAV svn
SVNParentPath /var/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
SSLRequireSSL
Restart Apache- sudo /etc/init.d/apache2 restart
Configure Subversion
Add repositories:
- sudo mkdir /var/svn
- sudo svnadmin create /var/svn/$REPOS
- sudo chown -R www-data:www-data /var/svn/$REPOS
- sudo chmod -R g+ws /var/svn/$REPOS
Test Subversion
Web access:
- lynx https://localhost/svn/$REPOS exposes the repository.
- lynx http://localhost/svn/$REPOS says: eat my shorts , i.e. 403-forbidden.
An initial import:
- svn import --username $AUTH_USER $A_FILE https://localhost/svn/$REPOS/testdir -m “Testing”
… and check-out:
- svn co --username $AUTH_USER https://localhost/svn/$REPOS
Configure Trac
Create the directory:
- sudo mkdir /var/trac
- sudo chown www-data:www-data /var/trac
Enable mod_python:
Put this into /etc/apache2/apache2.conf:
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /var/trac
PythonOption TracUriRoot /trac
AuthType Basic
AuthName "Trac"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
SSLRequireSSL
Restart Apache.- sudo /etc/init.d/apache2 restart
Configure Trac using trac-admin.
Congratulations, you are done!
References
- Installation of Subversion on Ubuntu, with Apache, SSL, and BasicAuth
- Configuring Trac with mod_python
- Ubuntu
- Subversion
- Trac
Labels: apache2, configuration-management, server, ssl, svn, trac, ubuntu