ParrotSecurity 4.2: Install Joomla for CMS

This article will describe installing Joomla which is a content management system.

1 Install Joomla

  • This article uses default SSL/TLS certicication file for https. Please change your SSL/TLS certification file.
  • If you use http instead of https, change 443 to 80 and delete SSLXXX directive in /etc/apache2/sites-available/joomla.conf.
  • JOOMLA_PASSWD is password of joomla user in MySQL.
#!/bin/sh -e


[ -z "${MYSQL_PASSWD}" ] && \
  MYSQL_PASSWD=mysql
[ -z "${JOOMLA_PASSWD}" ] && \
  JOOMLA_PASSWD=joomla
[ -z "${PHPMYADMIN_PASSWD}" ] && \
  PHPMYADMIN_PASSWD=phpmyadmin

mysql_install()
{
  sudo apt install -y default-mysql-server
  sudo systemctl enable mysql
  sudo systemctl restart mysql
  cat <<EOF | sudo mysql_secure_installation

y
${MYSQL_PASSWD}
${MYSQL_PASSWD}
n
y
y
y
EOF

  cat<<EOF | sudo mysql -uroot -p${MYSQL_PASSWD}
grant all privileges on joomla.* to joomla@localhost
  identified by '${JOOMLA_PASSWD}';
flush privileges;
exit
EOF
}

phpmyadmin_install()
{
  cat <<EOF | sudo debconf-set-selections
phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2
phpmyadmin phpmyadmin/dbconfig-install boolean true
phpmyadmin phpmyadmin/mysql/admin-pass password ${MYSQL_PASSWD}
phpmyadmin phpmyadmin/mysql/app-pass password ${PHPMYADMIN_PASSWD}
phpmyadmin phpmyadmin/app-password-confirm password ${PHPMYADMIN_PASSWD}
phpmyadmin phpmyadmin/setup-username string admin
phpmyadmin phpmyadmin/setup-password password ${PHPMYADMIN_PASSWD}
EOF
  sudo apt install -y phpmyadmin
}

joomla_install()
{
  sudo apt install -y php-mysql php-json php-curl
  JOOMLA3=https://downloads.joomla.org/cms/joomla3

  wget -q ${JOOMLA3}/3-8-2/Joomla_3-8-2-Stable-Full_Package.tar.bz2
  sudo mkdir -p /var/www/joomla
  sudo tar jxf Joomla_3-8-2-Stable-Full_Package.tar.bz2 -C /var/www/joomla
  rm -f Joomla_3-8-2-Stable-Full_Package.tar.bz2
}

apache_install()
{
  sudo apt install -y apache2 libapache2-mod-php

  sudo chown -R www-data:root /var/www/joomla

  cat <<EOF | sudo tee /etc/apache2/sites-available/joomla.conf
<VirtualHost _default_:443>
  SSLEngine on
  SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
  SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

  Alias /joomla /var/www/joomla

  <Directory /var/www/joomla>
    Options FollowSymLinks
    Require all granted
  </Directory>
</VirtualHost>
EOF
  sudo a2enmod ssl
  sudo a2enmod php7.2
  sudo a2ensite joomla
  sudo systemctl enable apache2
  sudo systemctl restart apache2
}

ubuntu_main()
{
  mysql_install
  phpmyadmin_install
  joomla_install
  apache_install
}

ubuntu_main

2 Access to Joomla

Access to the following URL and setup Joomla. Username of database is joomla and password of database is JOOMLA_PASSWD value.

https://<server>/joomla

0001_Joomla.png