I try to install ruby and rails to start to learn ruby on rails.
I work on Windows. After many search and tries, I gave up and installed a fresh ubuntu 14 x64 in a VirtualBox.
I installed ruby with apt-get, but its files get spread all over the file system (/bin, /var...). So, I have to use always sudo and search all over the place when installing gems.
I would like, just like in windows, find a ruby tar.gz which I can decompress in a folder of mine, with all files at the same place, where I have the "control" over the files, and I can watch easily what it's hapenning while installing gems, rails, etc...
The problem : I cannot find any tar.gz (or similar archive) of ruby for linux which I simply can uncompress in a folder and work with it (I can manage the $path). The only one I can find is for Windows !
Thanks !
It sounds like what you want is Ruby's source code. Go to https://www.ruby-lang.org/en/downloads/ and look under "Compiling Ruby - Source Code". That's where you'll find the .tar.gz files you want. You'll need to compile and install it before you can actually use it. Installing normally copies files "all over the file system", but you can force it to install to a specific folder by passing the --prefix option to the ./configure script.
$ tar -xf ruby-2.2.1.tar.gz
$ cd ruby-2.2.1
$ ./configure --prefix=/my/ruby/dir
$ make && make install
You may need to install some dev packages in order to get it to compile, but any compilation errors should make it clear what you need.
These instructions are also described here.
Thank you Max for your response.
In case someone else tries to compile ruby on a fresh new ubuntu, this is what I had to do to build and use it with success :
Install missing dependencies :
get the latest "Stable Snapshot" from https://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz and not the "Current stable"
sudo apt-get install libffi-dev
sudo apt-get install zlibc zlib1g zlib1g-dev
sudo apt-get install openssl
sudo apt-get install libssl0.9.8 [[[ first, find the latest version with : apt-cache search libssl | grep SSL ]]]
sudo apt-get install ca-certificates
sudo apt-get install libssl-dev
sudo apt-get install libreadline-dev
Then :
Edit downloaded file tools/rbinstall.rb, goto line 714 and correct the typo :
change "rescue LoadErroe" to "rescue LoadError" (not corrected in date of 20 March 2015).
Run Max's instructions above
Don't move the ruby destination folder declared with "--prefix" (even if you try to correct the shells in ruby/bin)
Finally, for using rails :
sudo apt-get install libsqlite3-dev
sudo apt-get install nodejs ==> inorder to have a js runtime
Related
I installed "eclipse" and want to run "fxruby" on fedora "linux", but it does not work it.
The error says :
cannot load such file -- fox16 (LoadError)
I installed this file with command
gem install fxruby
but fxruby not exist in gem list.
How can i fix it?
The warning about the path you can safely ignore (at least for now). What the error is telling you is that you do not have the FOX development headers and libraries installed, so it couldn't build the fxruby gem. So you must install the fox development package - it may be named something like "fox16" or "fox16-devel", or something else depending on what version of Linux you're running. (If all else fails, you can build it yourself).
After that, compiling fxruby (using gem install fxruby) should work.
If you do want to build FOX yourself, here are (approximately) the steps:
1) Go to the FOX website http://www.fox-toolkit.org/ , and download the latest 1.6 (stable) version (at the moment, fox-1.6.57.tar.gz).
2) I would create a directory ~/src, then cd ~/src, and unpack the downloaded package, e.g., tar xvf ~/Downloads/fox-1.6.57.tar.gz (adjust the path according to wherever you have actually downloaded the package).
2) You should now have a subdirectory fox-1.6.57 (i.e., ~/src/fox-1.6.57/). Cd to it, and read top-level documentation in README and INSTALL.
3) Run the configure script, ./configure or ./configure --prefix=$HOME.
The difference between these invocations is that if you run a plain ./configure, the software will be installed under the default location /usr/local (this will require root access when installed), whereas the invocation ./configure --prefix=$HOME will result in the software being installed under $HOME. The latter will not require root access to install and probably is better if you're just installing the software for your own use.
4) I you are installing under your own home directory, create appropriate subdirectories: cd ~; mkdir bin include lib'. (The installation may take care of this, but it doesn't hurt to pre-create the directories.)
5) Now run make. That should compile and build the FOX libraries under the local directory (~/src/fox-1.6.57/)
6) Run make install. That will install the libraries under either the default location of /usr/local or your home directory ~ (depending on your configure option)
7) A this point, you should have the FOX libraries and headers installed. Now try gem install fxruby. (If you're going for a local install, probably gem install fxruby --user-install.)
solved for fedora
i installed all of them :
ruby-devel.x86_64
fox-devel.x86_64
sudo dnf install redhat-rpm-config
yum groupinstall 'Development Tools'
yum group info 'Development Tools' yum -y install gcc ruby-devel
rubygems compass
gcc compt gcc-c++-x86_64-linux-gnu.x86_64
gcc-c++
[
gcc-c++-8.2.1-4.fc28.x86_64 C++ support for GCC
libstdc++-devel-8.2.1-4.fc28.x86_64 Header files and libraries for C++ development
]
sudo dnf install libpng12-devel.x86_64
sudo dnf install libb2-devel.x86_64
sudo dnf install libX11-devel
sudo dnf install libXcursor-devel.x86_64
sudo dnf install libXext-devel.x86_64 libXrandr-devel.x86_64
gem install fxruby
I would like to install Zephir on my Ubuntu machine.
The goal is to convert some of my existing code into a PHP extension, in order to get the benefits of faster execution.
Any pointers are more than appreciated.
Install zephir in Ubuntu..
You need download Zephir-master from https://github.com/phalcon/zephir
You nedd download json-c from https://github.com/json-c/json-c
1) sudo apt-get install gcc make re2c phpX phpX-json phpx-dev libpcre3-dev
2) Open folder Json-c
2.1) sh autogen.sh
2.2) ./configure
2.3) make && make install
3) Open folder zephir-master
3.1) ./install -c
4) zephir help for to test the correct installation
Please note Zephir is currently in Alpha stage and therefore bugs can be expected.
You need to have certain packages installed:
json-c
re2c
In the command line type:
sudo apt-get install libjson0 libjson0-dev libjson0-dbg
sudo apt-get install re2c
Once you have the required packages installed, you can generate the parser as follows:
./generate
Compile the extension (this is your code):
./zephir
The code produced is placed in ext/, there you can perform the standard compilation:
cd ext/
sudo ./install
I need some help here with RVM and installing the latest version of rails on a debian server. please note im not a linux programmer so you'll have to spell out everything for me.
basically i'm trying to upgrade to the newest version of ruby. I'm trying to install that on a debian server that I connect to via VPN. I'm trying to use RVM so far, but when i run the RVM install 1.9.3 from my debian bash prompt it says there are no binary available for that version, then proceeds to try and grab the source from online which fails (probably due to the firewall). basically when it grabs the source folder from online, it grabs a corrupted hunk of junk. I tried downloading the source package myself and if i click the link on the ruby site it blocks it. If i use wget it appears to download it, but the md5 doesnt match and i cant untar it the thing. it says gzip: stdin: the file is not in gzip format.
So! I neeeedddsss to help. What I was thinkin was getting the binary rubies for 1.9.3.. but I'm unsure how really.. I downloaded the tar.gz file on my windows and used winSCP to move it over, and then I can use untar the thing fine.. and then i have an unzipped folder that is the source from the site.. but im unsure where to go from there.. apt-get install doesnt seem to recognize the tar.gz or the untarred folder.. i tried rvm mount and specifying the path to ruby.exe file (ruby-1.9.3-p327/bin/ruby) but then it says unrecognized command line argument and i should see the usage..
Any advice out there? (preferably without 3rd party programs or stuff other the RVM)
thanks
Because you're a novice, I suggest skipping RVM unless you know you need it.
Debian has great way to install Ruby and make it available for all of the system users:
sudo apt-get install ruby1.9.3
You will use the root password to install it this way.
To verify it worked:
ruby -v
That should print out something like this:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
In case you want to install ruby using rvm: Just execute the commands in the same sequence..
$ sudo apt-get install curl git-core ruby
$ \curl -L https://get.rvm.io | bash -s stable
$ sudo apt-get install libssl-dev
$ source ~/.rvm/scripts/rvm
$ sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
$ rvm install 1.9.3
--give the password for sqlserver or you can just press enter.
$ gem install rails
You have ROR setup now!
Reading back on my questions, I remember now, it WAS the firewall. The firewall where I was working at the time didn't allow me to download ruby source properly. It was downloading, but not actual source, corrupted source. So, I did it at home and it worked fine.
Just thought I'd pop this in here in case anyone ever finds it when problems installing ruby.
i have downloaded and tar ed Ruby 1.9.2 package. how to install it now ?? i am working on ubuntu
Vague question, and you should probably pull up a tutorial to walk you through the process if you're not sure how to do this yet, but…
tar -xzf ruby_1.9.2.tar.gz
cd ruby_1.9.2/
./configure
make && make install
Might I suggest using RVM instead? It'll handle installing ruby, and let you manage and switch between different rubies and gem sets for each application. It's really easy to get started with, too. Check it out:
http://rvm.beginrescueend.com/
if you are on ubuntu, you can use apt to install ruby1.9.2
sudo apt-get install ruby1.9.1-full
check your install
ruby1.9.1 -v
it will return ruby 1.9.2-p0.
edit your .bashrc , back to normal.
alias ruby="ruby1.9.1"
alias irb="irb1.9.1"
alias gem="gem1.9.1"
everything will be allright.
The Ruby on Rails website recommends installing Ruby from source under Linux.
I encountered a number of C library problems building ruby from source on a clean install of Ubuntu 9.
All the instructions I found on the net about installing ruby on Ubuntu have involved using the prepackaged (.deb-based) ruby. Clearly this isn't what the rails people recommend.
When I did a clean source build of ruby I found Rubygems failed to install because the zlib extension didn't work.
Two problems occur:
1) The zlib extension isn't built.
Solution:
i) ensure zlib is uncommented in the Setup file within the extn directory of the ruby source, and
ii) ensure these zlib ubuntu packages are installed:
aptitude install zlib1g
aptitude install zlib1g-dbg
aptitude install zlib1g-dev
aptitude install zlibc
2) After fixing Problem 1 above (and doing a clean rebuild of ruby), zlib still doesn't work because the extension fails to load.
You can see that the module fails to load by running this and getting the output "false":
puts require 'zlib'
I observed this happens to any number of other C extensions in the extn directory, so it appears to be a more general problem with these extensions than just something zlib-specific.
To summarize:
My build of ruby finds the ruby-specific C zlib extension but it fails to load the zlib module.
This behaviour appears to happen to other extensions in /extn.
Is there a way I can find out why a module fails to load? some kind of trace/verbose mode?
Here is what I did to install ruby, gems and rails on Ubuntu 11.04
Install ruby from sources
Install RubyGems from sources
Install zlib:
sudo apt-get install zlib1g-dev
cd your-ruby-sources/ext/zlib
ruby extconf.rb
make
sudo make install
Install readline:
sudo apt-get install libreadline5-dev
cd your-ruby-sources/ext/readline
ruby extconf.rb
make
sudo make install
Install openssl:
sudo apt-get install libssl-dev
cd your-ruby-sources/ext/openssl
ruby extconf.rb
make
sudo make install
I don't see what your problem is. You say that require 'zlib' returns false. But that means that it did work! If there were an error, you would get a LoadError exception.
Did you install libzlib-ruby? Here's my typical Ubuntu initialization before installing Rubygems:
$ apt-get update
$ apt-get dist-upgrade
$ apt-get install build-essential -y
$ apt-get install rsync -y
$ apt-get install ruby ri rdoc irb ri1.8 ruby1.8-dev libzlib-ruby zlib1g libopenssl-ruby -y