Below are some setup notes I have jotted down during my setup. May be this will be helpful to you also.
Setup in Gentoo Linux, as apache2 module
1. If you happens to have apache 2 already installed, setting up Subversion is easy:
# emerge subversion
But in case you are using apache 1.x, you can still go ahead and let portage to install apache 2 for you. There is nothing much harm (other than use more memory) to run both apache 1.x and 2.x together. All you need is just changing the port number apache 2.x is listening to.
2. Create directory for source repository: (you can use whatever directory)
#mkdir /var/repository
3. Create user account for svn:
#mkdir /var/svn/conf
#htpasswd2 -c /var/svn/conf/svnusers newusername
The second command create a new user "newusername" and store the a/c password info in /var/svn/conf/svnusers. The -c option is for file creation, if you are adding more users, you can simply go without this option.
4. To allow apache2 to load the corresponding svn modules, modify /etc/conf.d/apache2 to add "-D DAV -D SVN", e.g.:
APACHE2_OPTS="-D SSL -D PHP4 -D FASTCGI -D DEFAULT_VHOST -D DAV -D SVN"
5. Configure the modules config file /etc/apache2/modules.d/47_mod_dav_svn.conf (you may have number other than 47, depending on the portage maintainer). Assuming we use the password file and repository directory created previously, the file may look like this:
<IfDefine SVN>
<IfModule !mod_dav_svn.c>
LoadModule dav_svn_module modules/mod_dav_svn.so
</IfModule>
<Location /repos>
DAV svn
SVNPath /file2/repos
AuthType Basic
AuthName "WINS Subversion Repository"
AuthUserFile /var/svn/conf/svnusers
Require valid-user
</Location>
<IfDefine SVN_AUTHZ>
<IfModule !mod_authz_svn.c>
LoadModule authz_svn_module modules/mod_authz_svn.so
</IfModule>
</IfDefine>
</IfDefine>
6. Create your initial repository:
#svnadmin create /var/repository
Setup in Redhat, standalone server
For illustration purpose, this time, we run subversion for standalone version, and invoked through xinetd.
1. First step is also easy:
#rpm -Uvh subversion-XXXX.rpm
Just replace XXXX with the version currently available in your system.
2. Create a user for svn in your system. For security, you should set it's login shell to nologin.
3. Add 2 lines to /etc/services: (if they don't exist yet)
subversion 3690/tcp # Subversion
subversion 3690/udp # Subversion
4. Create a file /etc/xinetd.d/svn
# subversion server
service svn
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = svnuser
server = /usr/bin/svnserve
server_args = -i
}
5. Create your initial repository:
#mkdir /var/repository
#svnadmin create /var/repository
6. During initializing the repository directory, svn creates various directories and files. In particular, there is a config file svnserve.conf inside conf directory created. There are extensive comments inside the config file, with all example setting commented out because they are already set by default by svn. Anyway, you can customize them to your needs, e.g.:
[general]
anon-access = none
auth-access = write
password-db = passwd
realm = My Subversion Realm
The above disables anonymous access, and allow write access for authenticated user. Most importantly, it defines the password file for authentication as 'passwd'. Now in the same conf directory, create this file with following content:
[users]
wins=password1
user2=password2
Using subversion
The most important command to know first is help:
$svn help
To get help on a specific topic :
$svn help update
Import initial directory for a project:
For apache module:
$svn mkdir 'http://localhost/repos/NewProject' -m 'Creating new Project'
$svn import ./MyProject 'http://localhost/repos/NewProject/trunk' -m 'Import for 1st time'
Note that '/repos' is defined in Location directive in apache config.
For standalone version, use svn:// instead.
$svn mkdir 'svn://localhost/var/repository/NewProject' -m 'Creating new Project'
$svn import ./MyProject 'svn://localhost/var/repository/NewProject/trunk' -m 'Import for 1st time
Note that the '/var/repository' are actually a full path of the directory where you create for repository.
Before performing any commit, you need to perfrom an update first :
$cd ./Myproject
$svn update
To check your checked out source status :
svn status
The svn will also mark all non-version file inside your checkout directory as '?' status.
To ignore some files from subversion status cmd (or add/import), either set it globally in ~/.subversion/config :
[miscellany]
### Set global-ignores to a set of whitespace-delimited globs
### which Subversion will ignore in its 'status' output.
global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store *.class
or set it in svn cmd:
$cd WEB-INF
$svn propset svn:ignore "*" work/
(first arg is the wildcard pattern, second is the path)
to view back any prop set to a path:
$cd WEB-INF
$svn proplist work
To commit your changes:
$svn commit -m 'Some changes...'
No comments:
Post a Comment