svn web管理 svnmanager常见问题 和解决
软件安装列表:
mysql 5.0.22
apache 2.0.59
php-5.1.1
subversion-1.4.4
mod_auth_mysql-3.0.0
php-pear
httpd-2.0.59
./configure --prefix=/VDS/APPS/apache2_svn --with-mpm=worker --enable-so --enable-dav --with-ssl --with-port=8091
make && make install
mod_auth_mysql-3.0.0
/VDS/APPS/apache2_svn/bin/apxs -cia -L/usr/lib/mysql -I/usr/include/mysql -lmysqlclient mod_auth_mysql.c
错误 :apxs:Error: Command failed with rc=65536
编辑mod_auth_mysql.c,大约111行。
把#include <mysql/mysql.h>改成如下应该就能解决问题了(/usr/local/mysql是我的mysql安装路径,不同的自己改)
#include </usr/local/mysql/include/mysql/mysql.h>
subversion-1.4.4
subversion-deps-1.4.4
./configure --prefix=/VDS/APPS/svn --with-apxs=/VDS/APPS/apache2_svn/bin/apxs --with-ssl --with-zlib --enable-maintainer-mode
最后出现这样提示:
configure: WARNING: we have configured without BDB filesystem support
You don't seem to have Berkeley DB version 4.0.14 or newer
installed and linked to APR-UTIL. We have created Makefiles which
will build without the Berkeley DB back-end; your repositories will
use FSFS as the default back-end. You can find the latest version of
Berkeley DB here:
http://www.sleepycat.com/download/index.shtml
由于我们不使用BDB库,所以忽略
make && make install
php-5.1.1
./configure --prefix=/VDS/APPS/php --with-apxs2=/VDS/APPS/apache2_svn/bin/apxs --with-mysql
安装php时的,一些错误及处理方法
错误1:configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 (found: none).
checking for flex... lex
checking for yywrap in -ll... no
checking lex output file root... ./configure: line 3238: lex: command not found
configure: error: cannot find output from lex; giving up
处理方法:安装flex-2.5.4a-33.i386.rpm 这个包在第2张盘上
错误2:Configuring extensions
checking whether to enable LIBXML support... yes
checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
处理方法:安装libxml2-2.6.16-6.i386.rpm libxml2-devel-2.6.16-6.i386.rpm 分别在第1、2张盘中
make && make install
cp php.ini-dist //VDS/APPS/php/lib/php.ini
修改httpd.conf AddType application/x-httpd-php .php
安装SVNManager
准备SVNManager源代码包(svnmanager-1.03.tgz):
下载地址:
http://jaist.dl.sourceforge.net/sourceforge/svnmanager/svnmanager-1.03.tgz
将文件解压至web目录下:
目前最新的是1.03.日期是10.9更新的
wget http://pear.php.net/go-pear
php go-pear 根据提示一步一步安装,一般就是一路回车
最后可以选择文件安装路径,按个人习惯设置,我一般都统一安装在固定的目录里SVNManager需要通过php-pear安装一个叫VersionControl_SVN的.将机器连接上互联网哦
pear install --alldeps VersionControl_SVN-0.3.0alpha1
把下载下来的pear的安装目录下temp/download/VersionControl_SVN-0.3.0alpha1目录
# cp VersionControl_SVN-0.3.0alpha1 web目录下svnmanager/
#mv VersionControl_SVN-0.3.0alpha1 VersionControl 改名
为SVNManager创建访问用户及数据库
本人对于mysql的命令操作不是很熟,我一般都是phpMyAdmin,对数据库进行操作
#mysql –u root –p
Mysql>create database svn;
Mysql>grant all privileges on svn.* to ‘svnmanager’@’localhost’ identified by ‘[访问用户密码]’;
Mysql>flush privileges; //使新建的用户生效,网上很多都写成错误的flush prifileges;害我想了半天
Mysql>quit;
增加权限配置
修改为配置的内容/etc/httpd/conf/httpd.conf加入以下:
<Location /repos>
DAV svn
SVNParentPath /var/svn/repos
AuthType Basic
AuthName "Subversion realm"
AuthUserFile /var/svn/passwdfile
AuthzSVNAccessFile /var/svn/accessfile
Require valid-user
</Location>
http权限控制增加如下内容,以加强安全控制
<Directory "/var/www/html/svnmanager/">
AllowOverride None
Order deny,allow
Deny from all
Allow from all
</Directory>
在/var/svn目录下创建两个空文件passwdfile和accessfile和项目库的总目录repos。
执行下边的语句创建:
#touch /var/svn/passwdfile
#touch /var/svn/accessfile
#chown svn:svn /var/svn/passwdfile
#chown svn:svn /var/svn/accessfile
#mkdir /var/svn/repos
#chown -R svn:svn /var/svn/repos
配置svnmanager 根据自己实际路径配置
在/var/www/html/svnmanager/config.php文件中,配置相关信息,如下
$htpassword_cmd = "/usr/bin/htpasswd";
$svn_cmd = "/usr/bin/svn";
$svnadmin_cmd = "/usr/bin/svnadmin";
$svn_repos_loc = "/var/svn/repos";
$svn_passwd_file = "/var/svn/passwdfile";
$svn_access_file = "/var/svn/accessfile";
$smtp_server = "smtp.domain.org";
$dsn = "mysql://svnmanager:password@localhost/svn";
//Administrator account
$admin_name = "admin";
$admin_temp_password = "admin";
启动Apache、Mysql
打开http://127.0.0.1/svnmanager ,会自动建svn的数据表,在刷新后输入用户名称为admin,密码为admin.
切记的进入用建一个管理员帐号,因为admin一次后失效。
完了。
错误一:svn: Can't open file '/root/.subversion/server': 权限不够 (cmd: /usr/bin/svn list --non-interactive file:///var/www/repos/test )Command used: /usr/bin/svn list --non-interactive file:///var/www/repos/test
解决方法:在svnmanager的config.php中添加
$svn_config_dir='/tmp';
在UserPrivilegesEditPage.php 和GroupPrivilegesEditPage.php中的240行
$switches = array();替换为$switches = array('config_dir'=>$svn_config_dir);
错误一:svnmanager创建时 却是一个空目录 但没有报出任何错误!!!
解决方法:在svnmanager的config.php 修改$svnadmin_cmd ;例:$svnadmin_cmd = "/usr/bin/svnadmin --config-dir /tmp";
解决svnmanager的一些错误
a.如果增加用户时总提示邮件地址无效,则通过修改PHP文件解决:
vi /usr/local/apache2/htdocs/svnmanager/svnmanager/UserModule/AddPage.tpl
删除对邮件地址验证的行:
<com:TEmailAddressValidator ControlToValidate="Email" Display="Dynamic">Invalid e-mail address!</com:TEmailAddressValidator>
b.安装svnmanager之后,出现以下状况:
建立的版本库为空文件夹
在用户权限和组权限编辑时出现错误,
如:错误一:svn: Can't check path '/var/www/.subversion': 权限不够 (cmd: /usr/bin/svn list --non-interactive [url=file:///var/www/repos/test]file:///var/www/repos/test[/url])Command used: /usr/bin/svn list --non-interactive [url=file:///var/www/repos/test]file:///var/www/repos/test[/url]
错误二:Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /usr/local/apache2/htdocs/svnmanager/svnmanager/RepositoryModule/UserPrivilegesEditPage.php on line 223
解决方法:在svnmanager的config.php中添加
$svn_config_dir="/tmp";
$svnadmin_cmd="/usr/bin/svnadmin --config-dir /tmp";
将./svnmanager/RepositoryModule/
UserPrivilegesEditPage.php 的249行
和GroupPrivilegesEditPage.php中的243行
替换$switches=array();为$switches=array('config_dir'=>$svn_config_dir);