The installation of multiple TRAC is a bit complicated, and the key is that there is a conflict on the setup, which requires a lot of attention. The difference between a specific installation method and a TRAC installation is not significant, and it is important to note that each TRAC project must use its own database and that all TRAC be under the same parent directory. Here's how I created the two TRAC process, creating the parent path under/home/trac, two TRAC names are called Project1 and Project2 respectively:
First, create two databases, because in the previous TRAC creation process, we had already used a database called TRAC, and if used again, there would be a database conflict and no project could be established. So we're going to delete the previous projects and databases before we build two new databases:
sudo rm -rf /home/hust_smartcar/trac (before the TRAC project is deleted)
sudo- u postgres sh (Switch to Postgres user)
CreateUser -A- D- P hcx (create HCX user and prompt for password, enter 123456)
Shall the new role is allowed to create more new roles? (y/n) Y
dropdb trac (pre-deleted database)
createdb- o hcx trac (Create TRAC database)
Createdb - o hcx trac2 (Create TRAC2 database)
exit (exit Postgres user, return to normal user prompt line)
The database is created, and then you can start creating the project. To create the first project:
CD /home
sudo mkdir trac
cd trac
sudo mkdir project1
sudo chown - R www-data:www-data Project1 sudo- u www-data trac-admin Project1 initenv
Project name [My project]> Project1 (enter your project name here)
Database connection string [sqlite:db/trac.db]> postgres:/ /hcx:123456@localhost/trac (Enter the location of the PostgreSQL database)
Repository type [svn]>
Path to Repository [/path/to/ repos]>
Templates Directory [/usr/share/trac/templates]>
Create a second project:
sudo mkdir project2
sudo chown- R www-data:www-data project2
sudo - u www-data trac-admin project2 initenv
Project Name [My project]> Project1 (enter your project name here)
Database connection string [sqlite:db/trac.db]> postgres://hcx:123456@localhost/ TRAC2 (Enter the location of the PostgreSQL database)
Repository type [svn]>
Path to Repository [/path/to/repos]>
Templates Directory [/usr/share/trac/templates]>
Once created, you need to configure the server:
sudo a2enmod python
sudo gedit /etc/apache2/sites-available/trac
Then edit the following configuration:
<virtualhost 192.168.0.108:80> ServerName hcx_project ServerAdmin
Documentroot/home/trac <directory "/home/trac/project1" > Options Indexes followsymlinks multiviews allowoverride None order Allow,deny allow from 127.0.0.1 192.168.0.0/24 192.168.1.0/24
t;/directory> <directory "/home/trac/project2" > Options Indexes followsymlinks multiviews AllowOverride None # Order Allow,deny # allow from 127.0.0.1 192.168.0.0/24 192.168.1.0/24 218.199.23.94 115 .156.219.36 115.156.219.35 </Directory> <location/> SetHandler mod_python pythoninte Rpreter main_interpreter pythonhandler trac.web.modpython_frontend pythonoption Tracenvparentdir/home/tra
(It must be changed to Tracenvparentdir) pythonoption tracuriroot/setenv python_egg_cache/tmp </Location>
<Location/project1/login>
authtype Basic
authname "TEST1 TRAC"
authuserfile/ho ME/TRAC/PROJECT1/.HTPASSWD
Require valid-user
</Location>
<LOCATION/PROJECT2/LOGIN&G t;
AuthType Basic
authname "TEST2 TRAC"
authuserfile/home/trac/project2/.htpasswd
Requi Re valid-user
</Location>
ErrorLog "/var/log/apache2/trac_errors.log"
customlog "/var/log /apache2/trac_accesses.log "Common
</VirtualHost>
Set the access permissions for TRAC
sudo htpasswd- c /home/hust_smartcar/trac/.htpasswd hcx
To activate this virtual host:
sudo a2ensite trac
sudo /etc/init.d/apache2 restart
At this point, two TRAC all installed, in the browser to enter the IP address of the computer, you can see the directory of two items, you can log in separately: