Contact Menu

Automated WordPress Installation Via Custom Virtualmin Script Installer

Updated: please read instructions again and find link to new example file.

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:

 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"

, ,

50 Responses to Automated WordPress Installation Via Custom Virtualmin Script Installer

  1. Ken Reidy May 31, 2012 at 6:51 am #

    Hi Chris, thanks for sharing this short article. I Will try this tips since it’s look more easier than what I usually do on my vps server and my local testing server. I usually download WordPress latest.tar.gz and extract it into ‘etc/skel/wordpress/public_html’.

    I just know your blog and I think you have many posts that I can learned to improve my skill.

    BTW, sorry if my English isn’t good. I’m Indonesian.

  2. imam June 13, 2012 at 7:04 pm #

    It’s very interesting, we are usually manual install in Webmin-Virtualmin.

  3. Xray June 30, 2012 at 9:00 pm #

    I have the script installed and it is working with the exception of getting my custom file. for some reason the script continues do download from… How do I force the script to download from a local site or directory?

    • Chris Gilligan July 7, 2012 at 9:24 am #

      Try changing line 151 to:
      'url' => "file://localhost/path/to/",
      You may want to read more about file URI scheme.

  4. Steve Wyman August 22, 2012 at 10:30 am #


    neat for use on a virtual server environment.

    Could i also use this approach on a shared hosted environment such as

    Im not a coder but understand systems well.

  5. Steve Wyman August 25, 2012 at 8:28 am #

    Hi Chris, thanks for letting me know.

    A shame :-(

    • Chris Gilligan August 25, 2012 at 8:58 am #

      That brings up an interesting point: why pay for a control panel when you can use Virtuamin GPL for free. You should look into getting your own inexpensive VPS, installing Virtualmin GPL and learning more about Linux Systems Administration. Load up a supported 64-bit OS, then install Virtualmin GPL.

      You will be surprised how easy it is to get up and running with Virtualmin, and if you have any questions, the Virtualmin forum is very helpful.

      I have a couple of Pro licenses, so I have access to all of the script installers, so I like to copy and customize the script installers, which work even on Virtualmin GPL, which includes a few… like WHMCS and phpMyAdmin.

    • Chris Gilligan August 30, 2012 at 12:23 pm #

      Steve, you would need to look into creating a customized Softaculous script for Cpanel… I do admin on a few Cpanel servers, but don’t really like them for several reasons… so have not yet done a custom Softaculous script… but it should be possible.

  6. Kevin Richard September 11, 2012 at 5:05 pm #


    Is this available only with Virtualmin Pro ?


    • Chris Gilligan September 11, 2012 at 5:24 pm #

      Script installers work with GPL as well. However, GPL only ships with a few scripts. But you can put any number of scripts in the installer folder, and copy and customize them if you like. The WordPress script is very handy indeed, I use it nearly every day.

      I sort of cheat the system with Virtualmin… I have 2 Pro licenses, but I install a ton of GPL servers for my clients. So if they need script installers, I will install Pro, then downgrade it to GPL. Or just copy the necessary scripts from Pro to GPL.

  7. Tony G November 8, 2012 at 5:43 am #

    Hi Chris,

    Do you know of a place to download scripts for GPL users without a pro license? :)


    • Chris Gilligan November 14, 2012 at 11:25 am #

      There’s no easy way to get the Pro script installers for free… buying a VM Pro license for 10 domains is pretty cheap and will get you all of the installers, which you can drop into GPL.

      If you do a lot of server deployments, it’s well worth having at least 1 Pro license. Sometimes it’s easiest to install Pro, then downgrade to GPL so you get the benefit of more supported OS’s and the script installers. Doing this is unrestricted. Jamie & Joe probably would not approve, but there’s no technical roadblock to prevent you from using the Pro software keys this way.

  8. Darnell March 16, 2013 at 1:36 pm #

    Hi there would you mind letting me know which
    webhost you are using? I’ve loaded your blog page in 2 completely different internet browsers and I have to say this web loads a lot quicker then most. Can you recommend a good hosting provider at a reasonable price? Thank you, I appreciate it! Please also excuse if my english is not good enough.

  9. kindnation March 21, 2013 at 2:42 pm #

    I did everything as you described and ran the script to install wordpress, and it results in:

    WordPress installation complete. It can be accessed at ( is the domain I’m running the script for).

    When I try to click on the link above, it results in a 404 Not Found, The requested URL /wordpress/wp-admin/install.php was not found on this server, even though I see wordpress has been installed in public_html.

    Any reason why I it doesn’t the wordpress install?

    • Chris Gilligan March 21, 2013 at 7:05 pm #
      1. Did you modify the WordPress installer script in any way, or did you use the one linked from this post, as-is? (if not, try the stock version and see if it works)
      2. What OS is your server?
      3. What web server are you running?
      4. Does /home/[domain-owner-username]/public_html/wordpress/wp-admin/install.php actually exist on your server?
      5. Create a hello-world.html file in /public_html/hello.html –> Does it load?

      On Monday, I helped co-worker set up a VPS with CentOS 6, Virtualmin GPL, and Apache, installed this script, and had a wordpress site running, all in less than 30 minutes… so it’s not the script that’s at fault. Most likely, if you modified the script, you may have mis-typed something. Check your code changes? Let me know if I have mis-typed something?

      • Chris Gilligan March 21, 2013 at 7:08 pm #

        Also, file://localhost/path/to/ needs to use your own proper pathing (and point to an actual, valid WordPress installation file). See reply to X-ray, above, and accompanying link.

        • Chris Gilligan March 21, 2013 at 7:13 pm #

          …and if you can’t get file://localhost… to work for you, try and see if it works. If that does not work, try linking to the zip file linked from this post… it will work (though it installs WP 3.4.x).

        • Chris Gilligan March 21, 2013 at 7:19 pm #

          …and be sure if/when you zip up your customized wordpress installer, you zip -r (recursive), and check to be sure you have the proper folder structure in your zip file.

    • Davids January 8, 2016 at 5:36 am #

      Did you get to solve this issue? I am currently facing the same problem.

  10. manny April 12, 2013 at 1:49 am #

    Hi Chris,

    Thank you for sharing the script, it works for me. Do you have similar .pl file for Drupal? Can you share it with us all, please?

  11. George February 5, 2014 at 3:34 am #

    Way to go Chris,this is something really cool.One doubt which version of WordPress will be installed with this script ?

    • Chris Gilligan February 5, 2014 at 10:22 am #

      21 return ( "3.x.x" );

      Or, whatever version you choose if you roll your own .zip file.

  12. Tee March 11, 2014 at 6:05 pm #

    This guide is perfect! I was torn between Virtualmin Pro and GPL and eventually went for GPL. Of all the scripts Pro offers, WordPress is the only one I was interested in so this has been super helpful, thank you.

    Just one question; I’ve followed the guide carefully and I’ve observed your reply to X-Ray and others above yet I’m finding that the script is pulling the WordPress install files from somewhere that looks like and not even

    I have created a custom zip and used the file://path/to/ URL and even hosted it on a remote server and tried to pull from there but it’s always going to I can’t find this anywhere in the script, it must be hardcoded in Virtualmin GPL somewhere.

    I’m using Virtualmin version 4.06 GPL on CentOS 6.5 64bit

  13. Don March 13, 2014 at 3:57 am #

    I am using the latest version of Virtualmin Pro, and I can’t get the default script installer to execute the script.

    It creates the virtual server, but doesn’t execute the WordPress installer. Even without any modifications to the, the script doesn’t run after creating a virtual server.

    Is there something I have to configure in the Default script installer besides pointing to the script?

  14. Tee March 13, 2014 at 7:17 am #

    Here is a screen grab of an example

    Have you got any ideas on how I can force the script to use my own path/URL as denied on line 151?


  15. Chris Gilligan March 13, 2014 at 1:45 pm #

    Aplogies… many things in Virtualmin script installers have changed since I originally wrote this post. I have updated it to work with current version, tested and provided a installer that links out to a file hosted on AWS S3.

    You should be able to use it as an example, and please re-read the UPDATED instructions to find correct info and link to

    To use a custom file and to exclude the script repo, set ‘virtualmin’ => 0 in the same section where you specify the URL of your custom wordpress zip.

    Also follow all of the links in the post to find useful info about custom Virtualmin script installers.

  16. Tee March 13, 2014 at 2:58 pm #

    Excellent, thank you!
    I’ll give it a go and feedback.

    Thanks again

  17. Tee March 14, 2014 at 12:22 am #

    Thank you Chris, this all worked a treat! My custom WordPress install now pulls my custom install and all works very well.

    Just for anybody who might need it, I’m using Virtualmin on CentOS 6.5 64 bit (PHP5.4) and it doesn’t like the file://localhost/path/to/ protocol. I managed to get it working using

    Chris, this is very very much appreciated :-)

    • Chris Gilligan March 14, 2014 at 8:43 am #

      Good news, Tee. Thank you for your patience and willingness to troubleshoot. Did you also try setting up automatic install of script on creation of virtual server? That is a very useful feature of Virtualmin templates. It is fun to meet with a client, and have their website up and running within a few minutes…

  18. Tee March 19, 2014 at 7:15 am #

    Hi Chris, no worries at all. It’s the least I could given the trouble and effort you went to to enable the opportunity :-)

    Yes, that’s what I’m actually using it for. I’m using it with my automatic provisioning and billing system to offer WordPress out of the bag complete with popular plugins and the best free themes available.

    However, there are two minor things I’ve noticed which I hope you can help with. Both relate to the wp-config.php file.

    1. The installed WordPress instance does not have randomised salts. I’m not a coder so I wouldn’t know how to do this but I imagine one could use cURL or something to pull the results of the online WordPress salts generator in to replace the lines in the file using some sort of regex (again, I know the concept – wouldn’t know where to begin!). Are these things that could be included in the script?

    2. The database table prefix is left as the default ‘wp_’ but I wonder if the script could be modified to randomise this too with some sort of ‘wp_???_’

    A savvy customer seeing those left unchanged might think I’ve done a half-hearted job and left their install ‘insecure’ so at present I go in and modify these after each new install.

    What do you think?

  19. Reenato Pasquini March 23, 2014 at 1:36 pm #

    what you posted is for the creation of a platform rental e-commerce with wordpress? like Shopify, where the user makes a record shop and is automatically installed? how sites:

    I realized that they all use wordpress.

  20. Steph Riggs March 24, 2014 at 6:55 am #

    Some people WP installation a complex step but its installation through custom virtualmin script installer has become quite easy even a beginner can easily install it by just following your guidelines. I am pretty happy to read your short article about this great scripts which need to say, thumbs up for your great work :)

  21. Josef April 17, 2014 at 12:10 pm #

    See this tutorial…

  22. Amir May 9, 2014 at 1:04 am #

    Hey Chris, you rock buddy! :) thanks a bunch….Salam (peace be unto you)

  23. lotnicza May 14, 2014 at 4:56 am #

    I used to use webmin to access my server, maybe i should try this method.

  24. Rick October 13, 2014 at 7:28 am #

    I had a look at this and got it working, I never touched Perl before so feel free to change the code when you do add it to the script.

    changed code with location:
    code for easy copy paste:

    It works like this:
    First it downloads the salt in the variable ‘string’ $salt_info.
    Second it splits each line into the array ‘wordpresssalt’ using new line.
    Third it uses the same patern as the existing regex replacing the lines with the values of the array.

  25. Eric Burns-White January 19, 2015 at 5:48 pm #

    Hey there — thank you for this, by the way.

    They currently list “six applications!” as being part of the GPL version, but I can’t find what those six applications are. We’re not going to be doing that many deployments, so it’s hard for me to justify the Pro license to the people up the line, so it would be useful to know which scripts come ‘out of the box,’ so I can compare those to the Pro list (which is, of course, pretty huge these days.)

    • Chris Gilligan January 26, 2015 at 8:40 am #

      I think they include phpMyAdmin, SquirrelMail, RoundCube… can’t recall others.

  26. Toufique Imam February 16, 2015 at 11:39 am #

    Worked like a charm!

    Little change for the script location, now newer virtualmin scroipt location is in “/usr/share/webmin/virtual-server/scripts”.

  27. Rufus June 18, 2015 at 9:33 am #

    Can such a script be used for the installation of any webapp (i.e., LAMP-based, java-based, etc)?

    • Chris Gilligan June 22, 2015 at 8:42 am #

      Rufus, I am not sure… LAMP for sure, java… I don’t know.

  28. Serge August 15, 2015 at 12:05 pm #

    Hi Chris, thanks for this post!

    You’ve inspired me to create my own WordPress install script for Virtualmin – it fetches the latest zip file from directly, which I think is a better option. So far works great

    I also made a Drupal install script, but I can’t get it to create the database tables itself, so it’s kinda semi-manual for now :-)

    • Wade November 4, 2015 at 11:53 pm #

      The script that Serge provided above works well through virtualmin’s install script’s administration, (including uninstalling) by loading the script at Virtualmin>virtualServersList>ScriptInstallers>AddScript
      Thanks Y’all

  29. Richard Durivage August 23, 2015 at 11:29 am #

    Hi Chris,

    Thanks for the informative post! It was very helpful to me. Excellent work!

  30. Davids January 9, 2016 at 1:58 am #

    I have user0 as my initial user other than root. I used that (user0) to install virtualmin/webmin. virtualmin does not know my root passed. After that I made a virtual server called server1. Now server1 is located in /home/server1/
    However none of the files I put in public_html inside server1 can’t be found by apache.
    My apache DocumentRoot is $(home)/server1/public_html.

    Is there any solution? I am totally stuck.

Leave a Reply