How do I install Ruby on my Ubuntu 12.10 partition

I already have Ruby installed on my Windows 7 partition.

I need it on my Ubuntu partition.

I know there are instructions on the ruby website but I want to be sure.

Thank you guys!

···

--
Posted via http://www.ruby-forum.com/.

Hello Kaye,
-> Following commands to install Ruby with RVM

sudo apt-get update

apt-get install build-essential

sudo apt-get install build-essential libmysqlclient-dev libmysql-ruby
libsqlite3-ruby libsqlite3-dev

apt-get install curl git-core build-essential zlib1g-dev libssl-dev
libreadline5-dev

bash -s stable < <(curl -sk
https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer\)

apt-get install build-essential openssl libreadline6 libreadline6-dev curl
git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0
libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev
ncurses-dev automak

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" #
Load RVM function' >> ~/.bash_profile

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" #
Load RVM function' >> ~/.bashrc

restart console

type below line into console for successful installtion of rvm

rvm | head -1

rvm install 1.9.2

rvm install 1.8.7

rvm use 1.9.2 --default

Thanks,
Bhavesh -RubyonRails

···

On Tue, Dec 25, 2012 at 4:31 PM, Kaye Ng <lists@ruby-forum.com> wrote:

I already have Ruby installed on my Windows 7 partition.

I need it on my Ubuntu partition.

I know there are instructions on the ruby website but I want to be sure.

Thank you guys!

--
Posted via http://www.ruby-forum.com/\.

it works without RVM!

just install "apt-get install ruby-full"
and you already get the nearly newest ruby

···

--
Posted via http://www.ruby-forum.com/.

Thanks guys! So now how do I run a simple Ruby program inside Ubuntu?
I have a file named Dungeon_interactive.rb
In Windows, I just typed that file name in command prompt and it would
run.
It's a simple, text based game, a Ruby exercise for beginners.

How do I run it in Ubuntu?

Thanks!!!

···

--
Posted via http://www.ruby-forum.com/.

duckhai you are wrong again its
#!/usr/bin/env ruby

otherwise you could get evil problems

···

--
Posted via http://www.ruby-forum.com/.

when you install ruby yourself, its mostly put under /usr/local/bin ...

so then the path does not match with the ruby program anymore, and then
the user comes back because they programs does not work anymore (because
of newer ruby features maybe)

···

--
Posted via http://www.ruby-forum.com/.

Unless doing guided install you should read all sub-sections under the
RVM Section.
Install RVM with ruby:

$ \curl -L https://get.rvm.io | bash -s stable --ruby

Additionally with rails:

$ \curl -L https://get.rvm.io | bash -s stable --rails

https://rvm.io/rvm/install/

do not install ruby with the package manager. IDE's and programming
languages move too quickly to use package managers. Hence, tools like
RVM.

HTH,

Thufir

···

On Tue, 25 Dec 2012 20:01:39 +0900, Kaye Ng wrote:

I need it on my Ubuntu partition.

I know there are instructions on the ruby website but I want to be sure.

Hey Derrick,

kaye@kaye-R439-R478:/media/kaye/MARLON/ruby/practice$ chmod 755
Dungeon_interactive.rb

kaye@kaye-R439-R478:/media/kaye/MARLON/ruby/practice$
./Dungeon_interactive.rb

bash: ./Dungeon_interactive.rb: Permission denied

What now?

Also, is there anyway to change the "kaye@kaye-R439-R478" ? It's
probably a Ubuntu question but what the heck....

Thanks!!!

···

--
Posted via http://www.ruby-forum.com/.

without rvm, and newer than ruby-full (1.9.3.194), use brightbox's ppa (1.9.3.327)

sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get install ruby1.9.1

···

On Tue 25 Dec 2012 06:11:38 PM WIT, Hans Mackowiak wrote:

it works without RVM!

just install "apt-get install ruby-full"
and you already get the nearly newest ruby

Kaye Ng wrote in post #1090172:

Thanks guys! So now how do I run a simple Ruby program inside Ubuntu?
I have a file named Dungeon_interactive.rb
In Windows, I just typed that file name in command prompt and it would
run.
It's a simple, text based game, a Ruby exercise for beginners.

How do I run it in Ubuntu?

Thanks!!!

You can simply type:

$ ruby interactive.rb

... from the shell prompt, and that should do it. The dollar sign
indicates your shell prompt and is not meant to be typed. Only type
what follows the dollar sign.

To make your Ruby file executable, first find your Ruby executable:

$ which ruby

---example output---
/usr/bin/ruby

...then add this line as the FIRST line of your Ruby file:

#!/usr/bin/ruby

IMPORTANT: Make sure that path matches the path found using the "which"
command.

Lastly, type:

$ chmod 755 interactive.rb

...to make your file executable. Now all you need to do is type:

$ ./interactive.rb

...and it should be executed.

···

--
Posted via http://www.ruby-forum.com/\.

I recommend "sudo synaptic" and use the GUI interface to choose the versions and extensions you want.

-- Matt
It's not what I know that counts.
It's what I can remember in time to use.

Hans Mackowiak wrote in post #1090216:

duckhai you are wrong again its
#!/usr/bin/env ruby

otherwise you could get evil problems

"wrong again"??? what does that mean?

It is not wrong, just another way to do it. Right? Or am I "wrong
again"? :slight_smile:

···

--
Posted via http://www.ruby-forum.com/\.

That should point out instinctively that the user is responsible for ensuring the right ruby is loaded. Using #!/usr/bin/env ruby does one thing and one thing only. It ensures that the first found ruby in the path is used, by checking en environment for the binary and using its full path. This presupposes that *that* particular ruby *is* the one a user wishes to use, which is generally the case. However, if a user wish a to invoke a specific ruby not in the path, they would then use the full path to *that* ruby and have their script/app use that one.

All of this, in turn is affected by the settings of GEM_HOME and RUBY_HOME and RUBY_OPTS. Under version managers, this can be affected by MY_RUBY_HOME and GEM_PATH settings as well.

So, the point being made is that *either* approach is, in fact, correct. One just needs to understand the impact(s) of using one or the other, which is a self-education pointer.

···

--
D. Deryl Downey

"The bug which you would fright me with I seek" - William Shakespeare - The Winter's Tale, Act III, Scene II - A court of Justice.

On Dec 26, 2012, at 12:42 AM, Hans Mackowiak <lists@ruby-forum.com> wrote:

when you install ruby yourself, its mostly put under /usr/local/bin ...

so then the path does not match with the ruby program anymore, and then
the user comes back because they programs does not work anymore (because
of newer ruby features maybe)

--
Posted via http://www.ruby-forum.com/\.

Hello,

Hey Derrick,

kaye@kaye-R439-R478:/media/kaye/MARLON/ruby/practice$ chmod 755
Dungeon_interactive.rb

kaye@kaye-R439-R478:/media/kaye/MARLON/ruby/practice$
./Dungeon_interactive.rb

bash: ./Dungeon_interactive.rb: Permission denied

What now?

You changed the "permissions" of the file but didn't make the file "executable".

Either you run it as:

ruby file.rb

Or you need to "chmod +x file.rb" to make it 'executable' under UNIX and clones (like linux).

Also, is there anyway to change the "kaye@kaye-R439-R478" ? It's
probably a Ubuntu question but what the heck....

gksudo gedit /etc/hostname

Thanks!!!

--
Posted via http://www.ruby-forum.com/\.

No prob :slight_smile:

Panagiotis (atmosx) Atmatzidis

email: atma@convalesco.org
URL: http://www.convalesco.org
GnuPG ID: 0xE736C6A0
gpg --keyserver x-hkp://pgp.mit.edu --recv-keys 0xE736C6A0

···

On 27 Δεκ 2012, at 18:16 , Kaye Ng <lists@ruby-forum.com> wrote:
--
The wise man said: "Never argue with an idiot. They bring you down to their level and beat you with experience."

Did you have "shebang" line at the beginning ?
Like this:
#!/usr/bin/ruby
OR
#!/usr/bin/env ruby

···

2012/12/28 Kaye Ng <lists@ruby-forum.com>

Hey Derrick,

kaye@kaye-R439-R478:/media/kaye/MARLON/ruby/practice$ chmod 755
Dungeon_interactive.rb

kaye@kaye-R439-R478:/media/kaye/MARLON/ruby/practice$
./Dungeon_interactive.rb

bash: ./Dungeon_interactive.rb: Permission denied

What now?

Also, is there anyway to change the "kaye@kaye-R439-R478" ? It's
probably a Ubuntu question but what the heck....

Thanks!!!

--
Posted via http://www.ruby-forum.com/\.

NEITHER of you are wrong. You won't run into nasty problems. What nasty problems could you get? So long as the ruby install that that *specific* ruby binary comes from (and is referenced in its internal compilation manifest) is fine, the ruby will be fine. EITHER way works.

···

--
D. Deryl Downey

"The bug which you would fright me with I seek" - William Shakespeare - The Winter's Tale, Act III, Scene II - A court of Justice.

On Dec 26, 2012, at 12:25 AM, "Derrick B." <lists@ruby-forum.com> wrote:

Hans Mackowiak wrote in post #1090216:

duckhai you are wrong again its
#!/usr/bin/env ruby

otherwise you could get evil problems

"wrong again"??? what does that mean?

It is not wrong, just another way to do it. Right? Or am I "wrong
again"? :slight_smile:

--
Posted via http://www.ruby-forum.com/\.

Derrick B. wrote in post #1090185:

You can simply type:

$ ruby interactive.rb

... from the shell prompt, and that should do it. The dollar sign
indicates your shell prompt and is not meant to be typed. Only type
what follows the dollar sign.

To make your Ruby file executable, first find your Ruby executable:

$ which ruby

---example output---
/usr/bin/ruby

...then add this line as the FIRST line of your Ruby file:

#!/usr/bin/ruby

IMPORTANT: Make sure that path matches the path found using the "which"
command.

Lastly, type:

$ chmod 755 interactive.rb

...to make your file executable. Now all you need to do is type:

$ ./interactive.rb

...and it should be executed.

Thanks a lot guys. Derrick, /usr/bin/ruby is right. So I edited the file
with Ubuntu's text editor, added #!/usr/bin/ruby (with the pound sign) ,
then saved it.

Went back to shell prompt. Typed:
chmod 755 Dungeon_interactive.rb

Got this:
chmod: cannot access `Dungeon_interactive.rb': No such file or directory

Does my ruby file Dungeon_interactive.rb being in my THUMB DRIVE have
anything to do with it?

Thanks a lot!!!

···

--
Posted via http://www.ruby-forum.com/\.

You changed the "permissions" of the file but didn't make the file "executable".

Uh, no; 755 *is* executable mode for user/group/world. Something else
has gotten messed up in the file in question. Really, this is so basic:

08:48 /tmp $ cat > example.rb
#!/usr/bin/env ruby

puts "hello"
08:48 /tmp $ ./example.rb
bash: ./example.rb: Permission denied
08:48 /tmp $ ruby ./example.rb
hello
08:48 /tmp $ chmod 755 example.rb
08:48 /tmp $ ./example.rb
hello
08:48 /tmp $

Also, is there anyway to change the "kaye@kaye-R439-R478" ? It's
probably a Ubuntu question but what the heck....

gksudo gedit /etc/hostname

Seriously, you would suggest someone change their *hostname*
just to have different prompt text?

When it can be configured to show actual *useful* information like
the directory you're in or which git branch is checked out?

And to the OP - yes, it's an Ubuntu/shell question, and you should
make time to learn about working in a command-line environment;
it will be effort well-spent.

···

On Thu, Dec 27, 2012 at 8:24 AM, Panagiotis Atmatzidis <atma@convalesco.org> wrote:

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

twitter: @hassan

Panagiotis Atmatzidis wrote in post #1090372:

Or you need to "chmod +x file.rb" to make it 'executable' under UNIX and
clones (like linux).

I'm really surprised by that! Why did changing the permissions to 755
not allow it to be executed? It still sets the 'x' flag. I've used
both methods and either worked in FreeBSD, Debian, and Cygwin
environments. What is the difference? I Google'd and check the man
pages, but did not find an answer.

Thanks,

···

--
Posted via http://www.ruby-forum.com/\.

Kaye Ng wrote in post #1090268:

Went back to shell prompt. Typed:
chmod 755 Dungeon_interactive.rb

Got this:
chmod: cannot access `Dungeon_interactive.rb': No such file or directory

Does my ruby file Dungeon_interactive.rb being in my THUMB DRIVE have
anything to do with it?

Thanks a lot!!!

Two possibilities:

1. You are using that command in the same location of the file.
--> It is a possibly a typo. You can use tab completion to help ensure
the right file is found in the current directory.

2. You are using that command in a location other than that of the
target file.
--> Make sure that you are in the same directory of your target file.

Look for your mounted media under /media/ and cd to the appropriate
location before using the command.

From https://help.ubuntu.com/community/Mount/USB:

···

----------------
Mounting
By default, storage devices that are plugged into the system mount
automatically in the /media directory, open a file browser window
for each volume and place an icon on your desktop. If you plug in a usb
hard disk with many partitions, all of the partitions will automatically
mount. This behaviour may not be what you want so you can configure it
as shown below.

If the volumes have labels the icons will be named accordingly,
otherwise they will be named "disk" and as more volumes are added, you
can get "disk-1" and so on.
----------------

Hope this helps!

Derrick

--
Posted via http://www.ruby-forum.com/\.