How to Install Wallabag on Arch Linux VPS with LEMP Stack
Wallabag is a free self-hostable application for saving web pages. It’s an open source alternative to Pocket, allowing you to manage a list of articles you stumbled upon on the Internet for later reading. This tutorial is going to show you how to install Wallabag on Arch Linux VPS with LEMP stack (Nginx, MariaDB, PHP).
It’s assumed that you have installed Arch Linux on a VPS and a LEMP stack is installed on your Arch VPS. Check out the following two tutorials if you haven’t already done so.
Now proceed to the installation.
Step 1: Create a Database and User for Wallabag
First, ssh into your Arch Linux VPS.
Wallabag needs a database to store your web pages and we are going to use MariaDB database in this tutorial. Run the following command to log into MariaDB shell as root.
mysql -u root -p
Then create a new database for Wallabag using the following command. This tutorial name it wallabag
, you can use whatever name you like for the database.
create database wallabag;
Next, create a new database user on localhost using the following command. Again, this tutorial name it wallabaguser
, you can use whatever name you like.
create user wallabaguser@localhost;
Set a password for the user. Replace your-password with your preferred password.
set password for wallabaguser@localhost= password("your-password");
Then grant all permission of the new database to the new user so later on Wallabag can write to the database.
grant all privileges on wallabag.* to wallabaguser@localhost identified by 'your-password';
Flush the privileges table for the changes to take effect.
flush privileges;
Exit MariaDB Shell:
exit;
Your web pages will be stored in wallabag_entry
table after you finished installing wallabag at the end of this tutorial.
Step 2: Install Wallabag on Arch Linux
We will use the git tool to clone the Wallabag repository from Github and later install Wallabag with Composer, which is a dependency manager for PHP. So install git on Arch Linux with the below command:
sudo pacman -S git
Then clone the Wallabag repository and change your working directory to the repository.
git clone https://github.com/wallabag/wallabag.git cd wallabag
The latest version of Wallabag (2.1.2) was released on October 17, 2016. Switch to version 2.1.2 with the git checkout
command.
git checkout 2.1.2
Before we install Wallabag with Composer, we need to edit the php.ini
file to enable some PHP extensions.
sudo nano /etc/php/php.ini
Find the following lines and remove the semicolons to enables these extensions.
;extension=bcmath.so ;extension=curl.so ;extension=gd.so ;extension=iconv.so ;extension=mysqli.so ;extension=pdo_mysql.so ;extension=zip.so
Save and close the file. Then reload php-fpm service for the changes to take effect.
sudo systemctl reload php-fpm
Next, install composer.
sudo pacman -S composer
Now set Symfony variable and install Wallabag using the following command. SYMFONY_ENV=prod
tells symfony we’re installing Wallabag in a production environment. The --no-dev
flag ensures that no development packages are installed in production environment.
SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist
During the installation process, composer will download and install all needed dependencies.
After that, you will be asked to provide missing parameters so that the app/config/parameters.yml
file can be created. Composer already provides some default values but they cannot be used for a production Wallabag service.
For simplicity, let’s break the questions into two parts. The first part is about database parameters. Here is the questions and the parameters this tutorial provides.
Creating the "app/config/parameters.yml" file Some parameters are missing. Please provide them. database_driver (pdo_sqlite): pdo_mysql database_host (127.0.0.1): 127.0.0.1 database_port (null): 3306 database_name (symfony): wallabag database_user (root): wallabaguser database_password (null): your-password database_path ('%kernel.root_dir%/../data/db/wallabag.sqlite'): /var/lib/mysql/wallabag database_table_prefix (wallabag_): wallabag_ database_socket(null): Press Enter
This first question is what database driver, i.e, what database you want to use for Wallabag. The default driver ispdo_sqlite
which means SQLite database will be used to store web pages. This article will use MariaDB/MySQL because they are speedy and are the most popular open source relation database management system. We have already enabled the pdo_mysql
driver in the beginning of this article. So enter pdo_mysql
as the answer for the first question.
The other questions are easy to answer. Enter 127.0.0.1
as the database host and 3306
as the database port because by default MariaDB database will listen on 127.0.0.1:3306. Then enter the database name, database user and database user password you created in step 1. The default database path of MariaDB/MySQL is /var/lib/mysql
. All you databases and tables are stored under this directory. The database table prefix helps you to recognize these tables are for Wallabag.
Now in the second part you can just press Enter to use the default values.
mailer_transport (smtp): mailer_host (127.0.0.1): mailer_user (null): mailer_password (null): locale (en): secret (ovmpmAWXRCabNlMgzlzFXDYmCFfzGv): twofactor_auth (true): twofactor_sender ([email protected]): fosuser_confirmation (true): from_email ([email protected]):
Once that’s done, run the following command.
php bin/console wallabag:install --env=prod
It will check system requirements and set up database. When it asks would you like to reset the database, press n to answer no. Then you will be asked to create an admin user.
Installing Wallabag... Step 1 of 5. Checking system requirements. +-----------------+--------+----------------+ | Checked | Status | Recommendation | +-----------------+--------+----------------+ | PDO Driver | OK! | | | curl_exec | OK! | | | curl_multi_init | OK! | | +-----------------+--------+----------------+ Success! Your system can run Wallabag properly. Step 2 of 5. Setting up database. It appears that your database already exists. Would you like to reset it? (y/N)n Creating schema Clearing the cache Step 3 of 5. Administration setup. Would you like to create a new admin user (recommended) ? (Y/n)y Username (default: wallabag) : your-admin-username Password (default: wallabag) : admin-pasword-here Email: admin-email-here Step 4 of 5. Config setup. Step 5 of 5. Installing assets. Wallabag has been successfully installed. Just execute `php bin/console server:run --env=prod` for using wallabag: http://localhost:8000
Step 2 will create wallabag database tables. Once that’s done, we move the wallabag directory to Nginx document root.
cd ~ sudo mv ~/wallabag/ /usr/share/nginx/
Then set Nginx user (http) as the owner.
sudo chown http:http /usr/share/nginx/wallabag -R
Step 3: Setting up Nginx Server Block File
Create the file.
sudo nano /etc/nginx/conf.d/wallabag.conf
Copy and paste the following text into the configuration file. Replace wallabag.example.com
with your own domain name. You should also point your domain name to the IP address of your Arch Linux VPS in DNS.
server {
server_name wallabag.example.com;
root /usr/share/nginx/wallabag/web;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
location ~ ^/app\.php(/|$) {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}
error_log /var/log/nginx/wallabag_error.log;
access_log /var/log/nginx/wallabag_access.log;
}
Save and close the file. Then reload Nginx so the server block can be enabled.
sudo systemctl reload nginx
Now you should be able to access your wallabag web interface at wallabag.example.com
and login.
Wallabag quick start page
Setting Up a Basic SMTP Server
Note that in order to register new users, your Arch Linux VPS needs to have a SMTP server running to send confirmation emails to new users. You can use Postfix for this purpose.
sudo pacman -S postfix
Then start and enable postfix service.
sudo systemctl start postfix sudo systemctl enable postfix
That’s it!
I hope this tutorial helped you to install Wallabag on Arch Linux VPS with LEMP stack. As always, if you found this post useful, subscribe to our free newsletter or follow us on Google+, Twitter or like our Facebook page.
Hi,
All goes well throughout the installation but when I try to access wallabag, it shows me a blank page. The wallabag_error.log shows this error :
PHP message: PHP Fatal error: Uncaught UnexpectedValueException: The stream or file “/var/lib/wallabag/var/logs/prod.log” could not be opened: failed to open stream: Permission denied in /usr/share/webapps/wallabag/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
Do you have any idea what could be the cause of this ?
Thanks!
BTW thank you for this how to which is very well made 😉