Skip to content

Instantly share code, notes, and snippets.

@nd3w
Last active December 11, 2023 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nd3w/b8a336ced3cce0efb999e50303e015e2 to your computer and use it in GitHub Desktop.
Save nd3w/b8a336ced3cce0efb999e50303e015e2 to your computer and use it in GitHub Desktop.
Install Apache2, PostgreSQL and PHP-FPM on Ubuntu 20.04

Install Apache2, PostgreSQL and PHP-FPM 8.2 on Ubuntu 20.04

Install Apache

sudo apt install apache2

sudo ufw app list

sudo ufw allow in "Apache"

sudo ufw status

sudo a2enmod headers deflate rewrite expires

Install PostgreSQL

PostgreSQL 12 is use as default version on Ubuntu 20.04

sudo apt install postgresql postgresql-contrib -y

sudo -i -u postgres

Now change admin's password

ALTER USER postgres WITH PASSWORD 'SECRETPASSWORd';

Change postgres' user type to match password changing

sudo vi /etc/postgresql/14/main/pg_hba.conf

Change this line

local	all		postgres	peer

to

local	all		postgres	md5
sudo service postgresql restart

psql -U postgres

CREATE DATABASE db_name

Install PHP-FPM version 8.2

We use Ondrej's PPA in order if we use another version in the future.

sudo add-apt-repository ppa:ondrej/php

sudo apt update

sudo apt install -y php8.2 php8.2-fpm php8.2-curl php8.2-gd php8.2-mbstring php8.2-mysql php8.2-opcache php8.2-xml php8.2-xmlrpc php8.2-common php8.2-imagick php8.2-pgsql php8.2-xdebug

sudo service php8.2-fpm start

sudo a2enconf php8.2-fpm

sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment