Consider installing Joomla CMS on Ubuntu 20.04 with LAMP preinstalled. Similarly, you can add multiple sites to one server. The guide will also be relevant for transferring sites, for example, from shared hosting to a VPS server.
We make all settings from the root user, if you are using a regular user, add before the command sudo.
1. Install the necessary php modules and download the latest version of Joomla
apt update && sudo apt upgrade
apt install php php-common libapache2-mod-php php-cli php-fpm php-mysql php-json php-opcache php-gmp php-curl php-intl php-mbstring php-xmlrpc php-gd php-xml php-zip
wget https://fossies.org/linux/www/Joomla_4.1.5-Stable-Full_Package.tar.bz2
apt install unzip
mkdir -p /var/www/joomla
tar -xf Joomla_4.1.5-Stable-Full_Package.tar.bz2 -C /var/www/joomla
mv /var/www/joomla /var/www/domain.tld
2. Create a database and write in the settings
mariadb -u root
CREATE DATABASE joomla;
GRANT ALL PRIVILEGES ON joomla.* TO 'user'@'localhost' IDENTIFIED BY 'your-password';
FLUSH PRIVILEGES;
EXIT;
3. Web service setup
Assign rights and create a configuration file for our domain:
chown www-data:www-data /var/www/domain.tld/ -R
Let's create a configuration file:
nano /etc/apache2/sites-available/domain.tld.conf
ServerName www.domain.tld
ServerAlias domain.tld
DocumentRoot /var/www/domain.tld
AllowOverride All
ErrorLog ${APACHE_LOG_DIR}/domain.tld.error.log
CustomLog ${APACHE_LOG_DIR}/domain.tld.access.log combined
Let's restart the services:
apache2ctl configtest
a2ensite domain.tld.conf
systemctl reload apache2
/etc/init.d/php7.4-fpm restart
Change domain.tld to your already configured in the DNS editor to the ip address of the VPS server. Thus, you can add several sites by analogy. Go to the browser using the configured http://domain.tld/ domain and complete the installation in the browser. You will be prompted to select a language, specify an administrator login and password, and specify the parameters created for the database, in our case these are:
Database username: user
Database name: joomla
Password: your-password
This completes the installation. In the case of a site transfer, you can place existing files and import the database, then specify the parameters in the configuration.php configuration file at the root of the site folder.