Install Ruby on Rails on Archlinux

[Overview] Here we will install ruby on rails framework on our Archlinux box. For more detail information, please refer this wiki page. [Install ruby and rubygems] First we need to install ruby and its package system rubygems: $ sudo pacman -S ruby rubygems [Install rails] Next install rails via rubygems: $ sudo gem install rails gem will help us manage all the dependencies and download them automatically. (Notes: if you execute the above command without being root (e.g. without sudo), gem will install rails in the home directory of the current user. Usually the directory is named after “.gem”, you probably need to manually add rails and rake bin directory to your PATH before you could use them, that may not be what you exactly want.) next install sqlite database since it’s rails’s default database: $ sudo pacman -S ruby-sqlite3 rails supports a lot of modern databases, but here we will only use sqlite for simplicity. Finally let’s replace rails build-in http server webrick with mongrel, which is faster and more stable, and also rails community’s recommendation. $ sudo gem install mongrel [Test rails installation] All right, that’s it, pretty simple, isn’t it? Next, let’s make sure it exactly works as we expected. test ruby, rubygems, rails and rake installation, make sure all these tools are successfully installed: $ ruby -v $ gem -v $ rails -v $ rake --version create a rails testapp with preconfiguration for sqlite 3 database: $ rails -d sqlite3 testapp next start the web server, mongrel will be booted since we have mongrel installed before, otherwise webrick will be used: $ cd testapp $ script/server as can be seen from the console output below, the default listening port is 3000:

=> Booting Mongrel => Rails 2.3.2 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server

finally fire our favorite browser to http://server-domain-or-ip:3000/ to see the rails “welcome abroad” page, and we’re done: ruby on rails installation

Buy me a coffee
  • Post author: Samson Wu
  • Post link: 958.html
  • Copyright Notice: All articles in this blog are licensed under BY-NC-SA unless stating additionally.
0%