1

NOTE This is a copy of a closed question from Stack Overflow, and a constructive version, I feel, of a similar question in Server Fault.

Often I need to edit many configuration files under /etc, however, I don't want these changes to get lost when I'll perform my next system upgrade.

Right now, I've housed all configuration files as well as some of my maintenance scripts in /opt/admin, and symlinked /etc targets there, but that doesn't seem right according to standards I've seen. Another option I thought of, is housing these in /usr/local. The aforementioned document says it is for use by the system administrator when installing software locally. That's the closest I've got. However, also /usr/local gets clobbered when you install new non-packaged software.

Is there a standard/largely followed best-practice as to how to maintain these? Since this is not a discussion page, answers should be definite and with an article or two to support them.

NOTE I have included my own answer I've found to be most useful up to now. I did re-open this here so it can be discussed and for more answers to come in.

3 Answers 3

4

While it doesn't keep them separate, etckeeper does a very good job of tracking changes to config files. Keeping the repository off of the box somewhere would make it easy to restore those changes to a new machine.

1

You could use a configuration management tool to do this. This scales well when you add servers with the same role.

It sounds like you've baked up one that fits your needs, but you might well want to look into Chef, Puppet, Ansible, Opsware, or other config management/automation/orchestration tools, depending on your needs and budget.

0

From answers to the questions I've mentioned, there seem to be two general solutions - either use symlinks or maintain a list of files (see ptman's and Jim's answers in linked questions). I couldn't find a best-practices article.

I suggest a hybrid solution: you maintain only a simple file (I call it FILES) with a list of configuration files. A script reads FILES and symlinks real configuration files into a duplicate filesystem hierarchy under a chosen directory (I call the script link-config-files.sh and the directory system-config) .

This way, you only maintain files in one file which is easy to edit and doesn't involve shell magic. Configuration files you care about are accessible from system-config thanks to the symlink. A cron job was set-up to back up system-config, so all configuration files are getting backed up automatically. And another cron job periodically runs link-config-files.sh so all is left for a file to appear in (or disappear from) system-config and be backed up is to edit FILES.

I find this to be the best solution so far. Of course I'm biased. In any case, here's my script and it links a backup script as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .