TRAC + SVN 架設 維護 記錄

TRAC + SVN 架設 維護 記錄

架設 SVN

apt-get install trac subversion libapache2-svn apache2

mkdir -p /var/svn

svnadmin create /var/svn/\$project_name

chown -R www-data.www-data /var/svn/\$project_name

a2enmod dav_svn

/etc/apache2/mods-enabled/dav_svn.conf

DAV svn

SVNParentPath /var/svn

SVNAutoVersioning On

AuthType Basic

AuthName "Subversion Repository"

AuthUserFile /etc/apache2/svn.passwd

AuthzSVNAccessFile /etc/apache2/svn.authz

Require valid-user

/etc/apache2/svn.authz

[/]

user = rw

  • = r

[/trunk]

user = rw

  • = r

[/tags]

user = rw

  • = r

[/branches]

user = rw

  • = r

設定密碼:

htpasswd -c /etc/apache2/dav_svn.passwd user

新增專案:

  • svnadmin create /var/svn/\$NEW_PROJECT_NAME
  • chown -R www-data.www-data /var/svn/\$NEW_PROJECT_NAME

架設 TRAC

apt-get install trac libapache2-mod-python

mkdir -p /var/trac/

trac-admin /var/trac/\$project_name initenv

Project Name = \$project_name

Path to repository = /var/svn/\$project_name

調整設定:

  • vim /home/trac/PROJECT_NAME/conf/trac.ini
  • default_charset = iso-8859-15 => default_charset = utf-8

chown www-data:www-data -R /var/trac/\$project_name

設定 apache 中 virtualhost without ssl:

ServerAdmin webmaster@localhost

.

.

.

SetHandler mod_python

PythonHandler trac.web.modpython_frontend

PythonOption TracEnvParentDir /var/trac_root/

PythonOption TracUriRoot /trac

AuthType Basic

AuthName "Trac"

AuthUserFile /etc/apache2/svn.passwd

Require valid-user

設定 apache with ssl:

sudo mkdir /etc/apache2/ssl

sudo openssl req -new -x509 -nodes -out /etc/apache2

sudo a2enmod ssl

設定 apache 中 virtualhost with ssl:

NameVirtualHost *:443

DocumentRoot /var/www/https/

ErrorLog /var/log/apache2/error.log

CustomLog /var/log/apache2/access.log combined

SSLEngine On

SSLCertificateFile /etc/apache2/ssl/apache.crt

SSLCertificateKeyFile /etc/apache2/ssl/apache.key

SetHandler mod_python

PythonHandler trac.web.modpython_frontend

PythonOption TracEnvParentDir /var/trac_root/

PythonOption TracUriRoot /trac

AuthType Basic

AuthName "Trac"

AuthUserFile /etc/apache2/svn.passwd

Require valid-user

Trac 安全權限設定:

  • trac-admin /home/trac/PROJECT_NAME permission
  • trac-admin /home/trac/PROJECT_NAME permission list # 看有哪些權限能開
  • trac-admin /home/trac/PROJECT_NAME permission remove anonymous '*'  # 這樣子預設沒登入就不能進入 Trac
  • trac-admin /home/trac/PROJECT_NAME permission add USERNAME TRAC_ADMIN
  • trac-admin /home/trac/PROJECT_NAME permission list # 可以看到 USERNAME 設為 TRAC_ADMIN 的訊息
  • chown -R www-data:www-data /home/trac/PROJECT_NAME

新增 TRAC:

mkdir -p /var/trac/\$new_project_name

trac-admin /var/trac/\$new_project_name initenv

Project Name = \$new_project_name

Path to repository = /var/svn/\$new_project_name

調整權限...

convert from Thomas blog post id 330 old convert log: ./111527/tag%3E2008%2007%20linux)

@2008 @07 @linux

Comments