Install subversion on centos cpanel vps with autostart script on reboot
I learned this stuff by searching and want to add a quick reference here for others. To install subverion on CentOS, just do:
# yum install subversion
Make sure if "perl-URI" is installed or not. If its not there you can install it using
# yum install perl-URI
Now you may stuck here, because yum may not install perl-URI, why? If you have cpanel, probably you have added perl* to /etc/yum.conf exclude list. Just remove it and install perl-URI, then revert it. The next thing was to create a repository.
# cd /home/username # mkdir repos # svnadmin create /home/username/repos/myProject1
I always create a symlink to make things easier:
# ln -s /home/username/repos /svn
Now to start subversion as daemon do:
# svnserve -d -r /svn
Ok, we need to setup subversion autostart at reboot. I just found a script sometime somewhere on internet and I do not really remember who was the author, but thanks to the guy, I edited the script to suit my needs. Below is the working result, I tested and installed it on CentOS x86_64
#!/bin/bash## /etc/rc.d/init.d/subversion## Starts the Subversion Daemon## chkconfig: 345 90 10# description: Subversion Daemon# processname: svnservesource /etc/rc.d/init.d/functions[ -x /usr/bin/svnserve ] || exit 1# To pass additional options (for instace, -r root of directory to server) to# the svnserve binary at startup, set OPTIONS here.#OPTIONS="-r /svn"RETVAL=0prog="svnserve"desc="Subversion Daemon"start() {echo -n $"Starting $desc ($prog): "daemon $prog -d $OPTIONSRETVAL=$?[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$progecho}stop() {echo -n $"Shutting down $desc ($prog): "killproc $progRETVAL=$?[ $RETVAL -eq 0 ] && success || failureecho[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$progreturn $RETVAL}case "$1" instart)start;;stop)stop;;restart)stopstartRETVAL=$?;;condrestart)[ -e /var/lock/subsys/$prog ] && restartRETVAL=$?;;*)echo $"Usage: $0 {start|stop|restart|condrestart}"RETVAL=1esacexit $RETVAL
Save this script on /etc/init.d/subversion and make it chmod 0750 Execute /etc/init.d/subversion and make sure it does not have any error. To make it autostart at reboot time, we should use chkconfig facility on RedHat/CentOS.
# chkconfig --level 345 subversion on
To get more info on chkconfig see man chkconfig and man runlevel, and http://en.wikipedia.org/wiki/Run_level Now start/restart svn server and check it works.
# /etc/init.d/subversion restart
Yes, it was so easy, no? ;)
Recent blog posts
- Learn to Keep Your Site Safe
- Choosing the Best Hosting Company for WordPress Based Websites
- Features of DirectAdmin
- 9 Advantages of Managed Hosting
- Necessity of Drupal
- Four Ways to Optimize WordPress for Search Engines
- Managed Hosting V.S Collocation Hosting
- Prevent Spam by Using Captcha Scripts
- Is Linux Surpassing Windows Web Hosting?
- Prevent Spam by Using Captcha Scripts