Skip to content

Instantly share code, notes, and snippets.

@virbo
Last active January 22, 2024 07:01
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 virbo/0784ca3350ce0878d917692dd8d505b8 to your computer and use it in GitHub Desktop.
Save virbo/0784ca3350ce0878d917692dd8d505b8 to your computer and use it in GitHub Desktop.
Install Linux Ubuntu 21.04, Nginx, MariaDB, Postgres, PHP 8.0

Update and Upgrade Package

apt -y update && apt -y upgrade
reboot

Install NGINX

Install dependency

apt install gnupg gnupg2 gnupg1 -y

Download the key used to sign NGINX packages and the repository, and add it to the apt program’s key ring

sudo wget https://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key

Edit the nano /etc/apt/sources.list file and add these lines

deb https://nginx.org/packages/mainline/ubuntu/ <CODENAME> nginx
deb-src https://nginx.org/packages/mainline/ubuntu/ <CODENAME> nginx

Install nginx

apt -y update
apt -y install nginx

Install PHP

Install dependency

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

Install PHP (7.x or 8.x)

apt install php8.0 php8.0-{mysql,pgsql,gd,cli,common,snmp,ldap,curl,mbstring,zip,fpm,mongodb,intl,xml,imagick,xmlrpc,soap}
apt install php7.4 php7.4-{mysql,pgsql,gd,cli,common,snmp,ldap,curl,mbstring,zip,fpm,mongodb,intl,xml,imagick,xmlrpc,soap}

Edit nano /etc/php/7.4/fpm/pool.d/www.conf (if using php 7.4)

user = nginx
group = nginx
;listen = /run/php/php8.0-fpm.sock
listen = /run/php/php7.4-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0660

Install LetsEncrypt

apt install certbot python3-certbot-nginx

Referensi:

  1. https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/
  2. https://wiki.crowncloud.net/?How_to_install_php_8_on_Ubuntu_21_04
  3. https://gist.github.com/virbo/3e4fbe0beda84833947e30a81d7d7b49
  4. https://phoenixnap.com/kb/letsencrypt-nginx
  5. https://www.server-world.info/en/note?os=Ubuntu_21.04&p=postgresql&f=1
  6. https://www.atlassian.com/data/admin/how-to-change-a-user-to-superuser-in-postgresql
  7. https://www.postgresqltutorial.com/postgresql-administration/postgresql-change-password/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment