明日中秋节了,今晚去看了敢死队,也周末端回来就想起来把这周自个在公司服务器上搭建SVN的过程收拾一下。
http://www.nuoyapingtai.net 诺亚平台www.nuoyapingtai.net?
1.装置软件
apt-get install subversion
apt-get install apache2
apt-get install libapache2-svn
2.创立SVN库,最好运用root用户,不然其他的用户会引发一些权限疑问
mkdir /home/svn
3.创立项目
svnadmin /home/svn/project 此刻project下面会多出几个文件
[email protected]:/home/svn/project# ls -a
. .. conf db format hooks locks README.txt
然后进行读写授权
chmod -R 777 /home/svn/project 不然在代码提交的时分会呈现commit failed !can‘t open file ‘/home/fruits/svn/projects/code/testsvn/db/txn-current-lock‘!
4.cd conf
[email protected]:/home/svn/project# cd conf
[email protected]:/home/svn/project/conf# ls -a
. .. authz hooks-env.tmpl passwd svnserve.conf
5.开端修正装备文件
[email protected]:/home/svn/project/conf# vi authz
[aliases]
[groups] #用户分组
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin=pm,admin
test=test
[/] #组赋予读写权限的设置
@admin=rw
@test=r
还能够设置详细的目录权限
[/projectname/目录/子目录]
[email protected]:/home/svn/project/conf# vi svnserve.conf
[general]
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
anon-access = read
auth-access = write
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file‘s location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file‘s location is relative to the
### directory containing this file. The specified path may be a
### repository relative URL (^/) or an absolute file:// URL to a text
### file in a Subversion repository. If you don‘t specify an authz-db,
### no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz
7.然后即是修正passwd文件,直接即是在【user】进行username=password的格局显现暗码,假如你要支持http格局加密的拜访这儿暂时不必装备
htpasswd -c /home/svn/project/conf/passwd username 然后会让输入2次暗码
以后在进行增加用户的时分要去掉 -c 不然就会掩盖一切
例如:增加test
htpasswd /home/svn/project/conf/passwd test
test:$apr1$FIjm/2hw$WtCyafEOc9rqBsPAewWGl1 #这是加密以后的
假如进行修正暗码 这样操作也是能够的
8.装备apache
[email protected]:~# cd /etc/apache2/mods-available/
[email protected]:/etc/apache2/mods-available# vi dav_svn.conf
DAV svn
#SVNParentPath /home/svn
SVNPath /home/svn/project
ModMimeUsePathInfo on
AuthzSVNAccessFile /home/svn/project/conf/authz #
AuthzSVNAnonymous off
AuthzSVNNoAuthWhenAnonymousAllowed off
AuthType Basic
AuthName "Subversion"
AuthUserFile /home/svn/project/conf/passwd #
Require valid-user
9.假如要修正apache2端口
[email protected]:/etc/apache2# vi ports.conf
Listen 端口 #你想要的端口
Listen 443
Listen 443
10.假如你想修正SVN默许的端口
从头指定一个端口号(默许端口3690)比如修正为3691
svnserve -d –listen-port 3691 -r /home/svn/project
11.装备结束重启/etc/init.d/apache2 restart
12.说一下我在装备过程中遇到的疑问
第一个:发动apache2的时分遇到的
AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using localhost.localdomain. Set the ‘ServerName‘ directive globally to suppress this message
apache 发动呈现这种过错的解决方法:
将 apache2的装备文件httpd.conf中的 ServerName 改成可用域名或如下装备
ServerName localhost:80 端口 留意是不是有修正过端口
第二个:编码疑问
在装置ubuntu的时分选了中文,但后来发现SVN客户端需要utf8来支持中文。
所以修正 /etc/default/locale为:
LANG="en_US.UTF-8"
LANGUAGE="en_US:en"
可是,后来perl, locale,export LANG=en_US.UTF-8之类的指令都呈现warning:
> locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=C
解决办法:
locale-gen en_US.UTF-8
第三个疑问:提交代码的时分呈现的
增加:chmod -R 777 /home/svn/project
就写到这儿吧!也能够运用一键包装置挺简略的!下一篇即是,我上载的附件有我下载的一键包!