I consistently run into issues with gems not having the required libraries on a server. RMagick is one, and usually mysql2, which usually require installing the dev versions such as:
imagemagick libmagickcore-dev libmagickwand-dev
My question is, is there a better way to manage this? I'm using bundler and capistrano, so it would be great if somebody could point me in the right direction.
The big problem I can see is that distros will change from server to server, but if I had a task I could run which could check the existence of these required packages based on the Gemfile, that would be tremendously helpful. Is this possible?
You can extend section 'cap deploy:setup'. =And in this section run 'apt-get instal imagemagick libmagickcore-dev libmagickwand-dev'. But you user must have sudo access.
Also you can read this manual
Related
I dont' know why I cannot install ruby through yum in my RHEL6.2
How can I fix it. I don't wanna install through source. Any idea?
[root#kithost ~]# yum install ruby
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Setting up Install Process
No package ruby available.
Error: Nothing to do
RVM is a solution but it is not that I want.
What I want to know is that once we can't find any package from yum, what kind of thing should we fix into order to let yum find it?
Probably the best way to install and manage Ruby is using RVM. Moreover, you can use more than one ruby versions using RVM. I can bet, it's really something you may love it. Yum is sometime a curse :-).
Follow their installation guide as there are different methods of (with pros and cons) installations and choose your preferred one. I'm pretty sure, you will love it too.
However, if you are still thinking to use it, you may follow this Guide. Be aware, I don't not know whether it works or not as I did not try it. Why should I try something else, when I'm already using BEST one :)!
Redhat does not have a free repo list unless you pay, or make subscription to them.
The reason for that I cannot install ruby is that there is no availalbe repo list
check
/etc/repo.list
you can copy the one from CentOS to Redhat.
Then your yum could search a available repo server and make your ruby downloadable.
RVM is a good solution but I found that rbenv was much better including when you have to use Ruby on a server.
You can find how to install rbenv in the README.
How to easily package software that uses multiple gems into a debian installable packages?
You have a couple options
1) package your application as a gem using jeweler
By making it a gem, you can specify dependencies in the gemspec, so when it is installed
rubygems will automatically attempt to install the needed gems.
This is probably the easiest thing
2) run an apt-server and package your app for it. There are some instructions on running an
apt server on the ubuntu help pages.
Packaging your app is somewhat complicated looking, but boils down to:
writing install/uninstall etc scripts
writing config files
Get started with this doc on the ibm developerworks
I'm running an ubuntu 9.10 server on an amd-64 platform. Everything's pretty much standard, and I've got Sinatra 0.94 running on a ruby 1.8 installation. I want to install passenger in order to easily configure ssl.
The problem is, it fails to find the installer.
I run
sudo gem install passenger
or
sudo gem install -r passenger
and then the next line,
passenger-install-nginx-module
or
passenger-install-apache2-module
both fail because the path isn't found.
Is there something I'm forgetting here? Shouldn't it just work, straight up, once the gem is installed?
A bit late for an answer I guess, but actually, the correct way of running the Phusion Passenger installer for nginx, when using RVM, is to use rvmsudo as in:
rvmsudo passenger-install-nginx-module
Credits go to this blog post,
I got it working with
rvmsudo `which passenger-install-nginx-module`
according to this issue on github: https://github.com/wayneeseguin/rvm/issues/1307
seems like you have to do full path:
this worked for me:
which passenger-install-nginx-module
rvmsudo ~/.rvm/gems/ruby-1.9.3-p327-new/gems/passenger-3.0.18/bin/passenger-install-nginx-module
apparently, the gem is installed in a place that's off the path, according to
http://groups.google.com/group/phusion-passenger/browse_thread/thread/78ca12c4838034a6/b5a3c7a00a871283?lnk=gst&q=ubuntu+9.10#b5a3c7a00a871283
Frustrating error, which is why I leave this question rather than delete it (and, with the upvote, I think I'm not the only one with the problem).
I had a similar issue. You need to add gems to your system PATH, paste this into your shell:
export PATH=$PATH:$HOME/bin:/var/lib/gems/1.8/bin
or, to make it permanent add it to your bashrc, usually here: ~/.bashrc
You can also execute just passenger-install-nginx-module by going to the directory at: /var/lib/gems/1.8/bin
Good luck!
I know you already answered the question, but figured I'd chime in with a cent or two.
I recently did a similar nginx install, but chose to go with RVM for managing Ruby versions, which requires us to NOT use sudo.
I recommend this route because all versions of Ruby and all your gems are organized neatly in your home directory. Doing so will also require you to compile nginx manually, which certainly helps understand the pipes a little.
You can compile nginx manually using the "--add-module=/home/user/path_to_passenger_gem/ext," but you'll want to read up RVM's instructions very carefully...really, don't skip a line as they are very concise.
Here's a link to RVM's instructions:
http://rvm.beginrescueend.com/passenger/
and to the Nginx manual instructions (which you probably already skimmed).
http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installing_phusion_passenger_for_nginx_manually
I have got a bit of information on my blog regarding setting up nginx with passenger (and ssl in this case). Perhaps it is of use since it goes through the whole process of recompiling nginx with options.
Upon upgrading from a MB to a new MBP, Apple's migration assistant didn't move my gems.
I'm installing rubygems via macports this time, hoping to avoid this upon next upgrade.
Are there any pitfalls I should be aware of?
If you want your gems installed in your home directory (which should copy over during a transfer, and, as a side benefit, will let you run gem install as yourself, rather than root), set the gemhome: key to a path in your home directory in your ~/.gemrc.
Where were your gems installed? The migration assistant only moves files in certain areas; I'm not sure if it copies files from places like /usr/local or /opt/local, you may have to do that manually (in which case, you can just copy the entire tree over to your new machine).
That said, you shouldn't have a problem installing gems using the version of RubyGems installed by MacPorts.
Installing a package manager via a package manager seems like it should be wrong.
Assuming you are not going to use the system ruby, and will only be using ruby installed via MacPorts; it should not be a problem.
If you plan on using gems with system ruby, you might have problems when Apple upgrades the system version of ruby, unless you are installing your gems in /Library/Ruby/Gems/
I'm going to assume you can just copy the gems to /Library/Ruby/Gems/1.8/gems from /opt/local/lib/ruby/gems but I wouldn't count on it working 100% with every gem.
The migration assistant doesn't move a lot of unix level stuff. This will be true of the macports installed gems as well (which typically live in /opt/local/lib/ruby/gems).
I use macports gem, and this generally works fine with the macports ruby. Be sure you know which ruby executable your shell ends up using, and perhaps use symlinks to control it specifically. I prefer using the macports version so that I'm not beholden to Apple's update schedule. Sadly macports iteself is somewhat inferior to package managers offered on bsd/linux distributions.
I would say don't use MacPorts. People that use their operating systems version of RubyGems often end up with an out of date gem version and then run into problems when they try to update their version of rubygems. Installing Rubygems from source is easy, and it's not hard to install gems when you get a new machine, I mean how often does that really happen????
I just installed ruby 1.8.7 with macport and when I launch scripts with gems, it complains that it doesn't know them.
Anyway to add cleanly the gems in the path of my macport ruby?
Gam
PS: I installed the gems via system gem
What no one mentioned rvm?
Use rvm to manage all of your ruby issues - seriously!
I have a machine at work from wich I'd like to run a script that gathers some information about other machines. I want to do it in Ruby, since it's what I know best, but I've ran into some problems, all apparently due to the same reason: I don't have root access in this machine.
So what I did was: Download ruby source, configure (with --prefix pointing to somewhere under my home dir), make, make install. Alright, ruby runs fine. Then I did the same with rubygems and installed it. Ok as well, untill I went to install my first gem.
I downloaded the gem package (sigh, lots of firewalls, can't just "gem install" something remote), net-ssh, and tried to install it locally. Got the infamous "no such file to load -- zlib". Clues about this led nowhere, so I tried the next approach: getting net-ssh's source. When it tries to require 'openssl' (or when I try it from irb), I get "no such file to load -- openssl".
All of these problems, apparently, could be solved by apt-getting or rpm installing, or whatever. Only problem is: I can't!
Any suggestions as to how I might proceed?
Thanks for the help,
Marcelo.
Closing this now.
I had to ask someone with root access to install zlib-devel and openssl-devel (I'm on RHEL). Couldn't make it otherwise.
I'm guessing there's probably a way of using the stuff inside said packages without installing them as root, but I couldn't do it.
Did you try Ruby RVM?
You can download, compile and install a full-featured Ruby version on your home environment.
I recently did the same. The trick that worked for me is NOT to use a --prefix flag when you install rubygems.