Hey @saleeh I’d suggest introducing configuration management to achieve this. Try out packer.io . It’s basically a “tool for creating machine images with pre-configured operating systems and installed software from a single source configuration”. DigitalOcean has a great tutorial on setting it up: https://www.digitalocean.com/community/tutorials/how-to-install-and-get-started-with-packer-on-an-ubuntu-12-04-vps
When you get into it, packer has more provisioners other than shell for installing and configuring software. Go through the tutorial first to get what I’m talking about here. For example see how I use this ansible provisioner to install software on the machine:
{
"builders": [{
"type": "digitalocean",
"api_token": "YOUR API TOKEN",
"region": "nyc3",
"size": "512mb",
"image": "ubuntu-14-04-x64"
}],
"provisioners": [{
"type": "ansible",
"playbook_file": "standard.yml"
]
}]
}
It references an ansible playbook: standard.yml which goes through a list of system packages to install that are listed in the vars.yml file.
standard.yml
---
- hosts: all
vars_files:
- vars.yml
tasks:
- name: Installs required system packages listed in the vars.yml file
apt: pkg={{ item }} state=installed update_cache=true
with_items: "{{ system_packages }}"
vars.yml
---
system_packages:
- apache2
- git
- mysql-server
- php5-mysql
- php5
- libapache2-mod-php5
- php5-mcrypt
- unzip
- zip
command:
- mysql_install_db
- mysql_secure_installation
Now all you need to do is share this configuration file that anyone can run to create an image on DigitalOcean with your custom setup. Please share if you do :)

by danny.sipos
In this tutorial we will see how to install and get started with Packer on an Ubuntu 12.04 run VPS.