windows下安装配置apache+svn+php+svnmanager
一、下载所需的软件
Apache: http://www.apache.org
Subversion: http://subversion.tigris.org
PHP: http://www.php.net
PHP pear (with VersionControl_SVN): http://pear.php.net
SVNManager http://svnmanager.sourceforge.net/
二、安装配置软件
1、安装apache2
2、安装Subversion,然后进行如下配置:
1). Copy bin/mod_dav_svn.so and bin/mod_authz_svn.so to the Apache modules directory.
2). Add the Subversion/bin directory to the SYSTEM PATH and reboot so all the Subversion support dll's are visible to the Apache service.
3). Edit the Apache configuration file (httpd.conf) and make the following changes:
3a. Uncomment the following two lines:
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_module modules/mod_dav.so
3b. Add the following two lines to the end of the LoadModule section:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
3c. Add the following to end of the file. Note: This Location directive is a
minimal example with no authentication directives. For other options,
especially authentication options, see the Subversion INSTALL file,
the Subversion Book, or the TortoiseSVN Manual.
DAV svn
SVNPath your/repository/path
DAV svn
#Repository Folders Location (make sure this folder exists
#and keep location in mind)
SVNPath /srv/svn/repos
AuthType Basic
AuthName "Restricted Access"
#File will be created by SVNManager, keep location in mind!
AuthUserFile /srv/svn/htpasswd
Require valid-user
#SSLRequireSSL
#File will be created by SVNManager, keep location in mind
AuthzSVNAccessFile /srv/svn/accessfile
3、安装PHP(注意:用apache2作web server,需要下载安装PHP的thread safe版本;安装时如果用的是SQLite作数据库,那么在安装时要选上SQLite扩展),并进行如下配置:
1).You need to insert the following lines into your Apache httpd.conf configuration file to load the PHP module for Apache 2.x:
#
LoadModule php5_module "c:/php/php5apache2.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"
4、安装VersionControl_SVN
安装VersionControl_SVN之前要先安装pear:到php安装目录下找到go-pear.bat,运行它,安装过程中一路 Enter即可,然后双击php目录下生成的PEAR_ENV.reg将注册信息写入注册表。然后cmd到php安装目录下,输入命令:pear install --alldeps VersionControl_SVN 进行自动安装。或者直接到http://pear.php.net/package/VersionControl_SVN/download/All和http: //pear.php.net/package/XML_Parser/download/All分别下载得到得到 VersionControl_SVN-0.3.1.tgz和XML_Parser-1.3.2.tgz,然后将这两个文件复制到php安装目录下,cmd到php安装目录下先后输入命令pear install XML_Parser-1.3.2.tgz和pear install VersionControl_SVN-0.3.1.tgz进行安装。我选择的是后者。
5. 安装SVNManager
Finally, you will have to download and install the SVNManager package and copy the contents to your web directory (defined in your Apache configuration by
the 'DocumentRoot' tag). You'll have to make changes to the config.php configuration file. First make a copy of config.php.linux or config.php.win to start
with and open the file in your favorite editor.
* Specify the locale settings. You can get a list of available options when you enter 'locale -a' in a terminal window.
$lang = "en_US.UTF-8";
* Specify the locations of the needed shell commands: 'htpasswd' or 'htpasswd2', 'svn' and 'svnadmin'. One can locate such files with the command
'whereis', e.g. (in a terminal window) 'whereis htpasswd'.
$htpassword_cmd = "/usr/bin/htpasswd";
$svn_cmd = "/usr/bin/svn";
$svnadmin_cmd = "/usr/bin/svnadmin";
* Specify a Subversion config dir, where the Subversion tools will store configuration data. Next, specify the locations of the repository directory and
the config files, as previously configured in Apache. You have to make these locations manual: 'mkdir /srv/svnconfig /srv/svn/repos'. If you please, you
could make empty files for the htpasswd and access file: 'touch /srv/svn/htpasswd /srv/svn/accessfile'. Important: you must give ownership to these files and
directories to the user than runs Apache, e.g. 'www-data', by calling 'chown -R www-data.www-data /srv/svnconfig /srv/svn'.
$svn_config_dir = "/srv/svnconfig";
$svn_repos_loc = "/srv/svn/repos";
$svn_passwd_file = "/srv/svn/htpasswd";
$svn_access_file = "/srv/svn/accessfile";
* Although dangerous, SVNManager has the option to delete repositories remotely. To reduce danger and have an extra catch for your users, you can specify
a trash folder location. Then, repositories will not be deleted but moved to the specified location. If you don't specify this, repositories will be removed
for ever! Just as the repository location, you should make this directory yourself: 'mkdir /srv/svn/trash;chown www-data.www-data /srv/svn/trash'.
$svn_trash_loc = "/srv/svn/trash";
* Although not specified (and not recommend), SVNManager can also generate svnserve user files. This requires usernames and password to be stored in
plain text. If you don't specify this option, this will not happen. From the moment you configure this option, SVNManager starts storing username and
password in plain text, and will generate a svnserver password file at the specified location.
$svnserve_user_file="";
* Next, you must configure a smpt server. This is necessary for the email-invitation function of SVNManager. SVNManger will send email from
'[email protected]'.
$smtp_server = "smtp-server.net";
* Another important configuration option is the Data Source Name of the database that is going to be used with SVNManager. As explained, SVNManager will
try to create tables at first startup. This has been tested with SQLite and MySQL databases. When you specify a SQLite database, it is wise to store it
somewhere outside the document root folder, or make sure that Apache can't read the specified location (e.g. by means of a .htaccess file containing 'deny
from all'):
$dsn = "sqlite://svnmanager/svnmanager.db";
Make sure that this location is NOT accessible from the outside (test this)!! This can happen when you choose the example location and Apache is
configured to ignore .htaccess files.
An MySQL example, according to the example database, with PHP's mysqli module:
$dsn = "mysqli://svnmanager:secret@localhost/svnmanager";
* Because the database starts empty, you'll have to specify an Administrator username and password to begin with. As soon as you have created an admin
account in SVNManager, this configured account will not work anymore.
$admin_name = "admin";
$admin_temp_password = "admin";
* For more advanced configurations, it is possible to define a script that will be executed after the creation of a repository. You can use such a script
to setup hooks or additional repository functionality. This script will get the absolute location of the new repository as parameter. When this configuration
string is not specified, nothing will happen.
$post_create_script = "newrepo-script";
After configuring, you can start SVNManager by opening the specified location in a web-browser. The first time you'll start SVNManager the database tables
will be created. The second time you can login by means of the configured credentials. Please start with creating a safe new administrator account, and re-
login into that new account.