一、先查看是否存在svn,沒有就須要安裝svnlinux
svnserve --version #查看svn版本號 which svn #查看svn程序所在目錄 yum install subversion -y #安裝svn systemctl cat svnserve.service #查看系統配置文件
二、修改svn全局配置文件中指向的目錄vim
三、建立svn版本庫tcp
sudo svnadmin create /opt/svn/topevery
四、修改authz、passwd、 svnserve.conf三個文件創建用戶組、用戶、目錄權限ide
authzsvn
[groups] manager=wilson dev=wilson01 [/] @manager=rw [/UI] @dev]
passwdspa
[users] # harry = harryssecret # sally = sallyssecret wilson=123 wilson01=1234
svnserve.conf3d
[general] anon-access = none auth-access = write password-db = passwd authz-db = authz realm = topevery [sasl]
五、編輯服務配置文件rest
在 /etc/init.d 目錄下,建立腳本 svndcode
touch svnd chmod u+x svnd
svnd文件內容以下server
#!/bin/sh # chkconfig: 2345 10 90 # description: svn server SVN_HOME=/opt/svn/topevery if [ ! -f "/usr/bin/svnserve" ] then echo "svnserver startup: cannot start" exit fi case "$1" in start) echo "Starting svnserve…" /usr/bin/svnserve -d --listen-port 3690 -r $SVN_HOME echo "Finished!" ;; stop) echo "Stoping svnserve…" killall svnserve echo "Finished!" ;; restart) $0 stop $0 start ;; *) echo "Usage: svn { start | stop | restart } " exit 1 esac
啓動svn
service svnd start
六、開放防火牆端口
firewall-cmd --zone=public --add-port=3690/tcp --permanent firewall-cmd --reload
netstat -ln | grep 3690
ps aux|grep svnserve
七、設置svn服務爲自啓動
chkconfig --add svnd
chkconfig svnd on
遇到的問題及解決方法
一、Can't open file '/opt/svn/topevery/db/txn-current-lock': Permission denied
關閉SELinux
[root@localhost ~]# getenforce Enforcing [root@localhost ~]# vim /etc/selinux/config 將SELINUX=enforcing改成SELINUX=disabled,保存後退出
二、