UbuntuUbuntu Based

How To Install Wallabag on Ubuntu 22.04 LTS

Install Wallabag on Ubuntu 22.04

In this tutorial, we will show you how to install Wallabag on Ubuntu 22.04 LTS. For those of you who didn’t know, Wallabag is a self-hosted application that allows users to save web content for later reading. It is an open-source project that aims to provide a simple, privacy-friendly, and ad-free experience for users who want to save articles, videos, and other web content for offline reading. Wallabag is available for Linux, macOS, and Windows operating systems, as well as for mobile devices running Android or iOS.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Wallabag on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Wallabag.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Wallabag on Ubuntu 22.04 LTS Jammy Jellyfish

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade
sudo apt install wget apt-transport-https gnupg2

Step 2. Installing LEMP stack (Nginx, MariDB, and PHP) on Ubuntu 22.04.

Before starting this tutorial, the LEMP server must be installed on your server. If you do not have LEMP Stack installed, you can follow our guide here.

Step 3. Installing Composer.

By default, the Composer is not available on Ubuntu 22.04 base repository. Now run the following command below to download the Composer installer using wget command:

wget -O composer-setup.php https://getcomposer.org/installer

After the Composer has been downloaded, then execute the following command on the command line to install and setup composer on the Linux Ubuntu system:

php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Confirm the installation and check the installed build version of Composer:

composer -V

For additional resources on installing Composer, read the post below:

Step 4. Configuring MariaDB.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- 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

Next, we will need to log in to the MariaDB console and create a database for the Wallabag. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Wallabag installation:

MariaDB [(none)]> CREATE DATABASE wallabag;
MariaDB [(none)]> CREATE USER 'wallabaguser'@'localhost' IDENTIFIED BY 'Your-Strong-Passwd';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON wallabag.* TO 'wallabaguser'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;

Step 5. Installing Wallabag on Ubuntu 22.04.

Now we can download and install Wallabag. Run the following command to download the latest version of Wallabag:

sudo mkdir /var/www/html/wallabag -p
wget https://wllbg.org/latest-v2-package

Then, extract the downloaded file with the following command:

tar xzf latest-v2-package
mv wallabag-2.5.4/* /var/www/html/wallabag

Next, create the asset directory:

mkdir /var/www/html/wallabag/data/assets

Give the Wallabag directory write and execute permissions:

chown -R $USER:$USER /var/www/html/wallabag

After that, switch to the directory:

cd /var/www/html/wallabag

Now create the parameters.yml file by copying the example file:

cp app/config/parameters.yml.dist app/config/parameters.yml

Before start configuring Wallabag, we generate a secret key. Note down the key to be used later:

openssl rand -base64 32
DMV/GpZwDobQbyQZQGDTHvt+ZFJZXwMEIF4KR46=

Next, open the parameters file for editing:

nano app/config/parameters.yml

Add the following configuration:

..........
    database_driver: pdo_mysql
    database_host: 127.0.0.1
    database_port: 3306
    database_name: wallabag
    database_user: wallabaguser
    database_password: Your-Strong-Passwd

Fill in the server description and domain name:

domain_name: https://your-domain.com
server_name: "idroot Wallabag"

Fill in the secret key generated before. If you want to keep two-factor authentication, then make sure the following settings are applied:

    # A secret key that's used to generate certain security-related tokens
    secret: DMV/GpZwDobQbyQZQGDTHvt+ZFJZXwMEIF4KR46=

    # two factor stuff
    twofactor_auth: true
    twofactor_sender: nagdimin@wallabag.it

    # fosuser stuff
    fosuser_registration: true
    fosuser_confirmation: true
.....
    from_email: ngadimin@wallabag.it
.....

Save and close the file, then run Composer to download and install the dependencies required by Wallabag:

SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist

Finish the installation using Wallabag command-line tool:

php bin/console wallabag:install --env=prod

You will be prompted if you want to reset the database and its schema. Enter NO as the response both times. Next, you will be asked if you want to create an administrator account. Type yes to proceed and enter the username, password, and email id for the account.

Step 6. Configure Nginx.

Now create a new virtual host configuration file for the Wallabag installation. You can create the file by running the following command:

nano /etc/nginx/conf.d/wallabag.conf

Add the following file:

server {
    listen       443 ssl http2;
    listen       [::]:443 ssl http2;
    server_name  your-domain.com;

    access_log  /var/log/nginx/wallabag.access.log;
    error_log   /var/log/nginx/wallabag.error.log;

	# SSL
    ssl_certificate      /etc/letsencrypt/live/your-domain.com/fullchain.pem;
    ssl_certificate_key  /etc/letsencrypt/live/your-domain.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/your-domain.com/chain.pem;
    ssl_session_timeout  5m;
    ssl_session_cache shared:MozSSL:10m;
    ssl_session_tickets off;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
    ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
    ssl_stapling on;
    ssl_stapling_verify on;
    ssl_dhparam /etc/ssl/certs/dhparam.pem;
    resolver 8.8.8.8;

    root /var/www/html/wallabag/web;

    location / {
        try_files $uri /app.php$is_args$args;
    }

    # Pass PHP Scripts To FastCGI Server
    location ~ ^/app\.php(/|$) {
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        fastcgi_pass unix:/run/php/php8.1-fpm.sock; # Depends On The PHP Version
        fastcgi_param SCRIPT_FILENAME  $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        include fastcgi_params;
        internal;
    }

    location ~ \.php$ {
        return 404;
    }
}

# enforce HTTPS
server {
    listen       80;
    listen       [::]:80;
    server_name  your-domain.com;
    return 301   https://$host$request_uri;
}

Save and close the file, then Restart the Nginx service to take change effect:

sudo systemctl restart nginx

Step 7. Secure Wallabag with Let’s Encrypt SSL.

First, install the Certbot client using the following command below:

sudo apt install certbot python3-certbot-nginx

Next, get your SSL certificate with Let’s Encrypt by following these steps:

certbot --nginx -d your-domain.com

Let’s Encrypt certificates have 90 days of validity, and it is highly advisable to renew the certificates before they expire. You can test automatic renewal for your certificates by running this command:

sudo certbot renew --dry-run

Step 8. Configure Firewall.

Now we set up an Uncomplicated Firewall (UFW) with Nginx to allow public access on default web ports for HTTP and HTTPS:

sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable

Step 9. Accessing Wallabag Web Interface.

Once successfully installed, now open your web browser and access the Wallabag web interface using the URL https://your-domain.com. You will be redirected to the following page:

Install Wallabag on Ubuntu 22.04 LTS Jammy Jellyfish

Congratulations! You have successfully installed Wallabag. Thanks for using this tutorial for installing Wallabag on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the Wallabag website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button