You can install apache-svn using the following steps.
=======================================================
Download SVN
wget http://subversion.tigris.org/downloads/s...4.4.tar.gz
cp /downloads/subversion-1.1.4.tar.gz /usr/local/src
cd /usr/local/src/
tar -xzvf subversion-1.1.4.tar.gz
cd subversion-1.1.4
As you can see with my runconfigure.sh wrapper script for Subversion, I was very specific about which features I did and did not want in my Subversion installation. Because I knew exactly what I wanted, I could afford to do this, and it spared me from prerequisite hell.You can change the apache as you want.You cn chage it as /usr/local/apache opr apache 1.3
# runconfigure.sh -- wrapper script for ./configure
./configure \
--with-apr=/usr/local/apache2 \
--with-apr-util=/usr/local/apache2 \
--without-berkeley-db \
--without-zlib \
--without-jdk \
--without-jikes \
--without-swig \
--without-junit
Once I saved runconfigure.sh, I ran it and installed Subversion:
make
make install
First, I needed to ensure that the binary could find Subversion's shared libraries. On Linux, I did this by ensuring that /etc/ld.so.conf contained the directory /usr/local/lib. (The /etc/ld.so.conf layout is just a list of directories, one per line--a refreshingly simple syntax, in this age of XML.) If your copy of /etc/ld.so.conf is missing /usr/local/lib, add it, and then run ldconfig with no arguments. On Solaris, ensure that $LD_LIBRARY_PATH contains /usr/local/lib. If that directory is not present, add it in /etc/profile and export LD_LIBRARY_PATH so that all users automatically pick it up when they log in. Also, if you are on Solaris, change your current environment so that you have access to Subversion's libraries right away:
export LD_LIBRARY_PATH
On any Linux/Unix system, be sure to add Subversion to your path. On my machine, I placed it first in the path, so that it would override any older Subversion that might be in /usr/bin:
export PATH
On any Linux/Unix system, you may want to ensure that anyone who logs on to the system has Subversion in the path. Here's a nifty way I did that without having to open a text editor:
> PATH=/usr/local/bin:\$PATH
> export PATH
> EOR
Creating the Repository
Next, I needed to create a Subversion repository. In real life, I actually used cvs2svn to port an entire CVS repository to Subversion; as long as you already have Python installed on your system, cvs2svn is fantastic. You may not have an existing repository to migrate, though, so here's how to create a sample repository and check in a one-file project:
svnadmin create /usr/local/svn_repository
cd /tmp
mkdir -p test_project/trunk
cd test_project/trunk
cat > test_file.txt <<EOS
> this
> is
> a
> test
> file
> EOS
svn import -m "initial checkin" .
file:///usr/local/svn_repository/test_project/trunk
Integrating Subversion with Apache
I wanted to use basic authentication to restrict access to my repository, so I created a .htpasswd file. What better location for this than the repository's configuration directory? Please note that for illustrative purposes, I used htpasswd's ability to accept passwords on the command line; you may want to make htpasswd prompt you for the passwords instead. I also used ridiculously insecure example passwords for illustrative purposes. Note how the first invocation of htpasswd used the -c switch to create the password file, whereas subsequent ones did not. Finally, if you don't mind having the passwords briefly shown in clear text, and you have to create a lot of users, consider making this a shell script that you can just run once and then delete when you are done:
-b /www/svn_repository/conf/htpasswd user1 password1
/usr/local/apache2/bin/htpasswd -m
-b /www/svn_repository/conf/htpasswd user2 password2
/usr/local/apache2/bin/htpasswd -m
-b /www/svn_repository/conf/htpasswd user3 password3
One step I didn't want to forget was making the repository readable and writable by the user nobody, which Apache runs by default. (Forgetting this step would produce sorts of errors from Apache.)
Finally, I changed httpd.conf to let Apache know about my repository and the fact that only authorized users should read and write to it. I plan to use my Apache installation only for Subversion, so I made the Subversion repository the root of Apache's filesystem. In /usr/local/apache2/conf/httpd.conf, I made the line containing DocumentRoot look like:
Next, I added these lines to the end of /usr/local/apache2/conf/httpd.conf to let Apache know that /usr/local/svn_repository is a Subversion repository and that access uses SSL and basic authentication:
DAV svn
SVNPath /usr/local/svn_repository
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /usr/local/svn_repository/conf/htpasswd
Require valid-user
SSLRequireSSL
</Location>
After those lines in /usr/local/apache2/conf/httpd.conf, I added the following mod_rewrite lines as a nice way to forward browsers from http to https:
RewriteEngine on
RewriteCond "%{SERVER_PORT}" "^80$"
RewriteRule "^(.*)$" "https://%{SERVER_NAME}$1" [R,L]
Ensuring Apache Starts When the Server Does
Chances are your Linux/Unix installation shipped with Apache already installed. My Fedora Core system did, so I disabled it to keep it from interfering with my custom Apache, which wanted to use the same ports.
The method for disabling the automatic startup of Apache is different from system to system. Fedora Core uses a spiffy system utility called chkconfig to manage the starting and stopping of system services at various runlevels. I asked chkconfig what runlevels Apache was running at:
httpd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
I told chkconfig not to run Apache at the three runlevels where it was on, and then I shut down Apache manually (as it was currently running).
[root@localhost etc]# chkconfig --list httpd
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@localhost etc]# /etc/rc.d/init.d/httpd stop
Stopping httpd: [ OK ]
At that point, I needed to put a different script in /etc/rc.d/init.d to start and stop my custom Apache. Fortunately, /usr/local/apache2/bin/apachectl is a shell script that already mostly follows the conventions of a Unix init script: it already takes start and stop as arguments. However, it uses the nonstandard startssl and stopssl to make Apache use SSL, so I had to do some editing.
First, I copied Apache's control script into Fedora Core's standard location for init scripts:
/etc/rc.d/init.d/apache_svn
Next I borrowed, in altered form, the first few lines of Fedora Core's /etc/rc.d/init.d/httpd script and put them at the top of /etc/rc.d/init.d/apache_svn, so that Fedora Core's spiffy chkconfig program could use apache_svn. (Note that chkconfig's parameters in init scripts seem to be only comments, but they are more than that.) Here are the lines I added just below
#
# apache_svn Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: This Apache installation is really a Subversion repository.
# processname: httpd
# config: /usr/local/apache2/conf/httpd.conf
Then, I removed these two stanzas:
stopssl|sslstop|stop-SSL)
$HTTPD -k stop -DSSL
ERROR=$?
;;
startssl|sslstart|start-SSL)
$HTTPD -k start -DSSL
ERROR=$?
;;
Next, I changed this stanza:
start|stop|restart|graceful)
$HTTPD -k $ARGV
ERROR=$?
;;
to this:
start|stop|restart|graceful)
echo -n $"Apache + SVN $ARGV, status: "
$HTTPD -k $ARGV -DSSL
ERROR=$?
[ "$ERROR" -eq 0 ] && echo "OK" || echo "FAILED"
;;
to define the property SSL for all four targets captured by that stanza, as well as to give some feedback on the command line (though not as pretty as Fedora Core's scripts).
Next I told chkconfig to add apache_svn to its setup, and to make it active at runlevels 3, 4, and 5:
chkconfig --list apache_svn
apache_svn 0:off 1:off 2:off 3:off 4:off 5:off 6:off
chkconfig --level 345 apache_svn on
chkconfig --list apache_svn
apache_svn 0:off 1:off 2:off 3:on 4:on 5:on 6:off
Then I started Apache using its new init script.
Apache + SVN start, status: OK
Testing the Connection
The moment of truth came when I got to test repository access from my web browser. I went to https://localhost/, accepted the cert, entered one of the sample usernames and passwords, and browsed my Subversion repository.
The command-line client worked too:
[root@localhost tmp]# svn co https://localhost/test_project/trunk test_project
Error validating server certificate for 'https://localhost:443':
- The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually!
- The certificate hostname does not match.
Certificate information:
- Hostname: Test-Only Certificate
- Valid: from Mar 12 00:48:54 2005 GMT until Mar 12 00:48:54 2006 GMT
- Issuer: Test-Only Certificate
- Fingerprint: 56:f8:be:cc:df:69:c4:64:43:ba:d4:0b:5d:65:a2:0e:9f:9f:5d:ee
®eject, accept (t)emporarily or accept (p)ermanently? t
Authentication realm: <https://localhost:443> Subversion Repository
Password for 'root': # there is no user root, so just hit enter here
Authentication realm: <https://svn1.digitas.com:443> Subversion Repository
Username: user1
Password for 'user1':
A test_project/test_file.txt
Checked out revision 1.
=======================================================