6.4. Ruby installation-Linux

发布时间 : 2025-10-25 13:34:05 UTC      

Page Views: 9 views

The steps for installing Ruby on a Linux machine are listed below.

Note: before installing, make sure you have root permissions.

6.4.1. Source code installation #

$ tar -xvzf ruby-2.2.3.tgz $ cd ruby-2.2.3 
  • Now, configure and compile the source code, as follows:

$ ./configure $ make $ sudo make install 
  • After installation, ensure that everything works properly by entering the following command on the command line:

$ruby -v ruby 2.2.3…… 
  • If everything works fine, the installed version of the Ruby interpreter willbe output, as shown above. If you have another version installed, differentversions are displayed.

6.4.2. Automatically install Ruby #

If your computer is already connected to Internet, the easiest way to install Ruby is to use the yum or apt-get . Enter the following command at the command prompt to install Ruby on your computer.

$ sudo yum install ruby # CentOS, Fedora, or RHEL system or sudo apt-get install ruby-full # Debian 或 Ubuntu 系统 

If you are an Apple system, you can use the brew command installation:

$ brew install ruby 

6.4.3. Install Ruby using RVM #

RVM can install and manage multiple Ruby versions in the system. At the sametime can manage different gem set. Support for OS X, Linux, and other UNIX-like operating systems.

Install RVM #

$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB $ curl -sSL https://get.rvm.io | bash -s stable 

After the installation is complete, some installation information is listed,including one line to note:

... To start using RVM you need to run `source /etc/profile.d/rvm.sh` .... 

It means that if you want to start using it, you need to execute a source command to re-execute the newly modified initialization file, according to the installation prompt, execute the following command to load the RVM environment (the new Termal does not have to do this, it will reloadautomatically)

source /etc/profile.d/rvm.sh 

Check to see if it is installed correctly

$ rvm -v rvm 1.22.17 (stable) by Wayne E. Seguin , Michal Papis  [https://rvm.io/]      

6.4.4. Install the Ruby environment with RVM #

List known ruby versions:

$ rvm list known 

You can choose an existing version of rvm to install (take the installation of rvm version 2.4.2 as an example)

$ rvm install 2.4.2 

Also continue to wait for the long download and compilation process, and when it is complete, Ruby and Ruby Gems will be installed.

6.4.5. Rvm common commands #

Query the installed ruby

$ rvm list 

Uninstall an installed version

$ rvm remove 1.9.2 

Set Ruby version

After RVM is installed, you need to execute the following command to set thespecified version of Ruby as the system default version

$ rvm 2.0.0 --default 

Similarly, you can use other version numbers, as long as you are useful rvm install installed that version.

At this time, you can test whether it is correct or not.

$ ruby -v ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0] $ gem -v 2.1.6 

This may be because the default source of Ruby uses cocoapods.org, and it issometimes difficult to access this URL in China. One solution on the Internet is to replace the remote source with ruby-china, as follows:

$ gem source -r https://rubygems.org/ $ gem source -a https://gems.ruby-china.com/ 

To verify that the replacement was successful, execute:

$ gem sources -l 

Normal output:

*** CURRENT SOURCES *** https://gems.ruby-china.com/ 

Please make sure that only gems.ruby-china.com

$ gem install rails 

If you use Gemfile and Bundle (for example, Rails project)

You can use Bundler’s Gem source code mirror command.

$ bundle config mirror.https://rubygems.org https://gems.ruby-china.com 

So you don’t have to change your Gemfile source.

source 'https://rubygems.org/' gem 'rails', '4.1.0' ... 
《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。