• SVN – Apache subversion


    SVN – Apache subversion

    SVN – Subversion is a versioning and revision control system used by developers to track and keep up earlier versions of their source codes.

    In this article we can see how to setup svn server on centos 6.

    Lets start ,

    Install svn server on centos 6

    Update yum repositories and packages by typing the below command

    [root@krizna ~]# yum update

    Before installing SVN packages, you must install and configure apache ( Webserver ) .

    Install and configure apache

    Step 1 » Type the below command to install apache along with dependencies.

    [root@krizna ~]# yum install httpd

    Step 2 » Open the file /etc/httpd/conf/httpd.conf .
    Find “#ServerName www.example.com:80″ (line no : 276 ) .

    #

    #ServerName www.example.com:80

    and add this line below . “ServerName youripaddress:80″

    #

    #ServerName www.example.com:80

    ServerName 192.168.1.2:80

    Step 3 » Issue the below command to start apache service .

    [root@krizna ~]# service httpd start


    and type this below command to start apache service automatically while booting.

    /*The chkconfig command can also be used to activate and deactivate services.*/

    /*A runlevel defines the state of the machine after boot. */

    [root@krizna ~]# chkconfig --levels 235 httpd on

    Now open your server ip address in the browser . you can see the apache test page.
    If you not able to see the apache test page, Disable the firewall ( iptables ) and selinux service on your server .
    Disable firewall ( Iptables ) »

    /* iptables -- administration tool for IPv4 packet filtering and NAT. */

    /* NSA Security-Enhanced Linux (SELinux) is an implementation of a flexible mandatory access control architecture in the Linux operation system. */

    [root@krizna ~]# service iptables stop

    [root@krizna ~]# chkconfig iptables off

    Disable Selinux » open the file /etc/selinux/config and find the line

    SELINUX=enforcing

    and replace with

    SELINUX=disabled

    now reboot the server and try again.

    /* mod_dav is an Apache module to provide WebDAV capabilities (RFC 2518) for your Apache web server. There are some disadvantages of using Apache's http for your Subversion server:
    It's slowerIt's harder to setupThen, there are advantages:
    It uses a standard port (80) that's not normally blocked by firewalls.It can be integrated with LDAP and Active DirectoryYou can use HTTPS which will encrypt updates and checkouts (including user passwords).You can have multiple repositories use the same Apache httpd instance. With svnserve, you can only do a single repository per instance and if you have multiple repositories on one system, you'll have to run each svnserve process on a non-standard port.You can run svnserve as a standalone server process (for clients that are using the svn:// access method);The svnserve program is a lightweight server, capable of speaking to clients over TCP/IP using a custom, stateful protocol. Clients contact an svnserve server by using URLs that begin with the svn:// or svn+ssh:// scheme. */

    Install and configure svn server

    Step 4 » Now start installing svn packages, Just type the below command .

    /* Install needed packages (mod_dav_svn and subversion) */

    [root@krizna ~]# yum install subversion mod_dav_svn

    Step 5 » Now create new directory for svn repository.

    [root@krizna ~]# mkdir /svn

    Step 6 » Create a new repository in the svn by issuing the below command

    /* Create a new, empty repository at the path provided. If the provided directory does not exist, it will be created for you. */

    [root@krizna ~]# svnadmin create /svn/newrep

    Step 7 » Now issue the below commands one by one for necessary permissions.

    /* chown changes the user and/or group ownership of each given file. If only an owner (a user name or numeric user ID) is given, that user is made the owner of each given file, and the files' group is not changed. 

    -R: operate on files and directories recursively. */

    [root@krizna ~]# chown -R apache.apache /svn/newrep/

    /*The chcon command changes the SELinux context for files.

    Run the chcon -R -t type directory-name command to change the type of the directory and its contents, where type is a type, such as httpd_sys_content_t, and directory-name is a directory name.
    The security context is comprised of four fields: user, role, type, and level. All fields are required, except for the level.*/

    [root@krizna ~]# chcon -h system_u:object_r:httpd_sys_content_t /svn/newrep/

    [root@krizna ~]# chcon -R -h apache:object_r:httpd_sys_content_t /svn/newrep/


    Step 8 » Now create a password file “newrep.users” with username “krizna” by typing below command

    /* htpasswd is used to create and update the flat-files used to store usernames and password for basic authentication of HTTP users.
    -c:Create the passwdfile. If passwdfile already exists, it is rewritten and truncated.
    -m:Use MD5 encryption for passwords. */

    [root@krizna ~]# htpasswd -cm /svn/newrep.users krizna

    /* The first time you run htpasswd command, use "-c" option, which will create an initial SVN password file. For subsequent runs of htpasswd command, do not use "-c" option.*/

    $ sudo htpasswd -cm /etc/svn-auth-users user1
    New password:
    Re-type new password:
    Adding password for user user1
    $ sudo htpasswd -m /etc/svn-auth-users user2
    $ sudo htpasswd -m /etc/svn-auth-users user3

    /* The location is what Apache will pass in the URL bar. For instance: http://yourmachine/repos points to the SVNPath that you have specified. */
    Step 9 » Now open the SVN apache config file ( /etc/httpd/conf.d/subversion.conf ) and add the below lines at the end of the file .

    <location /repos>
    DAV svn
    # SVN path
    SVNParentPath /svn
    AuthType Basic
    AuthName "Authorization Realm"
    #password file path
    AuthUserFile /svn/newrep.users
    Require valid-user
    </location>

    Step 10 » Restart apache service

    [root@krizna ~]# service httpd restart


    Step 11 » Now open your svn path http://yourserverip/repos/newrep in a browser( Ex: http://192.168.1.2/repos/newrep ) . you can see newrep revision page after typing username and password created (step 8).
    Step 12 » Create basic repository structure with the below commands

    [root@krizna ~]# mkdir -p /tmp/svn/{trunk,branches,tags}

    [root@krizna ~]# svn import -m 'Initializing basic repository structure' /tmp/svn/ http://localhost/repos/newrep/

  • 相关阅读:
    Linux-Oracle 安装配置步骤
    lombok 安装
    request (请求对象)
    response (响应对象)
    ServletContext (上下文对象)
    JavaWeb数据库配置
    HttpServlet
    博客园代码字体大小
    博客园背景美化
    用PHP实现反向代理服务器
  • 原文地址:https://www.cnblogs.com/qike/p/4666130.html
Copyright © 2020-2023  润新知