Diaspora is a non-profit, user-owned and distributed social network. The program consists of a group of independent nodes that work together to form a network. This social network does not belong to any person or institution, and makes the network not subject to the occupation of companies or advertisements. In this article, we try to learn you Tutorial Install Diaspora Social Media on Ubuntu 20.04. You can visit the packages available in Eldernode to purchase a Ubuntu VPS server.
The sections covered in this article include the following topics. We will first learn you how to install the dependency package. Then you need to create a PostgreSQL user for Diaspora. In the next step, we will explain how to install RVM and Ruby, and finally we will learn you how to download and configure Diaspora. Follow us in this tutorial.
Table of Contents
How to install package dependencies to install Diaspora
Before you start installing Diaspora Social Media on Ubuntu 20.04, you must first install the dependencies. These dependency packages include PostgreSQL, Redis, and Nginx web server. Use the following command to install dependencies:
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
Now that you have the dependency packages installed, you need to start and activate them. To do this, you can run the following commands:
systemctl start redis-server
systemctl enable redis-server
systemctl start postgresql
systemctl enable postgresql
How to Create New PostgreSQL User for Diaspora
Before creating a new PostgreSQL user for Diaspora, you first need to change the default postgres user password. You must first log in to PostgreSQL:
sudo -i -u postgres psql
Now you need to change the password using the following command. After entering the following command, you must enter the new password and type it again to set the new password for the postgres user.
\password postgres
After changing the password now is the time to create a new diaspora user with a CREATEDB privilege to create the database. To do this, run the following command.
Note: In the following command, you must enter your password instead of yourpassword.
CREATE USER diaspora WITH CREATEDB PASSWORD 'yourpassword';
Enter the following command to exit the PostgreSQL shell:
EXIT
Learn how to Create a New User
In this step, you must use the following command to create a new system user named diaspora. Then use the next command to set the password for it. It should be noted that this user is added to the sudo group after it is created.
adduser --disabled-login Diaspora
passwd diaspora
usermod -a -G sudo diaspora
Tutorial Install RVM and Ruby
To install RVM and Ruby, you must first log in to the diaspora user using the following command:
su - diaspora
It is also necessary to install RVM and Ruby GPGP Key. To do this, run the following command:
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
After completing the above steps, you can now install the RVM. After successfully installing the RVM by the following command, you must enter your password for the diaspora user.
curl -sSL https://get.rvm.io | bash -s stable
Then you need to load the rvm script to your server using the following command:
source /home/diaspora/.rvm/scripts/rvm
It should be noted that you can easily install Ruby 2.6 using the following command and then check its version:
rvm install 2.6
ruby -v
How to download and configure Diaspora
You must first install the Diaspora source code by running the following command:
git clone -b master https://github.com/diaspora/diaspora.git
cd diaspora
Next you need to run the following commands to configure the database and diaspora:
cp config/database.yml.example config/database.yml
cp config/diaspora.yml.example config/diaspora.yml
Now you need to edit the database configuration file with the Vim editor:
vim config/database.yml
After opening the file, change the username and password information to your desired data. Then save the file and exit it.
postgresql: &postgresql adapter: postgresql host: "localhost" port: 5432 username: "diaspora" password: "yourpassword" encoding: unicode
Now you need to edit the diaspora configuration file using the vim editor:
vim config/diaspora.yml
After opening the diaspora configuration file, you must configure it as follows. In the following commands, you must enter the domain name you want instead of yourdomainname. After making the changes, you can save them.
configuration: ## Section ... environment: ## Section ... url: "https://yourdomainname.com/" certificate_authorities: '/etc/ssl/certs/ca-certificates.crt' require_ssl: true ... server: ## Section rails_environment: 'production' ...
Once you have successfully completed the above steps, you should now install the gem and ruby libraries:
gem install bundler
script/configure_bundler
bin/bundle install --full-index
Next you need to move the database to Diaspora:
RAILS_ENV=production bundle exec rake db:create db:migrate
Finally, you must run the following command to compile all rails asset pipeline:
RAILS_ENV=production bin/rake assets:precompile
Conclusion
Diaspora is a social network that consists of a group of independent nodes that belong to each other (pods) that work together to form a network. In this article, we tried to learn you step by step how to install Diaspora Social Media on Ubuntu 20.04.
Hi,
I am receiving an error when running bin/bundle install –full-index,
Your bundle is locked to rails-assets-underscore (1.9.1) from rubygems repository https://rubygems.org/ or installed locally, but that version can no longer be found in that source.
Any idea how to fix this?
Run bundle update on your project to get the latest version. That should fix your issue as when you deploy next when heroku runs bundler, it will pick up that version from RubyGems.