• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to install LAMP stack by Bash Script on Ubuntu 21.04

  • 00:39 lsb_release -a
  • 00:51 vi lamp.sh
  • 07:27 sh lamp.sh
6765

Installation of LAMP stack by Bash Script on Ubuntu 21.04

Introduction:

BASH is short for Bourne Again Shell, a UNIX shell and command language, LAMP is a common stack for web servers, and Linux, Apache, MySQL, and PHP make up its components.

Installation Procedure:

Step 1: Check the OS version by using the following command

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 21.04
Release:	21.04
Codename:	hirsute

Step 2: Create a Bash script file to install LAMP stack

root@linuxhelp:~# vi lamp.sh

#!bin/bash


echo 'Installing Apache Web Server'

apt install apache2 -y

echo 'Apache Web Server is installed'

echo 'Installing Maria DB'

apt install mariadb-server -y

echo 'Maria db installed'

echo 'Installing php and its modules'

apt install php-pear php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php -y

echo 'php and its modules installed'

echo 'Starting the services'

systemctl restart apache2

systemctl restart mariadb

echo 'Enabling the services'

systemctl enable apache2

systemctl enable mariadb

echo 'Finally Checking status of services'

echo Apache service is $(systemctl show -p ActiveState --value apache2)

echo Maria DB service is $(systemctl show -p ActiveState --value mariadb) 

echo LAMP setup installed on ubuntu Successfully

Step 3: Run the Script file by using the following command

root@linuxhelp:~# sh lamp.sh
Installing Apache Web Server
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libllvm11 net-tools
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
Suggested packages:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,741 kB of archives.
After this operation, 7,550 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 libapr1 amd64 1.7.0-6ubuntu0.1 [96.9 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu hirsute/main amd64 libaprutil1 amd64 1.6.1-5ubuntu1 [84.9 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu hirsute/main amd64 libaprutil1-dbd-sqlite3 amd64 1.6.1-5ubuntu1 [10.6 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu hirsute/main amd64 libaprutil1-ldap amd64 1.6.1-5ubuntu1 [8,748 B]
Get:5 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 apache2-bin amd64 2.4.46-4ubuntu1.3 [1,201 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 apache2-data all 2.4.46-4ubuntu1.3 [158 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 apache2-utils amd64 2.4.46-4ubuntu1.3 [84.8 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 apache2 amd64 2.4.46-4ubuntu1.3 [95.9 kB]
Fetched 1,741 kB in 1s (1,851 kB/s)
Selecting previously unselected package libapr1:amd64.
(Reading database ... 191742 files and directories currently installed.)
Preparing to unpack .../0-libapr1_1.7.0-6ubuntu0.1_amd64.deb ...
Unpacking libapr1:amd64 (1.7.0-6ubuntu0.1) ...
Selecting previously unselected package libaprutil1:amd64.
Preparing to unpack .../1-libaprutil1_1.6.1-5ubuntu1_amd64.deb ...
Unpacking libaprutil1:amd64 (1.6.1-5ubuntu1) ...
Unpacking apache2-bin (2.4.46-4ubuntu1.3) ...
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
Processing triggers for install-info (6.7.0.dfsg.2-6) ...
Processing triggers for libc-bin (2.33-0ubuntu5) ...
Processing triggers for php7.4-cli (7.4.16-1ubuntu2.2) ...
Processing triggers for libapache2-mod-php7.4 (7.4.16-1ubuntu2.2) ...
php and its modules installed
Starting the services
Enabling the services
Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable apache2
Synchronizing state of mariadb.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mariadb
Finally Checking status of services
Apache service is active
Maria DB service is active
LAMP setup installed on ubuntu Successfully


By this installation of LAMP stack using Bash Script on Ubuntu 21.04 comes to an end

Tags:
isaac
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What are LAMP Stacks?

A

The LAMP Stacks are Linux, Apache. Maria DB, and PHP.

Q

What is the default login shell on Linux and Mac OS?

A

Bash is used as a default login shell in Linux systems and in macOS.

Q

What is the replacement of Shell Script?

A

Bash is the replacement for the original Shell Script.

Q

Does Bash requires any third-party software?

A

Bash does not require any third-party software to run.

Q

What is needed for the script file to run?

A

A script file must need to execute permissions to run.

Related Tutorials in How to install LAMP stack by Bash Script on Ubuntu 21.04

Related Tutorials in How to install LAMP stack by Bash Script on Ubuntu 21.04

How to install Meld tool in Ubuntu
How to install Meld tool in Ubuntu
Feb 25, 2017
How to install Dconf-Editor on Ubuntu 18.04
How to install Dconf-Editor on Ubuntu 18.04
Jul 14, 2018
How to install and update OpenSSL on Ubuntu 16.04
How to install and update OpenSSL on Ubuntu 16.04
Mar 9, 2017
How to install GLib 2.0 on Ubuntu 17.04
How to install GLib 2.0 on Ubuntu 17.04
May 22, 2017
How to Install Android Emulator on Ubuntu 20.4.1
How to Install Android Emulator on Ubuntu 20.4.1
Jul 13, 2021
How To Install AnyDesk on Ubuntu 16.04
How To Install AnyDesk on Ubuntu 16.04
Apr 4, 2018
How to install Genymotion 2.12.1 on Ubuntu 18.04
How to install Genymotion 2.12.1 on Ubuntu 18.04
Jul 9, 2018
How to install Timeshift 18.4 on Ubuntu 18.04
How to install Timeshift 18.4 on Ubuntu 18.04
Jul 6, 2018

Related Forums in How to install LAMP stack by Bash Script on Ubuntu 21.04

Related Forums in How to install LAMP stack by Bash Script on Ubuntu 21.04

Ubuntu
matthew class=
Failed to enable unit: Refusing to operate on linked unit file sshd.service
Apr 15, 2019
Ubuntu
mason class=
Passwd: You may not view or modify password information for root On Ubuntu 19.04
May 27, 2019
Ubuntu
isaac class=
/etc/apt/sources.list Permission denied
May 18, 2017
Ubuntu
yousuf class=
lsb_release command not working : Debian
Jan 18, 2018
ifconfig command
jackbrookes class=
what is the location of the ifconfig program on your machine?
Jan 4, 2018
Ubuntu
mason class=
"E: Package 'php-mcrypt' has no installation candidate" error on Ubuntu 20.4.1
Mar 15, 2021
NFS
luke class=
clnt_create: RPC: Program not registered
Apr 25, 2017
Apache
isaac class=
How to disable apache welcome page on Ubuntu
Dec 15, 2018

Related News in How to install LAMP stack by Bash Script on Ubuntu 21.04

Related News in How to install LAMP stack by Bash Script on Ubuntu 21.04

How To Install Mixxx on Ubuntu 16.04
How To Install Mixxx on Ubuntu 16.04
Oct 11, 2017
Ubuntu 17.04 released with greater expectations
Ubuntu 17.04 released with greater expectations
Apr 15, 2017
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Mar 1, 2017
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Sep 2, 2017
Ubuntu Unity is no more: One Linux dream has been axed
Ubuntu Unity is no more: One Linux dream has been axed
Apr 7, 2017
What’s next for Ubuntu Linux Desktop?
What’s next for Ubuntu Linux Desktop?
Apr 11, 2017
Say Hi to Ubuntu's new mascot
Say Hi to Ubuntu's new mascot
Mar 22, 2019
KDE Connect App was removed from Google Play Store and brought back in 24 hours
KDE Connect App was removed from Google Play Store and brought back in 24 hours
Mar 22, 2019
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Lucas ?
Various options in Top command

Am using Top command only to view the load average, what are the various options in Top command..??

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.