Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kanchudeep/fca43d4464d4eb163f4160c0111a4236 to your computer and use it in GitHub Desktop.
Save kanchudeep/fca43d4464d4eb163f4160c0111a4236 to your computer and use it in GitHub Desktop.
Setting Up Joomla on Debian/Ubuntu Linux
# Update apt & do a full upgrade
sudo apt update && sudo apt full-upgrade
# Install Apache2, appt https support & MariaDB
sudo apt install --yes apache2 apt-transport-https mariadb-server mariadb-client
# Setup database:
sudo mysql_secure_installation
# Configure as follows:
Enter current password for root (enter for none): PRESS ENTER
Switch to unix_socket authentication [Y/n] n
Change the root password? [Y/n] n
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
# Verify & validate MariaDB install:
sudo mysql -u root -p
# Exit by using 'exit'
# Add PHP repository:
sudo add-apt-repository --yes ppa:ondrej/php
# Note: This ends with 'gpg: keyserver received failed: General error' which we'll fix...
# Fix NO_PUBKEY for ondrej/php
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 4F4EA0AAE5267A6C
# Update apt
sudo apt update
# Install PHP
sudo apt install --yes php8.1 php8.1-common php8.1-mysql php8.1-gmp php8.1-curl php8.1-intl php8.1-mbstring php8.1-xmlrpc php8.1-gd php8.1-xml php8.1-cli php8.1-zip
# Set recommended PHP options
sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.1/apache2/php.ini
sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 256M/" /etc/php/8.1/apache2/php.ini
sudo sed -i "s/post_max_size = .*/post_max_size = 256M/" /etc/php/8.1/apache2/php.ini
sudo sed -i "s/output_buffering = .*/output_buffering = Off/" /etc/php/8.1/apache2/php.ini
sudo sed -i "s/max_execution_time = .*/max_execution_time = 300/" /etc/php/8.1/apache2/php.ini
sudo sed -i "s/;date.timezone.*/date.timezone = Asia\/Kolkata/" /etc/php/8.1/apache2/php.ini
# Create Joomla database:
sudo mysql -u root -p
CREATE DATABASE joomladb;
CREATE USER 'joomladbuser'@'localhost' IDENTIFIED BY 'new_password_here';
GRANT ALL ON joomladb.* TO 'joomladbuser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT
# Download Joomla:
wget --directory-prefix=/tmp https://downloads.joomla.org/cms/joomla4/4-1-5/Joomla_4-1-5-Stable-Full_Package.zip
# Extract Joomla:
sudo unzip -d /var/www/html /tmp/Joomla_4-1-5-Stable-Full_Package.zip
# Configure Joomla files ownership
sudo chown --changes --recursive www-data:www-data /var/www/html/
# Remove the default Apache page
sudo rm --verbose /var/www/html/index.html
# To test, visit 'localhost' on the system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment