Usando Linux para muchas cosas y disfrutando de videojuegos, en dispositivos moviles, consolas y pc. Using Linux for many things and enjoying video games, mobile devices, consoles and pc

Servidor subversion con interfaz web Trac

Hoy instalaremos y configuraremos un repositorio subversion con trac, una interfaz web que nos facilitara colaborar en nuestros proyectos de programacion con otras personas en un grupo.
Para esto usaremos un debian o ubuntu server

-Instalamos paquetes que usaremos
apt-get install enscript libapache2-mod-python python-docutils db4.3-util libapache2-svn subversion-tools

-Creamos el directorio para subversion
mkdir -p /var/local/svn/svn.example.com

-Creamos un grupo para desarrollo y agregamos el usuario web a este grupo
addgroup example
adduser www-data example

-Agregamos usuarios al grupo de desarrollo. En mi server el grupo tomo el id 1000
adduser --gid 1000 cabrera

-Colocamos permisos
chmod 2770 /var/local/svn/svn.example.com

-Activamos el repositorio
svnadmin create /var/local/svn/svn.example.com

-Eliminamos passwords para despues crearlos para protocolo https o http
rm /var/local/svn/svn.example.com/conf/passwd
touch /var/local/svn/svn.example.com/conf/passwd

-Damos permiso de escritura al grupo
chmod -R g+w /var/local/svn/svn.example.com

-Cambiamos el dueño y grupo de los files
chown -R www-data:example /var/local/svn/svn.example.com

-Activamos permisos para el repositorio. Ejemplo, dale permiso al grupo example de lectura y escritura
vi /var/local/svn/svn.example.com/conf/authz
example = rw

-Creamos un directorio para los logs
mkdir /var/log/apache2/svn.example.com

-Agregamos a la lista de rotacion de logs de apache
vi /etc/logrotate.d/apache2
/var/log/apache2/svn.example.com {
rotate 6
monthly
compress
missingok
notifempty
}

-Configuramos el directorio virtual de apache
vi /etc/apache2/sites-available/svn.example.com

ServerName svn.example.com

DAV svn
AuthType Basic
AuthName "svn.example.com"
AuthUserFile /var/local/svn/svn.example.com/conf/passwd
AuthzSVNAccessFile /var/local/svn/svn.example.com/conf/authz
SVNPath /var/local/svn/svn.example.com
Require valid-user

CustomLog /var/log/apache2/svn.example.com/access.log combined
ErrorLog /var/log/apache2/svn.example.com/error.log
# Descomente la siguiente linea cuando tenga un certificado web real.
# SSLCertificateKeyFile /etc/apache2/ssl/server.key


-Activamos el sitio virtual
a2ensite svn.example.com

-Creamos los usuarios web
htpasswd /var/local/svn/svn.example.com/conf/passwd cabrera

-Reiniciamos apache
/etc/init.d/apache2 restart

-Creamos un link para poder trabajar localmente
ln -s /usr/bin/svnwrap /usr/local/bin/svn

-Creamos el directorio web para trac
mkdir -p /var/local/trac/trac.example.com

-Activamos permisos
chmod 2770 /var/local/trac/trac.example.com

-Descargamos setuptools, en este caso el de python 2.4, si tiene otra version, cambie el file a descargar o verifique desde la pagina de python

wget -c http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c9-py2.4.egg

-Lo instalamos
sh setuptools-0.6c9-py2.4.egg

-Instalamos trac 0.11
easy_install http://svn.edgewall.org/repos/trac/tags/trac-0.11

-Creamos una instancia de trac
trac-admin /var/local/trac/trac.example.com initenv
Creating a new Trac environment at /var/local/trac/trac.hyette.com

Trac will first ask a few questions about your environment
in order to initalize and prepare the project database.

Please enter the name of your project.
This name will be used in page titles and descriptions.

Project Name [My Project]> Cabrera project

Please specify the connection string for the database to use.
By default, a local SQLite database is created in the environment
directory. It is also possible to use an already existing
PostgreSQL database (check the Trac documentation for the exact
connection string syntax).

Database connection string [sqlite:db/trac.db]>

Please specify the type of version control system,
By default, it will be svn.

If you don't want to use Trac with version control integration,
choose the default here and don't specify a repository directory.
in the next question.

Repository type [svn]>

Please specify the absolute path to the version control
repository, or leave it blank to use Trac without a repository.
You can also set the repository location later.

Path to repository [/path/to/repos]> /var/local/svn/svn.example.com

Creating and Initializing Project
Installing default wiki pages
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracFineGrainedPermissions imported from TracFineGrainedPermissions
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracPermissions imported from TracPermissions
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/WikiProcessors imported from WikiProcessors
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracLogging imported from TracLogging
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracWiki imported from TracWiki
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/InterTrac imported from InterTrac
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracBrowser imported from TracBrowser
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/SandBox imported from SandBox
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/InterMapTxt imported from InterMapTxt
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/WikiMacros imported from WikiMacros
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/PageTemplates imported from PageTemplates
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracWorkflow imported from TracWorkflow
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/InterWiki imported from InterWiki
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/CamelCase imported from CamelCase
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracUnicode imported from TracUnicode
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracInstall imported from TracInstall
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracUpgrade imported from TracUpgrade
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracModPython imported from TracModPython
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/WikiRestructuredTextLinks imported from WikiRestructuredTextLinks
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracEnvironment imported from TracEnvironment
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracTickets imported from TracTickets
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracCgi imported from TracCgi
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/WikiPageNames imported from WikiPageNames
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/WikiRestructuredText imported from WikiRestructuredText
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracIni imported from TracIni
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracInterfaceCustomization imported from TracInterfaceCustomization
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracChangeset imported from TracChangeset
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracRoadmap imported from TracRoadmap
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/RecentChanges imported from RecentChanges
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracReports imported from TracReports
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/WikiFormatting imported from WikiFormatting
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TitleIndex imported from TitleIndex
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracQuery imported from TracQuery
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracNotification imported from TracNotification
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracAdmin imported from TracAdmin
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracPlugins imported from TracPlugins
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracAccessibility imported from TracAccessibility
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracGuide imported from TracGuide
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracImport imported from TracImport
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracNavigation imported from TracNavigation
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/WikiHtml imported from WikiHtml
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracStandalone imported from TracStandalone
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/WikiStart imported from WikiStart
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracRevisionLog imported from TracRevisionLog
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracTicketsCustomFields imported from TracTicketsCustomFields
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracLinks imported from TracLinks
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracSyntaxColoring imported from TracSyntaxColoring
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracSearch imported from TracSearch
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracTimeline imported from TracTimeline
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracBackup imported from TracBackup
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracSupport imported from TracSupport
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/WikiNewPage imported from WikiNewPage
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracFastCgi imported from TracFastCgi
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/WikiDeletePage imported from WikiDeletePage
/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/default-pages/TracRss imported from TracRss
Indexing repository

---------------------------------------------------------------------
Project environment for 'Cabrera project' created.

You may now configure the environment by editing the file:

/var/local/trac/trac.hyette.com/conf/trac.ini

If you'd like to take this new project environment for a test drive,
try running the Trac standalone web server `tracd`:

tracd --port 8000 /var/local/trac/trac.example.com

Then point your browser to http://localhost:8000/trac.example.com.
There you can also browse the documentation for your installed
version of Trac, including information on further setup (such as
deploying Trac to a real web server).

The latest documentation can also always be found on the project
website:

http://trac.edgewall.org/

Congratulations!

-Activamos permisos al directorio web de trac
chown -R www-data:example /var/local/trac/trac.example.com

-Damos permisos de escritura al grupo
chmod -R g+w /var/local/trac/trac.example.com

-Configuramos trac
vi /var/local/trac/trac.example.com/conf/trac.ini

-Creamos un directorio para logs de trac
mkdir /var/log/apache2/trac.example.com

-Agregamos el site a la rotacion de logs
vi /etc/logrotate.d/apache2
/var/log/apache2/trac.example.com {
rotate 6
monthly
compress
missingok
notifempty
}

-Configuramos el directorio virtual
vi /etc/apache2/sites-available/trac.example.com

ServerName localhost
DocumentRoot /var/local/trac/trac.example.com/
Alias /trac/ /usr/share/trac/htdocs

Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all


SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonInterpreter main_interpreter
PythonOption TracEnv /var/local/trac/trac.example.com/
PythonOption TracUriRoot /
AuthType Basic
AuthName "trac.example.com"
# Use the SVN password file.
AuthUserFile /var/local/svn/svn.example.com/conf/passwd
Require valid-user

CustomLog /var/log/apache2/trac.example.com/access.log combined
ErrorLog /var/log/apache2/trac.example.com/error.log
# SSLCertificateKeyFile /etc/apache2/ssl/server.key


-Activamos el directorio virtual de trac
a2ensite trac.example.com

-Configuramos los permisos de trac dentro de su consola administrativa
trac-admin /var/local/trac/trac.example.com

-Reiniciamos apache
/etc/init.d/apache2 restart

-Por ultimo, en caso de que no queramos usar apache podemos manejar nuestro web trac con el server que incluye trac
tracd --port 8000 /var/local/trac/trac.example.com

-Tambien tener en cuenta que para que nos funcione en internet esta solucion, los domains usados, en este caso svn.example y trac.example.com deben estar registrados a nuestro nombre y activos y funcionando en un DNS. Share/Bookmark