docs / https / lamp-install

LAMP install

https updated 2025-06-20

APACHE INSTALL && CONFIG

textcopy
apt update && apt-get full-upgrade -y
textcopy
apt install apache2
textcopy
mkdir /var/www/domain.tld
textcopy
chown -R www-data:www-data /var/www/domain.tld
textcopy
nano /etc/apache2/sites-available/domain.tld.conf
textcopy
<VirtualHost *:80>
    ServerName domain.tld
    ServerAlias www.domain.tld
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/domain.tld
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
textcopy
a2ensite domain.tld
textcopy
a2dissite 000-default
textcopy
a2enmod headers
textcopy
systemctl reload apache2
textcopy
apache2ctl configtest

Syntax OK

IF

textcopy
apache2ctl configtest

AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message Syntax OK

THEN

textcopy
nano /etc/apache2/apache2.conf

#add last line ServerName localhost

textcopy
systemctl restart apache2

&& recheck

NEXT WE INSTALL CERTBOT

textcopy
apt install certbot python3-certbot-apache -y
textcopy
certbot –apache
#make sure all the domain names you are requiring certificates have rDNS

MYSQL / MARIADB INSTALL && CONFIG

textcopy
apt install mariadb-server mariadb-client -y
textcopy
mysql_secure_installation
textcopy
-mariadb -u root -p
textcopy
CREATE USER ‘username’@’localhost’ IDENTIFIED BY ‘password’;
textcopy
CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
textcopy
GRANT ALL PRIVILEGES ON nextcloud.* TO ‘username’@’localhost’;
textcopy
FLUSH PRIVILEGES;
textcopy
quit;

INSTALL PHP && PHP MODULES

FOR UBUNTU :

textcopy
add-apt-repository ppa:ondrej/php
textcopy
apt update
textcopy
apt install php8.4 php8.4-cli php8.4-mysql php8.4-fpm php8.4-gd php8.4-mbstring php8.4-xml php8.4-curl php8.4-zip php8.4-curl php8.4-cgi php8.4-xmlrpc

==For DEBIAN:==

textcopy
apt-get install software-properties-common
textcopy
apt-get install -y lsb-release apt-transport-https ca-certificates
textcopy
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
textcopy
echo “deb https://packages.sury.org/php/ $(lsb_release -sc) main” | sudo tee /etc/apt/sources.list.d/php.list
textcopy
apt install php8.4 php8.4-cli php8.4-mysql php8.4-fpm php8.4-gd php8.4-mbstring php8.4-xml php8.4-curl php8.4-zip php8.4-curl php8.4-cgi php8.4-xmlrpc