Tags
Note:
1. Commands preceded with “$” imply that you should execute the command as a general user – not as root.
2. Commands preceded with “#” imply that you should be working as the root user.
Install Rancid
# yum install rancid
Configuration
1. Edit /etc/rancid/rancid.conf
# vi /etc/rancid/rancid.conf
2. Find this line in rancid.conf:
#LIST_OF_GROUPS=”sl joebobisp”
And, underneath it add the following line:
LIST_OF_GROUPS=”bdnog”
We want to use Subversion for our Version Control System, and not CVS, so find the line with the parameter RCSSYS:
RCSSYS=cvs; export RCSSYS
And, change it to:
RCSSYS=svn; export RCSSYS
and the line with CVSROOT:
CVSROOT=$BASEDIR/CVS; export CVSROOT
And, change it to:
CVSROOT=$BASEDIR/svn; export CVSROOT
Note the lowercase “svn”. Now exit and save the file.
3. Change to the rancid user:
# su -s /bin/bash rancid
Check that you ARE the rancid user:
$ id
4. Create /var/rancid/.cloginrc
$ vi /var/rancid/.cloginrc
add user *.bdnog.org ssh_username
add password *.bdnog.org ssh_user_pass enable_pass
add method *.bdnog.org ssh
Note: You can also add IP address if you like to backup specific router/switch
add password 10.156.1.1 {user_password} {enable_password}
$ chown rancid:rancid /var/rancid/.cloginrc
$ chmod 600 /var/rancid/.cloginrc
5. Test login to the router of your group:
$ /usr/libexec/rancid/clogin rtrX.bdnog.org
[After successful execution, you will be login to router enable mode]
6. Initialize the SVN repository for rancid:
$ /usr/libexec/rancid/rancid-cvs
7. Create the router.db file:
$ vi /var/rancid/bdnog/router.db
Add this line. Replace X with your group no.
rtrX.bdnog.org:cisco:up
8. Run rancid!
$ /usr/libexec/rancid/rancid-run
9. Look at the configs. The backed up configs will be saved in /var/rancid/<GROUP_NAME>/configs. In our cases group name is “bdnog”:
$ cd /var/rancid/bdnog/configs
$ less rtrX.bdnog.org
10. Check the rancid log files:
$ cd /var/log/rancid
$ ls -ll
Email Alert Configuration
1. Edit /etc/rancid/rancid.conf
Add this to the /etc/aliases file: (group names have to be named rancid-admin-<group listed in rancid.conf file) and rancid-<group listed in rancid.conf file>)
# Groups for rancid
rancid-admin-all: noc@bdnog.org
rancid-all: noc@bdnog.org
Save the file and run
#newaliases
CRON Schedule
1. For automated backup, you can setup CRON schedule. Please note that cron need to configured under user RANCID.
# su -s /bin/bash rancid
# crontab -e
# m h dom mon dow command
0 0 * * * /usr/libexec/rancid/rancid-run g
Install WEBSVN
# yum install websvn
Configuration
1. Fix permissions. The web server must be able to read the SVN (Subversion) folder
# chgrp -R apache /var/rancid/svn
# chmod g+w -R /var/rancid/svn
2. Change ownership of web files:
# chown apache:apache /usr/share/websvn
3. Add the following virtual host entry to your apache configuration file /etc/httpd/conf.d/websvn.conf:
Alias /websvn /usr/share/websvn
<Directory /usr/share/websvn/>
DirectoryIndex index.php
Options FollowSymLinks
Options FollowSymLinks MultiViews
Order allow,deny
Allow from all
<IfModule mod_php4.c>
php_flag magic_quotes_gpc Off
php_flag track_vars On
</IfModule>
</Directory>
5. Reload apache and try to browse the websvn: http://<ip_address>/websvn.
Check you can access the WebSVN.
6. Now we add RANCID repository sites. Edit websvn configuration file.
# vi /usr/share/websvn/include/config.php
// Local repositories (without and with optional group):
//
$config->addRepository(‘BDNOG’, ‘file:///var/rancid/svn/’);