- Ec2 Install Soft Cli
- Aws Cli Install Ec2 Linux
- Ec2 Amazon Nodejs Install Free Download
- Ec2 Amazon Nodejs Install Free Fire
In this post, I will show you how to install Node.js and use PM2 as process manager to make node.js app keep running, I use my AWS EC2 instance of Ubuntu 18.04 for the installation, you can follow this post to launch an EC2 instance or you can use your local computer for the installation.
If you use an AWS EC2 instance to follow this post, you have to connect to instance first and add Custom TCP at port 3000 in inbound rules, this port is used for test to run node.js app.
If you’ve connected to your instance or use your local computer, now time to install node.js. In this post I’ll install node.js using nvm, nvm is a version manager for node.js.
The reasons I install node.js using nvm are that I can easily switch node.js version that currently running to another version, and I can install global packages
npm i -g without doing sudo.
Run the following commands in a terminal to install or update nvm
The command above will download a script and runs it. The script clones the nvm repository to
~/.nvm, and attempts to add the source lines to the correct profile file (
You can find the updated version of nvm here
Run the command below to check that nvm was successfully installed
The terminal will show
Command ‘nvm’ not found as the code has been added to your profile but hasn’t run yet
Just close the currently opened terminal and launch a new terminal and run
nvm –version again
To install node.js using nvm, you can use
nvm install node to install the latest version of node, or use
nvm install 6.14.4 to install a specific version of node, or use
nvm install –lts to install the latest LTS version of node.
NVM will install Node.js include with NPM (Node Package Manager), see the complete guide to use nvm here.
Ec2 Install Soft Cli
Install the latest LTS version of Node.js
Check the installed version of Node.js
Check the installed version of NPM
Node.js has successfully installed in your system, now time to run some node.js application. I’ll run an application that cloning from my github repository, the app is quite simple, it just a ‘Hello World’ app, it use just for test that node.js running correctly.
The main code
app.js of this repository looks like this:
Clone the repository
Change directory to
Install packages using npm
Run Node.js app
Open a browser and navigate to
localhost:3000 if you’re using a local computer, or navigate to
public-dns-or-ip-address:3000 if you’re using an AWS EC2 Instance.
The app will run as long as you open the terminal, but when you close the terminal or press
Ctrl-C, the app will stop running. To make node.js app keep running, we can use a process manager called PM2, find more information about PM2 here.
First, stop the
app.js running before by press
Install PM2 globally using npm
Start Node.js app using PM2
Aws Cli Install Ec2 Linux
Now even if you close the terminal, the app will keep running and can access using a browser on a url like
localhost:3000 if you use a local computer, or
public-dns-or-ip-address:3000 if you use an AWS EC2 instance.
When you reboot your server, the app won’t automatically be running, we can set up startup configuration by generating startup script using pm2.
To generate the startup script, use the following command:
Copy the generated script and hit enter to run it
Save the configuration
Now when you reboot your server, the pm2 will automatically running and start node.js app! :)
If you want to remove the startup configuration, the steps are similar, generate unstartup script with the command below
Copy and run the generated script, then save the configuration with
Useful PM2 Commands
Google chrome standalone installer 32 bit free download. List all running apps:
Details on a specific app:
Monitor logs, custom metrics, apps information:
Find more info about PM2 on npmjs or keymetrics
If you would rather use our pre-built AMI (Amazon Machine Image) that has Ghost already installed and ready to use, check out this article. If you would like to install Ghost manually, continue with this article!
A lot of people know Amazon's hosting as Amazon S3, but we are actually going to be using their EC2 section. Through Amazon EC2, you can host a website with a database backend for free (with limits). Amazon has a Free Tier that you can build a website on that as long as you don't get a ton of traffic or have a lot of server side data use, it will stay free. (you can setup alerts to let you know if its ever going to cost you money) Here is a step by step guide to setting it up:
- Head over to the Amazon Web Services site and sign up using your existing Amazon account or create one.
- Go ahead and enter in your payment information. The way the Amazon free tier works is that if you go over a certain threshold they will charge you, but what we are setting up will be free and remain that way unless you get a lot of hits or server side data use.
- Verify by phone and then on the next page, verify through your email once it arrives.
- Once you click the link in the email you got, go ahead and go to the AWS Management Console.
- Click on EC2 on the left side and wait for that email to come through (from previous setups I have had the email take anywhere from minutes to an hour to arrive).
- Once you get the email and your access to EC2 has been allowed, go ahead and click on the EC2 Link on the AWS Management Console page.
- Once on this page, click on 'Launch Instance'
- That will bring up a little wizard that looks like this:
- Go ahead and hit continue with the Classic Wizard and it will take you to this page:
- The very first option, `'Amazon Linux AMI'`. [32 or 64 bit, up to you] and then hit 'Select'
- Keep everything the same on this page, you want the instance to be Micro so it will stay free. Hit Continue.
- Keep everything as the default for the next two pages. Once you get to the 'Key' page, enter in the name and value that you want as your key. Doesn't really matter what you put. Hit Continue.
- Enter a name for your key pair, again doesn't really matter what you put, and then hit 'Create and Download your Key Pair'. Put this somewhere on your computer where you can find it easily. I put it in my Documents folder. On the next page, since your going to be running a website, you need to allow all ssh, http and https traffic. Just use the drop down to select `ssh`, `http` and `https` and leave the source as `0.0.0.0/0`
- After this, your all ready. Go ahead and hit launch.
- Once it says your instance is running and you hit close, you will be on this page:
- For the next part, click on the row that you see your instance on. This will populate some information in the area below. If you scroll down in this area a little bit you will see a section called 'Public DNS' and it will have a url like this `'ec2-54-24-65-15.us-west-2.compute.amazonaws.com'`. This is the url to your website/linux box.
- Now your going to need to `ssh` into your linux box to get things setup. In order to do that, open up Terminal (Mac default) or whatever SSH client you have and type in the following:
- ssh -i ~/Documents/AmazonKey.pem [email protected]
- Now your in! From here you can now install Ghost.
Ec2 Amazon Nodejs Install Free Download
- Update the operating system:
- Install C compiler
- Install node.js
- Use the following commands to compile and install node.js
- Download and install Ghost
- Configure and start Ghost
- Permissions 0777 for '/Documents/AmazonKey.pem' are too open. It is recommended that your private key files are NOT accessible by others. This private key will be ignored.
Under the 'Default Configuration' section
Create Ghost User
Create a password
Now to start Ghost, you will need to log into your 'ghost' user.
Now that you are logged in with your 'ghost' user you can start Ghost:
Now go to your amazon URL and Ghost is up! Go to yoururl.com/ghost/ to setup your admin user and you have a free Ghost install!