# Use wordpress on GCP with Google Compute Engine.

# Use wordpress on GCP with Google Compute Engine.


Today we’re going to see how to install wordpress on Google Compute Engine.

To start, we will log into the GCP console. Once done, click on **marketplace** and type wordpress in the search bar. You’ll see that there are a lot of wordpress packages.

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/2730/1*ywSyMdTHLcoYobR2GCk7Uw.png" width="1365" height="598" srcSet="https://miro.medium.com/max/552/1*ywSyMdTHLcoYobR2GCk7Uw.png 276w, https://miro.medium.com/max/1104/1*ywSyMdTHLcoYobR2GCk7Uw.png 552w, https://miro.medium.com/max/1280/1*ywSyMdTHLcoYobR2GCk7Uw.png 640w, https://miro.medium.com/max/1400/1*ywSyMdTHLcoYobR2GCk7Uw.png 700w" sizes="700px"/></noscript>

GCP Marketplace!

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/2688/1*XMxZez8lsd2fZM2Y4vg7XA.png" width="1344" height="546" srcSet="https://miro.medium.com/max/552/1*XMxZez8lsd2fZM2Y4vg7XA.png 276w, https://miro.medium.com/max/1104/1*XMxZez8lsd2fZM2Y4vg7XA.png 552w, https://miro.medium.com/max/1280/1*XMxZez8lsd2fZM2Y4vg7XA.png 640w, https://miro.medium.com/max/1400/1*XMxZez8lsd2fZM2Y4vg7XA.png 700w" sizes="700px"/></noscript>

GCP Marketplace — WordPress Certified by Bitnami and Automattic

Take care to choose the one with the following name: “**WordPress Certified by Bitnami and Automattic**”.


<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/1880/1*hCRteUy5uKSsEFec5oVt6Q.png" width="940" height="480" srcSet="https://miro.medium.com/max/552/1*hCRteUy5uKSsEFec5oVt6Q.png 276w, https://miro.medium.com/max/1104/1*hCRteUy5uKSsEFec5oVt6Q.png 552w, https://miro.medium.com/max/1280/1*hCRteUy5uKSsEFec5oVt6Q.png 640w, https://miro.medium.com/max/1400/1*hCRteUy5uKSsEFec5oVt6Q.png 700w" sizes="700px"/></noscript>

WordPress Certified by Bitnami and Automattic

You have the possibility to modify the characteristics of the virtual machine which will execute your wordpress. In the gray frame, you have the operating system and the software that will be installed on it. 👇🏽

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/2686/1*2I5qP204WRYKs56YkCvm3Q.png" width="1343" height="613" srcSet="https://miro.medium.com/max/552/1*2I5qP204WRYKs56YkCvm3Q.png 276w, https://miro.medium.com/max/1104/1*2I5qP204WRYKs56YkCvm3Q.png 552w, https://miro.medium.com/max/1280/1*2I5qP204WRYKs56YkCvm3Q.png 640w, https://miro.medium.com/max/1400/1*2I5qP204WRYKs56YkCvm3Q.png 700w" sizes="700px"/></noscript>

GCP Deployment Manager — WordPress Certified by Bitnami and Automattic

**_Why this one?_**

This is the one I use personally. It is complete, secure and always up to date.

Now that we have completed the installation, we will access the wordpress dashboard, files, database and phpmyadmin.

**_Access the wordpress dashboard._**

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/2694/1*5NRPb87ne_C5o16zn-1-YA.png" width="1347" height="617" srcSet="https://miro.medium.com/max/552/1*5NRPb87ne_C5o16zn-1-YA.png 276w, https://miro.medium.com/max/1104/1*5NRPb87ne_C5o16zn-1-YA.png 552w, https://miro.medium.com/max/1280/1*5NRPb87ne_C5o16zn-1-YA.png 640w, https://miro.medium.com/max/1400/1*5NRPb87ne_C5o16zn-1-YA.png 700w" sizes="700px"/></noscript>

GCP Deployment Manager — WordPress Certified by Bitnami and Automattic

Click on the website address and admin url. To log in to admin mode on wordpress, use the identifiers framed in red☝🏽.

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/2686/1*_00ErX2_FMk2WtN9Pki7YA.png" width="1343" height="615" srcSet="https://miro.medium.com/max/552/1*_00ErX2_FMk2WtN9Pki7YA.png 276w, https://miro.medium.com/max/1104/1*_00ErX2_FMk2WtN9Pki7YA.png 552w, https://miro.medium.com/max/1280/1*_00ErX2_FMk2WtN9Pki7YA.png 640w, https://miro.medium.com/max/1400/1*_00ErX2_FMk2WtN9Pki7YA.png 700w" sizes="700px"/></noscript>

Wordpress page!

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/1004/1*qqMTfk3URZRCYms284FDGA.png" width="502" height="488" srcSet="https://miro.medium.com/max/552/1*qqMTfk3URZRCYms284FDGA.png 276w, https://miro.medium.com/max/1004/1*qqMTfk3URZRCYms284FDGA.png 502w" sizes="502px"/></noscript>

Wordpress admin page

**_Access files._**

To get started, click on the instance name to access the Google Compute Engine page. After that, click on “**SSH**” then on “**Open in a browser window**” to connect to the virtual machine (VM).

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/2700/1*sg-6VjmWeT4dKcC9tKPzQg.png" width="1350" height="585" srcSet="https://miro.medium.com/max/552/1*sg-6VjmWeT4dKcC9tKPzQg.png 276w, https://miro.medium.com/max/1104/1*sg-6VjmWeT4dKcC9tKPzQg.png 552w, https://miro.medium.com/max/1280/1*sg-6VjmWeT4dKcC9tKPzQg.png 640w, https://miro.medium.com/max/1400/1*sg-6VjmWeT4dKcC9tKPzQg.png 700w" sizes="700px"/></noscript>

Google Compute Engine — SSH

When you have access to the machine, type this command: **cd apps/wordpress/htdocs && ls**

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/1736/1*7bCL8ttbEwfRAlwseNHsig.png" width="868" height="482" srcSet="https://miro.medium.com/max/552/1*7bCL8ttbEwfRAlwseNHsig.png 276w, https://miro.medium.com/max/1104/1*7bCL8ttbEwfRAlwseNHsig.png 552w, https://miro.medium.com/max/1280/1*7bCL8ttbEwfRAlwseNHsig.png 640w, https://miro.medium.com/max/1400/1*7bCL8ttbEwfRAlwseNHsig.png 700w" sizes="700px"/></noscript>

**_SSH_**

**_Connect to the database._**

We will need the database code found in the virtual machine information. To access it, follow the following steps: 👇🏽

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/1360/1*m2jBju0FmtrBRyKQyFGquQ.png" width="680" height="213" srcSet="https://miro.medium.com/max/552/1*m2jBju0FmtrBRyKQyFGquQ.png 276w, https://miro.medium.com/max/1104/1*m2jBju0FmtrBRyKQyFGquQ.png 552w, https://miro.medium.com/max/1280/1*m2jBju0FmtrBRyKQyFGquQ.png 640w, https://miro.medium.com/max/1360/1*m2jBju0FmtrBRyKQyFGquQ.png 680w" sizes="680px"/></noscript>

GCE VM!

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/1994/1*io0AXsaosvMa_JAGw2MiDA.png" width="997" height="252" srcSet="https://miro.medium.com/max/552/1*io0AXsaosvMa_JAGw2MiDA.png 276w, https://miro.medium.com/max/1104/1*io0AXsaosvMa_JAGw2MiDA.png 552w, https://miro.medium.com/max/1280/1*io0AXsaosvMa_JAGw2MiDA.png 640w, https://miro.medium.com/max/1400/1*io0AXsaosvMa_JAGw2MiDA.png 700w" sizes="700px"/></noscript>

bitnami-base-password

Look for “**bitnami-base-password**” in the VM information. Then run this command: **mysql — host=127.0.0.1 — user=root — password=“bitnami-base-password”**

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/1814/1*K3YoUwB_HqlM0GFV5g_03g.png" width="907" height="498" srcSet="https://miro.medium.com/max/552/1*K3YoUwB_HqlM0GFV5g_03g.png 276w, https://miro.medium.com/max/1104/1*K3YoUwB_HqlM0GFV5g_03g.png 552w, https://miro.medium.com/max/1236/1*K3YoUwB_HqlM0GFV5g_03g.png 618w" sizes="618px"/></noscript>

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/1458/1*LWIFjLs0m2TBpq6YNUSARA.png" width="729" height="645" srcSet="https://miro.medium.com/max/552/1*LWIFjLs0m2TBpq6YNUSARA.png 276w, https://miro.medium.com/max/766/1*LWIFjLs0m2TBpq6YNUSARA.png 383w" sizes="383px"/></noscript>

**Access phpmyadmin.**

[https://docs.bitnami.com/google/faq/get-started/access-phpmyadmin/](https://docs.bitnami.com/google/faq/get-started/access-phpmyadmin/)

**Add a domain name to our website.**

To begin with, we will make the IP address of our instance static. To do this, we will go to **VPC Network** and select **External IP Addresses** as Soot.👇🏽

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/956/1*Chou8lQYNwv0DhrLtvSwWQ.png" width="478" height="328" srcSet="https://miro.medium.com/max/552/1*Chou8lQYNwv0DhrLtvSwWQ.png 276w, https://miro.medium.com/max/956/1*Chou8lQYNwv0DhrLtvSwWQ.png 478w" sizes="478px"/></noscript>

Once this is done, click on the type that is **“ephemeral”** by default and replace it with **“static”**.

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/2172/1*6rQVzP9hBy5ms01R0KNOJg.png" width="1086" height="228" srcSet="https://miro.medium.com/max/552/1*6rQVzP9hBy5ms01R0KNOJg.png 276w, https://miro.medium.com/max/1104/1*6rQVzP9hBy5ms01R0KNOJg.png 552w, https://miro.medium.com/max/1280/1*6rQVzP9hBy5ms01R0KNOJg.png 640w, https://miro.medium.com/max/1400/1*6rQVzP9hBy5ms01R0KNOJg.png 700w" sizes="700px"/></noscript>

After you have done this, you need to update the DNS settings of your domain, adding an A record that points to the static IP address of your instance. That’s it, our website now has a domain name 👇🏽.

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/2646/1*e8UsZVx0eNTqqmaRgEeVuA.png" width="1323" height="369" srcSet="https://miro.medium.com/max/552/1*e8UsZVx0eNTqqmaRgEeVuA.png 276w, https://miro.medium.com/max/1104/1*e8UsZVx0eNTqqmaRgEeVuA.png 552w, https://miro.medium.com/max/1280/1*e8UsZVx0eNTqqmaRgEeVuA.png 640w, https://miro.medium.com/max/1400/1*e8UsZVx0eNTqqmaRgEeVuA.png 700w" sizes="700px"/></noscript>

**Enable SSL Certificate.**

We will connect to our SSH instance once again. Then we’re going to run the command : **sudo /opt/bitnami/bnhelper-tool**

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/1504/1*KynEzEwBHvvOolLgQFXDmw.png" width="752" height="436" srcSet="https://miro.medium.com/max/552/1*KynEzEwBHvvOolLgQFXDmw.png 276w, https://miro.medium.com/max/1104/1*KynEzEwBHvvOolLgQFXDmw.png 552w, https://miro.medium.com/max/1280/1*KynEzEwBHvvOolLgQFXDmw.png 640w, https://miro.medium.com/max/1400/1*KynEzEwBHvvOolLgQFXDmw.png 700w" sizes="700px"/></noscript>

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/1776/1*X_-sjSGOsUpjyw2hNg2R3w.png" width="888" height="245" srcSet="https://miro.medium.com/max/552/1*X_-sjSGOsUpjyw2hNg2R3w.png 276w, https://miro.medium.com/max/1104/1*X_-sjSGOsUpjyw2hNg2R3w.png 552w, https://miro.medium.com/max/1280/1*X_-sjSGOsUpjyw2hNg2R3w.png 640w, https://miro.medium.com/max/1400/1*X_-sjSGOsUpjyw2hNg2R3w.png 700w" sizes="700px"/></noscript>

Now select “**Set up Let’s Encrypt**”. After that, write your domain name(s).

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/1234/1*h1qEHGwWHenU-jNKCrVhCg.png" width="617" height="232" srcSet="https://miro.medium.com/max/552/1*h1qEHGwWHenU-jNKCrVhCg.png 276w, https://miro.medium.com/max/1104/1*h1qEHGwWHenU-jNKCrVhCg.png 552w, https://miro.medium.com/max/1234/1*h1qEHGwWHenU-jNKCrVhCg.png 617w" sizes="617px"/></noscript>

Finally, you will have a series of questions that you will answer.


- Enable HTTP to HTTPS redirection [Y/n]: Y
- Enable non-www to www redirection [Y/n]: Y
- Enable www to non-www redirection [y/N]: N
- Do you agree to these changes? [Y/n]: Y
- Do you agree to the Let’s Encrypt Subscriber Agreement? [Y/n]: Y
- Press [Enter] to continue:

As far as redirection issues are concerned, it all depends on what you want.

<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/1310/1*TmkLok0aCnVlbCVyfvQUkg.png" width="655" height="233" srcSet="https://miro.medium.com/max/552/1*TmkLok0aCnVlbCVyfvQUkg.png 276w, https://miro.medium.com/max/1104/1*TmkLok0aCnVlbCVyfvQUkg.png 552w, https://miro.medium.com/max/1280/1*TmkLok0aCnVlbCVyfvQUkg.png 640w, https://miro.medium.com/max/1310/1*TmkLok0aCnVlbCVyfvQUkg.png 655w" sizes="655px"/></noscript>

That’s it, our website is now secure.


<noscript><img alt="Image for post" class="dx hk dy hl t" src="https://miro.medium.com/max/2652/1*wnHK7FgvnDOyW0fnJ4oHBA.png" width="1326" height="369" srcSet="https://miro.medium.com/max/552/1*wnHK7FgvnDOyW0fnJ4oHBA.png 276w, https://miro.medium.com/max/1104/1*wnHK7FgvnDOyW0fnJ4oHBA.png 552w, https://miro.medium.com/max/1280/1*wnHK7FgvnDOyW0fnJ4oHBA.png 640w, https://miro.medium.com/max/1400/1*wnHK7FgvnDOyW0fnJ4oHBA.png 700w" sizes="700px"/></noscript>

And here we are, we just deployed wordpress on **Google Compute Engine** with a “**Marketplace**” solution.

Putting these eggs in one basket has never been a good idea. Reason why you should not put your database on the server that contains the files for your website. To solve this problem, you must put your database on Cloud SQL. And that’s what we’ll see in the next article.

Thank you for reading.
