UNA Installation Guide for Ubuntu Debian on Apache2 Server
Introduction
This guide provides a comprehensive walkthrough for installing UNA Community Software on an Ubuntu Debian system, specifically tailored for an Apache2 server environment. It incorporates general installation requirements and additional steps for setting up on Ubuntu Debian.
Pre-installation Requirements
Ensure your hosting environment meets the following system and software requirements:
- PHP Version: 7.4 up to 8.2 (with support starting from UNA v13 for PHP 8.1 and from UNA v14 for PHP 8.2).
- MySQL: Version 5.5.3 or higher, MySQL 8, or compatible databases like MariaDB.
- Server: VPS or dedicated cloud instance with at least 4GB RAM, 2 CPU cores, and 80GB storage. Shared hosting is not recommended.
- Server Type: Apache-compatible or Nginx web servers.
- Required PHP Modules:
curl
,gd
,mbstring
,json
,fileinfo
,zip
,openssl
,exif
.
Step 1: System Preparation
Update and Upgrade Packages
Run these commands to update and upgrade all packages:
sudo apt-get update
sudo apt-get upgrade
Install PHP and Necessary Extensions
sudo apt-get install php php-curl php-gd php-mbstring php-json php-fileinfo php-zip php-openssl php-exif php-mysql
Installing and Configuring MariaDB
sudo apt-get install mariadb-server
After installing, use the commands below to stop, start, and enable the MariaDB service to always start up when the server boots:
sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
After that, run the commands below to secure the MariaDB server by creating a root password and disallowing remote root access:
sudo mysql_secure_installation
When prompted, answer the questions below by following the guide:
- Enter current password for root (enter for none): Just press the Enter
- Set root password? [Y/n]: Y
- New password: Enter password
- Re-enter new password: Repeat password
- 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
Restart MariaDB server:
sudo systemctl restart mariadb.service
Create the Database
To log on to the MariaDB database server, run the commands below:
sudo mysql -u root -p
Run these commands to create the database, create a user, and give that user access to the database:
CREATE DATABASE database_name;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON csdb.* TO 'username'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
Creating a Virtual Host
Create a directory for your UNA site:
sudo mkdir /var/www/your_site_url
sudo chown -R $USER:$USER /var/www/your_site_url
sudo chmod -R 755 /var/www/your_site_url
Create a virtual host configuration file:
sudo nano /etc/apache2/sites-available/your_site_url.conf
Copy and paste the following lines into the conf file:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName your_site_url
DocumentRoot /var/www/your_site_url
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/your_site_url>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
</VirtualHost>
Enable the new virtual host and disable the default one:
sudo a2ensite your_site_url.conf
sudo a2dissite 000-default.conf
sudo apache2ctl configtest
sudo systemctl restart apache2
Installing Let's Encrypt SSL
sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-apache
sudo nano /etc/apache2/sites-available/your_site_url.conf
sudo apache2ctl config
sudo systemctl reload apache2
sudo certbot --apache -d your_site_url
This will install an SSL certificate to your system.
Installing UNA
Upload the UNA .zip archive to your server and extract it to
/var/www/your_site_url.
Finalizing Installation
Set Permissions Ensure your directory and files have the correct permissions:
sudo chmod -R 755 /var/www/your_site_url
- Update .htaccess for PHP Version Adjust .htaccess for your PHP configuration as needed.
- Complete UNA Installation Wizard
- Navigate to your site URL and follow the UNA installation steps.
Post-installation Steps
Configure a cron job as instructed by the installation wizard to ensure UNA's scheduled tasks are performed correctly.
Make the Necessary Permission Changes to Your Directory
Follow this guide for what permission to set
Use sudo chmod to grant permission to the directory.
Update .htaccess to Use Default PHP
sudo nano /var/www/your_site_url/.htaccess
- Change mod_php5.c to mod_php.c
- Check your site by going to your_site_url.
- Complete the server audit and troubleshoot.
Cron Job
Run the code and paste the cron job from the browser to the crontab:
crontab -e
Congratulations
You've successfully installed UNA on your Ubuntu Debian server with Apache2. Proceed to UNA Studio to customize your site further.