I suggest you use Ansible . This is exactly what you need, a configuration tool that allows you to configure your servers.
In a simplistic view, Ansible is practically a shell script with its installation and configuration commands, but one important difference, and the reason you should use Ansible, is that it is idempotent : If you have an Ansible script that installs, for example, git
on your server, and you run this script 8 times, git
will only be installed the first time. In the next 7 times Ansible verifies that git
is already installed, and that it does not make sense to try to install it again. While if you ran a simple shell script to install git
, it would give error and, depending on the case, could even compromise your server.
Ansible is a mature, widely used tool with several options, so I recommend you find a tutorial to your liking on, or else the documentation . I recommend this tutorial .
Below is a short walkthrough to install only git
on a server. I will not put the complete way to install all your programs because this would be monstrous (for the answer and for me :)) and because several of these tools have small details that you should configure in the installation.
Very basic Ansible tutorial
First important point: you do not need to install Ansible on your server (which you want to configure), only on some other machine (it can be your home computer) that has access via SSH , to the server to be configured.
Install Ansible on your machine (I'm assuming it's Ubuntu):
sudo apt-add-repository -y ppa:ansible/ansible
sudo apt-get update
sudo apt-get install -y ansible
Edit the /etc/ansible/hosts
file to contain the IP of the server (s) you want to configure (it can be more than one):
[web]
192.168.22.10
192.168.22.11
Create a playbook
, which is the collection of commands to be executed by ansible. playbook
is a file in YAML format, and should be saved with the .yml
extension. Example of a playbook
that installs the git
program on Ubuntu servers:
- hosts: all
tasks:
- name: Instalando git
apt: pkg=git state=installed update_cache=true
apt: pkg=git state=installed update_cache=true
indicates that Ansible should execute the apt
module, which should install the git
program, and the final execution result is expected to be git
installed ( state=installed
). / p>
And to execute this playbook
, on the terminal type:
$ ansible-playbook -s -k -u USUARIO --ask-become-pass ARQUIVO.yml