Linux Offline installation Ruby detailed

Source: Internet
Author: User



Many times we will find that the real production environment is not a lot of external network, only intranet environment, this time we need to install Ruby, we can not provide the Yum command to install online, this time we need to download the installation package for offline installation. This article is mainly about if you install ruby offline



Before installing, let's briefly introduce Ruby


first, Introduction to Ruby


Ruby is a purely object-oriented programming language. It was founded in 1993 by as of Japan (まつもとゆきひろ/yukihiro Matsumoto).



You can find the name of AS (まつもとゆきひろ/yukihiro Matsumoto) on the www.ruby-lang.org Ruby mailing list. In the Ruby community, Matsumoto is also known as Matts (Matz).



Ruby is "the best friend of programmers".



Ruby's features are similar to Smalltalk, Perl, and Python. Perl, Python, and Smalltalk are scripting languages. Smalltalk is a true object-oriented language. Ruby, like Smalltalk, is a perfect object-oriented language. It is much easier to use Ruby syntax than to use Smalltalk syntax.


Second, Ruby online installation


If your computer is already connected to the Internet, the simplest way to install Ruby is to use yum or apt-get. You can install Ruby on your computer by entering the following command at the command prompt.\

1 $ sudo yum install ruby # CentOS, Fedora, or RHEL system

3 or
4
5 sudo apt-get install ruby-full # Debian or Ubuntu system
If you are an Apple system, you can use the brew command to install:

1 $ brew install ruby
3. Ruby offline installation
Go to the official website to download: http://www.ruby-lang.org/en/downloads/ The latest version is 2.4.1

Before installing, please make sure you have root permissions, upload the downloaded Ruby installation package to the server, create a folder to store, we can set a file name, for example: ruby

We can create folders and copies through commands, here I am lazy, upload and create folders through the xtfp5 tool, as shown:

Unzip by command

1 & tar -zxvf ruby-2.4.1.tar.gz
We can use the command: ls to view the current directory, we can find that it has been decompressed successfully, and see the folder ruby-2.4.1 after understanding the compression

, In the current unzipped directory, edit the configuration and compile the source code to install

1 $ ./configure –-prefix = / usr / local / ruby -prefix is to install ruby to the specified directory, or you can customize it
2 $ make && make install
We installed ruby to the / usr / local / ruby directory and set the configuration file

Install ruby

After installation, make sure everything is working by entering the following command on the command line:

1 $ ruby -v
2 ruby 2.4.1 ...
Successful installation

Follow-up: If the following error occurs during installation

 1 /home/cmfchina/ruby/ruby-2.4.1/lib/fileutils.rb:226:in `mkdir‘: Permission denied @ dir_s_mkdir-/ usr / local / ruby (Errno :: EACCES)
 2 from /home/cmfchina/ruby/ruby-2.4.1/lib/fileutils.rb:226:in `fu_mkdir’
 3 from /home/cmfchina/ruby/ruby-2.4.1/lib/fileutils.rb:207:in `block (2 levels) in mkdir_p’
 4 from /home/cmfchina/ruby/ruby-2.4.1/lib/fileutils.rb:205:in `reverse_each’
 5 from /home/cmfchina/ruby/ruby-2.4.1/lib/fileutils.rb:205:in `block in mkdir_p’
 6 from /home/cmfchina/ruby/ruby-2.4.1/lib/fileutils.rb:191:in `each’
 7 from /home/cmfchina/ruby/ruby-2.4.1/lib/fileutils.rb:191:in `mkdir_p’
 8 from ./tool/rbinstall.rb:194:in `makedirs’
 9 from ./tool/rbinstall.rb:306:in `prepare‘
10 from ./tool/rbinstall.rb:344:in `block in <main>‘
11 from ./tool/rbinstall.rb:822:in `block in <main>‘
12 from ./tool/rbinstall.rb:819:in `each‘
13 from ./tool/rbinstall.rb:819:in `<main>‘
14 make: *** [do-install-all] Error 1
The problem is that you do not have permission to create files in the / usr / local / ruby directory. At this time, you can manually go to the ruby installation directory file or change the installation directory. Before that, you can set the prefix above.

PS: Please indicate the source for reprinting http://www.cnblogs.com/xuliangxing/p/7132656.html

Linux offline Ruby detailed explanation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.