Libravatar is a service that provides a free and open-source avatar service. It is based on the email address and allows users to upload avatars that can be accessed across different websites and services. In this tutorial, you will learn how to install Libravatar on Debian Latest.
Before starting this tutorial, make sure you have the following:
To install Libravatar, first, we need to install its dependencies. We can do this by running the following command:
sudo apt-get update
sudo apt-get install -y python3-dev python3-pip python3-venv uwsgi uwsgi-plugin-python3 git memcached nginx
Next, we need to create a virtual environment for Libravatar. We can do this by running the following commands:
mkdir ~/libravatar
cd ~/libravatar
python3 -m venv env
After creating the virtual environment, we need to clone the Libravatar repository using the git command.
git clone https://github.com/lavr/lavr.git
Once you have cloned the repository, you need to navigate to the libravatar folder and install the required libraries using pip.
cd ~/libravatar/lavr
# activate the virtual environment
source ~/libravatar/env/bin/activate
pip3 install -r requirements.txt
After installing the requirements, we need to configure the Django settings of Libravatar. Create a file named .env
in the lavr
folder and add the following contents:
# Django settings
SECRET_KEY=<your_secret_key>
DEBUG=True
ALLOWED_HOSTS=*
# Database settings
DATABASE_URL=sqlite:////path/to/your/db.sqlite3
# Django storage
DEFAULT_FILE_STORAGE=django.core.files.storage.FileSystemStorage
STATICFILES_STORAGE=django.contrib.staticfiles.storage.ManifestStaticFilesStorage
# Memcached caching
CACHES={"default":{"BACKEND":"django.core.cache.backends.memcached.MemcachedCache","LOCATION":"127.0.0.1:11211","TIMEOUT":3600}}
# Email settings
DEFAULT_FROM_EMAIL=<your_email>
EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
EMAIL_HOST=<your_smtp_host>
EMAIL_PORT=<your_smtp_port>
EMAIL_USE_TLS=True
EMAIL_HOST_USER=<your_email_username>
EMAIL_HOST_PASSWORD=<your_email_password>
After configuring the Django settings, create the database using the following command:
python manage.py migrate
Next, create a superuser account for the Libravatar service using the following command:
python manage.py createsuperuser
After creating the superuser account, run the Libravatar service using the following command:
uwsgi --socket :8080 --module lavr.wsgi --home ~/libravatar/env --chmod-socket=666
To access the Libravatar service from a web browser, we need to configure an Nginx server block. Create a new configuration file in the /etc/nginx/sites-available/
directory for the Libravatar service using the following command:
sudo nano /etc/nginx/sites-available/libravatar.example.com
Add the following contents to the file:
server {
listen 80;
server_name libravatar.example.com;
location / {
include uwsgi_params;
uwsgi_pass unix:///run/uwsgi/app/lavr/socket;
}
location /media/ {
alias /path/to/your/lavr/media/;
}
location /static/ {
alias /path/to/your/lavr/static/;
}
}
Note: Replace the values with the appropriate values
After creating the Nginx server block, enable it by creating a symbolic link to the /etc/nginx/sites-enabled/
directory.
sudo ln -s /etc/nginx/sites-available/libravatar.example.com /etc/nginx/sites-enabled/
Finally, restart Nginx to apply the changes and test the Libravatar service.
sudo systemctl restart nginx
You can now access the Libravatar service by visiting http://libravatar.example.com. Log in to the admin panel using the superuser account created earlier.
Conclusion
In this tutorial, you installed Libravatar on a Debian Latest system. You also created a virtual environment for Libravatar, installed its dependencies, configured Django settings, created a superuser account, and finally ran the Libravatar service with Nginx.
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!