Report this

What is the reason for this report?

Wordpress image with custom plugin pre installed

Posted on November 25, 2016

Hi all, I am just wondering how to create a custom image that I can share in public with the following things pre-installed.

My use case is that to create an e-commerce site with Woocommerce and an app with Appmaker.xyz . So that whoever need to setup an e-commerce website and an App with simple steps



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You can create a snapshot and send it to users who need it. That’s not enough public.

The thing you probably want is User Data - Cloud-Init scripts. How To Use Cloud-Config For Your Initial Server Setup. An Introduction to Cloud-Config Scripting. DigitalOcean User Scripts Library.

For further questions feel free to ask.

This comment has been deleted

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 :)

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.