How to Bytemark

Installing Wordpress from the command line with SSL (in 5 minutes)

Wordpress is the world’s most poular web site management system, powering 25% of web sites. This guide shows you how to set it up and maintain it very easily on a cloud server, and maintain lots of sites at once.

We’ll use:

  • Symbiosis which is a Debian-based Linux setup to power your server (it’s built for hosting domains in bulk without needing Linux knowledge), and
  • wp-cli which allows you to control Wordpress instances from the command line rather than the web.

The advantage of this combination is that you can still set up Wordpress in 5 minutes, but you can manage and maintain lots of sites in the same way.

You need to be able to use SSH to connect to a remote server, but otherwise no prior knowledge is needed.

One-time setup for your server

One cloud server can host tens of Wordpress sites without any trouble, so you only need to do this part once.

Step 1: Get yourself a cloud server

You can sign up to Bytemark’s cloud hosting in about 5 minutes.

To commission your server, go to Add Cloud Server and select the following:

  • Name: (e.g.) wptest
  • Performance: Can be left at 1 core / 1GB RAM
  • Distribution: Bytemark Symbiosis (based on Debian/jessie)
  • Discs:
    • Leave the root disc with a type of SATA (SSD) and size of 25GB

You can then click “Add this server” and your server should be created for you in about five minutes.

Don’t forget to note down your server’s hostname and root password.

You should then log onto your server with SSH as ‘admin’ for the remainder of this guide.

Step 2: Install wp-cli

You need to install the wp-cli tool which saves a lot of time building and installing Wordpress sites. Thankfully this is only one command:

sudo wget -O /usr/local/bin/wp
sudo chmod +x /usr/local/bin/wp

(you’ll need to enter your admin password after the first command, but not a second time unless you log out)

Creating a Wordpress site

You can repeat this step as many times as you like to create more sites.

Step 3: Decide on some details for your site

Your Wordpress site needs its own web address (hostname), a title, and an administrative username and password. We’re going to assume that you want to create a site called ‘’ with the username of ‘matthew’ and password ‘shazam’ (you should pick a better one!).

So enter the following into your server:

WP_TITLE="Snow bother - All about snowboarding"

Then you can cut & paste the following to set up other necessary parameters automatically:

WP_DB_NAME=wp_`echo $WP_HOSTNAME | sed -e 's/[^A-Za-z0-9]/_/g'`
WP_DB_USER=`echo $WP_DB_NAME | cut -c1-16`
WP_DB_PASS=`openssl rand -base64 18`

Step 3: Create a database

You need to create a database separately from the rest of the process. This command should do it for you in one go:

sudo mysql --defaults-file=/etc/mysql/debian.cnf -e "CREATE DATABASE $WP_DB_NAME; GRANT ALL PRIVILEGES ON $WP_DB_NAME.* TO '$WP_DB_USER'@'localhost' IDENTIFIED BY '$WP_DB_PASS'"

Step 4: Install and configure Wordpress

Now you’re able to create and install the Wordpress site with these commands, which you can cut & paste:

mkdir -p /srv/$WP_HOSTNAME/public/{config,htdocs} && cd $_
wp core download
wp core config --dbname=$WP_DB_NAME --dbuser=$WP_DB_USER --dbpass=$WP_DB_PASS
wp core install --url=$WP_HOSTNAME --title="$WP_TITLE" --admin_user=$WP_USER --admin_password=$WP_PASSWORD --admin_email=$WP_EMAIL
wp plugin install any-hostname --activate
echo "40 6 * * * /usr/local/bin/wp core update --minor --path=$WP_PATH" > $WP_PATH/../config/crontab
sudo chgrp -R www-data wp-content
echo; echo "http://$WP_HOSTNAME.testing.`hostname -f`/"

And you’re done!

Wordpress is now set up on your domain, and Symbiosis has given you a handy test URL where you can view the site immediately. (e.g. in this case the site is - it’s long, but works immediately!)

You can also add /wp-admin/ to your site’s address to access Wordpress’ administration pages, and test out your login.

If you’ve registered a new domain for your site, you should be able to view your new site at the address you’ve requested within a few minutes.

Once you’ve been able to see your site at its real host name through your web browser, you can ensure your visitors are accessing it securely. Symbiosis gives you SSL for free thanks to Let’s Encrypt.

SSL means your visitors’ traffic is securely encrypted so that the pages they view can’t be seen, and they’ll see the padlock icon in their browser. As of Symbiosis Jessie, this happens transparently and automatically in the background, but can take an hour or two, if your domain is resolving correctly.

To get Symbiosis to try and generate your certificate immediately, run :

sudo symbiosis-ssl -v $WP_HOSTNAME

Once this has run successfully you should be able to access your site at its secure address (i.e. your hostname but add https:// to the front of it). If this has worked, you should see a padlock in the address bar, and no warnings pop up.

If you’re happy with that, you can tell Symbiosis to ensure visitors get bounced to the secure version of your site from then on, just type:

touch $WP_PATH/../config/ssl-only

And you should find it happens automatically.

Bytemark Cloud used to be called "BigV"—nothing has changed except the name! We’re hiring! Please visit to find out more.