Updated 4/6/15 – now with added key/salt generation
When deploying a new WordPress site, there are two (potentially) needlessly time-consuming steps – logging in to MySQL to setup a new database and user, and then copying the WordPress files to the directory. The script below lets you do this in one step, pass in your database and basic WordPress settings, and it will configure MySQL and directly download WordPress to the server. A key benefit of this over a phpMyAdmin + FTP approach is that it will work over even ropey internet connections as the work is all done on the server itself.
A more advanced approach is to build a setup script based on WP-CLI, which allows the most customisation, but also needs more setup work and control over the server. If you always install the same plugins and themes – definitely look in to this.
How to use the script:
- SSH in to your server and navigate to the desired install directory (e.g. /var/www/domain/)
- Paste all of the following in to terminal and hit Return:
curl -L -o 'wp.sh' https://gist.githubusercontent.com/emirpprime/37ef1f355ec5a7ecbb8f/raw/019acd595af695498acdf7b497e32ca0ebfb87f0/wp.sh && bash wp.sh
- Enter your details when prompted
- (Exit / close the SSH connection, your done here)
- Navigate to your new site in a web browser to complete the normal WordPress installation steps
Here’s the raw script so you can see what it’s doing – feel free to Fork it or suggest improvements:
Leave a Reply