X

How To Install PHP 8.0 Apache Mysql 8.0 On Ubuntu 21.04 Server

In this tutorial how to install php 8.0, Apache and Mysql 8.0 on Ubuntu 21.04 server. Ubuntu 21.04 is latest release. So let’s start see LAMP server using Ubuntu 21.04.

How To Configure LAN and WAN Interface On VyOS Router

How To Install OpenProject On Ubuntu 16.04

My Server info:

#############################
IP Address  : 10.66.100.12
OS   : Ubuntu 21.04
RAM   : 2GB
vCPU   : 2
Disk   : 50 GB
Mysql   : v8.0
PHP   : v8.0
Service  : LAMP
############################# 

Step #01: Check server version and ip address.

root@LAMP:~# lsb_release -a && ip r

Output as like below.

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 21.04
Release:        21.04
Codename:       hirsute
default via 10.66.100.10 dev enp0s3 proto dhcp src 10.66.100.12 metric 100
10.66.0.0/16 dev enp0s3 proto kernel scope link src 10.66.100.12
10.66.100.10 dev enp0s3 proto dhcp scope link src 10.66.100.12 metric 100

Then must be server update and upgrade using below command.

root@LAMP:~# apt update && -y apt upgrade

Then Install Mysql 8.0 and Apache using below command.

root@LAMP:~# apt install -y apache2 mysql-server

Step #02: Install php 8.0 on Ubuntu 21.04.

root@LAMP:~# apt install -y apt-transport-https lsb-release ca-certificates
root@LAMP:~# add-apt-repository ppa:ondrej/php
root@LAMP:~# apt update
root@LAMP:~# apt install -y php8.0 libapache2-mod-php8.0
root@LAMP:~# apt install -y php8.0-fpm libapache2-mod-fcgid
root@LAMP:~# a2enmod proxy_fcgi setenvif
root@LAMP:~# a2enconf php8.0-fpm
root@LAMP:~# systemctl restart apache2

Setup Mysql root password, remember default root password is blank.

mysql_secure_installation

Must be use password strength like include capital latter, special character and number.

Install some required package like below.

root@LAMP:~# apt install -y php libapache2-mod-php php-mysql

Step #03: Check php working properly.

Open or create php file.

root@LAMP:~# vi /var/www/html/info.php

Insert below text into this file.

<?php phpinfo(); ?>

Restart Apache and Mysql service.

root@LAMP:~# systemctl restart apache2
root@LAMP:~# systemctl restart mysql

Insert below text into this file.

Then access server ip address like below.

http://10.66.100.12/info.php

See example like below.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If you see any error so please see my YouTube channel for more details.

5 1 vote
Article Rating
Admin: I am system administrator as Windows and Linux platform. I have 4 years skilled from the professional period. I have to configure Linux based system such as an Asterisk VOIP system, Network monitoring tools (ZABBIX), Virtualization (XEN Server), Cloud computing (Apache CloudStack) etc. Now share my professional skill each interested person. Thanks to all.
Leave a Comment