For the first portion of the class, we'll be working exclusively inside of the browser and Node. We'll be installing the following tools.
- Slack
- BASH
- Homebrew
- Git
TIP: Use CTRL+SHIFT+V
to paste into terminal
We will be using slack to communicate throughout the course. You should've received an invite to our channels via e-mail. You can login via the web browser, but downloading / installing the app is highly recommended.
Open the Terminal app on your mac (it's built-in). This is a command line interface (CLI) called a shell. CLIs allow us to interact directly with our computuer via lines of text. A shell, is a CLI for talking to the operating system. There are different types of shells you can use, but BASH and ZSH are currently the most popular for Unix systems (Linux and Mac). We will use BASH in this class. If your Terminal is running BASH, you'll see BASH at the top of the shell window. If it isn't BASH, you'll need to change the default shell to BASH.
Here is how you change the default shell to BASH (if the default is ZSH, for example):
- Run
cat /etc/shells
to see a list of the available shells on your OS. - Run
chsh -s /bin/bash
to change the default shell to Bash. - Quit the Terminal app and re-open it (the whole app, not just the window).
- Verify that the window says BASH at the top now, instead of ZSH
More on available shells for Unix systems (Linux & Mac)
Homebrew is a package manager that we will use to install various command line tools in our class.
Visit the homebrew website for install instructions.
You may be prompted to installed XCode command line tools. When prompted, click and install through that, and you're homebrew installation will continue.
After the installation process, run the command brew doctor
. If any warnings or errors are displayed, we will need to resolve them before proceeding with the rest of the install fest.
Before we do this process, please make sure you have signed up for an account on Github.
If you’re on Fedora (or any closely-related RPM-based distribution, such as RHEL or CentOS), you can use dnf:
$ sudo dnf install git-all
If you’re on a Debian-based distribution, such as Ubuntu, try apt:
$ sudo apt install git-all
For more options, there are instructions for installing on several different Unix distributions on the Git website, at https://git-scm.com/download/linux.
_These instructions are pulled directly from the Installing on Linux section of this page. _
Using your email credentials for GIT, run these commands with your user and email configured.
git config --global user.name "YOUR-USERNAME"
git config --global user.email "YOUR-EMAIL-ADDRESS"
git config --global push.default simple
git config --global credential.helper cache
You might find your self having to re-authenticate GIT every time you work on your command line. Setup SSH Keys to let Github remember your machine in the future.
Currently the most popular editor according to developer polls. This is Microsoft's free version of Visual Studio.
Download and install VS Code from here.
Set VS Code as your default text editor using these instructions.
The following set of instructions has not been verified on Linux - we will update this after installfest gives us this data.
You're all good to go now, but for ease of use, let's make it so we can automatically open up any file or project in VS Code, from our command line. The following instructions are taken from these docs.
To be able to open VS Code from any directory, open the Command Palette (Shift+⌘+P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command (it will be the first one that comes up).
Restart the terminal for the new $PATH value to take effect. You'll be able to type 'code .' in any folder to start editing files in that folder.
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y build-essential nodejs
Verify the installation afterwards by running
node -v
npm -v
The above should display without any errors.
To finish up your installation, run this command to allow for global installations of npm tools.
sudo chown -R $USER /usr/local/lib
We will be using a relational database called Postgres for Node and Rails portion our class. Download by running:
sudo apt-get install postgresql-client postgresql postgresql-contrib
You'll also need to configure a user for your Postgres database.
sudo -u postgres psql postgres
\password postgres
Choose an easy to remember password then type \quit
to exit psql. MAKE SURE YOU REMEMBER THIS PASSWORD YOU WILL NEED IT LATER.
To make it easier to start postgres we're going to create a couple aliases. Edit your zshrc file by typing subl ~/.zshrc
add these lines to the bottom of the file:
alias psql="sudo -u postgres psql"
alias pgserver="sudo -u postgres service postgresql start"
pgserver will be used to start the postgres server
psql will be used to access the psql termainal
While we're here, add these two functions and environment variables to make it easier to access, change and refresh our ZSH configuration file in the future. Copy and paste these to the end of the file.
export VISUAL=subl
export EDITOR="$VISUAL"
function zedit() {
subl ~/.zshrc
}
function zrefresh() {
echo "Refreshing your ZSH configuration."
source ~/.zshrc
}
Save the file, close Sublime, and restart your terminal.
sudo apt-get install pgadmin3
Quit terminal and reopen it before testing.
Start Server
pgserver
enter psql terminal
psql
Should enter psql terminal and have no error.
exit psql
\q
Follow the official installation instructions on MongoDB.com:
https://docs.mongodb.com/v3.0/tutorial/install-mongodb-on-ubuntu/#install-mongodb
#Start the MongoDB server
mongod
Press control-c
to stop the server.
We'll be using RoboMongo. Install here:
We'll be running Sublime 3, not Sublime 2 as our text editor of choice.
Install via the package manager
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer
If the above does not work, try installing via Sublime's website: http://www.sublimetext.com/3 Download the .deb
file and run it to install.
Oh my ZSH?!!! We will be tricking out commandline with another shell. A shell is an interface into our computer, and we will be using a lot to run commands.
We'll be using a shell and configuration package called Oh-My-Zsh
To install, we will run
sudo apt-get update
sudo apt-get install git-core zsh
chsh -s /bin/zsh
wget --no-check-certificate http://install.ohmyz.sh -O - | sh
sudo shutdown -r 0
(the last command will restart your computer)
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
rbenv lets us change ruby verions on the fly, useful for working with diffrent rails apps.
Note: New versions of Ruby and Rails are coming out all the time - check with your instructor that the version listed here is still correct. If you need to install multiple versions of Ruby, it may be easier to use the RVM - Ruby Version Manager which is described in detail under the osx section of this install instructions.
cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
exec $SHELL
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.zshrc
exec $SHELL
sudo chown -R $USER ~/.rbenv
rbenv install 2.4.0
(last step above will take a LONG time)
Set ruby version and check that it worked
rbenv global 2.4.0
ruby -v
Before moving on close and reopen terminal.
gem update
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
gem install bundler
gem install rails
(the last step will take a while)
Run each of these commands and then call someone over to validate your installation is correct.
rails -v
ruby -v
which ruby
which rails
which bundle
which gem
node -v
npm -v
git --version
psql --version
subl -v