How to Install and Configure Diaspora on Alibaba Cloud

By Arslan Ud Din Shafiq, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

Diaspora is an open source, distributed, user owned and non-profit social network based upon Diaspora software. Diaspora is a project of The Diaspora Foundation which was written in Ruby, under the AGPLv3 and MIT License.

In this tutorial, we will be installing and setting up a Diaspora pod using Alibaba Cloud Elastic Compute Service (ECS) with Ubuntu 16.04 installed.

Prerequisites

  1. You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you are a new user, you can get a free account in your Alibaba Cloud account. If you don’t know about how to setup your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 1.5GB RAM and 2 Core processor.
  2. A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
  3. Domain name must be pointed to your Alibaba Cloud ECS’s IP address
  4. Access to VNC console in your Alibaba Cloud or SSH client installed in your PC
  5. Set up your server’s hostname and create user with root privileges.

Setting Up Your Server

Before proceeding with installation of any kind of package, use the following command to update your Ubuntu system. To execute this command, remember to login from non-root user with sudo privileges.

To install build-essential execute the command.

To install libssl-dev execute the command.

To install libcurl4-openssl-dev execute the command.

To install libxml2-dev execute the command.

To install libxslt-dev execute the command.

To install imagemagick execute the command.

To install ghostscript execute the command.

To install curl execute the command.

To install libmagickwand-dev execute the command.

You will need to install Git on your server as well as local machine. To install and configure Git, follow the steps below.

(Optional) Now execute the commands below to configure Git by providing your name and valid email address so that commit messages may contain your correct information.

To install libpq-dev execute the command.

To install autoconf execute the command.

To install bison execute the command.

To install libyaml-dev execute the command.

To install libreadline6-dev execute the command.

To install zlib1g-dev execute the command.

To install libncurses5-dev execute the command.

To install libffi-dev execute the command.

To install libgdbm3 execute the command.

To install libreadline-dev execute the command.

To install libgdbm-dev execute the command.

To install redis-server execute the command.

To install patch execute the command.

To install ruby-dev execute the command.

To install liblzma-dev execute the command.

Install Node.js

Node.js is a cross platform open source JS runtime environment that runs JS code outside the browser. A version of Node.js is available in Ubuntu’s default repository. To install Node.js follow the steps below.

Type Y and hit Enter when you see the prompt. Nodejs should be installed successfully.

Install PostgreSQL Database

Diaspora supports PostgreSQL, MySQL and MariaDB. In this tutorial, I will use PostgreSQL.

In the first step, install PostgreSQL repo.

Now install the PostgreSQL server by executing the command below.

Execute the following command to start and enable PostgreSQL server so that it can start automatically after reboot.

Now connect to PostgreSQL server using postgres username.

Create a user and database for Diaspora.

Install Exim4

To send emails to use, you will need Exim4 as STMP relay. To install Exim4, execute the command below.

To configure Exim4, execute the command below.

Install Ruby

To install Ruby, you will use rbenv to manage environment and versions. Execute the following commands to download rbenv and set paths.

Now install ruby-build plugin to compile Ruby.

Now install rbenv using the command.

Now install Ruby by executing command below.

Install and Configure Diaspora

To install and configure Diaspora, follow the steps below.

Navigate to home directory

Clone source code for Diaspora.

Navigate to /diaspora

Copy the example database configuration file to location required by Diaspora.

Now open the database configuration file in text editor and configure database.

Now configure Diaspora file.

To make it work properly, make the following changes in opened file.

  1. Set public facing url
  2. Uncomment by removing # from start of certificate_authorities
  3. Set value of rails_environment from development to production.
  4. Change require_ssl value from true to false.
  5. Uncomment listen: ‘http://localhost:3000'

Install Gems

Edit .ruby-version file and change value from 2.4 to 2.4.3.

Now install bundle by executing command below.

Setup Database

Now create and configure database by executing command below.

Precompile Assets

To precompile the assets, execute the command below.

Diaspora systemd Services

We will manage Diaspora via service. First of all, create the following files: target file, web service file, and sidekiq service file.

Now add the following text to target file.

Now add the following text to web service file.

Now add the following text to sidekiq service file.

Now enable to services so that on reboot, they can restart automatically.

Restart the services by using command below.

Install openSSL 1.1.0f

By default, openssl v1.0.2 is installed. But in your Nginx configuration file, you will use ssl_ecdh_curve which requires openssl 1.1.0f or higher, otherwise you will get syntax error. To install openssl, execute the following set of commands.

Install Apache Server

You will be required to install apache server, for this purpose, you will need to follow the steps below.

To install execute the command.

Now you will need to start apache server by executing command below.

To check status of apache server, execute the command below.

To check installation, access IP address of your Alibaba Cloud ECS or your domain name that you have pointed to your IP address. In my case, I have accessed via domain name and the following screen loaded.

Install Let’s Encrypt SSL Certificate

Certbot will require port 80 for obtaining new certificate. Hence, in the first step, you will need to stop apache server because apache uses port 80. To do so, execute the command.

To install certbot, update the system using command.

Now install software-properties-common.

Add certbot repository.

Again, update the system.

Now install python-certbot-apache

Now execute the following command for issuance of SSL certificate.

Generate dhparam.pem file.

Create nginx configuration file by executing the command below.

Add the following text in opened file and save the file.

Now enable rewrite mode by executing command.

Now enable proxy mode by executing command.

Now enable headers by executing command.

Now enable SSL engine by using command.

Now enable lbmethod_byrequests by using command.

Now enable slotmem_shm by using command.

Now restart your apache to reload the updated settings.

Start Diaspora Server

To start Diaspora, follow the steps below.

Navigate to diaspora directory.

Note: Remember to replace aareez with your username.

Start the server by executing command.

That’s it! You can now access Diaspora via domain name or ECS IP address.

Reference:https://www.alibabacloud.com/blog/how-to-install-and-configure-diaspora-on-alibaba-cloud_594219?spm=a2c41.12345609.0.0

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store