Manage Configuration Changes with Git
This content was originally written on the OpenNMS Discourse forum (see Managing Configuration Changes with Git).
If you want to manage your configuration files with Git but haven’t used it for version control before, GitHub’s Using Git tutorial covers the basics. You can also read Developing with Git on the OpenNMS Discourse forum.
If you have an existing OpenNMS Meridian installation, check for the
If your Meridian environment does not have this directory, you will need to upgrade to a version that does.
Remember to stop Meridian before changing files in the
$OPENNMS_HOME/etc is linked to
Do not move that folder.
Moving the folder will break the link and cause future upgrades to fail.
Run the following code to prevent breaking the link between folders:
mv etc etc_bad
ln -s /etc/opennms etc
Run the following code to move your customized configuration files to
/etc/opennms.bak and replace them with the contents of
mv /etc/opennms /etc/opennms.bak
cp -pR /usr/share/opennms/share/etc-pristine /etc/opennms
Run the following code to move your
$OPENNMS_HOME/etc files to a safe place, then copy
etc-pristine to the
mv $OPENNMS_HOME/etc $OPENNMS_HOME/etc.bak
cp -pR $OPENNMS_HOME/share/etc-pristine $OPENNMS_HOME/etc
On RPM-based installations, the pristine configuration files are located in
Run the code below to turn your
etc directory into a Git repository and add the pristine files as your first commit:
cat << EOF > $OPENNMS_HOME/etc/.gitignore
git add .
git commit -m "Initial checkin of OpenNMS x.x.x configuration."
x.x.x in the last line with your current Meridian version.
Run the code below to create a new branch in your repository:
git branch local-modifications
git checkout local-modifications
You can now edit your configuration files as you normally would. If you previously backed up your modified configuration files, you can run this code to restore them:
rsync -avr $OPENNMS_HOME/etc.bak/ $OPENNMS_HOME/etc/
Any time you want to save your changes to the
etc directory, run this code to commit them to the branch you created (in this case,
git add .
git commit -m "Added initial discovery ranges."
When you are finished modifying your configuration files, you can start Meridian.