Ruby on Rails Installation
We will set up Ruby on Rails in Ubuntu 14.04 operating system.
There are three methods to install Ruby:
We will install using rbenv as it is the most recommended way.
First we will install some dependencies for Ruby:
Installing rbenv is a simple two way process. First rbenv will be installed and then ruby-build.
Follow the following commands:
The above command will install rbenv in your home directory and will set the appropriate environment variables.
Install Ruby using following commands:
To disable Rubygems which generate local documentation for each gem that you install, use following command:
Now you need to install bundler gem to manage application dependencies with following command.
Install Rails using following command,
You can specify the version of Rails which you want to install using -v option in the above command.
Now we will run rehash sub-command. This will install shims for all Ruby executables known to rbenv, which allow you to use executables.
To verify the installed Rails version, use the following command.
Now update apt-get and install Node.js packet.
Now you have successfully installed Ruby on Rails on your system.
Rails default database is Sqlite3. If you want to use some other database due to any reason, then you need to install it.
Here, we will install MySQL server as our database.
After this, install mysql2 gem, with following command.
Now you can easily use MySQL with Rails in your system.