Hi Pratibha, installing ROR on ubuntu is quite simple, just follow these installation steps and you will install ROR on your machine without any trouble:
1. Write the following commands one by one to install Ruby 2.6.1 :
>>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 software-properties-common libffi-dev nodejs yarn
>>git clone https://github.com/rbenv/rbenv.git ~/.rbenv
>>echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
>>echo 'eval "$(rbenv init -)"' >> ~/.bashrc
>>exec $SHELL
>>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
>>rbenv install 2.6.1
>>rbenv global 2.6.1
>>ruby -v
>>gem install bundler
2. To install Rails 5.2.2, write the following commands one by one on Ubuntu terminal:
>>curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
>>sudo apt-get install -y nodejs
>>gem install rails -v 5.2.2
>>rbenv rehash
>>rails -v
And that's it, the last command in above step will show you the installed version of rails on your system.