Skip to content

Latest commit

 

History

History
188 lines (139 loc) · 7.84 KB

environment_setup.md

File metadata and controls

188 lines (139 loc) · 7.84 KB

Special cases and scenarios:

For special cases and scenarios related to some problems and/or hardware specific issues, please check this guide

Note

Please don't include the dollar sign "$" when copying over the commands in the terminal , these are just used to denote that it's a terminal command in writing.

Main Setup

This is a walk-through to setup the operating system and environment on your machine for the SE course.

The course assumes a UNIX shell (Either Mac or Linux), accordingly if you are a windows user you are requested to setup a UNIX environment following one of the following guides.

General requirements:

  • Linux or Mac
  • Git
  • NodeJS
  • MongoDb
  • Text editor
  • Modern web browser

Linux

For non-mac users, this section will help you setup a Linux distributions alongside your favorite OS (Windows ?) or as a standalone operating system. For mac users, you can skip to the next section

You can use any Linux distribution, we recommend Ubuntu 14.04 LTS Or 16.04 LTS. This guide will help you setup your environment on both based on your choice, if you chose another distribution, you are geeky enough to continue the setup 😉

Setting up a dual boot with windows:

If you have windows setup and you need to have both windows and Ubuntu installed on the same machine, you can follow this section.

You will need to create 3 partitions one for home, one for swap and one for root (/home, swap, /) respectively root (/) only needs around 10-20GB, swap should be the size of your RAMx2 (If you have 16 GB RAM --> 32 GB for swap), for /home, you need a partition bigger than 6GB Preferably 40GB+, that's your main partition that you will use.

Environment Setup

  • [Ubuntu only] update your apt cache and your packages after first installation by running the following commands in the terminal
    $ sudo apt-get update
    $ sudo apt-get upgrade
    

Installing Git

  • [Mac users]

    • You can install git using Xcode command line tools, that would require you to have some download progress, but it is an easy option.
  • [Ubuntu users]:

    • install git from apt by running the following in the terminal
      $ sudo apt install git
  • [advanced] [optional] If you need the most updated version, you can compile git from source following these instructions.

  • Verify your installation by running $ git --version, you should expect some output like git version 1.9.1

Installing NodeJS

  • To install NodeJS, we will use nvm, follow these steps to get it installed:

    • [Mac] you still need Xcode's command line tools installed if you did install git from source and skipped this part.
    • [Ubuntu] Install build-essential and libssl-dev packages through apt:
      $ sudo apt install build-essential libssl-dev
      
    • run the following command to install nvm
      $ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
    
    • Restart your terminal session i.e open a new terminal and run the following commands to install node 8.9.4
    $ nvm install 8.9.4    
    $ nvm alias default 8.9.4    
    $ nvm use 8.9.4 
    • Verify your installation by running the following commands, expect some output similar to the following:
    $ node --version
    >> v8.9.4
    $ npm --version
    >> 5.6.0
    • [NOTE For Mac users]: to enable the nvm shell function automatically and avoid having nvm: command not found while spawning new terminal instances, run the following commands to create .bash_profile file in your home directory and add the initialization script inside.
    $ cd ~
    $ nano .bash_profile
    
    # copy the following snippet and paste it there, then press CTRL+X followed by Y then Enter to save the file
    export NVM_DIR="$HOME/.nvm"

[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm


Close your terminal and open another terminal and everything should work now :))

#### Installing MongoDb

##### Ubuntu 14.04

Run the following commands:
```bash
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

$ echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

$ sudo apt update

$ sudo apt-get install -y mongodb-org

# verify your installation by running
$ sudo service mongod status

# Expect output like
>> mongod start/running, process 1611
Ubuntu 16.04

Run the following commands:

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927

$ echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list

$ sudo apt update

$ sudo apt-get install -y mongodb-org

$ sudo nano /etc/systemd/system/mongodb.service

Copy the following lines and paste it there (Ctrl + Shift + v), then close and save the file by hitting Ctrl + x then y

[Unit]
Description=High-performance, schema-free document-oriented >database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target

Continue executing the following commands

$ sudo systemctl start mongodb

# verify that mongodb is running correctly
$ sudo systemctl status mongodb

# you should expect an output like
>> ● mongodb.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2016-04-25 14:57:20 EDT; 1min 30s ago
 Main PID: 4093 (mongod)
    Tasks: 16 (limit: 512)
   Memory: 47.1M
      CPU: 1.224s
   CGroup: /system.slice/mongodb.service
           └─4093 /usr/bin/mongod --quiet --config /etc/mongod.conf

# run the last command
$ sudo systemctl enable mongodb
Mac
  • Install homebrew

  • Run the following commands:

    $ brew update
    $ brew install mongodb

Install a Text Editor

You can use any text editor of your choice, we recommend using Atom, Sublime Text or VSCode, but you are free to choose whatever editor you like.

Install a modern web browser

Obviously, you will need some browser to run your web application on, we recommend using Google Chrome during this course.