DreamTracInstall
From DreamHost
Current version 0.9
| The instructions provided in this article or section are considered advanced. You are expected to be knowledgeable in the UNIX shell. |
DreamTracInstall is a bash script originally written by Paul-Robert Archibald based on Natmaster's Trac Installation Guide. It has since been further developed by a number of contributors:
| Please note that Petar Marić has created the dreamy-trac open-source project which has more features and is way simpler to use than this script. |
| A minimalistic scripted auto-install of Trac 0.11.x on DreamHost is available from AutoTracOnDreamHost |
This script was created to make Trac installation on Dreamhost a breeze. All packages will be installed to the $HOME/$ROOTDIR directory. Trac sites will be created in the $HOME/trac_sites directory.
Contents |
Info
This script assumes the following:
- You are trying to install trac on a dreamhost server.
- You have already created a subversion project via the dreamhost panel.
- You don't have python installed to your local home directory.
- You are working from a clean $HOME environment.
- You are throughly frustrated trying to install trac on your own.
- If you want to use a MySQL database, you already set one up (such as trac_db) as well as already set up a user allowed to modify it (such as mysqluser) so that Trac can store its stuff in it.
Installation
Step 1
| As of 2008/08/24, it seems that you should use python2.4, not 2.3, in the export below, and also change line 246 of the script accordingly. |
First off edit your edit ~/.bash_profile and add the following lines:
(You can replace "packages" with whatever you intend to use as the ROOTDIR argument for the script.)
export PYTHONPATH="$HOME/trac_packages/lib/python2.3/site-packages" export LD_LIBRARY_PATH="$HOME/trac_packages/lib" export PATH="$HOME/trac_packages/bin:$PATH"
At the bash shell type:
source ~/.bash_profile
Step 2
Copy the script below into a file DreamTracInstall.sh
At the bash shell type:
chmod +x ./DreamTracInstall.sh ./DreamTracInstall.sh
You'll be prompted to enter the following:
- PROJECT - SVN project ID
- PROJECTDIR - The web directory this Trac installation should be accessible from
- DOMAIN - The domain this Trac installation should be accessible from
- USEMYSQL - Whether or not to use the experimental MySQL database support (which some folks claim is "stronger/faster/better") or to use the default SQLite database backend. If you choose to use the MySQL support, you'll also be prompted for:
- MYSQLHOST - The mysql host that the trac data base lives on
- MYSQLUSER - The username used to access aforementioned mysql host
- MYSQLPASSWD - The password for the aforementioned username
- MYSQLDBNAME - The trac database
- TRACVERSION - The desired Trac version: 10 or 11
- REMOVEINSTALLFILES - yes to remove the installation files upon completion; otherwise no
- ROOTDIR - The root directory to install Trac and associated files into. E.g. $HOME/packages
It is also possible to enter all of these values as command-line arguments for the script, however this method assumes that you want to use the MySQL database. They must be entered in the exact order listed above (omitting the USEMYSQL parameter). If not entered, the script will prompt for them. After entering the variables sit back and relax for about 15 minutes.
Step 3
Log into the DreamHost Control Panel and add a new subdomain (e.g. trac.yourdomain.com). FastCGI should be enabled. Google services need not be checked. This may take an hour to propagate.
Step 4
Point your browser to your trac subdomain. Trac has been installed and is running on cgi.
Web login:
user: admin password: password
Don't forget to change your password! Enjoy!
Optional Step 5
There is an optional step if you want to install the post-commit hook (trac-post-commit-hook, which enables Subversion integration by automatically adding commit messages to Trac issues if referenced in the commit message). A description of how to install this is available here. Updated Script Only here
(if someone wants to rewrite this for usage in this wiki, please go ahead and do so)
Installation Bugs
Sometimes, things break. When that happens during an installation of Trac using this script, look here for solutions to problems. If you resolve an issue not listed here, please consider adding it so that others may benefit from your work.
PHP Syntax Highlighting
If you have problems with PHP syntax highlighting after installing trac, locate the php_path entry in the [mimeviewer] section of trac.ini (~/trac_sites/[your project id]/conf/trac.ini) and change it to this:
php_path = /usr/local/bin/php -q
OperationalError: (1267, "Illegal mix of collations …)
After installing trac, when attempting to add a new ticket, you may see the following error: OperationalError: (1267, "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'UNION'")
The trac team is aware of the issue, and to resolve it, see the patch for mysql_backend.py and the changes to trac.ini at #3182.
AttributeError: 'module' object has no attribute 'urlsafe_b64encode'
After a successful Trac installation, the only user that can log in might be the admin user. Logging in as any other user and then viewing any Trac page results in a message like the following one being displayed:
AttributeError: 'module' object has no attribute 'urlsafe_b64encode'
This problem is due to the TracAccountManager plugin that is installed with this script. The simplest way to fix the problem is to login as admin and go to Admin->Plugins->TracAccountManager and disable the email verification module. Removing the entire plugin will also serve to fix the problem. Updating python may also resolve the issue (untested).
System Information
- Trac
- 0.11
- Python
- 2.3.5 (#2, Oct 16 2006, 19:19:48) [GCC 3.3.5 (Debian 1:3.3.5-13)]
- setuptools
- 0.6c8
- MySQL
- server: "5.0.24a-standard-log", client: "5.0.16", thread-safe: 1
- MySQLdb
- 1.2.2
- Genshi
- 0.5
- Pygments
- 0.9
- Subversion
- 1.4.2 (r22196)
- jQuery
- 1.2.3
Setting up more Tracs
Now if you want to have more than one Trac, you will need to create a new domain, a new (empty) MySQL database, and a new Subversion repository. Then run :
More Trac 0.10.5 instances
trac-admin trac_sites/*choose a name* initenv *projectname* mysql://*mysqluser*:*mysqlpassword*@*mysqlhost*/*mysqldbname* svn *path-to-subversion-repo* /home/*username*/packages/share/trac/templates
More Trac 0.11 instances
trac-admin trac_sites/*choose a name* initenv *projectname* mysql://*mysqluser*:*mysqlpassword*@*mysqlhost*/*mysqldbname* svn *path-to-subversion-repo*
Or you can also have multiple Trac projects, without the need of creating more domains. After creating a new Trac project (${PROJECT_NEW}) like said above simply do
cp ${HOME}/${DOMAIN}/index.cgi ${HOME}/${DOMAIN}/${PROJECT_NEW}.cgi
cp ${HOME}/${DOMAIN}/index.fcgi ${HOME}/${DOMAIN}/${PROJECT_NEW}.fcgi
Then edit both ${HOME}/${DOMAIN}/${PROJECT_NEW}.fcgi and ${HOME}/${DOMAIN}/${PROJECT_NEW}.cgi and change line
export TRAC_ENV="$SITES/${PROJECT_NEW}
to
export TRAC_ENV="$SITES/${PROJECT_NEW}
and then you can access the new Trac project using the url
http://${DOMAIN}/${PROJECT_NEW}.cgi
or
http://${DOMAIN}/${PROJECT_NEW}.fcgi
The Script
Here is the script in its entirety. Please edit as necessary.
Script contributors
All contributors to the script please remember to update the version number and state your name and revision.
- Justin Hernandez (version 0.2)
- Etienne Samson (version 0.4) to make it use Dreamhost libraries instead of relying on installed items
- Andrew Kutz (version 0.6) to update it for Trac 0.11b2
- Guy Rutenberg adjusted the script to install Trac 0.11rc1.
- Meitar Moscovitz (version 0.9) to allow an option to use Trac's default SQLite database backend, updated for Trac 0.10.5 and Trac 0.11, and improved usability of some of the prompts.
Changelog
v0.9
- Trac 0.11
- Trac 0.10.5
- Genshi 0.5
- pysqlite 2.4.1
- When prompting, option to use SQLite or MySQL (still assumes MySQL from non-interactive installation)
- More understandable prompts, plus a few extra comments in the script source itself for clarity.
v0.8
- Trac 0.11rc1
- Validation
- Extra logging
v0.7
- Trac 0.11rc1
v0.6
- Trac 0.11b2
- Pygments 0.9
- Clearsilver 10.5
v0.5
- Added option to install into a project directory
- Added option to install Trac 0.11b1
- Installs pygments for Trac 0.11b1 for syntax highlighting
- Defaults to CGI instead of FCGI because of number of problems with getting FCGI working on Dreamhost these days
Script Source Code
| As of 2008/08/24, you should change the PYTHONPATH in step 1 to 2.4, not 2.3, and also change line 246 of the script below to read python2.4, instead of 2.3. |
#!/bin/bash
#DreamTracInstall
#Author v0.1 : Paul-Robert Archibald
#Author v0.2 : Justin Hernandez
#Author v0.4 : Etienne Samson
#Author v0.5 : Andrew Kutz <akutz@lostcreations.com>
#Author v0.6 : Daniel Drucker
#Author v0.7 : Guy Rutenberg <guyrutenberg gmail com>
#Author v0.8 : Steve Morin <steve dot morin at gmail dot com>
#Author v0.9 : Meitar Moscovitz <meitar at maymay dot net>
#License : http://www.archtechnologies.co.uk/dti.html
#Version : 0.9 Stable
# Abort on any errors
set -e
cat <<OutputDreamTracInstallReminder
Add the following to ~/.bash_profile
Where trac_packages=ROOTDIR
export PYTHONPATH="$HOME/trac_packages/lib/python2.3/site-packages"
export LD_LIBRARY_PATH="$HOME/trac_packages/lib"
export PATH="$HOME/trac_packages/bin:$PATH"
OutputDreamTracInstallReminder
if [ "$PYTHONPATH" == "" ] ; then
echo "You forgot to do the above add"
exit 1
fi
# No arguments specified. Prompt for required parameters.
if [ "$1" == "" ]
then
verify="n"
while [ "$verify" != y ];
do
echo "Enter Subversion project ID (e.g. svnproject): "
read PROJECT
echo "You entered \"$PROJECT\". Is this correct? (y/n)"
read verify
done
verify="n"
while [ "$verify" != y ];
do
echo "Enter trac project directory (e.g. '/' to install to root of domain): "
read PROJECTDIR
echo "You entered \"$PROJECTDIR\". Is this correct? (y/n)"
read verify
done
verify="n"
while [ "$verify" != y ];
do
echo "Enter trac domain name (e.g. trac.mydomain.org): "
read DOMAIN
echo "You entered \"$DOMAIN\". Is this correct? (y/n)"
read verify
done
verify="n"
while [ "$verify" != y ];
do
echo "Use MySQL database instead of default SQLite database backend? (e.g. yes or no): "
read USEMYSQL
echo "You entered \"$USEMYSQL\". Is this correct? (y/n)"
read verify
done
if [ $USEMYSQL == "yes" ]; then
verify="n"
while [ "$verify" != y ];
do
echo "Enter MySQL hostname (e.g. db.mydomain.org): "
read MYSQLHOST
echo "You entered \"$MYSQLHOST\". Is this correct? (y/n)"
read verify
done
verify="n"
while [ "$verify" != y ];
do
echo "Enter MySQL username (e.g. trac_username): "
read MYSQLUSER
echo "You entered \"$MYSQLUSER\". Is this correct? (y/n)"
read verify
done
verify="n"
while [ "$verify" != y ];
do
echo "Enter MySQL password (e.g. trac_password): "
read MYSQLPASSWD
echo "You entered \"$MYSQLPASSWD\". Is this correct? (y/n)"
read verify
done
verify="n"
while [ "$verify" != y ];
do
echo "Enter MySQL DB name (e.g. trac_db): "
read MYSQLDBNAME
echo "You entered \"$MYSQLDBNAME\". Is this correct? (y/n)"
read verify
done
fi
verify="n"
while [ "$verify" != y ];
do
echo "Enter desired Trac version (e.g. 10 or 11): "
read TRACVERSION
echo "You entered \"$TRACVERSION\". Is this correct? (y/n)"
read verify
if [ $TRACVERSION != "10" -a $TRACVERSION != "11" ]; then
verify="n"
fi
done
verify="n"
while [ "$verify" != y ];
do
echo "Remove install files? (e.g. yes or no): "
read REMOVEINSTALLFILES
echo "You entered \"$REMOVEINSTALLFILES\". Is this correct? (y/n)"
read verify
done
verify="n"
while [ "$verify" != y ];
do
echo "Root directory to install Trac and associated files into? (e.g. $HOME/packages): "
read ROOTDIR
echo "You entered \"$ROOTDIR\". Is this correct? (y/n)"
read verify
done
else
# Arguments specified on command line, use these instead.
# Note that this method assumes MySQL is desired!
PROJECT=$1
PROJECTDIR=$2
DOMAIN=$3
USEMYSQL=yes
MYSQLHOST=$4
MYSQLUSER=$5
MYSQLPASSWD=$6
MYSQLDBNAME=$7
TRACVERSION=$8
REMOVEINSTALLFILES=$9
ROOTDIR=${10}
fi
#PROJECT=nameofsvnproject
#PROJECTDIR=myproject
#DOMAIN=trac.somedomain.com
#USEMYSQL=no
#MYSQLHOST=mysql.somedomain.com
#MYSQLUSER=mysqluser
#MYSQLPASSWD=passwddb
#MYSQLDBNAME=mysqldb
#TRACVERSION=11
#REMOVEINSTALLFILES=no
#ROOTDIR=${HOME}/trac_packages
echo "PROJECT:${PROJECT}"
echo "PROJECTDIR:${PROJECTDIR}"
echo "DOMAIN:${DOMAIN}"
echo "USEMYSQL:${USEMYSQL}"
echo "MYSQLHOST:${MYSQLHOST:-n/a}"
echo "MYSQLUSER:${MYSQLUSER:-n/a}"
echo "MYSQLPASSWD:${MYSQLPASSWD:-n/a}"
echo "MYSQLDBNAME:${MYSQLDBNAME:-n/a}"
echo "TRACVERSION:${TRACVERSION}"
echo "REMOVEINSTALLFILES:${REMOVEINSTALLFILES}"
echo "ROOTDIR:${ROOTDIR}"
#Don't edit these
PKG=$ROOTDIR
INSTALL=${HOME}/trac_install_files
SITES=${HOME}/trac_sites
SVN=${HOME}/svn
# Update version information here and DIRs below.
if [ $TRACVERSION == "10" ]; then
TRAC=http://ftp.edgewall.com/pub/trac/trac-0.10.5.tar.gz
elif [ $TRACVERSION == "11" ]; then
TRAC=http://ftp.edgewall.com/pub/trac/Trac-0.11.tar.gz
fi
CLEARSILVER=http://www.clearsilver.net/downloads/clearsilver-0.10.5.tar.gz
GENSHI=http://ftp.edgewall.com/pub/genshi/Genshi-0.5.tar.gz
CGIFRONTEND=http://area51.archtechnologies.net/DreamTracInstall/cgi-frontend.tar.gz
SETUPTOOLS=http://peak.telecommunity.com/dist/ez_setup.py
MYSQLDB=http://switch.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.2.tar.gz
PYSQLITE=http://oss.itsystementwicklung.de/download/pysqlite/2.4/2.4.1/pysqlite-2.4.1.tar.gz
WEBADMIN=http://trac.edgewall.org/attachment/wiki/WebAdmin/TracWebAdmin-0.1.2dev_r4240-py2.3.egg.zip?format=raw
PYGMENTS=http://pypi.python.org/packages/source/P/Pygments/Pygments-0.9.tar.gz
if [ $TRACVERSION == "10" ]; then
TRACDIR=trac-0.10.5
elif [ $TRACVERSION == "11" ]; then
TRACDIR=Trac-0.11
fi
CLEARSILVERDIR=clearsilver-0.10.5
GENSHIDIR=Genshi-0.5
MYSQLDBDIR=MySQL-python-1.2.2
PYSQLITEDIR=pysqlite-2.4.1
PYGMENTSDIR=Pygments-0.9
echo "Download and install files"
# Only create directories and download if they do not already exist.
if [ ! -d ${INSTALL} -a ! -d ${PKG} ]; then
#Lets make the directories
[ ! -d ${PKG} ] && mkdir -p ${PKG}
[ ! -d ${INSTALL} ] && mkdir -p ${INSTALL}
[ ! -d ${SITES} ] && mkdir -p ${SITES}
cd ${INSTALL}
#Lets get the files, if we don't already have them
[ ! -f ${TRACDIR}.tar.gz ] && wget ${TRAC}
[ ! -f ${CLEARSILVERDIR}.tar.gz ] && wget ${CLEARSILVER}
[ ! -f ${GENSHIDIR}.tar.gz ] && wget ${GENSHI}
[ ! -f ${MYSQLDBDIR}.tar.gz ] && wget ${MYSQLDB}
#### I'm concerned PySQLite actually causes a bug of some kind, and Trac seems to work okay
#### even if this package is not explicitly installed. Therefore, I'm disabling it.
# [ ! -f ${PYSQLITEDIR}.tar.gz ] && wget ${PYSQLITE}
[ ! -f ${PYGMENTSDIR}.tar.gz ] && wget ${PYGMENTS}
[ ! -f ez_setup.py ] && wget ${SETUPTOOLS}
#Lets unpack the files
echo "Unpacking files, please wait..."
tar xzf ${TRACDIR}.tar.gz
tar xzf ${CLEARSILVERDIR}.tar.gz
tar xzf ${GENSHIDIR}.tar.gz
tar xzf ${MYSQLDBDIR}.tar.gz
#### I'm concerned PySQLite actually causes a bug of some kind, and Trac seems to work okay
#### even if this package is not explicitly installed. Therefore, I'm disabling it.
# tar xzf ${PYSQLITEDIR}.tar.gz
tar xzf ${PYGMENTSDIR}.tar.gz
echo "Starting compilation"
#Create site-packages directory. Script will fail if this directory doesn't exist.
mkdir -p ${PKG}/lib/python2.3/site-packages
echo "Setup Tools"
#Setup Tools
python ez_setup.py --prefix=${PKG}
if [ $USEMYSQL == "yes" ]; then
echo "MYSQLdb"
#MYSQLdb
cd ${INSTALL}/${MYSQLDBDIR}
python setup.py install --prefix=${PKG}
else
#### I'm concerned PySQLite actually causes a bug of some kind, and Trac seems to work okay
#### even if this package is not explicitly installed. Therefore, I'm disabling it.
echo "SQLite"
# cd ${INSTALL}/${PYSQLITEDIR}
# python setup.py install --prefix=${PKG}
fi
echo "Genshi"
#Genshi
cd ${INSTALL}/${GENSHIDIR}
python setup.py install --prefix=${PKG}
echo "Clearsilver"
#Clearsilver
cd ${INSTALL}/${CLEARSILVERDIR}
export PYTHON_SITE=`/usr/bin/python -c "import sys; print [path for path in sys.path if path.find('site-packages') != -1][0]"`
./configure --prefix=${PKG} --with-python --disable-ruby --disable-java --disable-apache --disable-csharp --disable-perl
make
make install
echo "Pygments"
#Pygments
cd ${INSTALL}/${PYGMENTSDIR}
python setup.py install --prefix=${PKG}
echo "Trac"
#Trac
cd ${INSTALL}/${TRACDIR}
python setup.py install --prefix=${PKG}
fi
echo "Setup site"
if [ ! -d ${SITES}/${PROJECT} ]; then
if [ $TRACVERSION == "10" ]; then
if [ $USEMYSQL == "yes" ]; then
#Setup Trac Environment for MySQL
${PKG}/bin/trac-admin ${SITES}/${PROJECT} \
initenv ${PROJECT} \
"mysql://${MYSQLUSER}:${MYSQLPASSWD}@${MYSQLHOST}/${MYSQLDBNAME}" \
svn \
${SVN}/${PROJECT} \
${PKG}/share/trac/templates;
else
#Setup Trac Environment for SQLite
${PKG}/bin/trac-admin ${SITES}/${PROJECT} \
initenv ${PROJECT} \
"sqlite:db/trac.db" \
svn \
${SVN}/${PROJECT} \
${PKG}/share/trac/templates;
fi
elif [ $TRACVERSION == "11" ]; then
if [ $USEMYSQL == "yes" ]; then
#Setup Trac Environment for MySQL
${PKG}/bin/trac-admin ${SITES}/${PROJECT} \
initenv ${PROJECT} \
"mysql://${MYSQLUSER}:${MYSQLPASSWD}@${MYSQLHOST}/${MYSQLDBNAME}" \
svn \
${SVN}/${PROJECT};
else
#Setup Trac Environment for SQLite
${PKG}/bin/trac-admin ${SITES}/${PROJECT} \
initenv ${PROJECT} \
"sqlite:db/trac.db" \
svn \
${SVN}/${PROJECT};
fi
fi
# set admin user to premissions
${PKG}/bin/trac-admin ${SITES}/${PROJECT} \
permission add admins TRAC_ADMIN
${PKG}/bin/trac-admin ${SITES}/${PROJECT} \
permission add admin admins
fi
echo 'Make Trac Web Accessible'
# Make Trac Web Accessible
mkdir -p ${HOME}/${DOMAIN}/${PROJECTDIR}
cd ${HOME}/${DOMAIN}/${PROJECTDIR}
if [ $TRACVERSION == "11" ]; then
# Copy the cgi-bin dir
mkdir -p ${PKG}/share/trac
cp -fr ${INSTALL}/${TRACDIR}/cgi-bin ${PKG}/share/trac
fi
if [ -f "${HOME}/${DOMAIN}/${PROJECTDIR}/index.cgi" ]; then
rm ${HOME}/${DOMAIN}/${PROJECTDIR}/index.cgi
fi
echo "#!/bin/bash" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.cgi
echo "export HOME=\"/home/${USER}\"" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.cgi
echo "export TRAC_ENV=\"$SITES/${PROJECT}\"" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.cgi
echo "export PYTHONPATH=\"$PKG/lib/python2.3/site-packages\"" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.cgi
echo "export PATH=\"$PKG/bin:$PATH\"" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.cgi
echo "export LD_LIBRARY_PATH=\"$PKG/lib\"" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.cgi
echo "exec $PKG/share/trac/cgi-bin/trac.cgi" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.cgi
chmod 755 ${HOME}/${DOMAIN}/${PROJECTDIR}/index.cgi
if [ -f "${HOME}/${DOMAIN}/${PROJECTDIR}/index.fcgi" ]; then
rm ${HOME}/${DOMAIN}/${PROJECTDIR}/index.fcgi
fi
echo "#!/bin/bash" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.fcgi
echo "export HOME=\"/home/${USER}\"" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.fcgi
echo "export TRAC_ENV=\"$SITES/${PROJECT}\"" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.fcgi
echo "export PYTHONPATH=\"$PKG/lib/python2.3/site-packages\"" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.fcgi
echo "export PATH=\"$PKG/bin:$PATH\"" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.fcgi
echo "export LD_LIBRARY_PATH=\"$PKG/lib\"" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.fcgi
echo "exec $PKG/share/trac/cgi-bin/trac.fcgi" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/index.fcgi
chmod 755 ${HOME}/${DOMAIN}/${PROJECTDIR}/index.fcgi
#Pretty URLs
mkdir -p ${HOME}/${DOMAIN}/${PROJECTDIR}/chrome
if [ $TRACVERSION == "10" ]; then
ln -sf ${PKG}/share/trac/htdocs ./chrome/common
elif [ $TRACVERSION == "11" ]; then
ln -sf ${PKG}/lib/python2.3/site-packages/Trac-0.11-py2.3.egg/trac/htdocs/ ${HOME}/${DOMAIN}/${PROJECTDIR}/chrome/common
fi
#Hack the Trac base_url
if [ $TRACVERSION == "10" ]; then
cd ${PKG}/lib/python2.3/site-packages/trac/web
elif [ $TRACVERSION == "11" ]; then
cd ${PKG}/lib/python2.3/site-packages/Trac-0.11-py2.3.egg/trac/web
fi
perl -pi.bak -e "s/^self.cgi_location =.+$/self.cgi_location = os.path.dirname(self.__environ.get('SCRIPT_NAME'))/gi" cgi_frontend.py
if [ $TRACVERSION == "10" ]; then
#WebAdmin
wget ${WEBADMIN}
mv TracWebAdmin-0.1.2dev_r4240-py2.3.egg.zip?format=raw TracWebAdmin-0.1.2dev_r4240-py2.3.egg
easy_install --prefix=${PKG} TracWebAdmin*
#AccountManager
#track-hacks.org is down
#easy_install --prefix=${PKG} http://trac-hacks.org/svn/accountmanagerplugin/trunk
#easy_install --prefix=${PKG} http://trachacks.coderanger.net/svn/accountmanagerplugin/trunk
easy_install --prefix=${PKG} http://trac-hacks.org/svn/accountmanagerplugin/0.10
elif [ $TRACVERSION == "11" ]; then
easy_install --prefix=${PKG} http://trac-hacks.org/svn/accountmanagerplugin/trunk
fi
# set WebAdmin & AccountManager to local trac.ini
echo "[components]" >> ${SITES}/${PROJECT}/conf/trac.ini
echo "webadmin.* = enabled" >> ${SITES}/${PROJECT}/conf/trac.ini
echo "trac.web.auth.LoginModule = disabled" >> ${SITES}/${PROJECT}/conf/trac.ini
echo "acct_mgr.* = enabled" >> ${SITES}/${PROJECT}/conf/trac.ini
echo "[account-manager]" >> ${SITES}/${PROJECT}/conf/trac.ini
echo "password_format = htpasswd" >> ${SITES}/${PROJECT}/conf/trac.ini
echo "password_file = ${SITES}/${PROJECT}.passwd" >> ${SITES}/${PROJECT}/conf/trac.ini
cd ~/
if [ $REMOVEINSTALLFILES == "yes" ]; then
rm -rf ${INSTALL}
fi
#Set the .htaccess file for FastCGI
cd ${HOME}/${DOMAIN}/${PROJECTDIR}
if [ -f ${HOME}/${DOMAIN}/${PROJECTDIR}/.htaccess ]; then
rm ${HOME}/${DOMAIN}/${PROJECTDIR}/.htaccess
fi
touch .htaccess
echo "DirectoryIndex index.cgi" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/.htaccess
chmod 644 ${HOME}/${DOMAIN}/${PROJECTDIR}/.htaccess
echo "Options ExecCGI FollowSymLinks" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/.htaccess
echo "<IfModule mod_rewrite.c>" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/.htaccess
echo "RewriteEngine On" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/.htaccess
echo "RewriteCond %{REQUEST_FILENAME} !-f" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/.htaccess
echo "RewriteCond %{REQUEST_FILENAME} !-d" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/.htaccess
echo "RewriteRule ^(.*)\$ /$PROJECTDIR/index.cgi/\$1 [L]" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/.htaccess
echo "</IfModule>" >> ${HOME}/${DOMAIN}/${PROJECTDIR}/.htaccess
#Create .htpasswd file and add admin with default password 'password'
cd ${SITES}
touch ${PROJECT}.passwd
echo "admin:\$apr1\$2PpwG/..\$09tzwaDfzKx4Yu/od5Alw0" >> ${SITES}/${PROJECT}.passwd
echo ---------- INSTALL COMPLETE! ----------
Packages Installed
Trac 0.10.5
- clearsilver-0.10.4
- TracWebAdmin-0.1.2dev_r4240-py2.3.egg
- accountmanagerplugin-0.10
- setuptools
- trac-0.10.5
Trac 0.11
- clearsilver-0.10.5
- Genshi-0.5
- MySQL-Python 1.2.2
- pysqlite-2.4.1
- setuptools
- accountmanagerplugin (trunk)
- trac-0.11
- pygments-0.9
Uninstall/Reinstall Trac
In order to make reinstalling and compiling of Trac easier use this script:
THIS WILL DELETE THE TRAC INSTALL that is installed via DreamTracInstall.sh . If any of these folders exist running DreamTracInstall.sh again will FAIL!
#!/bin/sh
# Abort on any errors
set -e
if [ "$1" == "" ]
then
verify="n"
while [ "$verify" != y ];
do
echo "Enter trac project directory: "
read PROJECTDIR
echo "You entered \"$PROJECTDIR\". Is this correct? (y/n)"
read verify
done
verify="n"
while [ "$verify" != y ];
do
echo "Enter trac domain name (e.g. trac.mydomain.org): "
read DOMAIN
echo "You entered \"$DOMAIN\". Is this correct? (y/n)"
read verify
done
verify="n"
while [ "$verify" != y ];
do
echo "Enter MySQL hostname (e.g. db.mydomain.org): "
read MYSQLHOST
echo "You entered \"$MYSQLHOST\". Is this correct? (y/n)"
read verify
done
verify="n"
while [ "$verify" != y ];
do
echo "Enter MySQL username (e.g. trac_username): "
read MYSQLUSER
echo "You entered \"$MYSQLUSER\". Is this correct? (y/n)"
read verify
done
verify="n"
while [ "$verify" != y ];
do
echo "Enter MySQL password (e.g. trac_password): "
read MYSQLPASSWD
echo "You entered \"$MYSQLPASSWD\". Is this correct? (y/n)"
read verify
done
verify="n"
while [ "$verify" != y ];
do
echo "Enter MySQL DB name (e.g. trac_db): "
read MYSQLDBNAME
echo "You entered \"$MYSQLDBNAME\". Is this correct? (y/n)"
read verify
done
verify="n"
while [ "$verify" != y ];
do
echo "Root directory to install Trac and associated files into? (e.g. $HOME/packages): "
read ROOTDIR
echo "You entered \"$ROOTDIR\". Is this correct? (y/n)"
read verify
done
else
PROJECTDIR=$1
DOMAIN=$2
MYSQLHOST=$3
MYSQLUSER=$4
MYSQLPASSWD=$5
MYSQLDBNAME=$6
ROOTDIR=$7
fi
# Remove the files
rm -fr $ROOTDIR $HOME/trac_sites $HOME/install_files $DOMAIN/$PROJECTDIR $HOME/.python-eggs $HOME/.subversion
# Remove the tables from the database
mysql -u $MYSQLUSER --password=$MYSQLPASSWD -h $MYSQLHOST -e 'DROP TABLE `attachment`, `auth_cookie`, `component`, `enum`, `milestone`, `node_change`, `permission`, `report`, `revision`, `session`, `session_attribute`, `system`, `ticket`, `ticket_change`, `ticket_custom`, `version`, `wiki`;' $MYSQLDBNAME

