Installing and setting up your own Joomla website
published on
Whilst most people appear to prefer Wordpress, and it certainly has more installations than Joomla, I prefer to use Joomla where I need something more powerful than a static site.
Install Apache
To begin setting up your Joomla website on the Apache webserver start by following the instructions found in 'Installing and setting up Apache in Ubuntu'. This will give you a good basis to work from although you won't need the modpagespeed section.
Install PHP
The instructions in the above article don't include installing everything you need for Joomla. It is now time to install the extra packages you will need. This can be done by entering
sudo apt install php7.4 php7.4-common,php7.4-cli,php7.4-bz2,php7.4-zip,php7.4-curl,php7.4-intl,php7.4-mysqlsudo apt install php7.4-snmp, php7.4-memcached, php7.4-bcmath, php7.4-readline, php7.4-soap, php7.4-tidysudo apt install php7.4-xmlrpc, php7.4-xml, php7.4-gd, php7.4-gmp, php7.4-pspell, php7.4-mbstringsudo apt install php7.4-opcache, php7.4-fpm, php7.4-imagick, php7.4-redis, php7.4-mcrypt
Now open the php.ini file that Joomla will use and make the edits shown below.
sudo nano /etc/php/7.4/fpm/php.ini output_buffering = Off expose_php = off max_execution_time = 30 max_input_time = 1000 max_input_vars = 3000 memory_limit = 256M display_errors = Off display_startup_errors = Off log_errors = On html_errors = Off post_max_size = 128M upload_max_filesize = 128M date.timezone = Europe/London opcache.enable=1 opcache.memory_consumption=128 opcache.max_accelerated_files=10000 opcache.revalidate_freq=200
Edit /etc/php/7.4/fpm/pool.d/www.conf and make sure to edit or uncomment the following lines to look like they do here:
listen = /run/php/php7.4-fpm.sock listen.owner = www-data listen.mode = 0660
Install the MariaDB database
The database is going to be where all your content, amongst other things, are stored ready for when somebody visits your site and Joomla reads the data it needs to be displayed to the user.
To install MariaDB type
sudo apt-get install mariadb-serversudo mysql_secure_installation
Remember that when running mysql_secure_installation the first time there is no root password and you can simply press enter.
Now create the actual database by running mysql -u root -p and entering the following commands
CREATE DATABASE [database_name] charset=utf8mb4;CREATE USER '[user_name]'@'localhost' IDENTIFIED BY 'password';GRANT ALL PRIVILEGES ON [database_name].* TO '[user_name]'@'localhost';FLUSH PRIVILEGES;exit
where [database_name] is the name of the Joomla database, [user_name] is the name of the user who has access to the Joomla database and [password] is a strong password.
Install Redis
Redis helps to cache some of the database data in memory for faster access. I find it much better to have some kind of server cache set up rather than relying purely on extensions.
To install Redis enter sudo apt-get install redis-server php-redis at the command line. Now type sudo nano /etc/redis/redis.conf to edit the configuration file and add or edit the following lines
supervised systemdmaxmemory 256mbmaxmemory-policy allkeys-lrubind 127.0.0.1 ::1
Lastly, it is necessary to restart the redis and php-fpm servers. This can be done with the following three commands
sudo systemctl restart redis-server.servicesudo systemctl enable redis-server.servicesudo systemctl restart php7.4-fpm
Download and install Joomla
First go to the directory that your domain is pointed to: cd /var/www/[domain] and create a new 'joomla' directory: sudo mkdir joomla.
Now you can download the Joomla compressed file and install it in your 'joomla' folder.
sudo wget https://downloads.joomla.org/cms/joomla3/3-10-2/Joomla_3-10-2-Stable-Full_Package.zipsudo unzip Joomla_3-10-2-Stable-Full_Package.zip -d /var/www/[domain]/joomla
Now change permissions and ownership on these files and folders
chown -R www-data:www-data /var/www/[domain]/joomlachmod -R 755 /var/www/[domain]/joomla
Make sure that your Apache virtual server configuration points to/var/www/[domain]/joomla and visit your domain in a browser.
Joomla will now take you through a number of options where you are asked to provide certain details so that it can connect to your database and set up the admin user for you.
Once you have completed these steps make sure to click on the 'Remove Installation Folder' button. Back on your server type sudo cp /var/www/[domain]/joomla/htaccess.txt /var/www/[domain]/joomla/.htaccess to set up the .htaccess rules.
Enable Redis
Even though you have installed Redis earlier you now need to let Joomla know how to connect to it. In the 'Admin' menu choose 'System' then 'Global Configuration' then 'system' and finally 'cache settings'. Change the settings to those shown below
Cache-Handler: RedisPersistent Redis: YesRedis Server Host: localhostRedis Server Port: 6379Redis Server Authentication: leave emptyRedis Database: 0Cache Time: 30Platform Specific Caching: NoSystem Cache: On – conservative Caching
Remember to save your changes.
Conclusion
You should now have a fully working Joomla installation just waiting for you to set up your website and start adding content. Watch out for future Joomla articles covering various aspects of Joomla configuration.
