Hakatime is a time-tracking tool designed for software development project management. In this tutorial, we will go through the process of installing Hakatime on a Debian-based system, specifically Debian Latest.
Before you start, make sure you have the following prerequisites in place:
To use Hakatime on Debian Latest, you need to install some required dependencies on your system. Open a terminal window and execute the following command to install them:
sudo apt-get update
sudo apt-get install git python3 python3-pip python3-dev libpq-dev build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev
The above command will install the necessary packages and libraries to run Hakatime on your Debian system.
After installing the dependencies, you need to clone the Hakatime repository from GitHub. To do this, execute the following command in your terminal:
git clone https://github.com/mujx/hakatime.git
This command will download the Hakatime repository to your system.
Now that you have cloned the Hakatime repository, create a Python virtual environment to isolate the project's dependencies from the system's packages.
Navigate to the Hakatime directory and execute the following command:
cd hakatime
python3 -m venv venv
This command will create a virtual environment called "venv" inside the "hakatime" directory.
To activate the virtual environment, execute the following command:
source venv/bin/activate
This command will activate the virtual environment and change your prompt to reflect it.
Now that you have the virtual environment set up, install the Hakatime dependencies using the following command:
pip3 install -r requirements.txt
This command will download and install all the necessary modules and packages needed to run Hakatime.
After installing the dependencies, you need to configure Hakatime to work with your database. Open the "config.py" file located in the "hakatime" directory using the following command:
nano config.py
Inside this file, you need to modify the following section:
SQLALCHEMY_DATABASE_URI = 'postgresql://<USERNAME>:<PASSWORD>@<HOST>:<PORT>/<DB_NAME>'
Replace the placeholders with your PostgreSQL database credentials accordingly.
Save and close the file.
After configuring the database, migrate and seed the database by executing the following command:
flask db upgrade
flask seed
This command will create the tables in your database and seed them with relevant data.
To start Hakatime, run the following command:
flask run
This command will start the Hakatime server, and you can access it by visiting the URL "http://localhost:5000" in your web browser.
That's it! You have successfully installed Hakatime on your Debian Latest system. You can now use Hakatime to track your time while working on your software development projects.
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!