---
# System prepended metadata

title: Staging setup steps

---

# Staging setup steps

## Launch instances

- Choose t4g instance type (ARM64)

###### ammar`s edits and notes on setup of AMI

**Amazon Linux 2 LTS is best for nodeJs and next Projects ; 
1. minimilistic 
2. nodeJs Preinstalled with npm

** configuring the storage type change it to gp3 

** bset kernel  ID ?
TL;DR
The best kernel ID to use for your Amazon Linux 2 LTS instance will depend on the specific requirements of your application. However, as a general recommendation, you should use the latest Amazon Linux 2 LTS kernel (pv, hvm).

The pv (paravirtual) kernel is optimized for instances that are launched from PV AMIs and is recommended for instances that are running on older generation instances types.

The **hvm** (hardware virtual machine) kernel is optimized for instances that are launched from **HVM** AMIs and is recommended for instances that are running on newer generation instance types.

It is also worth noting that the **HVM** kernel provides some additional benefits such as support for enhanced networking, better I/O performance and support for new instance types.

### Update packages

```bash
sudo yum update -y && sudo yum upgrade -y
```

### Set timezone

```bash
sudo timedatectl set-timezone Asia/Amman
sudo vi /etc/sysconfig/clock
sudo ln -sf /usr/share/zoneinfo/Asia/Amman /etc/localtime
```

## Install Nginx

```bash
sudo amazon-linux-extras install nginx1 -y
sudo systemctl enable nginx
sudo systemctl start nginx
```

## Install EPEL

```bash
sudo amazon-linux-extras install epel -y
```

## Install Certbot

```bash
sudo yum install certbot -y
sudo certbot certonly --standalone --debug -d *.stg.kutubee.comsudo certbot certonly --standalone --debug -d read.stg.kutubee.com -d www.read.stg.kutubee.com
sudo vi /etc/nginx/conf.d/ssl.conf
```

## Install MongoDB Enterprise Edition

### Configure repository

vi /etc/yum.repos.d/mongodb-org-6.0.repo

```
[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2/mongodb-org/6.0/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc
```

### Install the MongoDB Enterprise packages

sudo yum install -y mongodb-org

### Confirm permistions

```bash
sudo chown -R mongod:mongod /var/lib/mongo
sudo chown -R mongod:mongod /var/log/mongodb
```

### Start MongoDB

```bash
sudo systemctl enable mongod
sudo systemctl start mongod
```

### Install Node

```bash
curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
sudo yum install node
```

### Install Yarn
 
```bash
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo
sudo yum install yarn
```

###### ammar`s edits and notes on setup for yarn
:8ball:  i udesd this ofr yarn
```bash
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn
```


### Install Pm2

```bash
yarn global add pm2
```

### Start Project

```bash
pm2 start yarn --name "read" --interpreter bash -- start
```