LibrePhotos is a self-hosted photo management solution. With LibrePhotos, you can easily organize and manage your photos, view them in a slideshow, and share them with your friends and family. In this tutorial, we will guide you through the process of installing LibrePhotos on Debian Latest.
Before we start with the installation process, make sure that you have the following requirements:
The first step is to ensure that your Debian system is up-to-date. Run the following command to update the system:
sudo apt update && sudo apt upgrade
Next, install the required packages for LibrePhotos:
sudo apt install python3-pip python3-dev libpq-dev postgresql postgresql-contrib nginx
During the installation, you will be asked to set a password for the PostgreSQL server.
After installing the packages, log in to the PostgreSQL server:
sudo -u postgres psql
Create a new database and user for LibrePhotos:
CREATE DATABASE librephotos;
CREATE USER librephotos WITH PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE librephotos TO librephotos;
Replace 'password' with a secure password for the database user.
Exit the PostgreSQL server:
\q
Clone the latest version of LibrePhotos from its GitHub repository:
git clone https://github.com/LibrePhotos/librephotos.git
Change the directory to the project:
cd librephotos
Install the required Python packages:
pip3 install -r requirements.txt
Create a configuration file for the application:
cp .env.sample .env
Edit the .env
file and update the following parameters:
DJANGO_SECRET_KEY
: A secret key for your Django applicationDATABASE_URL
: The PostgreSQL database URL in the format postgres://USER:PASSWORD@localhost:5432/DATABASE_NAME
HOSTNAME
: Your domain or subdomain nameDJANGO_ALLOWED_HOSTS
: Comma-separated list of allowed hosts, e.g., example.com,www.example.com
Migrate the database schema using Django's manage.py
script:
python3 manage.py migrate
Create a Django superuser to manage the application:
python3 manage.py createsuperuser
Enter the required information, such as username, email, and password.
Collect the static files required by the application:
python3 manage.py collectstatic --noinput
Create a new NGINX Server Block file:
sudo nano /etc/nginx/sites-available/librephotos
Paste the following configuration:
server {
listen 80;
server_name example.com www.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name example.com www.example.com;
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA512:DHE-RSA-AES128-GCM-SHA256;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Replace example.com
and www.example.com
with your domain or subdomain name. Also, replace /path/to/fullchain.pem
and /path/to/privkey.pem
with the paths to your SSL certificate and key files.
Create a symbolic link to the sites-enabled
directory:
sudo ln -s /etc/nginx/sites-available/librephotos /etc/nginx/sites-enabled/
Test the NGINX configuration:
sudo nginx -t
If the configuration is valid, restart NGINX:
sudo systemctl restart nginx
Start the Django development server:
python3 manage.py runserver 127.0.0.1:8000
Open your web browser and visit https://example.com/admin/
(replace example.com
with your domain or subdomain name). Log in to the application with the Django superuser credentials created earlier.
Congratulations! You have successfully installed and configured LibrePhotos on Debian Latest. Now you can start uploading your photos and organizing them with this self-hosted photo management solution.
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!