Hubzilla is a powerful self-hosted platform designed for decentralized communication, content publishing, and social networking. It stands out for its rich feature set, including built-in federation with other platforms and advanced privacy controls. By hosting Hubzilla yourself, you gain full control over your data, extensive customization options, and the ability to connect seamlessly with other decentralized systems. This guide will walk you through the process of deploying, configuring, securing, and managing Hubzilla on your infrastructure.
Installing Hubzilla
π¦ Docker/Docker Compose Setup
To simplify deployment, we will use a docker-compose.yml
file to run Hubzilla in Docker. This method ensures easy setup and portability.
Create a docker-compose.yml
file:
version: '3.8'
services:
hubzilla:
image: hubzilla/hubzilla:latest
container_name: hubzilla
ports:
- "80:80"
- "443:443"
volumes:
- ./hubzilla_data:/var/www/html
- ./hubzilla_db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=securepassword
- MYSQL_DATABASE=hubzilla
- MYSQL_USER=hubzillauser
- MYSQL_PASSWORD=securepassword
restart: always
Deploy the application using Docker Compose:
docker-compose up -d
This will pull the latest Hubzilla image, set up a MySQL database, and start the application.
π Manual Installation
If you'd like to deploy Hubzilla directly on a Linux server, follow these steps:
- Update your system and install dependencies:
sudo apt update && sudo apt upgrade -y
sudo apt install apache2 mariadb-server php php-mysql php-cli php-curl php-gd unzip wget -y
- Download and extract Hubzilla:
wget https://framagit.org/hubzilla/core/-/archive/master/core-master.zip
unzip core-master.zip
sudo mv core-master /var/www/html/hubzilla
sudo chown -R www-data:www-data /var/www/html/hubzilla
sudo chmod -R 755 /var/www/html/hubzilla
- Set up the database:
sudo mysql -u root -p
CREATE DATABASE hubzilla;
CREATE USER 'hubzillauser'@'localhost' IDENTIFIED BY 'securepassword';
GRANT ALL PRIVILEGES ON hubzilla.* TO 'hubzillauser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
- Enable necessary Apache modules and restart:
sudo a2enmod rewrite
sudo systemctl restart apache2
Access Hubzilla in your browser at http://your-server-ip/hubzilla
to complete the setup.
Configuring Nginx as a Reverse Proxy
π Nginx Configuration
If you're using Nginx as the web server or reverse proxy, create a new server block for Hubzilla:
server {
listen 80;
server_name your-domain.com;
root /var/www/html/hubzilla;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Save the file as /etc/nginx/sites-available/hubzilla
and enable it:
sudo ln -s /etc/nginx/sites-available/hubzilla /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
π SSL/TLS Setup
Secure your setup with Let's Encrypt:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com
Automate certificate renewals:
sudo crontab -e
0 3 * * * certbot renew --quiet && systemctl reload nginx
π οΈ Testing and Reloading Nginx
Verify the configuration:
sudo nginx -t
sudo systemctl reload nginx
Check the SSL status by accessing https://your-domain.com
.
Logging and Debugging Hubzilla
ποΈ Enabling Debug Logs
To enable debug-level logs in Hubzilla, edit the .htconfig.php
file:
$a->config['system']['log_level'] = LOG_DEBUG;
π Viewing Logs
If using Docker:
docker logs hubzilla
For a manual install, check the Apache logs:
tail -f /var/log/apache2/error.log
π οΈ Troubleshooting Common Issues
Use the logs to diagnose issues like database connection errors or module failures. Common solutions include re-checking database credentials or ensuring PHP dependencies are installed.
π€ Exporting Logs
To forward logs to an external system like ELK Stack, configure a log shipper such as Filebeat to monitor Hubzillaβs log files.
Backup and Restore
ποΈ File-Based Backups
Backup your Hubzilla installation directory:
tar -cvzf hubzilla_backup.tar.gz /var/www/html/hubzilla
π Database Backups
Export the database:
mysqldump -u hubzillauser -p hubzilla > hubzilla_db_backup.sql
Restore the database:
mysql -u hubzillauser -p hubzilla < hubzilla_db_backup.sql
π Automated Backup Scripts
Create a cron job to automate backups:
crontab -e
## Add the following line:
0 2 * * * tar -cvzf /backups/hubzilla_$(date +\%F).tar.gz /var/www/html/hubzilla && mysqldump -u hubzillauser -p'yourpassword' hubzilla > /backups/hubzilla_db_$(date +\%F).sql
Updating and Upgrading Hubzilla
β¬οΈ Updating Docker Images
To update Hubzilla in Docker:
docker-compose pull
docker-compose up -d
π οΈ Manual Updates
For manual installations:
cd /var/www/html/hubzilla
git pull origin master
php util/udall
π Checking for Updates
Check Hubzillaβs admin panel or Git repository for announcements about new releases.
Leveraging Hubzillaβs Unique Features
π§ Enabling APIs
Activate the API in the admin settings. Test it with curl
:
curl -X GET "https://your-domain.com/api/resource" -H "Authorization: Bearer your-api-token"
π Advanced Configurations
Enable federation with other platforms:
-
Go to the admin panel > Features.
-
Enable the "Federation" module.
Integrate with third-party tools using WebDAV or CalDAV.
Wrapping Up
By following this guide, youβve successfully deployed and configured Hubzilla, secured it with SSL, and set up logging and backups for long-term management. With its modular features and decentralized nature, Hubzilla empowers you to take full control of your digital presence. Start exploring its advanced features to unlock its full potential!