HRM OS - Setup Guide for AWS - EC2 Ubuntu Instance - Docker
This guide will walk you through the process of setting up the HRM OS software on a AWS EC2 Ubuntu Instance. It includes creating a new Instance and installing the required software on the instance.
Prerequisites
- An AWS account. If you don't have one, sign up at https://aws.amazon.com/ (opens in a new tab) and follow the instructions to create a new account.
- A domain name (optional, but recommended for a production setup).
Step 1: Create a new EC2 Ubuntu instance
-
Log in to your AWS account as a root user.
-
Search for EC2 and navigate to the EC2 dashboard and click on Launch Instance.
-
Provide the required folowing details to create a new instance:
- Provide a name for your instance (e.g., hrm os).
- Select Ubuntu under Quick Start.
- Select Ubuntu Server 22.04 LTS (HVM), SSD Volume Type from the list of available Amazon Machine Image (AMI).
- Select the instance type (e.g., t2.small (1 vCPU, 2GiB Memory)). Minimum
t2.small
is recommended. - Select the number of instances (e.g., 1).
- Select the key pair from dropdown, if not created earlier then click on
create a new key pair
and provide the following details:- Provide a name for the key pair (e.g., hrm-os)
- Select the key pair type (e.g., RSA)
- Select Private key file format (e.g., .pem)
- Click on Create key pair.
- A file will be downloaded to your local computer. Save the file in a safe place. (e.g.,
hrm-os.pem
)
-
Under Network Settings select
Create security group
orSelect existing security group
- If you select
Create security group
then tick the checkboxAllow SSH traffic from
and selectanywhere
orMy IP
from the dropdown.If you select
anywhere
then you can access your instance from anywhere. If you selectMy IP
then you can access your instance from your current IP address only. - If you select
Select existing security group
then select the security group from the dropdown.
- If you select
-
Configure the storage settings according to your needs. (e.g., 1 X 15 GiB - General Purpose SSD (gp2))
-
Click on yellow Launch instance button and wait for the instance to be created.
-
Open EC2 instance's port for Network traffic. To do this follow the steps below (by default, the port is open for SSH traffic only for security reasons):
- Go to the Network & Security > Security Groups settings in the left hand navigation
- Click on the Security group ID that you created in Step 1
- Click on the Inbound rules tab and click on Edit inbound rules
- Click on Add rule and select All traffic from the
type
dropdown, and select Anywhere IPv4 from thesource
dropdown. Then click on Save rules.
And that's it! You have successfully created a new EC2 Ubuntu instance on AWS (this is your cloud Ubuntu server).
Step 2: Access the instance via SSH
- Go to EC2 > Instances and click on the instance that you have created in Step 1.
- Click on Connect button and then select SSH client and follow the instruction there.
For example: to connect to your EC2 instance via SSH, locate where your key file
was downloaded from terminal and then run the following command in your local computer's terminal:
chmod 400 <key_name>
ssh -i "<key_name>" ubuntu@<Public_IPv4_DNS>
replace <key_name>
with the name of the key pair that you have created in Step 1.3 and <Public_IPv4_DNS>
with the public IPv4 DNS of your instance. (e.g., ssh -i "hrm-os.pem" ubuntu@ec2-13-127-77-90.ap-south-1.compute.amazonaws.com
)
- When prompted, type "yes" to confirm the connection
- You are now connected to the instance via SSH and can run commands on the instance (your cloud Ubuntu server) from your local computer's terminal.
Step 3: Get the HRM OS source code in your instance
-
Upload the file that you have downloaded from Codecanyon to a repository of your github account
-
Access your instance (follow step 2) and Clone your repository (that you have created in above step) to your instance:
git clone https://github.com/your-repo/hrm-os.git
Replace https://github.com/your-repo/hrm-os.git
with your HRM repository's URL.
-
Open a new separate terminal/command promp/powershell on your local computer.
-
Upload the zip file that you have downloaded from Codecanyon to your instance (Ubuntu cloud server)
scp /<source-file-path> ubuntu@<Public_IPv4_DNS>:
Replace <source-file-path>
with the path to the file on your local computer of the file you want to upload. It must be a zip file.
Replace <Public_IPv4_DNS>
with the public IPv4 DNS of your instance.
(e.g., to upload into the root folder of your instance scp /home/username/hrm-os.zip ubuntu@1ec2-13-127-77-90.ap-south-1.compute.amazonaws.com:
)
It will upload the file to the root folder of your instance.
- Access your instance (follow step 2) and Install the unzip package on your instance
sudo apt-get install unzip
- Locate the file using
cd
command on your instance and unzip it
unzip <Codecanyon-file-name>.zip
Replace <Codecanyon-file-name>
with the name of the file you uploaded to your instance (e.g., unzip hrm-os.zip
)
Step 4: Now follow the below video to complete the setup
Optional: Point your domain to the instance
- Log in to your domain registrar's control panel.
- Set an A record for your domain, pointing it to your instance's IP address.
Now, your HRM software should be accessible at http://<Auto-assigned_IP_address>
:3000 (or your domain if you configured it). If you encounter any issues, make sure to check the logs and ensure that all services are running correctly.
Extras: for power users
Update the Ubuntu system
If required to update the Ubuntu system, run the following command:
sudo apt update && sudo apt upgrade
If prompted to continue, press Y
or select ok
and then press enter
.
Note: It's best practic to update the system before installing any software.
Fix server related issues
If face any server related issue mostly you can fix it by using the mystreious magic method:
- Stop the server
- Then start the server again
Hope it may help you. Don't forget to follow the setp 4 video after starting the server again.
You have successfully deployed your app to the WORLD
🎉 Congratulations! 🎉