How to Install Linkding on Ubuntu Server Latest
Linkding is a self-hosted bookmarking web app that helps you store and organize your favorite links. In this tutorial, we will guide you through the process of installing Linkding on Ubuntu Server latest.
Prerequisites
Before we proceed, ensure that the following prerequisites are met:
- You have a Linux Ubuntu 20.04 server.
- You have administrative access to your server.
Step 1 — Install Required Packages
First, update your system packages by running the following command:
sudo apt update
Then, install the required packages by running the following command:
sudo apt install build-essential libpq-dev libssl-dev libffi-dev python3-dev python3-pip
Step 2 — Install PostgreSQL
Linkding uses PostgreSQL as the database backend to store bookmarks. Run the following command to install PostgreSQL:
sudo apt install postgresql postgresql-contrib
Step 3 — Create PostgreSQL Database and User
Next, create a new PostgreSQL user and database for Linkding:
sudo su - postgres
createdb linkding
createuser linkding_user
psql
Now, grant permissions to the linkding_user on the linkding database:
GRANT ALL PRIVILEGES ON DATABASE linkding TO linkding_user;
Quit the psql prompt by typing \q and then exit from the postgres user session by running the exit command.
Step 4 — Install Linkding
Now, we will install Linkding by cloning the repository from the GitHub:
sudo git clone https://github.com/sissbruecker/linkding.git
Navigate to the cloned directory:
cd linkding
Create a new Python virtual environment and activate it:
python3 -m venv venv
source venv/bin/activate
Then, install the dependencies by running the following command:
pip install -r requirements.txt
Step 5 — Configure Linkding
The next step is to create a configuration file for the Linkding app. Copy the sample configuration file to the instance directory:
cp instance/config_example.py instance/config.py
Then, open the instance/config.py file in your preferred editor and set the configuration options. Here is an example configuration file:
SECRET_KEY = 'secret key'
SQLALCHEMY_TRACK_MODIFICATIONS = False
DATABASE_URL = 'postgresql://linkding_user:password@localhost:5432/linkding'
DEBUG = True
MAIL_SERVER = 'smtp.example.com'
MAIL_PORT = 465
MAIL_USE_SSL = True
MAIL_USERNAME = 'username'
MAIL_PASSWORD = 'password'
MAIL_DEFAULT_SENDER = '[email protected]'
Replace the SECRET_KEY, DATABASE_URL, MAIL_SERVER, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD, and MAIL_DEFAULT_SENDER values with your own.
Save and close the configuration file.
Step 6 — Initialize the Database
Initialize the database by running the following command:
export FLASK_APP=linkding.py
flask db upgrade
Step 7 — Start the Linkding App
Start the Linkding app by running the following command:
flask run
The Linkding app should now be running on http://localhost:5000. You can access it by opening your web browser and visiting this address.
To start the app in production mode, you can use a web server such as Gunicorn or uWSGI.
Congratulations, you have successfully installed Linkding on Ubuntu Server latest!
Conclusion
In this tutorial, we walked you through the installation of Linkding on Ubuntu Server latest. You have also learned how to configure the app and initialize the database.