What Will I Learn?
- You will learn about the installation of ruby
- You will learn how to use rvm
- You will learn how to create rvm gemset
- You will learn how to install rails with any version
Requirements
- Ubuntu
- internet connection
Difficulty
- Intermediate
Tutorial Contents
The first step is to install some dependencies for Ruby and Rails.
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. Please run the following commands from 1-5 one by one
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
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 nodejs yarn
Next step is to install Ruby using rvm for that please run the folowings command one by one. we are going to install ruby version 2.4.0 but you can install any stable version version for that you have to repalce the vesion number only.
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 2.4.0
rvm use 2.4.0 --default
ruby -v
The last step is to install Bundler:
gem install bundler
we're going to need to install a Javascript runtime like NodeJS. This lets you use Coffeescript and the Asset Pipeline in Rails which combines and minifies your javascript to provide a faster production environment. To install NodeJS, we're going to add it using the official repository:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
Since we are using RVM so we can install many versions of rails with ruby by using the gemsets.
First of all we have to create a gemset for example:
rvm gemset create 4.2.4
- 4.2.4 is the gemset name. We are using this name because it is easy to remember which rails version is install by checking the rails version.
We can check gemset lists by
rvm gemset list
Now, select the ruby and gemset so that we can install rails in this gemset.
rvm use [email protected]
Next is to install the compatible vesion of rails with ruby. For now we are going to install rails 4.2.4.
gem install rails -v 4.2.4
We can check the rails version by
rails -v
Posted on Utopian.io - Rewarding Open Source Contributors
Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://gorails.com/setup/ubuntu/17.10
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Your contribution cannot be approved because it does not follow the Utopian Rules.
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit