25

Is there any way to automate Linux server configuration? I'm working on setting up a couple of new build servers, as well as an FTP server, and would like to automate as much of the process as possible.

The reason for this is that the setup and configuration of these servers needs to be done in an easily repeatable way. We figured that automating as much of this process as possible would make it easiest to repeat as needed in the future.

Essentially, all the servers need is to install the OS, as well as a handful of packages. There's nothing overly complicated about the setups.

So, is there a way to automate this process (or at least some amount of it)?

EDIT: Also, say I use Kickstart, is there a way to remove the default Ubuntu repositories, and just install the packages from a collection of .deb files we have locally (preferably through apt, rather than dpkg)?

  • What distro did you choose to install? That would be helpful in determining the next step – eyoung100 Sep 11 '14 at 13:55
  • beware however that automation task may take a long time. If you plan to install less than 10 hosts, it might not be worth the task. – Archemar Sep 11 '14 at 13:58
  • I've recently learned about the features offered by saltstack (Most contributed repo on Github). I'd highly recommend looking in to it as it offers tools for both creating new servers on services like aws, and deploying configurations, settings, writing files, remote shell access, bulk shell access. even access restriction. Just about everything you'd ever need to do it seems. Though I have good friends who swear by Ansible for new server setups. – ThorSummoner Sep 11 '14 at 18:51
  • +1 to you and mattdm... I didn't know this forum existed until I saw it on the Hot Network Questions and then I hadn't even thought this question had an answer. So glad you asked and it was answered so very well! – Sylas Seabrook Sep 12 '14 at 5:25
36

Yes! This is a big deal, and incredibly common. And there are two basic approaches. One way is simply with scripted installs, as for example used in Fedora, RHEL, or CentOS's kickstart. Check this out in the Fedora install guide: Kickstart Installations. For your simple case, this may be sufficient. (Take this as an example; there are similar systems for other distros, but since I work on Fedora that's what I'm familiar with.)

The other approach is to use configuration management. This is a big topic, but look into Puppet, Chef, Ansible, cfengine, Salt, and others. In this case, you might use a very basic generic kickstart to provision a minimal machine, and the config management tool to bring it into its proper role.

As your needs and infrastructure grow, this becomes incredibly important. Using config management for all your changes means that you can recreate not just the initial install, but the evolved state of the system as you introduce the inevitable tweaks and fixes caused by interacting with the real world.

We figured that automating as much of this process as possible would make it easiest to repeat as needed in the future.

You are absolutely on the right track — this is the bedrock principle of professional systems administration. We even have a meme image for it:

AUTOMATE ALL THE THINGS

It's often moderately harder to set up initially, and there can be a big learning curve for some of the more advanced systems, but it pays for itself forever. Even if you have only a handful of systems, think about how much you want to work at recreating them in the event of catastrophe in the middle of the night, or when you're on vacation.

  • 1
    Great, thanks! I'll start looking into all of these. – user1617942 Sep 11 '14 at 13:54
  • You didn't mention Cobbler. – Brian Sep 11 '14 at 17:06
  • @staticx Yes, this isn't comprehensive. There's a whole world of provisioning systems too: Cobbler, Foreman, Satellite/Spacewalk, FAI, Razor, and that's not even getting into cloud stuff. – mattdm Sep 11 '14 at 18:34
  • @ChrisK Ha, I would say the same ;) – William Edwards Sep 12 '14 at 6:09
0

Slingshot is a script to automate the installation and configuration of Linux software packages. Slingshot has and uses a template/messaging system.

http://www.dyncomp.net/what-is-slingshot/

0

I strongly recommend Puppet. It's largely used, well documented and supported.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.