Custom WordPress Installer Script in Virtualmin

WordPress (or any other script) can automatically install during Virtualmin > Create Virtual Server.

Virtualmin automatically creates users, MySQL database, and installs WordPress in the public_html root, then gives a link to the WordPress Installer. You can even create a custom installer with a set of plugins and themes.

To create a custom script installer with plugins and themes:

  • Download & unzip
    • add some themes and plugins folders in /wp-content/
    • zip as
  • Create a copy of /usr/libexec/webmin/virtual-server/scripts/
    • name the copy — this is important because the script requires proper id
    • edit to give a new name: script_wordpress_desc “Custom WordPress”
    • replace ALL instances of script_wordpress with script_custompress (id to match filename)
    • link to your zip: 'url' => "file://localhost/path/to/" (~line 150 after # script_wordpress_files)
      • this must be retrievable via wget from YOUR SERVER (test this via terminal command)
    • change 'virtualmin' => 0 to NOT use virtualmin scripts repo! (~line 152)

Your custom file should now look like this:

# script_custompress_files(&domain, version, &opts, &upgrade-info)
# Returns a list of files needed by WordPress, each of which is a hash ref
# containing a name, filename and URL -- set virtualmin to 0 to use the url
sub script_custompress_files
local ($d, $ver, $opts, $upgrade) = @_;
local @files = ( { 'name' => "source",
           'file' => "custompress-$",
           'url' => "",
           'virtualmin' => 0,
           'nocache' => 1 } );
return @files;

Try the install:

  • Put in /usr/libexec/webmin/virtual-server/scripts/

Automatic installation with creation of new virtual server:

  • Virtualmin > System Settings > Server Templates > Default Settings > Default Script Installers
    • Custom WordPress

If you want to have the script archive download from a protected web directory, that is also possible:

'url' => "", 'nocache' => 1, 'user' => "username", 'pass' => "password"



1 thought on “Custom WordPress Installer Script in Virtualmin”

Leave a Reply