Skip to content

Latest commit

 

History

History
98 lines (85 loc) · 5.69 KB

server-linux.md

File metadata and controls

98 lines (85 loc) · 5.69 KB

server setup

Ubuntu setup / installing

For a remote server, SSH in to login with ssh [user]@[ip address or domain of server] - i.e. ssh root@111.111.111.111 then type the password for that user.

  1. add users
    • adduser lmadera (then follow prompts)
    • give sudo privilges adduser lmadera sudo
    • optional but recommended - add group and add user to group
      • groupadd developers
      • add user to group: usermod -a -G developers lmadera
  2. log out of root then re-login as the user you just created
  3. sudo apt-get update
  4. Install git: sudo apt-get install git-core
  5. Install node.js
  6. Install MongoDB - NOTE: maybe want to use hosted service (i.e. MongoLab or MongoHQ) to save on diskspace - see below
  7. Install PhantomJS
    1. sudo apt-get install phantomjs

Note on file sizes / server space

May want to use MongoLab or MongoHQ or another hosted/cloud MongoDB solution since MongoDB can easily take up 6GB - journal of 3ish GB (apparently it doesn't go past this though?) plus the data itself plus log files plus some other stuff.

MongoDB and node forever took up space; here's one of my servers that maxed out with 20GB - forever though was mostly log files and while forever cleanlogs didn't seem to work, I was able to just delete the file(s) that were large:

  • / 18G
    • /var 11G
      • /lib 6.4G
        • /mongodb 6.1G
          • /journal 3.1G
      • /log 1.2G
        • /mongodb 1.2G
      • /www 2.4G
    • /home 5.1G
      • /luke 2.0G
        • /.forever 1.3G
      • /node 2.3G
        • /.forever 2.3G
    • /usr 2.1G
  • after I cleared the forever and mongodb logs though I got it down to 14GB, so that was good.

Getting (& updating) files from your local (development) code

AWS (Amazon Web Services) setup

Since it can be tricky.. Digital Ocean and Rackspace are much simpler!

  1. create new (EC2) instance
    • Ubuntu (most recent - 12.04, 64bit)
  2. Create or use existing keypair. SSH public key will be generated and private key (as .pem file) will be available for download. We'll use this for SSH access later.
  3. Create or use existing security group
    1. open ports
      • 22 for SSH
      • 80 for HTTP
      • any other needed ports: 3000-3100 for node and socket
  4. Create elastic IP and associate with instance
  5. Use keypair (.pem file) to setup public key authentication to be able to SSH into the instance.
    • For Ubuntu, the "username" is "ubuntu" (other forums say "root" or "ec2-user" but those don't work for Ubuntu at least)
    • WINDOWS
      • navigate to ~/.ssh folder and create a new file (i.e. id_rsa.[project_name]) and paste the private key info downloaded from AWS (the .pem file contents) into it
      • open the "config" file in the ~/.ssh folder (or create it if it doesn't exist) and then add lines: Host [elastic ip address] IdentityFile ~/.ssh/id_rsa.[project_name]
      • Connect (via git bash - cygwin doesn't seem to work) ssh ubuntu@[elastic ip address]
  6. SSH in (i.e. ssh ubuntu@[elastic ip]) then set up Ubuntu as normal (see guide below)
  7. set up additional (non-root) users
  8. SES (email)
    1. need an access key id & secret)
    2. may need to synchronize system clock with amazon clock (UTC) if it doesn't work
    3. need to request "production access" and add verified "from" email addresses. In sandbox mode, need to also verify "to" email addresses.