How to Install Hakatime on Ubuntu Server Latest
Hakatime is a time-tracking tool for developers that integrates with various text editors, IDEs, and code hosting platforms. This tutorial outlines the steps for installing Hakatime on Ubuntu Server Latest.
Prerequisites
Before installing Hakatime, ensure that your Ubuntu Server Latest system meets the following requirements:
- Python 3.6 or higher
- pip3
- Git
You can install both pip3 and Git using the following command:
sudo apt-get install -y python3-pip git
Installation Steps:
- Clone the Hakatime repository from GitHub:
git clone https://github.com/mujx/hakatime.git
- Navigate to the cloned Hakatime repository:
cd hakatime
- Install the required dependencies:
pip3 install -r requirements.txt
- Create a
config.yamlfile in the Hakatime directory:
cp configs/config.example.yaml configs/config.yaml
- Generate a secret key for your Hakatime instance:
openssl rand -hex 16
Copy the generated key and update the SECRET_KEY value in the config.yaml file.
- Launch the PostgreSQL server:
sudo systemctl start postgresql
- Create a PostgreSQL user and database for Hakatime:
sudo su postgres
createuser hakatime
createdb hakatime -O hakatime
exit
- Update the PostgreSQL parameters in the
config.yamlfile:
DB_NAME: hakatime
DB_USER: hakatime
DB_PASSWORD: <password>
DB_PORT: 5432
DB_HOST: 127.0.0.1
Replace <password> with the password you set for the hakatime user.
- Run the database migration:
python3 hakatime/manage.py migrate
- Create a superuser for Hakatime:
python3 hakatime/manage.py createsuperuser
- Launch the Hakatime server:
python3 hakatime/manage.py runserver
- Access Hakatime in a web browser:
http://127.0.0.1:8000
Log in using the superuser credentials created in Step 10.
Congratulations! You have successfully installed Hakatime on Ubuntu Server Latest.