0

I’d like to be able to:

  1. Launch a Unix server configured to my liking with minimum time and no manual intervention.
  2. Periodically run a single script that checks my config changes are intact and offers to repair incorrect settings (ie. because config files sometimes get replaced during updates).

What techniques do I have to choose from in order to accomplish this? (I’m asking for different fundamental approaches on how to do this before I want to get into specific software suggestions.)

This is roughly what I would do manually (locally from VirtualBox, or remotely on a VPS). Parenthesis are only partial examples.

  1. Setup essentials (visudo, adduser)
  2. Install packages (sshd, php, nginx, mysql, ufw)
  3. Run setup scripts (mysql_secure_installation)
  4. Run config commands (ufw allow)
  5. Edit config files (php.ini, sshd_config)
  6. Populate the database (cat db.sql | mysql)
  7. Populate nginx web files (rsync local remote:)
  8. Launch nginx

As for checking up on config files today, I don’t have a good strategy except checking them manually, which is really difficult.

I’ve heard of Puppet and others, but honestly I’m a bit intimidated by their syntax. I'd like to know the bird perspective of options before deciding on a technique and investing learning time.

1

What you're looking for is Server Farmer (http://serverfarmer.org/) - it has similar architecture to Ansible, however it's more simple and written mostly in Bash.

It can handle full lifecycle of Linux instance, from creating new instance in all major cloud platforms (AWS, Azure, Google Cloud, Hetzner, Alibaba Cloud, e24cloud, Rackspace and OpenStack-based hybrid clouds), through basic host configuraton up to application deployment.

The only exception is that, as for firewall, it uses iptables directly, instead of ufw.

You can start from forking these 2 repositories and adjusting the configuration:

0

There are many options:

-- I am using puppet for the same task

-- You can use either puppet , ansible , saltstack , or chef etc

-- You can use docker container , using a docker file for your desired configuration

-- You can use a pre-configured VM in cloud ( openstack , aws) and launch it when needed , and just attached the data volume.

0

Some providers like Linode allow you to create your own image that you can deploy as desired to any VPS you create in their system. You can of course create your own VirtualBox/VMWare templates to use and clone or export and share with others.

Thinking outside the box though... somethign that would work in a local vm, a VPS, or bare metal hardware -

Set up a vm and after you install each package, before you configure anything, create a git repo out of the package's config directory (/etc/apache2 and so on). Do your config, do a git commit and git push on up to the repo. Repeat as needed for whatever packages. On my VPS, I'd probably do the basic LAMP config, then dovecot+postfix, etc. so that each service combo was its own git repo.

Then create a fake debian package using the control file and equivs-build so that you have a package that does nothing but depend on all the stuff you normally install - dovecot, postfix, apache, etc. Again, I'd consider breaking it down and creating a matching .deb file with dependencies for each of the service combos that you have a git repo for.

Then, for a new machine...

Do base install. Install the fake package, let apt handle getting the dependencies - your normal software - installed wtih default config. Then pull down copies of the various repos that contain your changed configs, and drop the config files in place.

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.