Ruby on Rails(RoR) is a web framework written in the Ruby programming language, designed to develop successful projects while writing less code.
The command-line tool RVM (Ruby Version Manager) which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.
-
Ubuntu 19.04 x64 server instance
-
we need to install
software-properties-common:sudo apt-get install software-properties-common
Run the following command to add the RVM key to your system, this key allows us to verify the legitimacy of the RVM release we will be downloading, which is signed with the matching private key:
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDBLet’s now move into a writable location such as the /tmp directory:
cd /tmpNow run the following command to install the latest stable version of RVM:
curl -sSL https://get.rvm.io | bash -s stableWhen the installation is complete, source the RVM scripts from the directory they were installed, which will typically be in your /usr/local/rvm/ directory:
source /usr/local/rvm/scripts/rvmNow the source for RVM is set. You can check the version number of RVM installed on your system:
rvm --versionInstall the latest version of Ruby and Ruby on Rails on your system, First, check to see which version of Ruby are available:
rvm list knownThrough this list, install the specific version of Ruby that you need through RVM
Note: In this article, I have installed Ruby 2.6.3 version, you can install a specific Ruby version you need through RVM.
rvm install 2.6.3After the installation, list available Ruby version we have installed:
rvm listRun the following RVM command will help you in setting the latest installed version of Ruby as the system default:
rvm use --default 2.6.3Next, we can install the latest version of Bundler :
gem install bundlerAfter that, list available versions of Rails:
gem search '^rails$' --allNote: this RoR version will only refer to the version number.
Now, install Ruby on Rails need version:
gem install rails -v 5.2.3We need to install some dependencies of RoR, It is a prerequisite for compiling Ruby on Rails asset pipeline:
cd /tmp
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -o install_nodejs.shVerify the Node script by outputting it to a file, then read it with less:
less install_nodejs.shIf you're satisfied with the Node script, install the Node source Node.js v12.x repo:
cat /tmp/install_nodejs.sh | sudo -E bash -Next, update apt, and install Node:
sudo apt update
sudo apt install -y nodejsInstall the Yarn package manager:
curl -sL 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.listsudo apt-get update && sudo apt-get install yarn