Last active
February 8, 2021 07:46
-
-
Save majedbojan/a94d3adc2516946436b22615e6c5add4 to your computer and use it in GitHub Desktop.
Install Ruby On Rails on ubuntu & macOS
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
# This document will help you setting up a Ruby on Rails development environment on Ubuntu and macOS. | |
# ---------------------------------------- Ubuntu ------------------------------------------------------ # | |
# To make sure we have everything necessary for Webpacker support in Rails, | |
# we're first going to start by adding the Node.js and Yarn repositories to our system before installing them. | |
- sudo apt-get update | |
- sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn | |
# Next we're going to be installing Ruby using one of RVM. | |
- sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev | |
- gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB | |
- curl -sSL https://get.rvm.io | bash -s stable | |
- source ~/.rvm/scripts/rvm | |
- rvm install 3.0.0 | |
- rvm use 3.0.0 --default | |
- ruby -v | |
# Install Bundler | |
- gem install bundler | |
# Installing Rails | |
- gem install rails -v 6.1.1 | |
- rails -v # Rails 6.1.1 | |
# Setting Up A Database | |
- sudo apt-get install libpq-dev postgresql postgresql-contrib | |
- sudo -u postgres createuser <username> # Or you can use default user `postgres` | |
# Install Redis | |
- cd ~ | |
- wget http://download.redis.io/releases/redis-stable.tar.gz | |
- tar xzf redis-stable.tar.gz | |
- cd redis-stable | |
- make | |
- make test | |
- sudo make install | |
- cd utils | |
- sudo ./install_server.sh | |
# Refference: | |
- https://gorails.com/setup/ubuntu/20.10 | |
# ---------------------------------------- osx ------------------------------------------------------ # | |
# Instal Homebrew Please leave this step if Homebrew already installed ot If your using other tools | |
- ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
- gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB | |
- curl -sSL https://get.rvm.io | bash -s stable | |
- source ~/.rvm/scripts/rvm | |
- rvm install 3.0.0 | |
- rvm use 3.0.0 --default | |
- ruby -v | |
# Install Bundler | |
- gem install bundler | |
# Installing Rails | |
- gem install rails -v 6.1.1 | |
- rails -v # Rails 6.1.1 | |
# Setting Up A Database | |
- brew install postgresql | |
# To have launchd start postgresql at login: | |
- brew services start postgresql | |
# Install Redis | |
- brew update | |
- brew install redis | |
# To have launchd start redis now and restart at login: | |
- brew services start redis | |
# to stop it, just run: | |
- brew services stop redis | |
# Or, if you don't want/need a background service you can just run: | |
- redis-server /usr/local/etc/redis.conf | |
# Test if Redis server is running. | |
- redis-cli ping | |
# If it replies “PONG”, then it’s good to go! | |
# Location of Redis configuration file. /usr/local/etc/redis.conf | |
# Uninstall Redis and its files. | |
- brew uninstall redis | |
- rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist | |
# Refferences: | |
- https://gorails.com/setup/osx/11.0-big-sur | |
# ---------------------------------------- Optionals ------------------------------------------------------ # | |
# Install Oh-My-Zsh | |
- sudo apt-get install zsh | |
- sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
- git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh | |
# Create a new zsh configuration file | |
- cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc | |
# Change your default shell | |
- chsh -s /bin/zsh | |
# Sometimes changes needs a computer restart to be reflected | |
# If you want to add shortcuts (Git - Rails - Bundle etc...) | |
# open file ~/.zshrc | |
- sudo nano ~/.zshrc | |
# Update the plugins | |
plugins=( | |
git | |
bundler | |
rails | |
ruby | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment