Skip to content
Script to generate a WordPress site in an LXD container.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Bash script to generate an LXD WordPress site, configured with a Let's Encrypt certificate and an Exim installation for delivering WordPress notification emails.

Getting Started

You may want to first copy '' to something like '', since there are some environment variables at the top of the script that should be edited according to your installation. In particular, HOST and DB_PASS will need to be set to something specific to your installation.


To run this script, you will need a working 'lxc' command on your host. See here for details on installing LXD.

I used snapd to install on Debian 9. Snap is simply a package manager by Canonical, and can be installed directly on Debian 9 onwards with 'sudo apt-get install snapd'.


With the script edited appropriately, it should be enough to just run ./ (or whatever you copied it as before editing.

When the script has finished, if all went well, you can connect to the container with 'lxc exec wp-container bash'. This will put you in a root prompt inside the container.

From here, things should look like an ordinary VPS, with Apache and Exim running. You should be able to connect to your site and follow on with the standard WordPress configuration wizard.

There are a few notes here from when I originally moved to LXD for WordPress.


This code is simply a generalised version of something I used for my own site. There's plenty of room for improvement, so pull-requests are welcome.


This project is licensed under the GNU GPLv2.


  • Thanks in particular to Neilpang for his awesome script for generating Let's Encrypt certificates. Being dependent on nothing but bash helped significantly reduce the size of the container, which was one of my goals.
You can’t perform that action at this time.