-
-
Save tareq3/fbcae98fce6f009b9b00d2f052cb2280 to your computer and use it in GitHub Desktop.
What to install for preparing a server for rest api hosting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### For Accessing any server in gitbash | |
``` | |
ssh userName@hostAddress | |
``` | |
### Then enter the password | |
### Install update | |
``` | |
sudo apt-get update | |
``` | |
### Install node js for Node and Node Package Manager | |
``` | |
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - | |
``` | |
``` | |
sudo apt-get install -y nodejs | |
``` | |
### Cheack Node Version | |
``` | |
node --version | |
``` | |
``` | |
npm --version | |
``` | |
### Install Mysql server to your server | |
``` | |
sudo apt-get update | |
sudo apt-get install mysql-server | |
``` | |
For more: https://support.rackspace.com/how-to/installing-mysql-server-on-ubuntu/ | |
## Getting SSH key From server And add this to Github so that server can access github private file as well | |
``` | |
ssh-keygen -t rsa -C "mti.tareq3@gmail.com" | |
``` | |
## Now copy the id_rsa.pub key to your github | |
Showing hidden folder | |
``` | |
ls -a | |
``` | |
Getting into ssh folder | |
``` | |
cd .ssh | |
``` | |
reading id_rsa.pub | |
``` | |
cat id_rsa.pub | |
``` | |
### now clone any repo to your server home dir | |
``` | |
git clone git@github.com:heroku/node-js-sample.git | |
``` | |
## For starting any nodejs server | |
inside into the repository cloned dir | |
``` | |
npm install | |
``` | |
for starting node app | |
``` | |
npm start | |
``` | |
### When app server will run it will show the port using for that server use this for get into server | |
``` | |
192.168.0.5:5000 | |
``` | |
### For providing support while server should be running and need any upgrade we will use pm2 in node | |
Installing as global pack | |
``` | |
sudo npm install pm2 -g | |
``` | |
starting server using pm2 | |
``` | |
pm2 start index.js/app.js/server.js | |
``` | |
## For more: | |
https://www.youtube.com/watch?v=RE2PLyFqCzE | |
https://scotch.io/tutorials/deploying-a-node-app-to-digital-ocean | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment