Managing server configurations

Managing server configurations

Well, you have two choices. Manage all your .sh scripts so you know what is happening with your system configuration. Or use etckeeper which pours things into a git repository, so you can play back your /etc changes.
Then use the
Some cool uses:
- For your web server configuration files if you have manually edited
You can install with apt-get so it is super convenient to use:

sudo apt-get install -y etckeeper

This will actually fail as the Ubuntu version use Bazaar, their version control system, so let’s make it work with git

# Substitute VCS=“git” for anything else already there
sudo sed -i “/^VCS=/d” /etc/etckeeper/etckeeper.conf
sudo tee -a /etc/etckeeper/etckeeper.conf <<<‘VCS=“git”'
# push to origin as a default
sudo sed -i “/^PUSH_REMOTE=/d” /etc/etckeeper/etckeeper.conf
sudo tee -a /etc/etckeeper/etckeeper.conf <<<‘PUSH_REMOTE=“origin”’

Now you can just have etckeeper auto commit which is pretty cool assuming REPONAME is the repo you’ve already created. Something like richtong/ubuntu-on-vmware-etckeeper.git. One detail is that you have to make sure that your root account has your .ssh keys for your git hub

sudo su
# Normally the home directory of root is /
mkdir -p ~/.ssh
# Copy your github.rsa into here
cp $YOUR_GIT_HUB_RSA_KEY ~/.ssh/
tee -a ~/.ssh/config <<<“IdentifyFile $YOUR_GIT_HUB_RSA_Yet"
# Go to the configuration directory.
cd /etc
# Initialize etckeeper.
sudo etckeeper init
# Add the remote repository.
sudo git remote add origin git@github.com:REPONAME
# First commit.
sudo etckeeper commit "Initial commit."
# Set the upstream and push.
git push -u origin master
# We're done here.
exit
%d bloggers like this: