Are you interested in hosting your own website on the Google Cloud Platform? In this article, we will guide you through the process of installing an Apache web server on a Linux virtual machine. It’s easier than you might think!
Step 1: Log into Google Cloud Console
First, log into your Google Cloud project and navigate to the Compute Engine section. Click on “Virtual Machine” and then select “Create New Instance.”
Step 2: Configure Your Virtual Machine
Give your virtual machine a name and choose the Region and Zone where it will be hosted. This determines the location of your server. Keep in mind that the Region and Zone selection is important and can affect performance. If you need more information on this topic, check out our dedicated video on it.
Step 3: Change Boot Disc Type and Allow Firewall
In the Machine Configuration section, you don’t need to make any changes except for the No Service Account option. In the Boot Disc section, choose the SSD option for faster performance. Additionally, click on “Allow HTTP Traffic” in the Firewall section. Once you’re done, click on “Create” to create your virtual machine.
Step 4: Connect to Your Virtual Machine
After a few minutes, your virtual machine will be ready. Click on the SSH button to connect to your virtual machine. A new window will open, asking for your authorization to log in. Click “Authorize” to proceed.
Step 5: Update Packages and Install Apache
Now that you’re inside the virtual machine, update all the packages by running the command
sudo apt-get update. This ensures that your virtual machine has the latest software updates. Once that’s done, install the Apache server by running the command
sudo apt-get install Apache2 php7.0. Give your permission to proceed with the installation.
Step 6: Update the Landing Page
To personalize the landing page of your server, modify the
index.html file located in the
var/www/html directory. Replace the content with your own, such as “Hello World from your domain name.” Save the changes.
Step 7: Test Your Website
To test your website, find the external IP address of your virtual machine. Click on the link and you should see the modified landing page with your custom content.
Step 8: Remember to Delete Your Virtual Machine
Once you have finished experimenting or studying, it’s important to delete your virtual machine to avoid unnecessary charges to your account. Click on the three vertical dots and select “Stop” to stop the virtual machine. After it has stopped, click on the dots again and select “Delete” to remove the virtual machine.
Now you know how to install an Apache web server on a Linux virtual machine hosted on the Google Cloud Platform. Make sure to follow these steps and remember to delete your virtual machine when you’re done to avoid additional charges. Happy hosting!
Image Source: Technical Potpourri