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!
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!
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
it works without RVM!
just install “apt-get install ruby-full”
and you already get the nearly newest ruby
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!!!
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
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.
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 M. wrote in post #1090216:
duckhai you are wrong again its
#!/usr/bin/env rubyotherwise 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”?
duckhai you are wrong again its
#!/usr/bin/env ruby
otherwise you could get evil problems
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)
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 D.
“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 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.
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
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
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 D.
“The bug which you would fright me with I seek” - William Shakespeare -
The Winter’s Tale, Act III, Scene II - A court of Justice.
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!!!
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!!!
Kaye Ng wrote in post #1090268:
Went back to shell prompt. Typed:
chmod 755 Dungeon_interactive.rbGot this:
chmod: cannot access `Dungeon_interactive.rb’: No such file or directoryDoes my ruby file Dungeon_interactive.rb being in my THUMB DRIVE have
anything to do with it?Thanks a lot!!!
Two possibilities:
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.
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.
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.
Hope this helps!
Derrick
On Thu, Dec 27, 2012 at 8:24 AM, Panagiotis A.
[email protected] wrote:
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.
Hello,
On 27 Δεκ 2012, at 18:16 , Kaye Ng [email protected] wrote:
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
Panagiotis (atmosx) Atmatzidis
email: [email protected]
URL: http://www.convalesco.org
GnuPG ID: 0xE736C6A0
gpg --keyserver x-hkp://pgp.mit.edu --recv-keys 0xE736C6A0
2012/12/28 Kaye Ng [email protected]
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/.
Did you have “shebang” line at the beginning ?
Like this:
#!/usr/bin/ruby
OR
#!/usr/bin/env ruby
Hello,
On 27 Δεκ 2012, at 18:58 , Hassan S. [email protected]
wrote:
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 $
Yeah you’re right. My bad, I’ll die and go to hell for that.
However you don’t even need 755, 600 is enough to make it exec.
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?
I didn’t suggest that. I did not suggest anything for that matter.
I just answered a very straight forward question.
When it can be configured to show actual useful information like
the directory you’re in or which git branch is checked out?
So according to you a user that doesn’t know how to change his hostname
will be able to use oh-my-zsh-like prompts and
git/mercurial/svn/cvs/whatever???
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.–
Hassan S. ------------------------ [email protected]
Hassan Schroeder | about.me
twitter: @hassan
Panagiotis (atmosx) Atmatzidis
email: [email protected]
URL: http://www.convalesco.org
GnuPG ID: 0xE736C6A0
gpg --keyserver x-hkp://pgp.mit.edu --recv-keys 0xE736C6A0
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs