LibrePhotos is a self-hosted, open-source alternative to Google Photos, which lets you manage and share your photos and videos securely. In this tutorial, we'll show you how to install LibrePhotos on the latest version of NixOS.
Before starting, you need to have the following prerequisites:
Before installing LibrePhotos, ensure that your system has the required dependencies installed. Run the following command to install all necessary dependencies:
sudo nix-env -iA nixos.python36Packages.mysql nixos.git
To download LibrePhotos, run the following command in the terminal:
git clone https://github.com/LibrePhotos/librephotos.git
This command will download the LibrePhotos repository into your current working directory.
LibrePhotos requires a running MySQL database to store metadata and thumbnails. To install and set up MySQL, follow these steps:
sudo systemctl start mysql
sudo systemctl enable mysql
mysql_secure_installation
The above commands will start the MySQL server, enable it to start automatically on boot and run the MySQL installation script to set up the database.
To set up the required environment variables, edit the librephotos/.env
file using your preferred text editor:
cd librephotos
cp .env.example .env
nano .env
Edit the following variables in the .env
file:
DATABASE_URL=mysql+pymysql://root:<MYSQL_ROOT_PASSWORD>@localhost/librephotos
Replace <MYSQL_ROOT_PASSWORD>
with MySQL's root password. Leave root
in place for the user.
LIBREPHOTOS_SECRET_KEY=<A-RANDOM-GENERATED-SECRET-KEY>
Set <A-RANDOM-GENERATED-SECRET-KEY>
to a 64 character random string. You can use pwgen like so: pwgen -B -v 64 1
.
LIBREPHOTOS_ADMIN_USER=<ADMIN-USERNAME>
LIBREPHOTOS_ADMIN_PASSWORD=<ADMIN-PASSWORD-GENERATED>
Replace <ADMIN-USERNAME>
with the username you want to use for the admin account, and set <ADMIN-PASSWORD-GENERATED>
to the password you want to use for that account.
Save and close the file.
To install and set up LibrePhotos, run the following command in the terminal:
python3.6 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python manage.py migrate
python manage.py collectstatic
You can now start LibrePhotos by running the following command:
python manage.py runserver 0.0.0.0:8000
This command will start the server on port 8000. You can access the LibrePhotos web interface by navigating to http://<YOUR-SERVER-IP-ADDRESS>:8000/
in your web browser.
Congratulations! You have successfully installed and set up LibrePhotos on NixOS Latest. You can now start uploading, managing, and sharing your photos and videos securely.
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!