windows下安裝配置apache+svn+php+svnmanager

來源:互聯網
上載者:User

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.

      <Location /svn>
        DAV svn
        SVNPath your/repository/path
      </Location>

      <location /svn>
        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

      </location>

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

'svnmanager@smtp-server.net'.
      $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.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.