Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
1) Make a download dir to store the node source and download it.
mkdir downloads
cd downloads
git clone https://github.com/joyent/node.git
Find the latest version
2) List all of the tags in the repository, and check out the most recent.
git tag
git checkout v0.9.9
3) Make a local bin, configure, compile and install node
mkdir -p ~/usr/local/bin
./configure --prefix=~/usr/local
make
make install
4) Add new bin to path variable
export PATH=$PATH:$HOME/usr/local/bin
echo "export PATH=$PATH:$HOME/usr/local/bin" >> ~/.bashrc
echo "export PATH=$PATH:$HOME/usr/local/bin" >> ~/.bash_profile
5) Check whether Node is working, and whether it matches your repo checkout
node --version
6) Download and install node's NPM package manager. Use curl's -L option to follow redirects.
curl http://npmjs.org/install.sh -L | sh
7) Installed correctly?
npm --version
8) Use "forever" to deploy node apps.
npm install -g forever
9) To start node as a daemon with forever:
forever start path/to/server.js
Forever will keep the node daemon running as long as the server stays up.
We need one more thing to restart the node daemon if the server is restarted.
To do this we will add a cron job to start the node daemon after the server is restarted.
@restart path/to/forever start path/to/server.js
You can get the path to forever by running
which forever
@Shiv2195
Copy link

Shiv2195 commented Apr 14, 2020

Where to add the 9th command?

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