[1].Chuẩn bị:
- Disable Firewall và Selinux
- Update server
[2].Cài đặt httpd:
[root@svn-dev ~]#yum install httpd [root@svn-dev ~]#systemctl start httpd [root@svn-dev ~]#systemctl enable httpd [root@svn-dev ~]#vim /etc/httpd/conf/httpd.conf Sửa lại dòng 95=> ServerName 192.168.11.180:80[3]. Cài đặt SVN và mod_dav_svn module:
[root@svn-dev ~]#yum install subversion mod_dav_svn[4].Cấu hình SVN configuration file:
[root@svn-dev ~]#vim /etc/httpd/conf.modules.d/10-subversion.conf LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so DAV svn SVNParentPath /var/www/svn Satisfy Any AuthType Basic AuthName "SVN Authentication" AuthUserFile /etc/svn-auth-accounts AuthzSVNAccessFile /etc/svn-auth-file SVNPathAuthz On Require valid-user Order allow,deny Allow from all[5]. Tạo SVN repo:
[root@svn-dev ~]#mkdir /var/www/svn [root@svn-dev ~]#cd /var/www/svn [root@svn-dev svn]#svnadmin create nhaccuatuitv [root@svn-dev svn]#chown -R apache:apache nhaccuatuitv [root@svn-dev svn]#chcon -R -t httpd_sys_content_t /var/www/svn/nhaccuatuitv/ [root@svn-dev svn]#chcon -R -t httpd_sys_rw_content_t /var/www/svn/nhaccuatuitv/[6].Tạo user SVN:
[root@svn-dev svn]#htpasswd -cm /etc/svn-auth-accounts quocha => nct@1234 [root@svn-dev svn]#htpasswd -m /etc/svn-auth-accounts cuongpt => nct@12345[7]. Add quyền cho user:
[root@svn-dev svn]# cp nhaccuatuitv/conf/authz /etc/svn-auth-file [root@svn-dev svn]#vim /etc/svn-auth-file [groups] admin=cuongpt repo1_user=quocha repo1_trainee=user003_no [/] @admin=rw [nhaccuatuitv:/] @repo1_user=rw [repo2:/] @repo1_trainee=rw [root@svn-dev svn]# systemctl restart httpd.service[8].Checkout SVN trên Windows: trên google đầy
[9].Checkout trên SVN Server:
[root@svn-dev ~]#mkdir -p /home/nhaccuatuitv/
[root@svn-dev ~]#svn co http://192.168.11.180/svn/nhaccuatuitv/ /home/nhaccuatuitv/ --username quocha
=> nhập pass và kiểm tra file
[10] More, Tạo crontab cho checkout
#vim /home/Notes/scripts/svn-co.sh svn co --username quocha --password nct@1234 http://192.168.11.180/svn/nhaccuatuitv/ /home/nhaccuatuitv/ [root@svn-dev scripts]# chmod +x svn-co.shCrontab cho 1 phut check out
#crontab -e * * * * * /home/Notes/scripts/svn-co.sh >/dev/null 2>&1