Debian

How to Install Diaspora Decentralized Social Media on Debian 10

Diaspora is a privacy-aware distributed and an open-source, decentralized social network. It comprises a collection of independently owned and deployed nodes that are incorporated to create the social network. This article will show the installation procedure of Diaspora distributed social network on the Debian 10 system.

Prerequisites

All commands should run under administrative privileges.

Follow the following procedure to install the diaspora decentralized social media on Debian 10:

Step 1: Install the required packages

Install the required dependencies for diaspora installation such as Redis, PostgreSQL, and Nginx web server.

$ sudo apt-get install build-essential cmake gnupg2 libssl-dev libcurl4-openssl-dev libxml2-dev libxslt-dev imagemagick ghostscript curl libmagickwand-dev git libpq-dev redis-server nodejs postgresql

Enable and start the Redis and PostgreSQL services after completing the installation of required packages. Add all of them to the Debian system boot by using the following commands:

$ systemctl start redis-server

$ systemctl enable redis-server

$ systemctl start postgresql

$ systemctl enable postgresql

Step 2: Create PostgreSQL new user for diaspora

Change the f=default ‘Postgres’ user password and create a PostgreSQL user for the diaspora.

By using the ‘psql’ command, Log in to the PostgreSQL shell.

$ sudo -i -u postgres psql

Now, change the ‘postgres’ default user password by using the following command:

# \password postgres

Enter the new password and again re-enter the password for confirmation.

Create a new user named ‘diaspora’ who have certain privileges ‘CREATEDB’:

# CREATE USER diaspora WITH CREATEDB PASSWORD 'yourpassword';

Type ‘exit’ on the terminal to leave the PostgreSQL shell window.

Step 3: Create a new diaspora user

Once the PostgreSQL user for diaspora is created, you will create a system user named ‘diaspora’ and then include it into the sudo group.

By using the following commands, create a new system user named ‘diaspora’ and assign its password:

$ sudo adduser --disabled-login Diaspora

$ sudo passwd diaspora

Add the above user ‘diaspora’ into the sudo group by running the below-given command:

$ sudo usermod -a -G sudo diaspora

Now, this user can run all administrative sudo commands on this system.

Step 4: Installation of RVM and Ruby Packages

Log in as a diaspora user on your system by executing the following command:

$ su - diaspora

Enter the password that you have been set above for a diaspora system user.

Now, start the installation of Ruby Version Manager (RVM) and install Ruby packages for the ‘diaspora’ user.

Include the RVM GPG key by running the following command:

$ sudo gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Next, install the RVM by executing the following command:

$ curl -sSL https://get.rvm.io | bash -s stable

Once the RVM installation is completed, load the script on your system by using the following command:

$ source /home/diaspora/.rvm/scripts/rvm

Now, using the rvm commands, you can install ruby packages on your system. So, use the following command to install Ruby 2.6:

$ rvm install 2.6

Once the installation of Ruby is completed, check the installed version by executing the following command:

$ ruby --version

Step 5: Download and set up Diaspora

Download the source code of diaspora by using the following git clone command:

$ git clone -b master <a href="https://github.com/diaspora/diaspora.git">https://github.com/diaspora/diaspora.git

Navigate into the diaspora directory and copy or duplicate the database configuration ‘database.yml’ and the diaspora configuration ‘diaspora.yml’.

$ cd diaspora

$ cp config/database.yml.example config/database.yml

$ cp config/diaspora.yml.example config/diaspora.yml

Open the configuration files in the most friendly nano text editor and edit them.

For database configuration:

$ sudo nano config/database.yml

Edit the PostgreSQL section with your username and password as follows:

postgresql: &postgresql

  adapter: postgresql

  host: "localhost"

  port: 5432

  username: "diaspora"

  password: "yourpassword"

  encoding: unicode

Press ‘Ctrl + O’ to save changes and then press ‘Ctrl +X’ to exit from the nano.

Now, edit the ‘config/diaspora.yml’ file.

$ sudo nano config/diaspora.yml


configuration: ## Section

::::::::::

  environment: ## Section

:::::::::

    url: "https://example.org/"

    certificate_authorities: '/etc/ssl/certs/ca-certificates.crt'

    require_ssl: true

::::::::

  server: ## Section

    rails_environment: 'production'

:::::

Save the configuration exit from the current displaying window by pressing ‘Ctrl+O’.

Now, you need to install the gem and required ruby libraries for the diaspora.

$ gem install bundler

$ script/configure_bundler

$ bin/bundle install --full-index

After that, you need to migrate the database by executing the following command:

$ RAILS_ENV=production bundle exec rake db:create db:migrate

Combine all rails assets as follows:

$ RAILS_ENV=production bin/rake assets:precompile

Step 6: Configure diaspora as a Service

Once the diaspora installation is completed, you will set up the Diaspora as a systemd service.

Navigate into ‘/etc/systemd/system’ directory and create a new service file using the nano editor as follows:

$ cd /etc/systemd/system/

$ sudo nano diaspora.target

Paste the following lines in this file:

Save and exit from the nano editor.

Now, create a new service file named ‘diaspora-web.service’ using the nano command:

$ sudo nano diaspora-web.service

Paste the following code in it:

Save and exit from the nano.

Create a new file for monitoring services with named ‘diaspora-sidekiq.service’ using the nano command as follows:

$ sudo nano diaspora-sidekiq.service

Paste the following configuration code in it:

Save and exit from the current window.

Now, reload the systemd services and enable the following diaspora services on your system:

$ sudo systemctl daemon-reload

$ sudo systemctl enable diaspora.target diaspora-sidekiq.service diaspora-web.service

Now, start all services and get status by using the following commands:

$ sudo systemctl start diaspora.target

Enter the password and continue the process.

$ systemctl status diaspora-web

$ systemctl status diaspora-sidekiq

From the above results, you can verify that the Diaspora is running as a systemd service. The basic configuration for Diaspora has been completed now.

Step 7: Generate SSL certificate

To make your domain more secure, generate the SSL Letsencrypt certificate. For this purpose, install the certbot using the following command:

$ sudo apt install certbot

Generate the SSL letsencrypt certificate by replacing the mentioned domain name with your domain as follows:

You can find your SSL certificate in the ‘/etc/letsencrypt/live/yourdomain.com/’ directory in your system. Now, install Nginx as follows:

Configure diaspora with Nginx.

Testing

Once you have configured all diaspora services, add your domain name to your browser’s address bar.

http://youdomain.com/

Conclusion

That’s all about the Diaspora installation on your Debian 10 system. By using the above steps, you can easily install the Diaspora Decentralized Social Media on your Debian system. Thanks.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.