Installing Subversion on FreeBSD from ports
- Go to
/usr/ports/devel/subversionand runÂmake install clean.ServerName#
ServerName#cd /usr/ports/devel/subversion
make install cleanNOTE: If you get a failure due to apr already being installed but not being built correctly, then uninstall apr and reinstall it with the default settings. Then go back and try to install subversion again.
ServerName#
ServerName#
ServerName#cd /usr/ports/devel/apr
make deinstall
make BATCH=yes install - Configure Subversion to start at bootup.
ServerName#
ServerName#
ServerName#
ServerName#
ServerName#echo # Subversion >> /etc/rc.conf
echo ‘svnserve_enable=”YES”‘ >> /etc/rc.conf
echo ‘svnserve_data=”/home/svn/repos”‘
echo ‘svnserve_user=”svn”‘
echo ‘svnserve_group=”svn”‘ - Create an svn user using the adduser command line wizard. This command will walk you through creating an svn user. Make sure to use the nologin shell and a random password so the user cannot login. Also, lockout the account after creation.
ServerName# # adduser
Username: svn
Full name: svn
Uid (Leave empty for default):
Login group [svn]:
Login group is svn. Invite svn into other groups? []:
Login class [default]:
Shell (sh csh tcsh nologin) [sh]: nologin
Home directory [/home/svn]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]: yes
Lock out the account after creation? [no]:
Username : svn
Password :
Full Name : svn
Uid : 1002
Class :
Groups : svn
Home : /home/svn
Home Mode :
Shell : /usr/sbin/nologin
Locked : no
OK? (yes/no): yes
adduser: INFO: Successfully added (svn) to the user database.
adduser: INFO: Password for (svn) is: /2CZct48a
Add another user? (yes/no): no
Goodbye! - Make a repos directory in the svn user’s home directory.
ServerName# mkdir /home/svn/repos - Create a repository.
ServerName#
ServerName#
ServerName#
ServerName#
ServerName#
ServerName#
ServerName#cd /home/svn
mkdir repos
cd repos
svnadmin create MyApp
cd MyApp
mkdir branches tags trunk
chown -R svn:svn ../MyAppThis will create a MyApp folder and populate it with the files needed to start a repository.
This is default subversion repository folder structure:
/home/svn/repos/MyApp/README.txt
/home/svn/repos/MyApp/format
/home/svn/repos/MyApp/conf
/home/svn/repos/MyApp/confauthz
/home/svn/repos/MyApp/conf/passwd
/home/svn/repos/MyApp/confsvnserve.conf
/home/svn/repos/MyApp/db
/home/svn/repos/MyApp/db/current
/home/svn/repos/MyApp/db/format
/home/svn/repos/MyApp/db/fs-type
/home/svn/repos/MyApp/db/fsfs.conf
/home/svn/repos/MyApp/db/min-unpacked-rev
/home/svn/repos/MyApp/db/rep-cache.db
/home/svn/repos/MyApp/db/revprops
/home/svn/repos/MyApp/db/revs
/home/svn/repos/MyApp/db/transactions
/home/svn/repos/MyApp/db/txn-current
/home/svn/repos/MyApp/db/txn-current-lock
/home/svn/repos/MyApp/db/txn-protorevs
/home/svn/repos/MyApp/db/uuid
/home/svn/repos/MyApp/db/write-lock
/home/svn/repos/MyApp/db/revprops/
/home/svn/repos/MyApp/db/revprops/0
/home/svn/repos/MyApp/db/revprops/0/0
/home/svn/repos/MyApp/db/revs/
/home/svn/repos/MyApp/db/revs/0
/home/svn/repos/MyApp/db/revs/0/0
/home/svn/repos/MyApp/db/transactions/
/home/svn/repos/MyApp/db/txn-protorevs/
/home/svn/repos/MyApp/hooks/
/home/svn/repos/MyApp/hooks/post-commit.tmpl
/home/svn/repos/MyApp/hooks/post-lock.tmpl
/home/svn/repos/MyApp/hooks/post-revprop-change.tmpl
/home/svn/repos/MyApp/hooks/post-unlock.tmpl
/home/svn/repos/MyApp/hooks/pre-commit.tmpl
/home/svn/repos/MyApp/hooks/pre-lock.tmpl
/home/svn/repos/MyApp/hooks/pre-revprop-change.tmpl
/home/svn/repos/MyApp/hooks/pre-unlock.tmpl
/home/svn/repos/MyApp/hooks/start-commit.tmpl
/home/svn/repos/MyApp/locks/
/home/svn/repos/MyApp/locks/db-logs.lock
/home/svn/repos/MyApp/locks/db.lock - To configure a Repository and add users, edit the following file: /home/svn/repos/MyApp/conf/svnserve.conf
ServerName# vi /home/svn/repos/MyApp/conf/svnserve.conf Uncomment lines below or just create a new svnserve.conf file with these
lines:[general]
anon-access = none
auth-access = write
password-db = /home/svn/userdbNow edit the following file:: /home/svn/repos/MyApp/passwd
ServerName# vi /home/svn/repos/MyApp/passwd Add users. For example, to add a user allen1 with a password of P@@sswd! and another user jared with a password of My$ecre+1, the file would look like this:
[users]
allen1 = P@sswd!
jared = My$ecre+1 - Now you should be able to connect to your repository with an svn client. TortoiseSVN is a popular windows tool that you can use to connect to your repository.Use the following to connect:svn://allen1:P@sswd!@ServerName/MyApp
- Now let’s go install WEBSVN from Ports:
ServerName#
ServerName#
ServerName#
ServerName#
ServerName#cd /usr/ports/devel/websvn
make install clean
cd /usr/local/www/websvn/
cp distconfig.php config.php
vi config.ph - You should have the config file opened up. Let’s make a few setup changes and we are ready to use WebSVN…
$config->setSVNCommandPath(‘/usr/local/bin’);Â // This where the SVN Commands are located
….
$config->addRepository(‘My First APP’, ‘file:///home/svn/repositories/MyApp/’);Â // You need to add this for each Repo, better if it was dynamic - Go into your apache config and add The WEBSVN setup.
ServerName#
ServerName#cd /usr/local/etc/apache22/Includes/
vi websvn.confNow add the following to the websvn.conf file and restart Apache.
Alias /websvn “/usr/local/www/websvn”
<Directory “/usr/local/www/websvn”>
<IfModule mod_php5.c>
php_admin_flag safe_mode Off
php_admin_value register_globals   0
php_value magic_quotes_gpc 0
php_value magic_quotes_runtime 0
php_value allow_call_time_pass_reference 0
php_admin_value open_basedir “.:/var/tmp:/usr/local/bin:/usr/local/lib/php:/usr/local/www/websvn/”
php_admin_value safe_mode_include_dir “.:/var/tmp:/usr/local/lib/php:/usr/local/www:/usr/local/share/pear”
</IfModule>RewriteEngine on
AllowOverride All
Order deny,allow
deny from all
allow from 192.168.0.1/11
</Directory>ServerName# /usr/local/etc/rc.d/apache22 restart
- That is it, now go checkout your repos! http://myservername/websvn/
| ServerName# | /usr/local/etc/rc.d/svnserve start |
This article was originally posted at http://rhyous.com/2009/11/07/how-to-install-subversion-1-6-6-on-freebsd-7-2/ but I made some security changes for better jailing and the WebSVN install.