Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home Google Cloud

LAMP Installation on Google Cloud – Ubuntu 18.04

by Cloudbooklet
5 years ago
in Google Cloud, Compute Engine
Lamp Installation On Google Cloud Ubuntu 18.04
ShareTweetSendShare
Readers like you help support Cloudbooklet. When you make a purchase using links on our site, we may earn an affiliate commission.

LAMP Installation on Google Cloud – Ubuntu 18.04. A LAMP stack is a set of open-source software installed to host dynamic websites and web applications. This guide demonstrates how to install and setup LAMP stack on Google Cloud Platform. Here we use Ubuntu 18.04 to install Apache and PHP 7.3. We will not install MariaDB […]

ADVERTISEMENT

LAMP Installation on Google Cloud – Ubuntu 18.04. A LAMP stack is a set of open-source software installed to host dynamic websites and web applications.

This guide demonstrates how to install and setup LAMP stack on Google Cloud Platform. Here we use Ubuntu 18.04 to install Apache and PHP 7.3.

We will not install MariaDB or MySQL in the same server, instead we will use Cloud SQL with Second Generation instance MySQL v5.7 for high performance.

ADVERTISEMENT

Prerequisites

  • A running Compute Engine, see the Setting up Compute Engine Instance with Ubuntu 18.04
  • Initial Ubuntu Server Set up.
  • Domain name is pointed to your virtual machine.
  • For setting up Cloud DNS, see the Setting up Google Cloud DNS for your domain
  • A running Cloud SQL instance, see How to set up Cloud SQL in Google Cloud

1. Install Apache

The Apache web server is the widely used web server in the world. It is also well documented and makes a default choice for hosting a website.

You might also like

How To Setup Ssh Keys On Ubuntu

How to Setup SSH Keys on Ubuntu 20.04

4 months ago
Draggan Ai Editing Tool Install And Use Draggan Photo Editor

DragGAN AI Editing Tool Install and Use DragGAN Photo Editor

4 months ago

Update the packages and install Apache using the following command.

sudo apt update
sudo apt install apache2

2. Configure Firewall

Now you can set up Uncomplicated Firewall (UFW) with Apache to allow public access on default web ports for HTTP and HTTPS

ADVERTISEMENT
sudo ufw app list

You will see all listed applications.

Output
Available applications:
Apache
Apache Full
Apache Secure
OpenSSH
  • Apache: This profile opens port 80 (normal, unencrypted web traffic)
  • Apache Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)
  • Apache Secure: This profile opens only port 443 (TLS/SSL encrypted traffic)
  • OpenSSH: This profile opens port 22 for SSH access.

If you are not going to use SSL you need to enable only the Apache profile.

ADVERTISEMENT

Now we will enable Apache Full.

sudo ufw allow 'Apache Full'

With this command you can view the status of UFW.

ADVERTISEMENT
sudo ufw status

You will see the output as follows.

Output
Status: active
To Action From
-- ------ ----
Apache Full ALLOW Anywhere
OpenSSH ALLOW Anywhere
Apache Full (v6) ALLOW Anywhere (v6)
OpenSSH (v6) ALLOW Anywhere (v6)

3. Check Apache Installation

Once Apache is installed is is started automatically and already be up and running.

ADVERTISEMENT

Every process in Apache is managed with the systemctl command. Check the status of Apache with the following command.

sudo systemctl status apache2
Output
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: active (running) since Tue 2019-01-29 03:59:34 UTC; 5min ago
Main PID: 10617 (apache2)
Tasks: 55 (limit: 667)
CGroup: /system.slice/apache2.service
├─10617 /usr/sbin/apache2 -k start
├─10619 /usr/sbin/apache2 -k start
└─10620 /usr/sbin/apache2 -k start
Jan 29 03:59:34 apache systemd[1]: Starting The Apache HTTP Server…
Jan 29 03:59:34 apache systemd[1]: Started The Apache HTTP Server.

Now visit your domain name in your favourite web browser, you will see the default Apache welcome page.

00De463E Apache Welcome Page

Now Apache is installed and you can know more about Apache commands here.

4. Install PHP

You can install PHP 7.2 with the following command.

sudo apt install php7.2 libapache2-mod-php php7.2-common php7.2-mysql php7.2-xml php7.2-xmlrpc php7.2-curl php7.2-gd php7.2-imagick php7.2-cli php7.2-dev php7.2-imap php7.2-mbstring php7.2-opcache php7.2-soap php7.2-zip php7.2-redis php7.2-intl php7.2-bcmath unzip -y

If you want to use PHP 7.3 you can use this command.

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php

sudo apt update

sudo apt install php7.3 libapache2-mod-php php7.3-common php7.3-mysql php7.3-xml php7.3-xmlrpc php7.3-curl php7.3-gd php7.3-imagick php7.3-cli php7.3-dev php7.3-imap php7.3-mbstring php7.3-opcache php7.3-soap php7.3-zip php7.3-redis php7.3-intl php7.3-bcmath unzip -y

After the installation has completed, confirm that PHP 7.3 has installed correctly with this command

php -v

5. Configure PHP

Now we configure PHP for WordPress by changing some values in php.ini.

PHP 7.2
sudo nano /etc/php/7.2/apache2/php.ini 

PHP 7.3
sudo nano /etc/php/7.3/apache2/php.ini

Hit F6 for search inside the editor and update the following values

upload_max_filesize = 32M 
post_max_size = 48M
memory_limit = 256M
max_execution_time = 600
max_input_vars = 3000
max_input_time = 1000

Hit CTRL+X and Y to save the configuration and check if the configuration is correct and restart Apache

sudo service apache2 restart

6. Setup Cloud SQL

Now you can create a Second generation Cloud SQL Instance and connect with your Compute Engine VM Instance.

Learn to set up Cloud SQL in Google Cloud.

Now you have installed LAMP stack on Google Cloud with Ubuntu 18.04.

Tags: Compute EngineUbuntu 18.04
ShareTweetSendShare
Cloudbooklet

Cloudbooklet

Comments 3

  1. Avatar Of Good Man Good Man says:
    3 years ago

    You forgot about editing file with hosts and domain at sites-available

    Reply
    • Avatar Of Cloudbooklet Cloudbooklet says:
      3 years ago

      Yes, that is described in another post.

      Reply
  2. Avatar Of Wishvesh Ujawane Wishvesh Ujawane says:
    3 years ago

    Where is the domain name available?

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related Posts

Set Up Deep Learning With Nvidia, Cuda, Cudnn On Ubuntu

How to Set Up Deep Learning with Nvidia, CUDA, cuDNN on Ubuntu 22.04

7 months ago
How To Install Or Upgrade Php 8.2 On Ubuntu 22.04

How to Install or Upgrade PHP 8.2 on Ubuntu 22.04

9 months ago
How To Change Timezone On Ubuntu 22.04

How to Change Timezone on Ubuntu 22.04

1 year ago
How To Install Ansible On Ubuntu 22.04

How to Install Ansible on Ubuntu 22.04

1 year ago

Follow Us

Trending Articles

Ai Trainer

How to Become an AI Trainer: Skills, Salary, and Career Opportunities

September 15, 2023

Google Bard Extensions: How to Link Your Gmail, Docs, Maps, and More to an AI Chatbot

7 Best AI Girl Generators for Creating Realistic and Beautiful AI Girls

Microsoft Editor vs Grammarly: Which is the Best Grammar Checker?

Validator AI: The AI Powered Business Idea Validator

Top 10 Advantages of a Cloud VPS Server

Popular Articles

Website Malware Scan

8 Best Tools for Website Malware Scanning Online Free

September 11, 2023

How to Upscale Image with Stable Diffusion Models

10 Free Business Email Account Providers in 2023

How to Use Canva on ChatGPT: A Step-by-Step Guide

OpenAI Introduces ChatGPT Enterprise for Businesses

TinyLlama: A 1.1B Parameter Language Model Pre-trained on 3 Trillion Tokens

Subscribe Now

loader

Subscribe to our mailing list to receives daily updates!

Email Address*

Name

Cloudbooklet Logo

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Applications
  • Linux

Cloudbooklet © 2023 All rights reserved.