Ubuntu server

Update and upgrade the system:

sudo apt update && sudo apt upgrade -y

Create a dedicated Pixelfed user:

sudo useradd -m -s /bin/bash pixelfed-user

Define its password:

sudo passwd pixelfed-user

And install additional programs:

sudo apt install -y sshguard fail2ban apache2 redis-server git jpegoptim optipng pngquant ffmpeg

Firewall

Allow OpenSSH and Apache Full through Ubuntu's firewall:

sudo ufw allow OpenSSH
sudo ufw allow 'Apache Full'

Enable the firewall:

sudo ufw enable

Redis

Edit configuration file:

sudo nano /etc/redis/redis.conf

And modify settings as followed:

# Unix socket.
#
# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
#
unixsocket /run/redis/redis.sock
unixsocketperm 770
# If you run Redis from upstart or systemd, Redis can interact with your
# supervision tree. Options:
#   supervised no      - no supervision interaction
#   supervised upstart - signal upstart by putting Redis into SIGSTOP mode
#                        requires "expect stop" in your upstart job config
#   supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
#                        on startup, and updating Redis status on a regular
#                        basis.
#   supervised auto    - detect upstart or systemd method based on
#                        UPSTART_JOB or NOTIFY_SOCKET environment variables
# Note: these supervision methods only signal "process is ready."
#       They do not enable continuous pings back to your supervisor.
#
# The default is "no". To run under upstart/systemd, you can simply uncomment
# the line below:
#
supervised systemd

Save and exit Nano.
Add pixelfed-user to the redis group:

sudo usermod -aG redis pixelfed-user

Then restart Redis server:

sudo systemctl restart redis.service