Setup Hubzilla with Caddy and PostgreSQL on Fedora 37

This installation manual will guide you step-by-step through setting up your very own Hubzilla instance, empowering you to join the decentralized revolution seamlessly. Stay tuned for a hands-on experience that brings privacy, control, and innovation to your online social interactions.

Wording in this tutorial

string

meaning

foo.net

domain

xxxxxxxxx

any string

xx.xx.xxx.xx

IPv4 address

xxxx:xxx:xxxx:xxxx::1

IPv6 address

Install packages

sudo dnf install \
   caddy \
   postgresql-server postgresql-contrib \
   php php-gd php-pecl-zip php-pgsql php-cli \
   ImageMagick

# Populate PostgreSQL with initial data after installation. (required)
sudo postgresql-setup --initdb --unit postgresql

# Start
sudo systemctl start postgresql
sudo systemctl start php-fpm

# Start automatically at boot
sudo systemctl enable postgresql
sudo systemctl enable php-fpm

Configure PostgreSQL

[https://docs.fedoraproject.org/en-US/quick-docs/postgresql/]

Create user and database

# Create database user for webserver/PHP.
sudo -u postgres createuser caddy
sudo -u postgres createdb caddy

# Create database.
sudo -u postgres createdb socialhub

# Login to create database with superuser.
sudo -u postgres psql
-- Set passwords.
\password postgres
\password caddy

grant all privileges on database socialhub to caddy ;
\q

Check if it works:

sudo -u caddy psql
-- Show databases.
\l
\q

sudo vi /var/lib/pgsql/data/pg_hba.conf:

Change:

# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
# IPv6 local connections:
host    all             all             ::1/128                 ident

to:

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

Configure PHP

sudo vi /etc/php.ini:

# Change:
upload_max_filesize = 200M

# Add:
post_max_size = 200M
sudo systemctl restart php-fpm.service

Prepare Hubzilla

sudo git clone https://framagit.org/hubzilla/core.git /var/www/hubzilla
sudo chown -R caddy:caddy /var/www/hubzilla
sudo chmod -R 755 /var/www/hubzilla

Remove email authentication, as most likely something for sendig email from your server is not (yet) installed:

sudo nvim /var/www/hubzilla/.htconfig.php:

// App::$config['system']['verify_email'] = 1;
App::$config['system']['verify_email'] = 0;

Install addons:

sudo -u caddy sh -c 'cd /var/www/hubzilla && util/add_addon_repo https://framagit.org/hubzilla/addons.git hzaddons'

Configure Caddy

sudo mkdir /var/log/caddy
sudo chown caddy /var/log/caddy
sudo chgrp caddy /var/log/caddy

sudo nvim /etc/caddy/Caddyfile.d/foo.net.caddyfile:

foo.net {
    root * /var/www/hubzilla
    php_fastcgi unix//run/php-fpm/www.sock
    file_server
    encode gzip
    rewrite * /index.php?q={path}&{query}

    log {
        output file /var/log/caddy/foo.net-access.log
    }

    @static {
        file
        path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff *.pdf *.webp
    }
    header @static Cache-Control max-age=5184000
}

Configure PHP

# Replace
sudo sed -i 's/^user = apache$/user = caddy/g' /etc/php-fpm.d/www.conf
sudo sed -i 's/^group = apache$/group = caddy/g' /etc/php-fpm.d/www.conf
# Append
sudo sed -i 's/\blisten.acl_users =.*\b/&,caddy/' /etc/php-fpm.d/www.conf

sudo systemctl restart caddy

Install Hubzilla

Point your webbrowser to https://foo.net/.

PHP executable path

/usr/bin/php

Database Name

127.0.0.1

Database Port

0

Database Login Name

caddy

Database Login Password

<the one set with \password caddy>

Database Name

socialhub

Database Type

PostgreSQL

Appendix

Security

Admin -> Security -> Provide a cloud root directory: off

Guest Access

Apps -> Available Apps -> Guest Access: enable

In that List, also click on the "pin to navbar" icon, as guest access doesn't show up in the settings as stated in the docs.

Configure Addons

As a user, you might consider the following addons:

  • articles

  • markdownposter

  • NSFW

  • page header

  • pubcrawl

Editing settings

Markdown

Admin -> Features -> Markdown: on

Admin -> Features -> Lock feature Markdown: on

Channel -> Share -> gearwheal item -> Markdown.

Basically, you can turn most editing option on.

Admin -> Features -> Conversation

Dislike Posts -> Ability to dislike posts/comments: on

Lock feature Dislike Posts: on

Dark Theme

Select Settings -> Display settings -> Scheme: dark.

sudo nvim /var/www/hubzilla/view/theme/redbasic/schema/dark.css:

/******** custom ********/

.nav-link {
    color: #95c7df
}

.generic-content-wrapper, .thread-wrapper {
    background-color: #484e62;
}

.generic-content-wrapper {
    border-color: #00000021;
}

body {
    font-size: 1.2em;
}

.wall-item-content, .mail-conv-body, .page-body, .chat-item-text, .chat-item-text-self {
    font-size: 1.1rem;
}

input, optgroup, select, textarea {
    font-size: 1.3rem !important;
}

h3, .h3 {
  font-size: 1.3rem;
}

.comment-edit-text {
  height: 2.6rem;
}

.btn {
    font-size: 1.1rem;
}