Difference between revisions of "Ruby - Setting Up The Environment"
From Logic Wiki
m |
|||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 50: | Line 50: | ||
* ruby-doc.org | * ruby-doc.org | ||
* tutorials.jumpstartlab.com/projects/ruby_in_100_minutes.html | * tutorials.jumpstartlab.com/projects/ruby_in_100_minutes.html | ||
| + | |||
| + | |||
| + | == Quick Installation == | ||
| + | Install Ruby, Rails requires Ruby 1.9.3 or newer. | ||
| + | sudo apt-get install ruby | ||
| + | Install Rails (this could take a while) | ||
| + | sudo gem install rails | ||
| + | New versions of Rails can be installed the same way. | ||
| + | |||
| + | Install a javascript runtime | ||
| + | sudo apt-get install nodejs | ||
| + | Create your application skeleton and start the server: | ||
| + | rails new path/to/your/new/application | ||
| + | cd path/to/your/new/application | ||
| + | rails server | ||
| + | You’re running Ruby on Rails! Follow the instructions on http://localhost:3000 | ||
| + | |||
| + | |||
| + | == folder write problem == | ||
| + | cd $HOME | ||
| + | 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 python-software-properties libffi-dev | ||
| + | |||
| + | 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.3.1 | ||
| + | rbenv global 2.3.1 | ||
| + | ruby -v | ||
| + | The last step is to install Bundler: | ||
| + | |||
| + | gem install bundler | ||
| + | rbenv rehash | ||
Latest revision as of 13:39, 1 June 2017
Contents
Ubuntu
install ubuntu from Web Site
required packages
$ sudo apt-get update $ sudo apt-get upgrade
$ sudo apt-get install build-essential $ sudo apt-get install vim $ sudo apt-get install libxml2-dev libxslt-dev #Needed for nokogiri gem $ sudo apt-get install libcurl3-dev #Needed for curb gem $ sudo apt-get install git-core $ sudo apt-get install curl
$ sudo apt-get install libpq-dev # for pg gem
MySQL client and server
For a dev machine it's more convinient to leave the root password blank
$ sudo apt-get install mysql-server mysql-client libmysqld-dev
PostgreSQL
apt-get install postgresql-9.4
RVM
Follow the instructions below to install `rvm`
$ curl -L https://get.rvm.io | bash
Open a new terminal window or source your profile
$ rvm install 1.9.3
Make this the default version of ruby
$ rvm use 1.9.3 --default
Test & Other Tools
gem install cucumber gem install bundler sudo apt-get install meld
Sources
- koans.heroku.com
- ruby-doc.org
- tutorials.jumpstartlab.com/projects/ruby_in_100_minutes.html
Quick Installation
Install Ruby, Rails requires Ruby 1.9.3 or newer.
sudo apt-get install ruby
Install Rails (this could take a while)
sudo gem install rails
New versions of Rails can be installed the same way.
Install a javascript runtime
sudo apt-get install nodejs
Create your application skeleton and start the server:
rails new path/to/your/new/application cd path/to/your/new/application rails server
You’re running Ruby on Rails! Follow the instructions on http://localhost:3000
folder write problem
cd $HOME 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 python-software-properties libffi-dev
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.3.1 rbenv global 2.3.1 ruby -v
The last step is to install Bundler:
gem install bundler rbenv rehash