window的svn客户端,上传文件到专门的svn服务器,再在另外一台上线的linux上检出并在其上进行项目的编译。
1.预备:在window端装有svn客户端;在linux系统上装有svn作为专门的svn服务器;在另一linux(装有apache、 php、mysql,运行网站)上装svn。
2.在CentOS6.8下搭建svn服务器
1)安装---# yum -y install subversion
2)创建svn版本库
mkdir -p /opt/svn/repos/svn1 ----创建目录
svnadmin create /opt/svn/repos/svn1 ----创建svn库
3)添加用户 # cd /opt/svn/repos/svn1/conf ---此目录下,会有passwd、authz、svnserve.conf文件
# vi passwd
[users]
# harry = harryssecret
# sally = sallyssecret
#
user1 = 123 #用户名user1 = 密码123
user2 = 123 #用户名user1 = 密码123
4)设置权限 # vi authz
[svn1:/]
user1 = rw ----读写权限
user2 = rw
5)取消些注释 # vi svnserve.conf
[general] anon-access = none #非授权用户无法访问 auth-access = write #授权用户有写权限 password-db = passwd #密码数据所在目录 authz-db = authz
6) 启动svn --#svnserve -d -r /opt/svn/repos/ #注意目录,不包含svn1ps aux | grep svnserve #查看服务是否启动7)测试SVN的服务器 svn://Ip1地址/svn1 (可能这里报错,继续下边操作)
7-1:查看进程--# ps -ef | grep svn
root 6435 0 15:25 ? 00:00:00 svnserve -d -r
/opt/svn/repos
root 675643 0 15:34 pts
/0
00:00:00
grep
svn
7-2:查看端口:# netstat -lntup
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 1680/svnserve tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1134/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1215/master tcp 0 0 :::22 :::* LISTEN 1134/sshd tcp 0 0 ::1:25 :::* LISTEN 1215/master
(注意上边的端口 3690)7-3 [root@bogon repos]# vi /etc/sysconfig/iptables ---在里边设置开启3690的端口重启防火墙 [root@bogon repos]# service iptables restart重新测试下svn服务器。至此。CentOS 上设置svn完毕。而运行的linux上的安装也一样接下来开始操作,从window上传文件到svn服务器,再在运行服务器上检出1.在window上创建个index.html文件测试,创建的文件要先svn加入,再svn提交;2。填上svn服务器上的仓库地址 -- http://svn:ip1地址/svn1 (之前创建的仓库),3、上传成功。然后在 linux上找到默认访问的文件夹。我的是在下边这 html下的index.php[root@bbs www]# pwd
/var/www
[root@bbs www]# cd html/
[root@bbs html]# ll
总用量 4
-rw-r--r--. 1 apache apache 21 5月 16 08:29 index.php
4.在html文件夹下 检出svn服务器上的index.html:[root@bbs html]# svn checkout 'svn://IP1地址 /svn1' . --此处结尾有加 . 小数点
认证领域: <svn://192.168.1.108:3690> 7f9b4e4c-f340-4a7f-a211-3aa9f0783c98
“root”的密码:
认证领域: <svn://192.168.1.108:3690> 7f9b4e4c-f340-4a7f-a211-3aa9f0783c98
用户名: user1
“user1”的密码: 123
5. ll下:[root@bbs html]# ll
-rw-r--r-- 1 root root 20 5月 17 07:43 index.html ---此为刚检出的文件
-rw-r--r--. 1 apache apache 21 5月 16 08:29 index.php
6.浏览器上访问下ip2。能显示出index.html的内容,表示成功。
GET。
当window上有文件svn上传到svn服务器,在ip2里头,对应的文件夹下,svn up ,既可更新到。