安裝 LAMP & Redmine
# 安裝 LAMP
apt-get install apache2 php5 mysql-server php5-mysql libapache2-mod-php5 libapache2-mod-auth-mysql
# 安裝 svn, dav_svn
apt-get install subversion libapache2-svn
# 安裝 redmine
apt-get install redmine redmine-mysql libapache2-mod-fcgid libapache2-mod-passenger
# 可以使用下面的方式重新設定 redmine DB 連結
#dpkg-reconfigure redmine
# 啟用 Apache 套件 php5, headers, expires
a2enmod php5 dav_svn auth_mysql cgid fcgid passenger rewrite ssl setenvif
# 安裝 git, phpmyadmin
apt-get install mercurial git-core phpmyadmin
# 連結 phpmyadmin 設定檔
cd /etc/apache2/conf.d/
ln -s ../../phpmyadmin/apache.conf phpmyadmin.conf
service apache2 restart
安裝 Redmine 套件
gem install pandoc-ruby rdiscount rpeg-markdown bluefeather
cd /usr/share/redmine/vendor/plugins
# 安裝 Code Review 套件
hg clone https://bitbucket.org/haru_iida/redmine_code_review
rake db:migrate_plugins RAILS_ENV=production
# 安裝 Markdown Extra formatter 套件
git clone git://github.com/juno/redmine_markdown_extra_formatter.git
# 安裝 reStructuredText formatting 套件
git clone git://github.com/alphabetum/redmine_restructuredtext_formatter.git
cd redmine_restructuredtext_formatter
git checkout pandoc-ruby
建立SVN庫
mkdir -p /home/repoadmin/repos
svnadmin create /home/repoadmin/repos/team1
svnadmin create /home/repoadmin/repos/team2
chown -R www-data:www-data /home/repoadmin/repos
建立SVN認證時需要的DB使用者(redmine_svn_auth)
CREATE USER 'redmine_svn_auth'@'localhost' IDENTIFIED BY 'redmine_svn_auth';
GRANT SELECT(id, login, hashed_password, status ,type) ON redmine_default.users TO 'redmine_svn_auth'@'localhost';
設定 Apache2 Site
cd /etc/apache2/sites-available/
cp default redmine_svn
vim redmine_svn
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /usr/share/redmine/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /usr/share/redmine/public>
Options ExecCGI FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} dispatch.fcgi$
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</Directory>
<Location /svn>
DAV svn
SVNParentPath /home/repoadmin/repos
SVNPathAuthz off
AuthBasicAuthoritative Off
AuthUserFile /dev/null
AuthType Basic
AuthName "Subversion Repository"
# auth_mysql help in http://localhost/doc/libapache2-mod-auth-mysql/DIRECTIVES.gz
Auth_MYSQL On
Auth_MySQL_Host localhost
Auth_MYSQL_DB redmine_default
Auth_MYSQL_Username redmine_svn_auth
Auth_MYSQL_Password redmine_svn_auth
Auth_MYSQL_Password_Table users
Auth_MYSQL_Username_Field login
Auth_MYSQL_Password_Field hashed_password
Auth_MySQL_Password_Clause " AND status=1 AND type='User' "
Auth_MYSQL_Empty_Passwords Off
Auth_MYSQL_Encryption_Types SHA1Sum
# Options: Crypt_DES, Crypt_MD5, Crypt, PHP_MD5, SHA1Sum, MySQL, Apache
Require valid-user
</Location>
LogLevel warn
CustomLog /var/log/apache2/redmine_access.log combined
ErrorLog /var/log/apache2/redmine_error.log
</VirtualHost>
重新啟動 Apache
a2dissite default
a2ensite redmine_svn
service apache2 restart
測試網址
參考來源:
將 Redmine 安裝於 Debian、Ubuntu Linux
Ubuntu 10.04 using Passenger
svn 使用和 redmine 相同帳號進行認證