Skip to content

Instantly share code, notes, and snippets.

@hakanbaysal
Forked from WisdomSky/README.md
Created September 24, 2022 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakanbaysal/b541524f95c2566d4cb0d4d62d569f72 to your computer and use it in GitHub Desktop.
Save hakanbaysal/b541524f95c2566d4cb0d4d62d569f72 to your computer and use it in GitHub Desktop.
Signal Server Installation v1.88 Full Guide

# Requirements

  • Java 11
  • Maven
  • Redis
  • PostgreSQL

# Cloning the repository

Run the following commands:

$ git clone [https://github.com/signalapp/Signal-Server.git](https://github.com/signalapp/Signal-Server.git)


$ cd Signal-Server


$ git checkout 15cf010e449e61d06fed1387abd01d64c5e6ea82

Note: The commit hash specified in the checkout command is the v1.88 version of the source.

# Installing Java 11 on Ubuntu

The original required version of Java for Signal is Java 8, however the PPA for this version has been discontinued. We can install and use Java 11 however there are issues when this version of Java is used for Signal.

You can install Java 11 on Ubuntu by following the steps specified in this page:

https://tecadmin.net/install-oracle-java-11-on-ubuntu-16-04-xenial/

# Compiling Signal from Source

In order to compile the source, you need to install Maven by following the steps specified in this page:

https://www.vultr.com/docs/how-to-install-apache-maven-on-ubuntu-16-04

After successfully installing Maven, you can start compiling the source by running the following command:

$ mvn install -DskipTests		

When the compilation is successful, a folder named **target **should exist and contains the jar files inside especially the file TextSecureServer-1.88.jar. If this file doesn’t exist, it means that the compilation was unsuccessful.

# Installing Redis

To install Redis, just follow the steps specified in this page:

https://tecadmin.net/install-redis-ubuntu/

# Installing PostgreSQL

To install PostgreSQL, just follow the steps specified in this page:

https://tecadmin.net/install-postgresql-server-on-ubuntu/

After installing PostgreSQL, you need to create two separate databases, you can just name them accountdb and messagedb for convention, but you can name them anything as long as you know which is which.

# Configuration

You can find a sample configuration file at config/sample.yml. You can create a copy of this file with a different filename.

Here is a sample configuration file with the correct format of values.

**twilio**: _# Twilio gateway configuration_


_ **accountId**_: test


 **accountToken**: test


 **numbers**: _# Numbers allocated in Twilio_


_   _- +181591234567


 **messagingServicesId**:


 **localDomain**: exampleapp.com _# Domain Twilio can connect back to for calls. Should be domain of your service._


**push**:


 **queueSize**: 10 _# Size of push pending queue_


_#redphone:_


_#  authKey: # Deprecated_


**turn**: _# TURN server configuration_


_ **secret**_: test _# TURN server secret_


_ **uris**_:


   - turn:127.0.0.1:3478


**cache**: _# Redis server configuration for cache cluster_


_ **url**_: redis://127.0.0.1:6379/1


 **replicaUrls**:


   - redis://127.0.0.1:6379/2


**directory**: _# Redis server configuration for directory cluster_


_ **url**_: redis://127.0.0.1:6379/3


 **replicaUrls**:


   - redis://127.0.0.1:6379/4


**messageCache**: _# Redis server configuration for message store cache_


_ **redis**_: {**url**: "redis://localhost:6379/5", **replicaUrls**: ["redis://localhost:6379/6"]}


 **cacheRate**: 1


 **persistDelayMinutes**: 10


**messageStore**: _# Postgresql database configuration for message store_


_ **driverClass**_: org.postgresql.Driver


 **user**: example


 **password**: 12345678


 **url**: jdbc:postgresql://127.0.0.1:5432/example


**attachments**: _# AWS S3 configuration_


_ **accessKey**_: test


 **accessSecret**: test


 **bucket**: exampleapp.com


**profiles**: _# AWS S3 configuration_


_ **accessKey**_: test


 **accessSecret**: test


 **bucket**: exampleapp.com


 **region**: us-east-2


**database**: _# Postgresql database configuration_


_ **driverClass**_: org.postgresql.Driver


 **user**: example


 **password**: 12345678


 **url**: jdbc:postgresql://127.0.0.1:5432/example2


**apn**:


 **bundleId**: com.exampleapp.example3


 **pushCertificate**: "-----BEGIN CERTIFICATE-----\r\nMIIFjzCCBHegAwIBAgIIfkSIVVtC9UIwDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV\r\nBAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSwwKgYDVQQLDCNBcHBsZSBXb3Js\r\nZHdpZGUgRGV2ZWxvcGVyIFJlbGF0aW9uczFEMEIGA1UEAww7QXBwbGUgV29ybGR3\r\naWRlIERldmVsb3BlciBSZWxhdGlvbnMgQ2VydGlmaWNhdG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Q1Mrsn53xxNrqPFDxh8M23iMh8+b+Zl1wdGQqxztaPsLdE\r\nicX9ldKOiULWOfWyO9Y2oO0p3SaHu/dSDrC66r02yMYRDl6zlTq7K/fozIJNynUN\r\n2WHXh4ECgYEAneclaDj/KMtedyaJcblyEjtpzW3V/Gotws2cAaHqVaWDJHRrp0bl\r\nZNg8Jjf/NoixxENZ5bdduAR3JEjTwScRpOluO45Huq2gIMS7jsBKoDAvF94DNUI5\r\nNDtK8x/8+SOdk5HAGNHDoMqVbgZ2NpeOIGxzoZUCCK4f1j1CZbeEIio=\r\n-----END RSA PRIVATE KEY-----"


**gcm**:


 **senderId**: 90077701463


 **apiKey**: AIzaSyAHNIwGE0yKG9QnDZQMcziNAF-0zliXOtH


**pushScheduler**:


 **url**: redis://localhost:6379/7


 **replicaUrls**:


 - redis://localhost:6379/8

# Extracting Push Certificate and Push Private Key

The configuration file requires you to include the string contents of the certificate and private key which can be extracted from the .p12 file.

To extract the certificate, just run the comment below:

$ openssl pkcs12 -in example.p12 -out example.crt.pem -clcerts -nokeys -passin 'pass:XXXXXXXX'

The example.p12 is the path to the .p12 file.

The example.crt.pem is the outfile filename.

Replace XXXXXXXX with the password of the file.

To extract the certificate, just run the comment below:

$ openssl pkcs12 -in example.p12 -nocerts -nodes -passin 'pass:XXXXXXXX'' | openssl rsa -out example.rsa.key.pem

The example.p12 is the path to the .p12 file.

The example.rsa.key.pem is the outfile filename.

Replace XXXXXXXX with the password of the file.

On each file, the contents are separated by a new line character, since the configuration file only accepts a single line string for the pushCertificate and pushKey, you need to replace the new line character with \r\n just like in the sample configuration above. This is important to avoid errors.

# Running Migrations

Before you start running the server, you need to run the following commands to create the necessary tables used by Signal.

$ java -jar service/target/TextSecureServer-1.88.jar  messagedb migrate  config/Signal.yml


$ java -jar servive/target/TextSecureServer-1.88.jar  accountdb migrate  config/Signal.yml

Note: Replace the Signal.yml with the correct filename of your configuration file.

# Starting the Server

You can start the server by running the command below:

$ java -jar target/TextSecureServer-1.88.jar  server config/Signal.yml

Note: Replace the Signal.yml with the correct filename of your configuration file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment