John Mark Causing

System Administrator | Hosting Support Engineer

Bacolod City, Philippines

+639393497018

John Mark Causing

System Administrator | Hosting Support Engineer

Bacolod City, Philippines

+639393497018

Installing Bedrock + Trellis in Windows 10 using Ubuntu/WSL.

So I’ve been searching around on how to easily install Trellis + Bedrock in Windows and I don’t see any easy spoon feeding tutorial so far even in youtube. So I created one my self. .

So let’s skip the intro (but you can find it here and here) about Trellis + Bedrock and let’s get started!

These are the requirements from Trellis:

Let’s install those 1 by 1.

Composer (Requirement #1)

To install composer in Windows 10, we need Ubuntu and WSL so we can run linux commands so it would be easier. Download that in Miscrosoft store app. Download that and launch it!

Now it requires WSL. Go to https://aka.ms/wslinstall

Then run this:

Restart the Windows 10 Machine then run Ubuntu again

Now let’s proceed for the installation of composer. We are following this link

sudo apt update

sudo apt install curl php-cli php-mbstring git unzip

Then just run:

sudo apt install composer

Composer is ready to go!

Virtual Box (Requirement #2)

You can download it here: https://www.virtualbox.org/ or just click this link.

Now our virtual box is ready!

Vagrant (Requirement #3)

You can download it here.

Install it and it needs to restart your machine!

Installing Trellis

So now we are following this guide.

  1. Create a new project directory:
$ mkdir example.com && cd example.com
  1. Install Trellis:
$ git clone --depth=1 [email protected]:roots/trellis.git && rm -rf trellis/.git
  1. Install Bedrock into the site directory:
$ composer create-project roots/bedrock site

We need to open powershell and run WSL

Now we got an error from github that we don’t have access to that repo. Let’s fix that!

Generate github SSH key and add it to ssh agent (3 steps)

We are following this guide to generate ssh key. Run this to your powershell terminal.

Step 1 (Generate SSH KEY)

Go to the ~/.ssh directory (~ is your home directory then there is a .ssh folder)

ssh-keygen -t rsa -b 4096 -C "[email protected]"

Then read and copy the public key (id_rsa.pub) using cat id_rsa.pub

Step 3 (Add the public key to github)

So you copied those key text. Now login to github.com and go here then add new SSH key.

Remember we got an error about github repo permission? Let’s try again!!

Running this command:

git clone –depth=1 [email protected]:roots/trellis.git && rm -rf trellis/.git

Screenshot above shows I tried to check if I have access to github.com with that ssh -T command. I am also in the example.com directory. ls shows that we got the folder trellis downloaded using that git clone command.

Now we got the composer and trellis installed, final requirement is to install Bedrock! (the #3 installation guide from this link). Make sure you are still in the example.com directory.

composer create-project roots/bedrock site

Now it appears there’s an error. So I tried to google search that error and I found this solution. Run this command:

sudo apt-get install php-xml

We need to delete the ‘site‘ folder first then run it again.

rm -rf site

We fixed it! Now there is a site directory. Next step is to edit files in trellis to setup our WordPress site.

Editing the development environment files

We need to edit two file in (vault.yml and wordpress_sites.yml) located inside the trellisgroup_varsdevelopment folder. Just set your password and make sure to change it to your domain. I used the default one example.com

I also just remove the redirects:

    redirects:
      - www.example.test

Starting up our WordPress site (vagrant up)

Make sure you are in the trellis directory and in power shell (exit WSL) then run vagrant up.

Screenshot below shows that vagrant is starting up. It means that it is installing all the apps that it needs for our localhost WordPRess like Nginx, MariaDB, php, ansible and more. So sit back, relax and watch how Trellis magic works.

So far so good! No errors..

All done! WordPress is now installed using Trellis and Bedrock (using vagrant + virtual box). Take a look at this screenshot. A normal WordPress install and a curl results coming from nginx where Trellis created those for you.

You want part 2? Here’s the link for deploying your WordPress Bedrock + Trellis site to Kinsta.

I hope you enjoyed this tutorial and you please leave some comments just in case you have questions.