Installing rails. Gem install rails stucks (for real!), and curl stucks - ruby-on-rails

:)
I am trying to install ruby on rails on VirtualBox. I started with Fedora... without success, now I am giving Ubuntu a try, and still some problems occur. I wrote:
$ gem install rails
$ gem -V install rails
$ gem update --system
I waited... but nothing happend. Then i tried diffrent approach and I wanted to install RVM... but then
$ curl -L get.rvm.io | bash -s stable --ruby
stucked... It downloaded 1 file... and that was it.
Any hint?
oh... to install ruby on rails i followed this way:
$ sudo apt-get install ruby1.9.1
$ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
$ tar zxvf rubygems-1.8.24.tgz
$ cd rubygems-1.8.24
$ sudo ruby setup.rb
$ sudo apt-get install ruby1.9.1-dev
$ gem install rails
And I can't go any further than this...

Try using rbenv instead of rvm, bit simpler for a start.
rbenv + ruby-build is a must ;)
rbenv install ruby
gem install bundler
gem install rails
Maybe your OS has already a ruby installed and its interfering...
try :
which ruby
to find out.
Can't tell you more without nknowing more. :s
Good luck !

Related

tiny_tds gem installation issue on Rails 5

I have tried to install gem tiny_tds on Rails 5, but not able to install. I have googled it and tried all the solution. But there is no solution. Can you please suggest me to install it.
Below are the solutions I have tried,
Rails 4: Error when installing tiny_tds gem?
sudo apt-get install freetds-dev
tiny_tds gem can be easily installed from terminal using following command:
$ gem install tiny_tds
If any other issue you are facing with tiny_tds gem you can refer the documentation of gem:
https://github.com/rails-sqlserver/tiny_tds
Make sure you have freetds library installed in case of MacOS
brew install freetds
Debian 10
Rails: 5.2
Ruby 2.5
How to Install FreeTDS:
source: https://www.microsoft.com/en-us/sql-server/developer-get-started/ruby/ubuntu/
Use the Terminal with Root or Sudo permissions to run the following commands:
wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.00.27.tar.gz
tar -xzf freetds-1.00.27.tar.gz
cd freetds-1.00.27
./configure --prefix=/usr/local --with-tdsver=7.3
make
sudo make install
cd ..
gem install tiny_tds
This should get you started.

Ruby on rails installing error on Ubuntu

I just tried to install rails by this command:
sudo gem install rails
but error occurs like this:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in 'require'
from extconf.rb:1:in '<main>'
Gem files will reamin installed in /var/lib/gems/1.9.1/gems/json-1.8.3 for inspection.
Results logged to /var/lib/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
I tried several times reinstalling ruby and also triedsudo apt-get update
What should I do?
Just follow the below steps and you will be able to install rails easily on ubuntu :
First install rvm (I guess you have already installed) using the command :
$ \curl -L https://get.rvm.io | bash -s stable --ruby
Then install Ruby :
$ rvm install ruby
$ rvm --default use ruby-2.2.3
Then install Node.js for rails :
$ sudo apt-get install nodejs
And lastly , install rails by :
$ > gem install rails
You can check the version of rails installed using :
$ > rails -v
I hope this helps.
Update:
As per #Amit sir's comment , We can use the below command which installs both , ruby and rails combined as :
\curl -sSL https://get.rvm.io | bash -s stable --rails
Rails 4.0 needs RubyGem version 2.0.3, update your rubygem
gem update --system 2.0.3

Ubuntu/Aptana/WEBrick Ruby/Rails version with and without sudo dont match

I am using Ubuntu 14, Aptana Studio 3 and WEBrick 1.3.1 for Ruby on Rails (installed by https://gorails.com/setup/ubuntu/14.10)
I noticed that there is a difference between sudo and non-sudo ruby/rails.
$ ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [i686-linux]
$ rails -v
sRails 4.2.0
$ sudo ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [i686-linux]
$ sudo rails -v
Rails 3.2.16
The problem is that Aptana is running WEBrick with the old sudo version of Rails which causes a number of issues. Can you please suggest how to either update the sudo Ruby (which might not be a good idea since it seems to be used somewhere in the system) or how to make WEBrick use correct updated version of Ruby and Rails or how to make Aptana start server without sudo?
How to update ruby see here How to install Ruby 2 on Ubuntu without RVM
I'm recommending to install ruby v >= 2.2.0
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/2.2/ruby-2.2.0.tar.gz
tar -xvzf ruby-2.2.0.tar.gz
cd ruby-2.2.0/
sudo ./configure --prefix=/usr/local
sudo make
sudo make install
You probably are loosing the environment variables when calling sudo
You can keep your environment variables with sudo by using the -E switch:
From the manual:
-E, --preserve-env
Indicates to the security policy that the user wishes to preserve their existing environment variables. The security policy may
return an error if the user does not have permission to preserve the environment.
So try:
sudo -E ruby -v

Ubuntu Installation Error

I had used below mentioned commands to install rails in ubuntu 12.10
sudo apt-get update
sudo apt-get install curl
\curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
rvm install 1.9.3
rvm use 1.9.3 --default
rvm rubygems current
gem install rails
Every steps are doing good, but it works for terminal which we are installing rails. If we exit from the terminal and work on a new terminal then the following error occurs.
The program 'rails' can be found in the following packages: * rails * ruby-railties-3.2 Try: sudo apt-get install
I came through a solution that whenever I open an terminal I would run these cmd
source ~/.rvm/scripts/rvm rvm --default use 1.9.3-p374
Can any one explain why these things happen??
Did you include the init script into your bash_profile/bashrc?
RVM installed by Ruby not working?
I've installed Rails 3.2.9 on my machine with RVM. You can follow this steps:
Install RVM : \curl -L https://get.rvm.io | bash -s stable
Reload shell configuration & test: source ~/.rvm/scripts/rvm
Install Ruby via RVM: rvm install 1.9.2 or rvm install 1.9.3
Choose version Ruby after install: rvm use 1.9.2 or rvm use 1.9.3
Ruby 1.9.2 and 1.9.3 support gem 1.8.25, so you'll install rails: gem install rails -v 3.2.9.
Done.
Note
Reload shell: source ~/.rvm/scripts/rvm and choose version Ruby rvm use 1.9.2 before work with projects.

Install RoR on debian Squeeze

is there any way to install Ruby 1.9.2 or 1.8.7 + Rails 3 on my debian squeeze?
You probably don't want to use RVM on a production machine. Its $PATH magic will break in non-obvious places (e.g. cron jobs), and you'll be up a creek.
You could simply build from sources and use checkinstall to create a .deb for yourself. Here's a tutorial for Ubuntu that should translate pretty well into debian.
First install rubygems, I think it's the only Debian package. Then (as Ruby gems):
rvm (install with it ruby 1.9.2, or Ruby version you want)
bundler
rails
And then you can manage application gems with Bundler.
Have you looked at railsready-debian-lenny (it is claimed to work on Squeeze too)? Don't forget to install dependencies pointed in readme.md
The steps below outlines installing Ruby On Rails as a normal user.
Check first if the user has sudo rights. To do this try executing a simple command
$sudo ls -a
[sudo] password for unlimit:
unlimit is not in the sudoers file. This incident will be reported.
If you see a message like above, you will need to add the user to the sudoer file, this can be done by
$echo 'unlimit ALL=(ALL) ALL' >> /etc/sudoers
Check if you have ruby installed. Execute the command below
$ruby -v
-[bash]: ruby:command not found
If you see something like this, this means ruby is not installed. Install it
$sudo apt-get install ruby
Install additional libraries
$sudo apt-get install build-essential
$sudo apt-get install curl
$sudo apt-get install libssl-dev
Install rvm
$curl -L get.rvm.io | bash -s stable
Set the rvm path
$source $HOME/.rvm/scripts/rvm
You should add this to the .bashrc file.
Fetch the latest rvm and reload it
$rvm get head && rvm reload
Install ruby 1.9.3
$rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm.usr
I needed to install the readline lib
$sudo apt-get install libreadline-dev
Get the rails gem
$gem install rails -v 3.2.3
Check if you have rails
$rails -v
Rails 3.2.3
Get the readline package
$rvm pkg install readline
Get sqlite3
$sudo apt-get install sqlite3 libsqlite3-dev
You are all set to create your first rails app
$rails new app HelloWorld
You can find more info http://unlimit.in/installing-ruby-on-rails-on-debian.html
The best way to install Ruby and any Gems you like is with RVM. It will compile the latest version of Ruby for you and give you tools to manage gemsets.
Relying on the distribution's packages is usually a bad idea, because they are typically out-of-date.

Resources