安装svn和svn与apache集成的必要.so文件 执行:
apt-get -y install libapache2-svn apache2-mpm-prefork subversion subversion-tools
安装完成后输入
svn --version
测试是否安装成功
如果安装成功, 接着 SVN + apache 集成步骤:
在/etc/apache2/site-aviliables下建立dev-svn文件命令如下:
sudo touch /etc/apache2/sites-aviliables/dev-svn
编辑文件
sudo vim /etc/apache2/sites-aviliales/dev-svn
在文件中加入一下内容:
<Location /svn> DAV svn #/srv/svn是你的svn版本库路径 SVNParentPath /srv/svn AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/dav_svn.passwd AuthzSVNAccessFile /etc/apache2/dav_svn.authz SVNListParentPath On Require valid-user </Location>
注意: 内容中的SVNParentPath /srv/svn 路径如果系统中没有的话,就手动建一个空文件
使subversion 目录能被 apache 进程所访问:
sudo chown -R www-data.www-data /srv/svn
创建apache访问账号文件:
sudo mkdir /etc/apache2/dav_svn.passwd
sudo mkdir /etc/apache2/dav_svn.authz
SVNManager安装
安装PHP支持类库:
apt-get install php-pear
pear install -a VersionControl_SVN-0.3.3
手动下载svnmanager
http://sourceforge.net/projects/svnmanager/files/
下载后解压到一个目录下,我的解压到了/opt目录下
进入解压后的svnmanager目录下,修改config.php.linux复制为config.php
修改config.php文件内容为:
<?php $htpassword_cmd = "/usr/bin/htpasswd"; $svn_cmd = "/usr/bin/svn"; $svnadmin_cmd = "/usr/bin/svnadmin"; $svn_repos_loc = "/srv/svn"; $svn_passwd_file = "/etc/apache2/dav_svn.passwd"; $svn_access_file = "/etc/apache2/dav_svn.authz"; $svn_trash_loc = ""; $svnserve_user_file=""; $smtp_server = "smtp.mailserver.net"; $dsn = "mysql://root:@localhost/svnmanager"; $admin_name = "admin"; $admin_temp_password = "admin"; ?>
注意上图中的配置
修改文件,确保svnmanager有足够权限访问
chmod 777 /etc/apache2/dav_svn.passwd chmod 777 /etc/apache2/dav_svn.authz
数据库的配置:
mysql –u root –p
Mysql>create database svnmanager; Mysql>grant all privileges on svnmanager.* to 'svnmanager'@'localhost' identified by '[访问用户密码]'; Mysql>FLUSH PRIVILEGES; Mysql>quit;
注意:在执行grant语句是,例如:用户密码为password,那么语句为
grant all privileges on svnmanager.* to 'svnmanager'@'localhost' identified by 'password';
要去掉“[]”括号
安装ssl
apt-get install openssl
apt-get install ssl-cert
a2enmod ssl
创建apache下的ssl目录:
mkdir /etc/apache2/ssl
创建证书相关文件
进入/etc/apache2/ssl目录,创建私鈅,需要输入两次相同的关键字:
cd /etc/apache2/ssl
openssl genrsa -des3 -out my-server.key 1024
创建证书:
openssl req -new -key my-server.key -x509 -out my-server.crt -config /etc/ssl/openssl.cnf
创建完证书后,每次重启apache,都会提示输入密码,这样很不方便,如果系统重启,需要手工干预,所以执行下面的命令可以省去这个步骤:
sudo cp my-server.key my-server.key.org
sudo openssl rsa -in my-server.key.org -out my-server.key
重启apache验证是否成功
sudo /etc/init.d/apache2 restart
创建站点文件/etc/apache2/sites-available/ssl
sudo touch /etc/apache2/sites-available/ssl
添加内容:
NameVirtualHost *:443 <VirtualHost *:443> ServerName www.test.com ServerAdmin webmaster@localhost DocumentRoot "/srv/www/dev" <Directory / > Options FollowSymLinks AllowOverride None </Directory> <Directory /srv/www/dev> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined ServerSignature On SSLEngine on SSLCertificateFile /etc/apache2/ssl/my-server.crt SSLCertificateKeyFile /etc/apache2/ssl/my-server.key <Location /svn> DAV svn SVNParentPath /srv/svn AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/dav_svn.passwd AuthzSVNAccessFile /etc/apache2/dav_svn.authz SVNListParentPath On Require valid-user </Location> Alias /svnmanager "/opt/svnmanager-1.08/" <Directory "/opt/svnmanager-1.08/"> SSLRequireSSL </Directory> </VirtualHost>
ssl站点设为可运行:
a2ensite ssl
到此svnmanager svn ssl已经配置成功!
测试:
https://192.168.2.119/svnmanager/
其中192.168.2.119修改你的IP地址
成功后的效果为:
一般初始的用户名密码都为: admin
1 楼 marine8888 2011-10-11
你好。我是安装你的步骤安装的,但是在浏览器输入https://[ip]/svnmanager,回车,并没有出现成功的界面,而是直接下载了一个文件,文件内容是:
<?php
require_once "./prado-2.0.3/framework/prado.php";
$app = pradoGetApplication('svnmanager/application.spec');
$app->run();
?>
麻烦高手点拨一二!!!
不胜感激!!!!
<?php
require_once "./prado-2.0.3/framework/prado.php";
$app = pradoGetApplication('svnmanager/application.spec');
$app->run();
?>
麻烦高手点拨一二!!!
不胜感激!!!!