Habitica is an online task management and productivity tool that gamifies the work process. In this tutorial, we will guide you through the installation process of Habitica on Ubuntu Server latest.
Before we start with the installation process, make sure your system meets the following requirements:
The first and foremost step is to update your system to the latest version. Open the terminal and execute the following commands:
sudo apt update
sudo apt upgrade
Habitica is a web-based application, and you need a web server to run it. In this tutorial, we will use NGINX, an open-source web server.
To install NGINX, execute the following commands:
sudo apt install nginx
Habitica requires PHP to run, so the next step is to install PHP. We will install PHP 7.4 along with some required extensions.
sudo apt install php7.4-fpm php7.4-mysql php7.4-curl php7.4-gd php7.4-mbstring php7.4-xml php7.4-zip
Now we need to set up the NGINX server blocks for Habitica. Open the NGINX default configuration file using the following command:
sudo nano /etc/nginx/sites-available/default
Add the following code to the file:
server {
listen 80;
listen [::]:80;
root /var/www/habitica;
index index.php index.html index.htm;
server_name your_domain.com; # Replace with your domain
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
Press CTRL+X
and then Y
and then Enter to save the changes and exit the file.
Make sure to replace your_domain.com
with your own domain name or IP address.
Create a directory to store Habitica files:
sudo mkdir /var/www/habitica
The next step is to install Git to download the Habitica application code.
sudo apt install git
Now we can get the Habitica source code by cloning the repository.
cd /var/www/habitica
sudo git clone https://github.com/HabitRPG/habitica.git .
Make sure to give permission to the www-data
user:
sudo chown -R www-data:www-data /var/www/habitica
Set permission:
sudo chmod -R 770 /var/www/habitica/app/tmp
Create an environment file:
cd /var/www/habitica
nano .env
Add the following code to the file:
DB_HOST=localhost
DB_NAME=habitica
DB_USER=your_db_user
DB_PASS=your_db_password
Replace your_db_user
and your_db_password
with your database credentials.
Login to MySQL or MariaDB server and create a new database and user:
mysql -u root -p
CREATE DATABASE habitica;
GRANT ALL PRIVILEGES ON habitica.* TO 'your_db_user'@'localhost' IDENTIFIED BY 'your_db_password';
FLUSH PRIVILEGES;
Restart NGINX and PHP services:
sudo systemctl restart php7.4-fpm
sudo systemctl restart nginx
Open your favorite web browser and navigate to your domain or IP address. You will see the Habitica login page. Create a new account or sign in using an existing account.
Congratulations, you have successfully installed Habitica on Ubuntu Server latest. Now you can use this gamified task management tool and boost your productivity.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!