# Installing Joomla! on Debian

1. Log into the Debian device
2. Run the following commands in a terminal:
   # update repositories and install any available software updates
   sudo apt update
   sudo apt upgrade -y
   # install Apache HTTPD and MySQL
   sudo apt-get install apache2 mariadb-server mariadb-client curl
   # install PHP components
   sudo apt install php php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
   # configure the MySQL database
   sudo su
   mysql_secure_installation
3. Press Enter to login as root
4. Type Y and press Enter to set a root password, type the password twice to confirm
5. Type Y and press Enter to remove anonymous users
6. Type Y and press Enter to disallow root login remotely
7. Type Y and press Enter to remove the test database
8. Type Y and press Enter to reload privilege tables
9. Run the following command to login into MySQL:
   mysql -u root -p
10. Authenticate with the root password set earlier
11. Run the following commands to create the Joomla! database and database user
    CREATE DATABASE joomla DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    GRANT ALL ON joomla.* TO 'joomla_rw'@'localhost' IDENTIFIED BY 'J00mla!!';
    FLUSH PRIVILEGES;
    EXIT;
    exit
12. Continue with the following commands to download and extract Joomla! in the Apache webroot
    # download latest joomla version
    sudo wget -O joomla.tar.gz https://downloads.joomla.org/cms/joomla3/3-9-24/Joomla_3-9-24-Stable-Full_Package.tar.gz?format=gz
    # extract joomla.tar.gz
    sudo mkdir /var/www/joomla
    sudo tar xzvf joomla.tar.gz --directory /var/www/joomla
    # create a new joomla.conf file to configure the site
    sudo nano /etc/apache2/sites-available/joomla.conf
13. Paste the following configuration into joomla.conf

    Alias /joomla "/var/www/joomla/"
    <Directory /var/www/joomla/>
    AllowOverride All
    </Directory>

14. Press CTRL+O, Enter, CTRL+X to write the changes to joomla.conf
15. Continue with the following commands to enable the site and restart Apache:
    # enable the Joomla site and required PHP modules
    sudo a2ensite joomla
    sudo a2enmod rewrite
    # set the owner of the new joomla directory to www-data
    sudo chown -R www-data:www-data /var/www/joomla
    # restart apache2 service
    sudo systemctl restart apache2
16. Open a web browser and navigate to http://DNSorIP/joomla
17. The Joomla! setup screen should be displayed
18. Set the site title and create an administrative account login > Click the Next button
19. Enter the database configuration as follows:

    Database Type: MySQLi
    Host Name: localhost
    Username: joomla_rw
    Password: J00mla!!
    Database Name: joomla
    Table Prefix: jmla_

20. Click the Next button
21. On the Overview page click the Install button
22. Review the configuration and click the Install button
23. When the installation completes, copy the output configuration.php and run the following in the terminal window
    sudo nano /var/www/joomla/configuration.php
24. Paste the copied configuration text
25. Press CTRL+O, Enter, CTRL+X to write the changes to configuration.php
26. Continue with deleting the installation directory by running the following command
    sudo rm /var/www/joomla/installation -r
27. Back in the web browser, click on the Site button
28. Welcome to your very own, self-hosted Joomla! installation