Migrating Trac from Hosted Apps

Note: *The Hosted Apps platform was retired on 2014-06-19.

Not Recommended: migrating Trac from Hosted Apps to Project Web

The SourceForge team has evaluated this issue and has determined that the Project web platform is not a viable option a Trac installation.

The rest of this document will remain for users that still want to try this regardless, however SourceForge will not assist with installation or maintenance tasks in accordance with our third party application policy for Project web.


BROKEN as of 2013-12-24

1) Get backup of your Trac database

You will find a backup of your Trac data in your project's (or user's) web directory root. For a project named PROJECT these are:

/home/project-web/PROJECT/p_PROJECT_trac.sql.gz (the database dump)
/home/project-web/PROJECT/p_PROJECT_trac.tar.gz (the web files)

For a user you will have /home/user-web/USER/u_USER_* files instead. You can copy these using rsync/scp/sftp from web.sourceforge.net using your sourceforge username and password.

2) Enable mysql for your project

In classic:

Go to project home page e.g. http://sourceforge.net/projects/paintown

Select Project Admin => Features

Feature Settings page appears with Enabled Features table

In Project Database (MySQL) row, click Manage

MySQL Service page appears. This shows information including

Host name e.g. mysql-p
Database name prefix e.g. p261620_
Database users e.g. p261620ro, p261620rw, p261620admin
In what follows, replace the above with your own host name, name prefix or users

Enter passwords for the three MySQL user accounts, if you have not already done so

Click Set passwords

A green message will appear, "Password data recorded. Changed passwords will be available on the MySQL server in approximately five minutes."

In Allura, these same tools are available at.
Admin -> Tools -> Mysql

Make sure that you’ve set passwords for your various access accounts, and make note of your required database hostname and prefix for the following step.

3) Copy files and get access to shell:

Secure copy files to your SourceForge account

  $ scp paintown_trac_mysqldump.sql sfuser@web.sourceforge.net:
  sfuser@web.sourceforge.net's password:
  paintown_trac_m 100% |*****************************| 2610 KB 00:01

  $ scp paintown_trac_files.tar sfuser@web.sourceforge.net:
  sfuser@web.sourceforge.net's password:
  paintown_trac_f 100% |*****************************| 8540 KB 00:04

Log into the SourceForge secure shell

  $ ssh -t sfuser,paintown@shell.sourceforge.net create
  sfuser,paintown@shell.sourceforge.net's password:

  Requesting a new shell for "sfuser" and waiting for it to start.
  queued... creating... starting...

  This is an interactive shell created for user sfuser,ogsa-dai.
  Use the "timeleft" command to see how much time remains before shutdown.
  Use the "shutdown" command to destroy the shell before the time limit.
  For path information and login help, type "sf-help". 

4) Create database:

Create a database for Trac

Remember to replace mysql-p, p261620admin, p261620_ with your database prefix, database administrator user and database prefix as described in step 2

  $ mysqladmin -h mysql-p -u p261620admin -p create p261620_trac
  Enter password:

Set UTF-8 encoding to created database

  $ echo "ALTER DATABASE p261620_trac DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;" | mysql -h mysql-p -u p261620admin -p p261620_trac
  Enter password:

Load the database dump

  $ mysql -h mysql-p -u p261620admin -p p261620_trac < ~/paintown_trac_mysqldump.sql
  Enter password:

(Alternately, you may use the web interface at https://mysql-t.sourceforge.net. Select the _trac database, select the "import" tab, upload the paintown_trac_mysqldump.sql and import it.)

Clean up

  $ rm ~/paintown_trac_mysqldump.sql

5) Install some Python prerequisites

Install virtualenv:

 $ cd ~
 $ wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.8.2.tar.gz
 $ tar -vzxf virtualenv-1.8.2.tar.gz

 $ mv virtualenv-1.8.2/virtualenv.py . 
 $ rm -r virtualenv-1.8.2
 $ rm virtualenv-1.8.2.tar.gz
 $ python2.6 virtualenv.py --system-site-packages /home/project-web/paintown/venv

New python executable in /home/project-web/paintown/venv/bin/python
Installing setuptools..............................done.
Installing pip.....................done.

Be sure to verify that you're installing the latest version of virtualen.

See Installing Trac without Root Privs for more detail on why you're doing this.

Install other prerequisites:

/home/project-web/paintown/venv/bin/easy_install Pygments

6) Now install Trac

Go to your CGI directory, and install Trac with easy_install

cd /home/project-web/paintown/cgi-bin
/home/project-web/paintown/venv/bin/pip install trac

7) Create your Trac environment

cd /home/project-web/paintown/
tar -xvf ~/paintown_trac_files.tar
mv paintown trac_env

Remove invalid link

rm trac_env/htdocs/ha-css

Clean up

rm ~/paintown_trac_mysqldump.sql

Modify /home/project-web/PROJECTNAME/trac_env/conf/trac.ini and change database connection string. Also see if there's anything in there that you want to tweak.

database = mysql://p261620admin:PASSWORD@mysql-p:3306/p261620_trac

Be sure to replace the bolded variables with your project's mysql information from steps above.

8) Deploy the CGI script

Now, deploy the cgi script.

/home/project-web/paintown/venv/bin/trac-admin /home/project-web/paintown/trac_env deploy /home/project-web/paintown/
chmod +x /home/project-web/paintown/cgi-bin/trac.*

This step may fail due to missing mysql bindings. You can install these bindings via the process described at https://sourceforge.net/p/forge/community-docs/Migrating%20Trac%20from%20Hosted%20Apps/?limit=25&page=3#71f3 until such time as we have these bindings installed.

Trac should now be available at http://paintown.sourceforge.net/cgi-bin/trac.cgi


Community Docs: Hosted Apps Retirement


<< < 1 2 3 4 5 > >> (Page 3 of 5)
  • Mike Jackson
    Mike Jackson

    Here is one way of getting logins working which, if you're desperate, could serve as a stop-gap until a "recommended" solution comes along)

    $ cd /home/project-web/YOUR_PROJECT_NAME/trac_env

    Easy install the TRAC Account Manager plug-in:

    $ /home/project-web/YOUR_PROJECT_NAME/venv/bin/easy_install https://trac-hacks.org/svn/accountmanagerplugin/0.11

    Create an egg cache:

    $ mkdir .egg-cache
    $ chown YOUR_USER_NAME.apache .egg-cache

    Create an htpasswd file with an entry for a user you know has admin priviledges:

    $ htpasswd -c trac.htpasswd KNOWN_ADMIN_USER

    At the prompt enter a desired password:

    New password: 
    Re-type new password: 
    Adding password for user KNOWN_ADMIN_USER

    Give the web server permission to write to required TRAC files:

    $ chmod g+w /home/project-web/admire/trac_env/trac.htpasswd 
    $ chmod g+w .egg-cache
    $ chmod -R g+w conf/

    Update the TRAC configuration to enable the Account Manager plug-in:

    $ emacs trac.ini


    trac.web.auth.LoginModule = disabled
    acct_mgr.web_ui.LoginModule = enabled
    acct_mgr.web_ui.RegistrationModule = disabled
    acct_mgr.htfile.HtPasswdStore = enabled
    password_store = HtPasswdStore
    password_file = /home/project-web/YOUR_PROJECT_NAME/trac_env/trac.htpasswd


    secure_cookies = True


    secure_cookies = False

    Browse to


    Click Login

    A login form should appear so enter your admin user name and password.

    • defnax

      thanks it works for me now,
      but how can register new users? on trac

      • Mike Jackson
        Mike Jackson

        The quick approach is to just use htpasswd in the SourceForge shell, as above:

        $ htpasswd trac.htpasswd NEW_USER_NAME

        You'll then be prompted for a new password for the user.

        Alternatively, the Account Manager plug-in has a component that allows you to do this via the Admin interface in TRAC itself:

        • Log in to TRAC using your admin user.
        • Click the Admin tab at the top right of the page.
        • In the left hand table, under General, click Plugins.
        • Click the little triangle beside TracAccountManager 0.3.2 to expand its description.
        • Select the box to the right of AccountManagerAdminPages.
        • Click Apply changes.
        • You'll see additional links in the left-hand table allowing you to manage users.
  • defnax

    thanks for that info, i not mean to create a user by admin,
    trac has a Registration interface like this

    how i can enable that?

    • Mike Jackson
      Mike Jackson

      I didn't need that functionality at this time but it looks like the Account Manager plug-in contains components to do this too so check out their doc at http://trac-hacks.org/wiki/AccountManagerPlugin.

  • Andrea Tessaro
    Andrea Tessaro

    Hi guys, thanks for this usefull guide.
    I have some problem with step 6 :

    Downloading/unpacking trac
    Running setup.py egg_info for package trac
    Trac requires Python 2.5 or later
    Complete output from command python setup.py egg_info:
    Trac requires Python 2.5 or later

    Command python setup.py egg_info failed with error code 1 in /home/project-web/sinekarta/venv/build/trac
    Storing complete log in /home/users/a/an/andrea-tessaro/.pip/pip.log

    Can someone help me?

    • XhmikosR

      The problem is that SourceForge is still using the ancient Python 2.4.

      When you run /home/project-web/paintown/venv/bin/pip install trac it installs v1.0.

      Try /home/project-web/paintown/venv/bin/pip install trac==0.12.3 which works with Python 2.4.

      But SF should upgrade their Python, or give us instructions how to do it ourselves if it's possible.

  • Pekka Ojala
    Pekka Ojala

    I had same kind of problems.

    I entered to phase 5/8 (Install some Python prerequisites) without problems. Then I got following error:

    "Trac requires Python 2.5 or later. Complete output from command python setup.py egg_info: Trac requires Python 2.5 or later. Command python setup.py egg_info failed with error code 1 in /home/project-web/opixproject/venv/build/trac Storing complete log in /home/users/u/uk/ukkopekka/.pip/pip.log."

    Anyway I continued without new problems to phase 8/8 (Deploy the CGI script). Then I got following error:

    "-bash: /home/project-web/opixproject/venv/bin/trac-admin: No such file or directory".

    So there is no trac-admin directory or file. Maybe because of that first Python error.

  • I'm having problem with step 5) Install some Python prerequisites

    ...@shell-21006 ~]$ python26
    python26: Command not found.

    ...@shell-21006 ~]$ uname -a
    Linux shell-21006 2.6.18-238.19.1.el5.028stab092.2 #1 SMP Thu Jul 21 19:23:22 MSD 2011 x86_64 x86_64 x86_64 GNU/Linux

    Update: I've tried this again on Sep 4 2012. I got access to a different machine (shell-24005), but python26 is not installed there either (I can only use python2.4 there). Could you please let me know when there is a fix or workaround available for this.

    Thank you much!

    Last edit: Sarkis Dallakian 2012-09-04
  • Sahits GmbH
    Sahits GmbH

    I tried to migrate sahitseclipse and stumbled upon two issues:

    1. In step 3, based on the underlieing OS the scp command might not work. When adding the filename after the : of the host this should work fine, at least it did for me:

      $ scp paintown_trac_mysqldump.sql sfuser@web.sourceforge.net:

    2. I had the same problem as Sarkis Dallakian in step 5. Using python which is version 2.4. But as python 2.6 is not available, so the directory /usr/lib64/python2.6 is not available as well. Using prython2.4, as I did, may result in subsequent problems. Issueing the command pip install trac results then in this:

      /home/project-web/sahitseclipse/venv/bin/pip install trac
      Traceback (most recent call last):
      File "/home/project-web/sahitseclipse/venv/bin/pip", line 7, in ?
      File "/home/project-web/sahitseclipse/venv/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/pkg_resources.py", line 318, in load_entry_point
      return get_distribution(dist).load_entry_point(group, name)
      File "/home/project-web/sahitseclipse/venv/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/pkg_resources.py", line 2221, in load_entry_point
      return ep.load()
      File "/home/project-web/sahitseclipse/venv/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/pkg_resources.py", line 1954, in load
      entry = import(self.module_name, globals(),globals(), ['name'])
      File "/home/project-web/sahitseclipse/venv/lib/python2.4/site-packages/pip-1.2.1-py2.4.egg/pip/init.py", line 9, in ?
      from pip.basecommand import command_dict, load_command, load_all_commands, command_names
      File "/home/project-web/sahitseclipse/venv/lib/python2.4/site-packages/pip-1.2.1-py2.4.egg/pip/basecommand.py", line 4, in ?
      from pkgutil import walk_packages
      ImportError: cannot import name walk_packages

    I suppose this is a subsequent problem of the wrong python version.

  • Hi.

    Thanks for the tutorial.I've been able to set up http://radiocefyl.sourceforge.net/cgi-bin/trac.cgi
    However, as you can see, there's some encoding problem.

    I'm VERY sure that the mysql satabase was set on utf-8 by default, as said in the tutorial. Also, i've changed trac_env/conf/tra.ini to use utf-8 charset. But the error stays.

    Any clue?


    The encoding problem is gone. I solved it by installing v0.12 instead of v0.11.
    I had to install trac with easy_install instead of pip. That is, /home/project-web/PROJECT_NAME/venv/bin/easy_install trac==0.12

    I also had to create the PYTHON_EGG_CACHE directory, and had to give access to it. Once i did that, trac was working again.

    Now i have the problem of not being able to log in, but i'll check it out tomorrow, reading other people's comments.

    Last edit: Daniel Cantarín 2012-09-25
  • Pina Palmieri
    Pina Palmieri

    At the first step "Get backup of your Trac database", I have an error:

    "Error 6 (net::ERR_FILE_NOT_FOUND)"
    Export of database is not possible. The result is always a blank page or an internal server error.
    (see the attachment file)

    No web page found for web address is : "https://sourceforge.net/apps/backup/coffee-soft".

    Any clues?


    Last edit: Pina Palmieri 2012-10-25
  • I managed to have this going from my project (http://pyrx.sourceforge.net/cgi-bin/trac.cgi), but MySQL support is still missing. I would appreciate if someone from SourceForge would clarify what's going on? I'm not sure if we still need to do this or if there is any deadline for this. Thank you much!

    • Rich Bowen
      Rich Bowen

      Not sure what you mean by mysql support missing. What exactly is happening?

      • Thank you Rich. Python mysql binding was missing from the default python installation last time I checked. In other words, there was no /usr/lib64/python2.6/site-packages/MySQLdb to perform 5) Install some Python prerequisites

        I also tried easy_install MySQL-python; this would give error messages about .h files missing, which seems to indicate that we need mysql-devel package installed. Please let me know if you have questions or need more information. Thank you.

        Last edit: Sarkis Dallakian 2012-10-29
        • Ahmed Allam
          Ahmed Allam

          Same problem here any updates ?

        • Pina Palmieri
          Pina Palmieri


          I have the same problem a few days ago, did you manage to solve it?

          I would be very happy if you can give me some suggestions.

          Best regards,

  • Since about a week from now, i get an error 500 when trying to acces my trac instance: http://radiocefyl.sourceforge.net/cgi-bin/trac.cgi

    It was working fine since my last post here, and i have updated a lot of data. Now i can't access trac. I didn't changed anything.

    I can see other trac instances published on comments here are showing the same behaviour.
    Does anybody knows what's going on?


  • Pina Palmieri
    Pina Palmieri

    I still have problems in the first step about migration.
    I do this kind of step ((see also the attachment file)):

    For Classic, or old-style projects,
    - select Project Admin => Features

    • In Backups row, click Hosted Apps

    • Select Content to backup: Files
      Select Content format: plain
      Select Application to backup: Trac

    But when I click "Submit Query", an error page:

    "Export of database is not possible. The result is always a blank page or an internal server error."

    Does anybody knows what's going on?



  • Pina Palmieri
    Pina Palmieri

    Hi guys,

    I have this kind of problem:
    I entered to phase 5) Install some Python prerequisites.

    When I do the following step:

    Copy mysql adapter to virtualenv:
    cp -rv /usr/lib64/python2.6/site-packages/_mysql* /home/project-web/paintown/venv/lib64/python2.4/site-packages/
    cp -rv /usr/lib64/python2.6/site-packages/MySQLdb/ /home/project-web/paintown/venv/lib64/python2.6/site-packages/

    The error message is:
    "cp -rv /usr/lib64/python2.6/site-packages/_mysql /home/project-
    cp: cannot stat `/usr/lib64/python2.6/site-packages/_mysql
    ': No such file or directory
    By checking in the "/usr/lib64/python2.6/site-packages/" folder, there are no modules.

    In this folder, there are the file/folders following:

    Crypto README bzr-2.4.0-py2.6.egg-info bzrlib pycrypto-2.3-py2.6.egg-info

    Any clue, please?

    Thanks, regards


  • Michael Pohl
    Michael Pohl

    cp -rv /usr/lib64/python2.6/site-packages/_mysql* /home/project-web/paintown/venv/lib64/python2.4/site-packages/
    cp -rv /usr/lib64/python2.6/site-packages/MySQLdb/ /home/project-web/paintown/venv/lib64/python2.6/site-packages/
    Not working, because they don't exist...

  • Pina Palmieri
    Pina Palmieri

    thanks, yes I know, but do you have the same problem?

    • Rich Bowen
      Rich Bowen

      It's my plan to work on this document today. There have been some changes to the hosting environment, and the document needs to be updated to adjust for those changes.

      • Pina Palmieri
        Pina Palmieri


        are no update for the step 8?


<< < 1 2 3 4 5 > >> (Page 3 of 5)