BILLYSOFTACADEMY

How To Deploy Linux Ubuntu 20.04 LTS In The Cloud On AWS Lightsail And Install The Etherpad Lite Document Collaboration Web App.

Linux ubuntu 20.04 LTS (focal fossa) released on August 6, 2020 is a free open source operating system from canonical. It comes with new features and improvements such as an updated linux kernel version 5.4, Support for AMD Rome CPUs, Radeon RX Vega M and Navi GPUs, Intel Cannon Lake platforms, Support for raspberry pi (Pi 2B, Pi 3B, Pi 3A+, Pi 3B+, CM3, CM3+, Pi 4B), Significant power-saving improvements, boot speed improvements through changing the default kernel compression algorithm to lz4 (in Ubuntu 19.10) on most architectures, and changing the default initramfs compression algorithm to lz4 on all architectures and more! The server version of linux ubuntu was also released with new functions and features such as SSH two factor authentication, Wireguard VPN, Support for all major architectures: x64-64, ARM v7, ARM64, POWER 8, POWER 9, IBM x390x (LinuxONE),Updates to various built in applications and more! Continue reading this tutorial to learn how to deploy Linux Ubuntu 20.04 LTS in the cloud on AWS Lightsail. You will also learn how to install the ETHERPAD LITE document collaboration web app.

REQUIREMENTS

In order to complete this tutorial successfully the following items that may be required. Please ensure to have these items available before taking implementation action on this tutorial to ensure success:
1) An AWS free tier account.
2) An IAM user account with permissions to provision resources in AWS Lightsail.
3) A Linux Ubuntu 20.04 instance.
4) The WGET package.
5) The etherpad lite document collaboration web app.

OVERVIEW

1) Sign up or log into your AWS free tier or paid account and open the AWS LIGHTSAIL management console.
2) Create a new LINUX UBUNTU 20.04 LTS instance and configure a static public IP address.
3) Connect to the LINUX UBUNTU 20.04 LTS using the AWS Lightsail browser based SSH client.
4) Install ubuntu system, package updates and install GIT.
5) Install the ETHERPAD LITE document collaboration web app.

Step 1: Sign Up Or Log Into Your AWS Free Tier Or Paid Account And Open The AWS LIGHTSAIL Management Console

1) Click HERE to go to the AWS sign up page, to sign up for a free tier account. The free tier account allows you to explore more than 100 products and start building on AWS without having to make any upfront payments or commitments.

However there are 3 different types of free access that are available on AWS services and these are:
1) 12 months free.
2) Free trials.
3) Always free.

Once you have complete the free tier account sign up process we recommend that you create an IAM user account that will be used to create and manage AWS services.Click HERE to learn how to create an IAM user

2) Login into the AWS console using your IAM user account and click on SERVICES > LIGHTSAIL to open the AWS Lightsail management console.

Step 2: Create A New LINUX UBUNTU 20.04 LTS Instance And Configure A Static Public IP Address

3) On the LIGHTSAIL dashboard, click on the CREATE INSTANCE button to open the instance creation page.

4) AWS LIGHTSAIL will automatically select the best location for the instance however if you would like to change the location of the instance click on the “CHANGE AWS REGION AND AVAILABILITY ZONE” link..

On the SELECT A PLATFORM section, select the LINUX / UNIX option and on the SELECT A BLUEPRINT section, click on the OS ONLY tab and click on UBUNTU 20.04 LTS.

5) You can all a shell script that will run the the instance when it starts up for the first time. To do so, click on the ADD LAUNCH SCRIPT link.

If you would like to change the SSH KEY PAIR that is used to securely connect to the instance, click on the CHANGE SSH KEY PAIR button..

Select the amount of money that you would like to pay, each month for your instance on the CHOOSE YOUR INSTANCE PLAN section. If you select any of the first three plans, you als get the first 3 months FREE!

6) Enter a unique name to identify the linux ubuntu instance as shown in the image on the right and click on the CREATE INSTANCE button.
7) Proceed by setting a static public IP address on the Linux Ubuntu instance, to do this click on HOME, click on the NETWORKING tab and click on the CREATE STATIC IP button.

8) Again AWS LIGHTSAIL will choose the best region where the static IP address will be allocated from but if you would like to change this, click on the “CHANGE AWS REGION AND AVAILABILITY ZONE” link..

Select the linux ubuntu instance on the ATTACH TO AN INSTANCE drop down menu, add a name to identify the static IP address and click on CREATE.

Step 3: Connect To The LINUX UBUNTU 20.04 LTS Instance Using The AWS Lightsail Browser Based SSH Client.

9) The next step is to connect to the terminal interface of the cloud hosted linux ubuntu server. To do so, click on HOME and click on the TERMINAL ICON on the linux ubuntu instance as indicated by the arrow in the image on the right.
10) A new web browser window will open and you will see a terminal interface similar to the one shown in the image on the right.

Step 4: Install Ubuntu System & Package Updates And Install GIT

11) Each time you install an operating system such as linux ubuntu we recommend that you install system and package updates so as to get the lasted improvements and bug fixes installed. Run the following command to install system and package updates: sudo su apt-get update && apt-get upgrade.
12) Once the installation is complete, run the following command to restart linux ubuntu: sudo reboot

13) Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

In this tutorial the GIT software package will be used to download the ETHERPAD LITE installation files. Run the following command to install GIT:

apt-get install git.

Step 5: Install The ETHERPAD LITE Document Collaboration Web App

14) Next, Run the following command to install the following packages that are needed to install ETHERPAD LIT on Linux Ubuntu 20.04 LTS:

sudo su

apt-get install gnupg2 git unzip libssl-dev pkg-config gcc g++ make build-essential -y

15) The ETHERPAD LITE web application uses a MAIADB database in its backend. So the next thing to do is to install the MARIADB database engine by running the following commands

sudo su

apt-get install mariadb-server -y

16) Next, log into the MARIADB shell an running the following commands to  create a MYSQL database for the ETHERPAD LITE web app:

a) mysql

b) MariaDB [(none)]> create database ETHERPADWEBAPP;

c) MariaDB [(none)]> grant all privileges on ETHERPADWEBAPP.* to ETHERPADUSER@localhost identified by ‘ETHERPADPASSWORD’;

d) MariaDB [(none)]> flush privileges;

e) MariaDB [(none)]> exit;

17) Next, you need to install NODEJS because ETHERPAD LITE depends on it to run. Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser. However Node.js is not available in the Ubuntu 20.04 standard repository. So you will need to add the Node.js repository to your system by running the following commands: a) curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh b) bash nodesource_setup.sh

18) Now, run the following command to install NODEJS:

 apt-get install nodejs -y

Once the installation is complete, run the following command to confirm the version of NODEJS that has been installed:

node -v

You should get the following output:

v14.18.1

19) Next, run the following command to add a ETHERPAD user in linux ubuntu:

 adduser –home /opt/etherpad –shell /bin/bash etherpad-user

You will be prompted to set a password for the ETHERPAD user as shown in the image on the right and on  the “IS THE INFORMATION CORRECT” prompt, press Y and press ENTER.

20) Give the newly created ETHERPAD user the correct file permissions for accessing the ETHERPAD application folder by running the following command:

 install -d -m 755 -o etherpad-user -g etherpad-user /opt/etherpad

21) Change to ETHERPAD user and download the latest version of ETHERPAD from the Git repository by running the following commands:

su – etherpad

cd /opt/etherpad

git clone https://github.com/ether/etherpad-lite.git

22) Next, go into the etherpad-lite folder and run the following command to install all dependencies & start the ETHERPAD server:

cd etherpad-lite.

bin/run.sh

23) If the dependancy installation process and server start process completes successfully, you should see output as shown in the image on the right.

24) Next, press CNTRL + C on your keyboard to stop the ETHERPAD server and run the following command to edit the settings.json file :

 nano settings.json

Remove the following lines for the .json file:

 “dbType” : “dirty”,
“dbSettings” : {
“filename” : “var/dirty.db”
},

25) Press CNTRL + W on your keyboard to open the nano search box, type DBTYPE and press ENTER.

Nano will automatically scroll to a section where you can configure the MYSQL database details. Add your mysql database name, username and password and press CNTRL + O to save changes

26) Press CNTRL + W on your keyboard once more to open the nano search box, type TRUSTPROXY and press ENTER.

Set the TRUSTPROXY parameter to TRUE and press CNTRL + O to save changes

27) Press CNTRL + W on your keyboard once more to open the nano search box, type USERS and press ENTER. Enter a password that you will use to log into the ETHERPAD admin account and press CNTRL + O to save changes.

28) Next, run the following command to install ETHERPAD dependancies:

 ./bin/installDeps.sh

Then exit out of the ETHERPAD user account by runnig the following command:

exit

29) The next step is to create a systemd configuration file that will be used to manage the ETHERPAD service. Run the command indicated below to create the file:

 nano /etc/systemd/system/etherpad.service

30) Next, copy and paste the following configuration into the ETHERPAD.SERVICE file and press CNTRL + O to save changes:

 [Unit]
Description=Etherpad-lite, the collaborative editor.
After=syslog.target network.target

[Service]
Type=simple
User=etherpad
Group=etherpad
WorkingDirectory=/opt/etherpad/etherpad-lite
Environment=NODE_ENV=production

ExecStart=/usr/bin/node /opt/etherpad/etherpad-lite/src/node/server.js

Restart=always

[Install]
WantedBy=multi-user.target