Edit file nano /etc/default/locale
LC_CTYPE=en_US.UTF-8
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
Run these commands:
locale-gen en_US.UTF-8
dpkg-reconfigure locales
reboot server
apt -y update && apt -y upgrade
reboot
- Install dependency
apt install libgd-graph-perl libio-socket-ssl-perl libcrypt-ssleay-perl libnet-libidn-perl libio-socket-inet6-perl libsocket6-perl libwww-perl -y
- Change permission
sendmail
echo '#!/bin/sh' > /usr/sbin/sendmail
chmod +x /usr/sbin/sendmail
- Install CSF
cd /usr/src
rm -fv csf.tgz
wget https://download.configserver.com/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh
- 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/debian/ <CODENAME> nginx
deb-src https://nginx.org/packages/mainline/debian/ <CODENAME> nginx
- Install nginx
apt -y update
apt -y install nginx
- Install dependency
apt install -y curl wget gnupg2 ca-certificates lsb-release apt-transport-https
- Import the public using the below commands
wget https://packages.sury.org/php/apt.gpg
apt-key add apt.gpg
- Add the SURY repository to your system
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
- Install Multi PHP (7.4, 8.0)
apt update
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}
- Set default PHP Version
update-alternatives --set php /usr/bin/php8.0
- 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
- Create default server block
server {
listen 80;
server_name server_domain_or_IP;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
- Add key
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
- Add repo
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
apt update -y
- Install Postgres
apt install postgresql-13 postgresql-contrib
- Initdb
mkdir /usr/local/pgsql/data
chown postgres:postgres /usr/local/pgsql/data
/usr/lib/postgresql/13/bin/initdb /usr/local/pgsql/data
- Edit
nano /var/lib/pgsql/13/data/pg_hba.conf
and replacetrust
tomd5
orscram-sha-256
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
service postgresql restart
- Create Database
su postgres
psql
CREATE DATABASE db_name;
CREATE ROLE username WITH PASSWORD 'password'
GRANT ALL PRIVILEGES ON DATABASE db_name TO username;
ALTER ROLE username WITH LOGIN;
- Download repo and enable
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
chmod +x mariadb_repo_setup
./mariadb_repo_setup
- Install MariaDB
apt install mariadb-server
- Configuring and Securing MariaDB Server
mysql_secure_installation
This will take you through a series of prompts where you can make some changes to your MariaDB installation’s security options. The first prompt will ask you to enter the current database root password. Since we have not set one up yet, press ENTER to indicate “none”.
The next prompt asks you whether you’d like to set up a database root password. Type N and then press ENTER. In Debian, the root account for MariaDB is tied closely to automated system maintenance, so we should not change the configured authentication methods for that account. Doing so would make it possible for a package update to break the database system by removing access to the administrative account. Later, we will cover how to optionally set up an additional administrative account for password access if socket authentication is not appropriate for your use case.
From there, you can press Y and then ENTER to accept the defaults for all the subsequent questions. This will remove some anonymous users and the test database, disable remote root logins, and load these new rules so that MariaDB immediately respects the changes you have made.
- Testing installation
mysqladmin -u root -p version
indicates the installation has been successful like this
mysqladmin Ver 9.1 Distrib 10.6.5-MariaDB, for debian-linux-gnu on x86_64
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Server version 10.6.5-MariaDB-1:10.6.5+maria~buster
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /run/mysqld/mysqld.sock
Uptime: 7 min 17 sec
Threads: 1 Questions: 815 Slow queries: 0 Opens: 253 Open tables: 69 Queries per second avg: 1.864
- Install Certbot
apt install python3-acme python3-certbot python3-mock python3-openssl python3-pkg-resources python3-pyparsing python3-zope.interface
apt install python3-certbot-nginx
- Obtaining an SSL Certificate
certbot --nginx -d your_domain -d www.your_domain
- Verifying Certbot Auto-Renewal
certbot renew --dry-run
- https://askubuntu.com/questions/1077398/fresh-installation-of-ubuntu-16-04-gives-me-warning-about-locale-unable-to-fix
- https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/
- https://download.configserver.com/csf/install.txt
- https://www.node35.com/how-to-fix-8-common-errors-on-csf-configserver-security-firewall/
- https://www.itzgeek.com/post/how-to-install-php-8-0-on-debian-10-debian-9.html
- https://www.linuxtechi.com/install-php-8-on-debian-10/
- https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-debian-10
- https://varunver.wordpress.com/2019/10/11/install-php-mcrypt-on-debian-10-php-7-3/
- https://wiki.postgresql.org/wiki/Apt
- https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-debian-10
- https://snippets.aktagon.com/snippets/614-how-to-fix-bash-warning-setlocale-lc-all-cannot-change-locale-en-us-
- https://www.digitalocean.com/community/tutorials/how-to-install-mariadb-on-debian-10
- https://gist.github.com/virbo/71776c0a7f3c1442147eb9f5b4306af5