warning: Can’t open file ‘/root/.subversion/servers’ …

Standard

我们用PHP写了个Release界面用来做svn up及rsync操作,之前运行正常,今早发现报错如下:
warning: Can’t open file ‘/root/.subversion/servers’: Permission denied

解决方法:
因为php以apache用户运行,所以最简单的办法就是直接把config-dir放到apache目录下
svn status –config-dir /etc/apache/.subversion;
svn info –config-dir /etc/apache/.subversion;

编译安装LAMP+SVN+Trac+Memcached

Standard
##
## 转载请注明出处: http://yemaosheng.com
##
 
## 环境:Dell1950  CentOS5.3 x86
 
## 新建软件安装目录
 
mkdir /home/lib
mkdir /home/apache
mkdir /home/mysql
mkdir /home/memcached
mkdir /home/php
mkdir /home/svn
mkdir /home/trac
 
## 安装依赖包
 
# gettext-devel
yum install -y gettext-devel.x86_64
 
# zlib
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/home/lib/zlib
make
make install
cd ..
 
# openssl
tar zxvf openssl-0.9.8g.tar.gz
cd openssl-0.9.8g
./config \
	--prefix=/home/lib/openssl \
	--openssldir=/home/lib/openssl \
	--with-zlib-lib=/home/lib/zlib/lib \
	--with-zlib-include=/home/lib/zlib/include \
	shared \
	zlib \
	threads 
make
make test
make install
echo "/home/lib/openssl/lib" >> /etc/ld.so.conf.d/openssl.conf
ldconfig
cd ..
 
# apr
tar zxvf apr-1.3.5.tar.gz
cd apr-1.3.5
./configure --prefix=/home/lib/apr
make
make install
cd ..
 
# apr-util
tar zxvf apr-util-1.3.7.tar.gz
cd apr-util-1.3.7
./configure \
	--prefix=/home/lib/apr-util \
	--with-apr=/home/lib/apr
make
make install
cd ..
 
## 安装Apache
 
rm -rf /usr/lib/libexpat.so
ln -s /usr/lib64/libexpat.so /usr/lib/
tar zxvf httpd-2.2.11.tar.gz
cd httpd-2.2.11
./configure \
	--prefix=/home/apache \
	--enable-track-vars \
	--enable-rewrite \
	--enable-proxy \
	--enable-proxy-http  \
	--enable-cache \
	--enable-disk-cache \
	--enable-mem-cache \
	--enable-so \
	--enable-ssl \
	--enable-mods-shared=all \
	--enable-rewrite=shared \
	--enable-proxy=shared \
	--enable-proxy-http=shared \
	--with-mpm=worker \
	--sysconfdir=/home/apache/conf \
	--with-ssl=/home/lib/openssl \
	--with-z-dir=/home/lib/zlib \
	--with-apr=/home/lib/apr \
	--with-apr-util=/home/lib/apr-util \
	--with-perl 
make 
make install
cd ..
 
mv /etc/init.d/httpd /etc/init.d/httpd.bak
cp /home/apache/bin/apachectl /etc/init.d/httpd
chmod +x /etc/init.d/httpd
 
## 安装依赖包
 
# icon
tar zxvf libiconv-1.12.tar.gz
cd libiconv-1.12
./configure --prefix=/home/lib/iconv
make
make install
cd ..
 
# libpng
tar jxvf libpng-1.2.23.tar.bz2   
cd libpng-1.2.23
env \
	CPPFLAGS="-I/home/lib/zlib/include" \
	LDFLAGS="-L/home/lib/zlib/lib" \
	./configure \
	--prefix=/home/lib/libpng
make
make check 
make install
cd ..
 
# curl
tar zxvf curl-7.19.5.tar.gz
cd curl-7.19.5
./configure --prefix=/home/lib/curl
make
make install
cd ..
 
# freetype
tar jxvf freetype-2.3.5.tar.bz2 
cd freetype-2.3.5
env \
	CPPFLAGS="-I/home/lib/zlib/include" \
	LDFLAGS="-L/home/lib/zlib/lib" \
	./configure \
	--prefix=/home/lib/freetype2
make
make install
cd ..
 
# jpeg
mkdir -p \
	/home/lib/jpeg6/bin \
	/home/lib/jpeg6/lib \
	/home/lib/jpeg6/include \
	/home/lib/jpeg6/man1 \
	/home/lib/jpeg6/man/man1 
 
tar zxvf jpegsrc.v6b.tar.gz    
cd jpeg-6b
./configure \
	--prefix=/home/lib/jpeg6 \
	--enable-shared --enable-static
make
make install-lib  
make install
cd ..
 
# libxml
tar -zxvf libxml2-2.6.30.tar.gz
cd libxml2-2.6.30
./configure \
	--prefix=/home/lib/libxml2 \
	--with-zlib=/home/lib/zlib
make
make install
cd ..
 
# gd
tar -jvxf gd-2.0.35.tar.bz2
cd gd-2.0.35 
./configure \
	--prefix=/home/lib/gd2 \
	--with-freetype=/home/lib/freetype2 \
	--with-png=/home/lib/libpng \
	--with-jpeg=/home/lib/jpeg6 \
	CPPFLAGS="-I/home/lib/zlib/include" \
	LDFLAGS="-L/home/lib/zlib/lib"
make
make install 
cd ..
 
## 安装Mysql
 
groupadd mysql
useradd -g mysql mysql
tar zxvf mysql-5.1.34.tar.gz
cd mysql-5.1.34
./configure \
	--prefix=/home/mysql \
	--enable-assembler \
	--without-debug \
	--with-mysqld-ldflags=-all-static \
	--with-charset=utf8 \
	--with-extra-charsets=all \
	--with-innodb \
	--with-unix-socket-path=/home/mysql/mysql.sock \
	--enable-thread-safe-client \
	--with-mysqld-user=mysql
make
make install
cd ..
cp /home/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld 
if [ -f my.cnf.slave ]; then mv my.cnf.slave /etc/my.cnf; else mv my.cnf.mast /etc/my.cnf; fi; mkdir -p /data/mysqllog/binlog /data/mysqllog/relaylog ; chown mysql.0 /data/mysqllog/binlog /data/mysqllog/relaylog  /home/mysql; cp /home/mysql/share/mysql/mysql.server /etc/init.d/mysqld ; /home/mysql/bin/mysql_install_db --user=mysql; /etc/init.d/mysqld start
 
## 安装PHP
 
tar zxvf php-5.2.9.tar.gz
cd php-5.2.9
./configure \
	--prefix=/home/php \
	--with-zlib=/home/lib/zlib \
	--with-zlib-dir=/home/lib/zlib \
	--with-apxs2=/home/apache/bin/apxs \
	--with-mysql=/home/mysql \
	--with-mysql-sock=/home/mysql \
	--with-pdo-mysql=/home/mysql \
	--with-libxml-dir=/home/lib/libxml2 \
	--with-gd=/home/lib/gd2 \
	--with-jpeg-dir=/home/lib/jpeg6 \
	--with-png-dir=/home/lib/libpng \
	--with-freetype-dir=/home/lib/freetype2 \
	--with-libxml-dir=/home/lib/libxml2 \
	--with-openssl=/home/lib/openssl \
	--with-iconv-dir=/home/lib/iconv \
	--with-curl=/home/lib/curl \
	--with-ttf \
	--with-gettext \
	--enable-gd-native-ttf \
	--enable-mbstring \
	--enable-xml \
	--enable-pcntl \
	--enable-soap \
	--enable-sockets \
	--enable-zip \
	--with-bz2 \
	--disable-debug 
 
make
make install
cp php.ini-dist /home/php/lib/php.ini 
cd ..
 
## 安装PHP扩展
 
# memcached
tar zxvf memcache-2.2.1.tgz
cd memcache-2.2.1
/home/php/bin/phpize
./configure --with-php-config=/home/php/bin/php-config --enable-memcach
make 
make install
cd ..
 
# APC
tar zxvf APC-3.0.19.tgz 
cd APC-3.0.19
/home/php/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-apxs=/home/apache/bin/apxs --with-php-config=/home/php/bin/php-config 
make
make install
cd ..
 
# xdebug
tar zxvf xdebug-2.0.4.tgz
cd xdebug-2.0.4
/home/php/bin/phpize
./configure --enable-xdebug --with-php-config=/home/php/bin/php-config
make
make install
cd ..
 
sed -i 's#extension_dir = "./"#extension_dir = "/home/php/lib/php/extensions/no-debug-zts-20060613/"\n\nextension = "memcache.so"\nextension = "apc.so"\nextension = "xdebug.so"#' /home/php/lib/php.ini
sed -i 's#expose_php = On#expose_php = Off#' /home/php/lib/php.ini
 
#xdebug.auto_trace=on 监测函数调用过程
#xdebug.collect_params=on 收集函数参数
#xdebug.collect_return=on 收集函数返回值
#xdebug.profiler_enable=on 效能监测器
#xdebug.trace_output_dir="/tmp" 函数调用监测信息的输出文件的路径
#debug.profiler_output_dir="/tmp" 效能监测信息输出文件的路径
#sed -i 's#extension = "xdebug.so"#xdebug.auto_trace=on\nxdebug.collect_params=on\nxdebug.collect_return=on\nxdebug.profiler_enable=on\nxdebug.trace_output_dir="/tmp"\ndebug.profiler_output_dir="/tmp"#' /home/php/lib/php.ini
 
 
sed -i 's#DirectoryIndex index.html#DirectoryIndex index.html index.php#' /home/apache/conf/httpd.conf
sed -i 's#TypesConfig conf/mime.types#TypesConfig conf/mime.types\nAddType application/x-httpd-php .php#' /home/apache/conf/httpd.conf
 
tar zxvf phpmyadmin.tar.gz
mv phpmyadmin /home/apache/htdocs/
 
## 安装memcached
tar zxvf libevent-1.4.10-stable.tar.gz 
cd libevent-1.4.10-stable
./configure --prefix=/home/lib/libevent
make
make install
cd ..
 
tar zxvf memcached-1.2.8.tar.gz
cd memcached-1.2.8
./configure \
	--prefix=/home/memcached \
	--with-libevent=/home/lib/libevent \
	--enable-64bit
make
make install
ln -s /home/lib/libevent/lib/libevent-1.4.so.2 /usr/lib64/libevent-1.4.so.2
/home/memcached/bin/memcached -l 127.0.0.1 -d -p 11211 -u nobody -m 128
cd ..
 
## 安装SVN
tar zxvf subversion-1.6.2.tar.gz
tar zxvf subversion-deps-1.6.2.tar.gz
tar zxvf sqlite-amalgamation-3.6.14.2.tar.gz
 
cd subversion-1.6.2
./configure \
	--prefix=/home/svn \
	--with-apxs=/home/apache/bin/apxs \
	--enable-maintainer-mode
 
make
make install
 
make swig-py
make install-swig-py 
 
cd ..
 
echo /home/svn/lib/svn-python > /usr/lib/python2.4/site-packages/subversion.pth
 
# Create SVN Repo
mkdir /srv/svn
mkdir /srv/trac
 
/home/svn/bin/svnadmin create /srv/svn/project
 
touch /srv/svn/project.htpasswd
htpasswd -m /srv/svn/project.htpasswd svnroot
echo -e "<Location /svn>\nDAV svn\nSVNParentPath /srv/svn\nAuthType Basic\nAuthName \"project Repository\"\nAuthzSVNAccessFile /srv/svn/svn-acl-conf\nAuthUserFile /srv/svn/project.htpasswd\nRequire valid-user\n</Location>" >> /home/apache/conf/httpd.conf
echo -e "[project:/]\nsvnroot =  rw" >> /srv/svn/svn-acl-conf
 
## 安装Trac
yum install flex
tar zxvf mod_python-3.3.1.tgz
cd mod_python-3.3.1
./configure \
	--with-apxs=/home/apache/bin/apxs \
	--with-python=/usr/bin/python2.4 \
	--with-max-locks=32
make
make install_dso
make install_py_lib
cd ..
 
yum install -y python-setuptools
rpm -i clearsilver-0.10.4-1.el5.rf.i386.rpm
rpm -i python-clearsilver-0.10.4-1.el5.rf.i386.rpm
 
tar zxvf Trac-0.11.4.tar.gz
cd Trac-0.11.4
python setup.py build && python setup.py install
 
# vi /home/apache/conf/httpd.conf
# Add: LoadModule python_module modules/mod_python.so
 
trac-admin /srv/trac/project initenv
sed -i 's#php_path = php#php_path = /home/php/bin/php#' /srv/trac/project/conf/trac.ini
# vi /srv/trac/project/conf/trac.ini 在 [mimeviewer] 后加上 pygments_default_style = trac 修改[trac] default_charset = utf-8
 
chown -R apache.apache /srv/svn/project
chown -R apache.apache /srv/trac/project
 
# 生成trac的用户名密码
touch /srv/trac/project.htpasswd
htpasswd -m /srv/trac/project.htpasswd tracroot
# 生成tracroot用户的权限
trac-admin /srv/trac/project permission add tracroot TRAC_ADMIN
 
echo -e "<Location /trac/project>\nSetHandler mod_python\nPythonHandler trac.web.modpython_frontend\nPythonOption TracEnv /srv/trac/project\nPythonOption TracUriRoot /trac/project\n</Location>\n<Location "/trac/project/login">\nAuthType Basic\nAuthName \"trac\"\nAuthUserFile /srv/trac/project.htpasswd\nRequire valid-user\n</Location>" >> /home/apache/conf/httpd.conf
 
/etc/init.d/httpd restart
 
## OK
 
http://127.0.0.1/svn/project
http://127.0.0.1/trac/project
memcached: telnet 127.0.0.1 11211
 
/home/lib (关联库)
/home/apache  (2.2.11)
/home/mysql  (5.1.34)
/home/php  (5.2.9)
/home/memcached  (1.2.8)
/home/svn  (1.6.2)
/home/trac  (0.11.4)

yum安装svn+trac+apache

Standard
#
# 转载请注明出处: http://yemaosheng.com
# 将以下代码直接贴到命令行中运行即可
#
 
#改用国内的yum源
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.save
wget http://centos.ustc.edu.cn/CentOS-Base.repo
sed -i 's#gpgcheck=1#gpgcheck=0#' CentOS-Base.repo
 
#安装subversion及apache和python的相应模块
yum install -y subversion mod_dav_svn mod_python python-setuptools
 
#下载安装python模板clearsilver
wget http://dag.wieers.com/rpm/packages/clearsilver/clearsilver-0.10.4-1.el5.rf.i386.rpm
rpm -i clearsilver-0.10.4-1.el5.rf.i386.rpm
wget http://dag.wieers.com/rpm/packages/clearsilver/python-clearsilver-0.10.4-1.el5.rf.i386.rpm
rpm -i python-clearsilver-0.10.4-1.el5.rf.i386.rpm
 
#建svn及trac目录
mkdir /srv/svn
mkdir /srv/trac/
 
#安装Trac
wget http://ftp.edgewall.com/pub/trac/Trac-0.11.4.tar.gz
tar zxvf Trac-0.11.4.tar.gz
cd Trac-0.11.4
python setup.py build && python setup.py install
 
#新建svn项目
svnadmin create /srv/svn/project
#新建trac项目
trac-admin /srv/trac/project initenv
#按提示操作,`Path to repository` is: /srv/svn/project
 
#改文件所属为apache
chown -R apache.apache /srv/svn/project
chown -R apache.apache /srv/trac/project
 
#新建svn的apache配置文件
echo -e "<Location /svn/project>\nDAV svn\nSVNPath /srv/svn/project\nAuthType Basic\nAuthName \"project Repository\"\nAuthzSVNAccessFile /srv/svn/svn-acl-conf\nAuthUserFile /srv/svn/project.htpasswd\nRequire valid-user\n</Location>" >> /etc/httpd/conf.d/subversion.conf
#生成svn的用户名密码
touch /srv/svn/project.htpasswd
htpasswd -m /srv/svn/project.htpasswd svnroot
#生成svn用户所对应的acl权限
echo -e "[project:/]\nsvnroot =  rw" >> /srv/svn/svn-acl-conf
echo -e "<Location /trac/project>\nSetHandler mod_python\nPythonHandler trac.web.modpython_frontend\nPythonOption TracEnv /srv/trac/project\nPythonOption TracUriRoot /trac/project\n</Location>\n<Location "/trac/project/login">\nAuthType Basic\nAuthName \"trac\"\nAuthUserFile /srv/trac/project.htpasswd\nRequire valid-user\n</Location>" >> /etc/httpd/conf.d/trac.conf
 
#生成trac的用户名密码
touch /srv/trac/project.htpasswd
htpasswd -m /srv/trac/project.htpasswd tracroot
#生成tracroot用户的权限
trac-admin /srv/trac/project permission add tracroot TRAC_ADMIN
 
#重启apache
service httpd restart
 
#SVN: http://127.0.0.1/svn/project/
#Trac: http://127.0.0.1/trac/project/

备份脚本

#!/bin/sh
svnadmin hotcopy /srv/svn/project /srv/svn_bak/project/
cd /srv/svn_bak
tar -zcvf /srv/svn_bak/project_svn_.`date +%Y-%m-%d_%T`.tar.gz project/
rm -rf /srv/svn_bak/project/
 
trac-admin /srv/trac/project hotcopy /srv/trac_bak/project/
cd /srv/trac_bak
tar -zcvf /srv/trac_bak/project_trac_.`date +%Y-%m-%d_%T`.tar.gz project/
rm -rf /srv/trac_bak/project/

svn+trac install for window

Standard

下载地址:
http://www.python.org/download/
Python 2.6.2 Windows installer
http://genshi.edgewall.org/wiki/Download
Genshi-0.5.1.win32-py2.6.exe
http://oss.itsystementwicklung.de/trac/pysqlite/
pysqlite-2.5.5.win32-py2.6.exe
http://trac.edgewall.org/wiki/TracDownload
Trac-0.11.4.win32.exe
http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100
Setup-Subversion-1.6.2.msi
svn-python-1.6.1.win32-py2.6.exe
http://trac.edgewall.org/wiki/TracOnWindows#Setuptools
ez_setup.py
setuptools-0.6c9-py2.6.egg
python ez_setup.py setuptools-0.6c9-py2.6.egg #这一步很重要,否则trac-admin操作时会报错

安装步骤:
X、apache2.2.11
O、Python 2.6.2
O、Genshi-0.5.1.win32-py2.6
O、pysqlite-2.5.5.win32-py2.6.exe
X、MySQL-python-1.2.2.win32-py2.6.exe
O、Subversion-1.6.2
O、svn-python-1.6.1.win32-py2.6
X、mysql-5.1.34-win32
O、Trac-0.11.4.win32
O、python ez_setup.py setuptools-0.6c9-py2.6.egg

SVN:
svnadmin create c:\svn_repo\mytest
Trac:
trac-admin c:/trac/mytest initenv #按提示输入
tracd -p 8080 d:/trac/mytest #在8080端口上单项目运行
现在可访问 http://127.0.0.1:8080/ 进行管理

#因未找到py2.6 for apache2.2.x的mod_python.so 所以还没配apache
#py2.5的话在下面步骤中应该没什么问题

#http://httpd.apache.org/download.cgi
#apache_2.2.11-win32-x86-openssl-0.9.8i.msi
#http://home.netimperia.com/files/misc/MySQL-python-1.2.2.win32-py2.6.exe
#MySQL-python-1.2.2.win32-py2.6.exe
#http://www.modpython.org/
#未找到py2.6 for apache2.2.x的mod_python.so

SVN update in post-commit hook

Standard

假设服务器对外访问域名为http://yemaosheng.com/ 网站文件存放于/var/www/html/ye/
修改SVN库中post-commit文件
操作如:
cd /var/www/svn/repos/hooks/
cp post-commit.tmpl post-commit
chown apache:apache post-commit
chmod a+x post-commit
vi post-commit
#!/bin/sh
REPOS=”$1″
REV=”$2″
svn update /var/www/html/ye –username svnuser1 –password 123456

PS:以上操作应该都没错,但我在我FC8的服务器上测试了没有效果,估计是UTF-8的问题.
我只好先用crontab每5分钟运行一次sh来代替.
#!/bin/sh
export LANG=zh_CN.UTF-8 #注:这一行害我折腾了几小时
svn update /var/www/html/ye –username root –password 123456

SVN on CentOS

Standard

1) Installation:
The first thing to do is to install the packages I mentioned above. If you don’t have Apache installed already, it’ll go ahead and drag that down as well.
[root@lucifer ~]# yum install mod_dav_svn subversion

2) Configurations:

a) Apache:

b) Subversion’s Apache configs:
The next step is to setup some settings within Apache so Subversion and Apache play nice together. Get yourself to the example configuration file Subversion installed for you.
[root@lucifer ~] cd /etc/httpd/conf.d/
[root@lucifer ~] vim subversion.conf

# Make sure you uncomment the following if they are commented out
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

# Add the following to allow a basic authentication and point Apache to where the actual
# repository resides.
<Location /repos>
DAV svn
SVNPath /var/www/svn/repos
AuthType Basic
AuthName “Subversion repos”
AuthUserFile /etc/svn-auth-conf
Require valid-user
</Location>

The location is what Apache will pass in the URL bar. For instance: http://yourmachine/repos points to the SVNPath that you have specified. My examples are just that, so feel free to put things where you want. Make sure you save the file when you are finished editing.
Next we have to actually create the password file that you specified in the previous step. Initially you’ll use the -cm arguments. This creates the file and also encrypts the password with MD5. If you need to add users make sure you simply use the -m flag, and not the -c after the initial creation.
[root@lucifer ~] htpasswd -cm /etc/svn-auth-conf yourusername
New password:
Re-type new password:
Adding password for user yourusername
[root@lucifer ~] htpasswd -m /etc/svn-auth-conf anotherusername
New password:
Re-type new password:
Adding password for user anotherusername

c) Configure your repository
The next thing you need to do is to create the actual repository from which you will check in and out your files. This is simple to do with some of the included svn tools.
[root@lucifer ~] cd /var/www/ — Or wherever you placed your path above
[root@lucifer ~] mkdir svn
[root@lucifer ~] cd svn
[root@lucifer ~] svnadmin create repos
[root@lucifer ~] chown -R apache.apache repos
[root@lucifer ~] service httpd restart

Go test out whether or not you can access your repository from a web browser: http://yourmachine/repos. You should get a popup box asking for a username and password. If so, type in your credentials and you should be displayed with a Revision 0:/ page. If so, that’s it for setting up a repo. If you want multiple repos, check out the docs from the links provides above. This sets up one repository and shows you how to start using them. Speaking of, let’s move on to just that.

3) Using Subversion:

a) Layout Your Repo:
If all went well above, you’re now ready to start using the repository that you created. Subversions svn tool is the command line client that you will use to talk to the database. To see the use of the tool:
[root@lucifer ~] svn –help
The most common arguments you will most likely be using are: svn import, svn commit (ci), and svn checkout (co). With these you will initially import files into your repository with import, you’ll check them out to work on them with checkout, and you’ll commit the changes back into the database with commit. It’s pretty simple once you see them in use a few times.
Before I continue I’d like to explain about directory structure layouts. Almost all of the documentation talks about creating a certain layout for your directories. They specifically mention about making sure you have a branches, tags, and trunk underneath the root directory structure, where trunk holds all your files. For instance:
.
|– project1
| |– branches
| |– tags
| `– trunk
`– project2
|– branches
|– tags
`– trunk
The book explains why in a bit more detail, and I mainly don’t bother using this type of layout…because I’m not doing coding and maintaining “projects” per se. I’m mainly using it to store configuration files, and text items that aren’t as complex. Set things up for whatever works for you.
As an example, I’m going to just create some dummy directories and throw some files in them. This is from the actual SVN server. Play along.
[root@lucifer ~] cd /tmp
[root@lucifer ~] mkdir mytestproj
[root@lucifer ~] cd mytestproj
[root@lucifer ~] mkdir configurations options main
[root@lucifer ~] vim configurations/testconf1.cfg — Add whatever you want to these files.
[root@lucifer ~] vim options/testopts1.cfg
[root@lucifer ~] vim main/mainfile1.cfg

Keep in mind that you can layout anything anyway you’d like. Once you have the initial layout of what you want, let’s go ahead and import this up to Subversion.

b) Importing:
[root@lucifer ~] svn import /tmp/mytestproj/ file:///var/www/svn/repos/mytestproj -m “Initial repository layout for mytestproj”
Adding /tmp/mytestproj/main
Adding /tmp/mytestproj/main/mainfile1.cfg
Adding /tmp/mytestproj/configurations
Adding /tmp/mytestproj/configurations/testconf1.cfg
Adding /tmp/mytestproj/options
Adding /tmp/mytestproj/options/testopts1.cfg

c) Checking Out:
Now, just to check it out across the web browser: http://yourmachine/repos. You’ll get whatever you have imported showing up to peruse. Once you upload your original layout from the local SVN server, you’re now free to use it remotely on another machine. As long as you are connecting to the Subversion server with the user account(s) that you created earlier. Let’s give it a shot.
[me@mylappy ~] mkdir mytestproj
[me@mylappy ~] svn co
http://yoursvnserver/repos/mytestproj
Authentication realm: <http://yoursvnserver:80> Subversion repos
Password for ‘youruser’:
A mytestproj/main
A mytestproj/main/mainfile1.cfg
A mytestproj/configurations
A mytestproj/configurations/testconf1.cfg
A mytestproj/options
A mytestproj/options/testopts1.cfg
Checked out revision 1.

d) Edit & Commit
As you can see, you’ve checked out revision 1 from the Subversion server. Now you can edit some things and commit the changes back to the Subversion server.
[me@mylappy ~] cd mytestproj
[me@mylappy ~] vim configurations/testconf1.cfg — Add or delete something and save.
[me@mylappy ~] svn commit -m “Added a line to testconf1.cfg.”
Sending configurations/testconf1.cfg
Transmitting file data .
Committed revision 2.

The nice thing about this then, is that you can delete all of the directories that you just checked out on your machine. The only reason you checked them out, was to edit them, and then send them back up the line. Web browse to your server to check out the different files.

e) Adding/Deleting Items
Now this is all fine and dandy, but how do you add more files to an already existing repo directory? Easy, with the add argument. Go ahead and checkout your latest and greatest, copy a file over to a directory, add, then commit the changes.
[me@mylappy ~] svn co http://yoursvnserver/repos/mytestproj
A mytestproj/main
A mytestproj/main/mainfile1.cfg
A mytestproj/configurations
A mytestproj/configurations/testconf1.cfg
A mytestproj/options
A mytestproj/options/testopts1.cfg
Checked out revision 2.

[me@mylappy ~] cd mytestproj
[me@mylappy ~] cp /etc/yum.repos.d/CentOS-Base.repo configurations/
[me@mylappy ~] svn add configurations/CentOS-Base.repo
A configurations/CentOS-Base.repo

[me@mylappy ~] svn commit -m “Added the CentOS Yum repo file.”
Adding configurations/CentOS-Base.repo
Transmitting file data .
Committed revision 3.

To delete items simply use delete instead of add. Commit your changes back up, and you’re good to go. It’s as simple as that. Go back over to your web browser again and you’ll notice the revision number should say 3. You’ll be able to click through the files to pick our your differences as well.

f) Reverting Back:
Ok, this is all great but how do I revert back to an older revision…isn’t this the point of Subversion? Yep, it’s easy. If you’re not sure as to what revision you’re at…check out the log command. This is why you put a message in every commit. Short and to the point, but enough information to ring a bell that you perhaps forgot about.
[me@mylappy ~] svn log http://yoursvnserver/repos — For the entire repository
[me@mylappy ~] svn log
http://yoursvnserver/repos/mytestproj — For the specific project
You’ll get a nice complete list of revision numbers along with the comments, like I mentioned above. This allows you to pick which revision you want to check back out now.
[me@mylappy ~] svn co -r 1 http://yoursvnserver/repos/mytestproj
This command will drag down revision number 1.

4) Access control lists
Usually, you don’t want to give every user access to every repository. You can restrict repository access per user by using ACLs. ACLs can be enabled with the AuthzSVNAccessFile file option, which takes a file name as its parameter. For instance:
AuthzSVNAccessFile /etc/svn-acl-conf
You can add this to the relevant Location section:
<Location /repos>
DAV svn
SVNParentPath /var/www/svn/repos
AuthzSVNAccessFile /etc/svn-acl-conf
AuthType Basic
AuthName “Subversion repos”
AuthUserFile /etc/svn-auth-conf
Require valid-user
</Location>

You can then create /etc/svn-acl-conf. This file consist of sections of the following form:
[reponame:repopath]
user = access

Where access can be r (read), rw (read-write), or empty (no access at all). The default ACL is to give users no access to a repository. Suppose that there is a repository named framework to which you would like to give john read access, and joe read and write access. You could then add the following section:
[framework:/]
john = r
joe = rw

It is also possible to create groups in a section named groups, groups are then prefixed with the ‘at’ sign (@) in the access control lists. For instance:
[groups]
staff = joe, george

[framework:/]
john = r
@staff = rw

If you would like to make all repositories readable to all users, you can add a section for the root directory of every repository:
[/]
* = r