Skip to content

Instantly share code, notes, and snippets.

@amirrajabi
Last active December 28, 2015 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amirrajabi/8dadf19933daa3fcdb52 to your computer and use it in GitHub Desktop.
Save amirrajabi/8dadf19933daa3fcdb52 to your computer and use it in GitHub Desktop.
---------- Start with EC2 server -----------
- create account on Amazon
- create EC2 enstance
- create group securety in EC2 with SSH:22 (console conection) and HTTP:8080 (web conection)
- connect to server with SSH (test working)
- run code for redirect all http port to 8080 (find on full-stack bookmark)
- create directory "site" on root
- set SFTP filezila for uploading files
- connect to server with filezila (test working)
- installing git
- installing NVM (node, npm)
- installing Mongodb
- installing node npm express
- activated node be active with NVM
- add server.js for testing http conection to server
- add real domain to server
------------
$ cd ../..
$ ssh -i ....pem ec2-user@00.000.000.000
$ sudo yum update
$ sudo yum -y update
$ sudo yum install gcc-c++ make
$ sudo yum install openssl-devel
$ sudo yum install git
$ ~
$ /
$ ll
$ ls
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
$ nvm install stable
$ nvm alias default node
$ npm list -g --depth=0
$ npm uninstall -g ejs
$ killall node
$ sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to 8080
$ sudo mkdir -p /data/db
$ sudo chmod 777 /data/db --- full access
$ sudo chmod 777 /data --- full access
$ sudo chown -R `id -u` /data --- full access
$ sudo chown -R `id -u` /data/db --- full access
$ rm -r data --- remove dir
$ rm data.js --- remove file
$ sudo yum install -y mongodb-org-server mongodb-org-shell mongodb-org-tools
$ baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
$ curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.8.tgz
$ tar -zxvf mongodb-linux-x86_64-3.0.8.tgz
$ sudo mkdir -p /mongodb
$ cp -R -n mongodb-linux-x86_64-3.0.8/ /mongodb
$ sudo service mongod status
$ sudo vim /etc/mongod.conf
$ ps -eaf|grep mongod ---show all mongo run
$ ps aux | grep node
$ pgrep mongod --- run mongo port
$ kill "port number"
$ mongo db.createUser({ user: "admin", pwd: "pass", roles: [{ role: "clusterAdmin", db: "admin" }, { role: "readWrite", db: "config" }]})
$ mongod
$ sudo service mongod stop/start/restart
$ clear
------------
install Mongodb
- first update mac tools and comments from ruby install gist
- https://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/
$ mongod ---------------------------------------------------- (start)
$ mongo --eval "db.getSiblingDB('admin').shutdownServer()" -- (stop)
- conectin on "http://localhost:27017/" and "Robomongo app"
------ node and npm
$ npm init
$ bower init
$ touch .gitignore
$ cat package.json
$ npm update //update all npm packages
$ npm install -g react-tools
$ npm install -g jsx
------ .gitignore
node_modules
bower_components
create folder
-app
-server
/app/index.html or index.ejs
/server/main.js
$ npm install -g nodemon
$ npm install -g node-inspector
$ node main.js --debug
$ npm install twilio
$ npm install --save express
$ npm install --save body-parser
$ npm install -g gulp
$ gulp live-server
$ npm install --save browser-sync
$ npm install --save react
$ bower install --save react
$ npm install -g react-tools
$ jsx
$ npm install -g browserify
$ npm install --save reactify browserify
$ npm install --save vinyl-source-stream
$ npm install --save body-parser
$ npm install --save mongoose
$ npm list -g --depth=0
$ npm uninstall -g ...
$ killall node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment