在linux上建立svn
四 22
要给公司的vps上面装svn,过程记在下面。如果访问不了,请检查iptables。
1.安装 subversion
yum install subversion2.安装 apache的svn模块(可选步骤)
yum install mod_dav_svn3.建立 svn仓库文件位置
mkdir /var/svn
4.建立 SVN库并修改/var/svn用户组和用户
svnadmin create /var/svn/repos/ chown -R apache.apache /var/svn
5.编辑配置
vi /var/svn/repos/conf/svnserve.conf
a.
把
#anon-access = read #auth-access = write
改为
anon-access = none
auth-access = writeb.
把
#password-db = passwd改为
password-db = passwd6.增加用户密码
vi /var/svn/repos/conf/passwd
如[users]
znjack = 123456!
7.与你的工作路径同步(可选)
把每次提交的文件都和/var/www/html同步,那样,就可以直接访问了
新建一个post-commit文件
vi /var/svn/repos/hooks/post-commit
写入以下内容:
#!/bin/sh export LANG=en_US.UTF-8 svn update /var/www/html –username znjack –password 123456!
并且
chmod 777 /var/www/html svn checkout svn://example.com/repos /var/www/html –username znjack –password 123456!
先在服务器端/var/www/html checkout以后,每次更新就能够向/var/www/html添加了
8.添加subversion服务为自行启动(可选)
vi /etc/rc.local
加入如下命令
#!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don’t # want to do the full Sys V style init stuff. touch /var/lock/subsys/local svnserve -d -r /var/svn/repos
9.设置 apache的svn配置文件(可选)
vi /etc/httpd/conf.d/subversion.conf
<Location /repos> DAV svn SVNParentPath /var/svn # # # Limit write permission to list of valid users. # <LimitExcept GET PROPFIND OPTIONS REPORT> # # Require SSL connection for password protection. # # SSLRequireSSL # # AuthType Basic # AuthName "Authorization Realm" # AuthUserFile /path/to/passwdfile # Require valid-user # </LimitExcept> </Location>
把对应的#号去掉,并修改路径,改为如上的。
10.重启svn服务
killall svnserve svnserve -d -r /var/svn/repos
11.建立project test
mkdir /tmp/test mkdir /var/svn/repos/test svn import /tmp/test file:///var/svn/repos/test -m "initial import"
12.第一次checkout
svn checkout svn://example.com/ /var/www/html
13.可以访问了
svn://example.com/test
http://example.com/test
以后 commit到数据仓库的代码,和服务器的/var/www/html里面的同步了
RSS
近期评论