How to Install ROR
2. Installing Dependencies
Before installing Rbenv, ensure you have the necessary dependencies. To do so, run the following command:
sudo apt install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libffi-dev libgdbm-dev libncurses5-dev libsqlite3-dev libtool pkg-config sqlite3
3. Installing Rbenv
Now, let’s install Rbenv on Ubuntu. Follow these steps:
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
4. Installing Rbenv-build
Next, install Rbenv-build on Ubuntu. Rbenv-build is an rbenv plugin that facilitates the installation of different versions of Ruby. Execute the following commands:
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
5. Installing Ruby
Now, let’s install Ruby on Ubuntu. First, check for the available versions:
rbenv install -l
Choose the desired version and install it:
rbenv install 3.1.2
Set the installed version as the global default:
rbenv global 3.1.2
To view all installed versions:
rbenv versions
6. Installing Ruby on Rails (ROR)
Finally, let’s install Ruby on Rails on Ubuntu. For the latest version, execute:
gem install rails
Or specify a particular version:
gem install rails -v 7.0.4
Finally, Enjoy Ruby on Rails Development on Ubuntu ;)