Quick Trac installation in openSUSE

    Sooner or later, many are faced with the choice of a bugtracker. At the same time, regardless of the purpose for which it is planned to be used (industrial or personal), I would like to familiarize myself with it before use. After a quick analysis of the results of search engine queries on a question of interest, it becomes clear that one of the systems that cannot be ignored is Trac. But, unfortunately, when studying the installation instructions for this wonderful tool, many have no desire to get to know Trac. I will tell you how to avoid this and get to know (or maybe make friends) with Trac as quickly as possible, and most importantly simply.

    Introduction


    Who needs this?

    This article will cover an example of installing Trac with the integration of the Subversion version control system and the PostgreSQL database management server with a web-based interface that Apache will provide and all this will be installed on the free openSUSE operating system. It is assumed that the reader is generally familiar with why In general, a bug tracker is needed, therefore, neither a review nor comparisons of Trac and related tools will be presented.
    The article may be of interest to everyone, those who are “on the lookout” and who wants to try Trac, as well as to openSUSE users who have already made their choice and want to install it.

    What will be necessary for work

    To work, you will need:
    • Internet access
    • VirtualBox (the author strongly recommends not to conduct experiments on working machines and servers);
    • openSUSE 11.2 installation DVD
    • several hours of free time and the desire to touch the beautiful.

    Installation and setup


    OS installation

    Create a new virtual machine and install openSUSE with your favorite DE (especially severe or undecided environments may choose Text Mode). When installing the OS, you don’t need to make any special settings and just accept the ones that are provided by default. The only requirement is to leave English unchanged when choosing a language.

    Adding Repositories

    Add the necessary repositories:
    sudo zypper ar http://download.opensuse.org/repositories/home:/FunkyM:/scm/openSUSE_11.2 FunkyM
    sudo zypper ar http://download.opensuse.org/repositories/Apache:/Modules/Apache_openSUSE_11.2 Apache
    sudo zypper ar http://download.opensuse.org/repositories/home:/babelworx:/python/openSUSE_11.2 babelworx
    sudo zypper ar http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_11.2 devel
    sudo zypper ar http://download.opensuse.org/repositories/devel:/tools:/scm/openSUSE_11.2/ csm
    They are necessary in order to install: python-genshi, apache2-mod_wsgi, python-babel, python-pygments, trac, respectively, as well as other necessary packages.

    Direct installation

    Let's perform the installation:
    sudo zypper in python python-devel python-xml python-setuptools postgresql-server python-psycopg2 subversion swig apache2 apache2-mod_wsgi apache2-mod_python docutils python-pygments python-pytz sqlite3 subversion-python trac-multirepo trac-server trac
    At this stage, it is highly advisable to make sure that all requested packages will be installed and therefore all repositories have been correctly initialized. With a successful installation, this may look like this:

    image

    Creating a source code repository

    Create an svn repository:
    sudo mkdir -p /srv/svn/repos
    cd /srv/svn/repos
    sudo svnadmin create --fs-type fsfs habrahabr
    Create a file for storing passwords:
    sudo mkdir /srv/svn/user_access
    sudo touch /srv/svn/user_access/habrahabr_passwdfile
    And add two users: admin and user:
    sudo htpasswd2 /srv/svn/user_access/habrahabr_passwdfile admin
    sudo htpasswd2 /srv/svn/user_access/ habrahabr_passwdfile user
    Set the correct permissions on files and directories:
    sudo mkdir -p /srv/svn/repos/abacus/dav
    sudo chown -R wwwrun:www habrahabr/{dav,db,locks}
    sudo chown root:www /srv/svn/user_access/habrahabr_passwdfile
    sudo chmod 640 /srv/svn/user_access/habrahabr_passwdfile

    PostgreSQL setup

    Let's configure DBMS to work with Trac.
    Start the server:
    sudo /sbin/service postgresql start
    Define the database access parameters, for which we open the configuration file for editing:
    sudo vim /var/lib/pgsql/data/pg_hba.conf
    and replace the line:
    host all all 127.0.0.1/32 ident
    with the following:
    host trac trac 127.0.0.1/32 password
    The result should be something like this:

    image

    Then we will log in with the rights of the postgres user: create a new user trac: and the database of the same name: Do not forget to restart the server so that the security settings take effect:
    su
    su postgres


    createuser --pwprompt --encrypted --no-adduser --no-createdb trac

    createdb --encoding=UNICODE --owner=trac trac

    sudo /sbin/service postgresql restart

    Creating a Trac Project

    Let's create the Trac environment:
    sudo trac-admin /srv/trac/habrahabr initenvIn this case, we will answer tricky questions as follows:
    habrahabr
    postgres://trac:secret@127.0.0.1:5432/trac
    svn
    /srv/svn/repos/habrahabr
    If the project was created successfully, you will be informed about this: We will

    image

    set the correct rights to files and directories: We
    sudo chown -R wwwrun /srv/trac/habrahabr
    would like to provide one of the users with an introduction to Trac (we are talking about those users, which were created during the configuration stage of Subversion) administrator rights:
    trac-admin /srv/trac/habrahabr permission add admin TRAC_ADMIN
    Change the cgi-file:
    sudo vim /usr/share/trac/cgi-bin/trac.cgi
    Add two lines between the try and from lines, resulting in the following:
    try:
    import os
    os.environ['TRAC_ENV'] = "/srv/trac/habrahabr"
    from trac.web import cgi_frontend

    Web server setup

    Configure Apache.
    Open the Apache configuration file for editing:
    sudo vim /etc/sysconfig/apache2
    And set the following value for the APACHE_SERVER_FLAGS parameter:
    APACHE_SERVER_FLAGS="TRAC_CGI"
    Open the trac module configuration file for editing:
    sudo vim /etc/apche2/conf.d/trac.conf
    And change the settings in the sectionwe bring it to the following form: The remaining parameters must be left unchanged. As a result, you should get something like the following: Start the web server:
    SetEnv TRAC_ENV "/srv/trac/habrahabr"
    Order allow,deny
    Allow from all
    AuthType Basic
    AuthName "Trac"
    AuthUserFile /srv/svn/user_access/habrahabr_passwdfile
    Require valid-user



    image


    sudo /sbin/service apache2 start

    Using trac


    Now we can, using our favorite web browser, start acquaintance with Trac locally:

    image

    Such a dialog box indicates the configured authentication. And if after entering the name and password you can see approximately the following:

    image

    then the authentication is configured correctly. In addition, you can contact Trac normally remotely, without forgetting to open the corresponding port in Firewall:

    image

    Conclusion


    In conclusion, it is worth noting that, in fact, there is a shorter way to install Trac. You can omit the installation and configuration of Subversion and Apache and use the standalone server to start it:
    tracd --port 8000 /srv/trac/habrahabr
    For access, you will need to go to the address: http: // localhost: 8000.

    Also popular now: