CentOS Linux
There are 2 ways to do this on centOS, one preferably being the pear install below
Pear CentOS Install #1 (similar to above except #2)
-------------------------------
1. Check if PEAR is on the server with: pear version
2. If PEAR is not on the server then type in: yum install php-pear
3. Then type in: pear channel-discover pear.drush.org
4. and then finally: pear install drush/drush
4a. if you would like to install a specific version, you can do this (for instance drush 6.x requires php 5.3.3, so you may want to use the 5.x branch instead):pear install drush/drush-5.7.0
If something goes awry, you can always uninstall drush with: pear uninstall drush/drush
安装ruby
I am using CentOS 6.3, below is easy steps to install ruby using RVM , or Ruby Version Manager. RVM provides easy set of commands to install single or multiple versions of Ruby on single server.
Step 1: Upgrade Packages
It is the best practice to keep your system up to date with latest packages. Before running below command make sure that update will not affect to your running apps ( if any )on server else skip it
# yum update
Step 2: Installing Recommended Packages
There are few developemnt libraries required to run Ruby on Linux. Use following command to install recommended packages on your server using yum.
# yum install gcc-c++ patch readline readline-devel zlib zlib-devel
# yum install libyaml-devel libffi-devel openssl-devel make
# yum install bzip2 autoconf automake libtool bison iconv-devel
Step 3: Install RVM ( Ruby Version Manager )
Install latest stable version of RVM on your system using following command. This command will automatically download all required files and install on your system.
# curl -L get.rvm.io | bash -s stable
[Sample Output]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 20511 100 20511 0 0 1120 0 0:00:18 0:00:18 --:--:-- 19722
Downloading https://github.com/wayneeseguin/rvm/archive/stable.tar.gz
Creating group 'rvm'
Installing RVM to /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete:
* First you need to add all users that will be using rvm to 'rvm' group,
and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.
* To start using RVM you need to run `source /etc/profile.d/rvm.sh`
in all your open shell windows, in rare cases you need to reopen all shell windows.
# Administrator,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
In case of problems: http://rvm.io/help and https://twitter.com/rvm_io
Step 4: Setup RVM Environment
After installing RVM first we need to setup rvm environment using below command.
# source /etc/profile.d/rvm.sh
Step 5: Install Required Ruby Version
RVM provides option to manage multiple ruby version on single system. Use following command to install required version of Ruby.
# rvm install 1.9.3
[Sample Output]
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/6/i386/ruby-1.9.3-p545.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Installing requirements for centos.
Updating system......
Installing required packages: libyaml-devel......
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p545, this may take a while depending on your cpu(s)...
ruby-1.9.3-p545 - #downloading ruby-1.9.3-p545, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9802k 100 9802k 0 0 217k 0 0:00:45 0:00:45 --:--:-- 393k
ruby-1.9.3-p545 - #extracting ruby-1.9.3-p545 to /usr/local/rvm/src/ruby-1.9.3-p545.
ruby-1.9.3-p545 - #applying patch /usr/local/rvm/patches/ruby/GH-488.patch.
ruby-1.9.3-p545 - #applying patch /usr/local/rvm/patches/ruby/ssl_no_ec2m.patch.
ruby-1.9.3-p545 - #configuring..............................................
ruby-1.9.3-p545 - #post-configuration.
ruby-1.9.3-p545 - #compiling...................................................................
ruby-1.9.3-p545 - #installing........................
ruby-1.9.3-p545 - #making binaries executable.
ruby-1.9.3-p545 - #downloading rubygems-2.2.2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 404k 100 404k 0 0 25393 0 0:00:16 0:00:16 --:--:-- 335k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-1.9.3-p545 - #extracting rubygems-2.2.2.
ruby-1.9.3-p545 - #removing old rubygems.
ruby-1.9.3-p545 - #installing rubygems-2.2.2...............
ruby-1.9.3-p545 - #gemset created /usr/local/rvm/gems/ruby-1.9.3-p545@global
ruby-1.9.3-p545 - #importing gemset /usr/local/rvm/gemsets/global.gems.....
ruby-1.9.3-p545 - #generating global wrappers.
ruby-1.9.3-p545 - #gemset created /usr/local/rvm/gems/ruby-1.9.3-p545
ruby-1.9.3-p545 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-1.9.3-p545 - #generating default wrappers.
ruby-1.9.3-p545 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-1.9.3-p545 - #complete
WARNING: Please be aware that you just installed a ruby that is no longer maintained (2014-02-23), for a list of maintained rubies visit:
http://bugs.ruby-lang.org/projects/ruby/wiki/ReleaseEngineering
Please consider upgrading to ruby-2.1.1 which will have all of the latest security patches.
Ruby was built without documentation, to build it run: rvm docs generate-ri
Step 6: Install Another Version ( if Required )
If you want using multiple versions of ruby, you can install it also using rvm else skip this step.
# rvm install 1.8.6
Step 7: Setup Default Ruby Version
Use rvm command to setup default ruby version to be used by applications.
# rvm use 1.9.3 --default
Using /usr/local/rvm/gems/ruby-1.9.3-p545
Step 8: Check Current Ruby Version
Using following command you can check the current ruby version is used.
# ruby --version
ruby 1.9.3p545 (2014-02-24 revision 45159) [i686-linux]
I hope above steps will help you for installing multiple Ruby version using RVM.
参考文章