In this tutorial I will clone the codebase of a pre-built website from GitHub into a virtual machine and serve the website files over the internet.
This tutorial builds on a previous tutorial: How to setup a compute engine VM on GCP and install LAMP stack on the server.
Prerequisite
Complete tutorial: How to setup a compute engine VM on GCP and install LAMP stack on the server.
Find the link to the YouTube tutorial here.
Steps
i) SSH into the VM – Log into your GCP console and SSH into the server virtual machine instance.
ii) Change to the apache2 web server root directory:
ls
cd /var/www/html
List files
ls
iii) Clone prebuilt code from https://github.com/ugogineering/computershop2 into the VM with the command:
sudo git clone https://github.com/ugogineering/computershop2.git
List files:
ls
Change to the cloned directory
cd computershop2
iv) Move cloned files to web server root directory
sudo mv * ..
v) Change directory
cd ..
vi) List files
ls
vi) Visit website file in the virtual machine from a browser over the internet by opening a browser and going to
http://[EXTERNAL_IP]/index.php
You should see the website home page. Make sure that you don’t use the https protocol specifier because HTTPS is not configured.
END.
What we accomplished in this tutorial
i) We cloned a website code from GitHub into a compute engine virtual machine on Google Cloud Platform (GCP);
ii) We viewed a web page from the virtual machine from a browser over the internet.
NB: With the skills you learned in this blog and accompanying video you have skills to clone code from a repository into a compute engine virtual machine.
If you have comments or corrections about this blog post please write them in the comments section below and I will respond. Thank you.
References
- How to setup a GCP compute engine virtual machine instance and install Linux, Apache, MariaDB, PHP (LAMP) Stack on Ubuntu 22.04 – YouTube Video.
- How to setup a GCP compute engine virtual machine instance and install Linux, Apache, MariaDB, PHP (LAMP) Stack on Ubuntu 22.04 – blog post.
- My (Ugochukwu Ukwuegbu’s) YouTube channel.
Comments are closed.