Recently I tried to upgrade ruby on my server. Installation was supposed to go something like this:
cd /tmp wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz tar -zxf ruby-1.9.2-p180.tar.gz cd ruby-1.9.2-p180 ./configure make make install
However, when I got to the “./configure” command, I would return a c compiler error. So I check my c compiler and it was in fact working… Then I tried another version of ruby with the same result. So I did some searching…
It turns out, if you set your server up a long time ago or are running a VPS that has been set up by other admins, there might be a chance you have your /tmp directory mounted with the ‘noexec’ option. This will option will block any execution of programs within the /tmp directory itself. So you have a couple options:
Download to /tmp then tar to some other folder (I used root for example, probably a bad example)
cd /tmp wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz tar -zxf ruby-1.9.2-p180.tar.gz /root/ruby-temp cd /root/ruby-temp/ruby-1.9.2-p180 ./configure make make install
Download to Another Directory and Install
cd /root mkdir /root/ruby-temp cd ruby-temp wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz tar -zxf ruby-1.9.2-p180.tar.gz cd /root/ruby-temp/ruby-1.9.2-p180 ./configure make make install
Best Option: Change Permissions on the /tmp Directory (remember to change it back when finished!)
mount -o,remount,rw,exec /tmp cd /tmp wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz tar -zxf ruby-1.9.2-p180.tar.gz cd ruby-1.9.2-p180 ./configure make make install mount -o,remount,rw,noexec /tmp
Also Try: /var/tmp
* If you don’t have permission to change the “exec” option on the /tmp drive, you can also try and compile from the /var/tmp directory. The same command can be executed on the /var/tmp directory as well:
mount -o,remount,rw,exec /var/tmp mount -o,remount,rw,noexec /var/tmp
So like this:
mount -o,remount,rw,exec /var/tmp cd /var/tmp wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz tar -zxf ruby-1.9.2-p180.tar.gz cd ruby-1.9.2-p180 ./configure make make install mount -o,remount,rw,noexec /var/tmp
Or just:
cd /tmp wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz tar -zxf ruby-1.9.2-p180.tar.gz cd ruby-1.9.2-p180 ./configure make make install
Hope that helped!
Great Post!! Thank you very much!
If you mention the CentOS Packages that are required to compile this document. Would be most useful for the readers…