Linux Offline Installation RubyGems detailed

Source: Internet
Author: User
Tags echo command

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 RubyGems, 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 a brief introduction if you install RubyGems offline

Before installing we briefly introduce the next RubyGems

I. Introduction of RubyGems

RubyGems is a package manager for Ruby that provides a standard format for distributing Ruby programs and libraries, as well as a tool for managing package installation.

The RubyGems is designed to conveniently manage gem-installed tools, as well as servers for distributing gems. This is similar to the apt-get under Ubuntu, the Yum,python pip of Centos.

RubyGems was created around November 2003 and became part of the Ruby Standard library since Ruby version 1.9.

Second, online installation RubyGems

Direct installation by command

& Yum Install RubyGems
Second, offline installation RubyGems

If your Ruby is below version 1.9, you can also install it manually:

    • First download the installation package: Https://rubygems.org/pages/download.
    • Unzip and go to directory, execute command:Ruby setup.rb

Decompression TAR-ZXVF rubygems-2.6.12.tgz

$ cd/home/cmfchina/rubygems
$ TAR-ZXVF rubygems-2.6. tgz.

Execute command:Ruby setup.rb

Update RubyGems command:

1 $ gem update--system          # requires administrator or root user
Third, RUBYGEMS environment variable configuration (requires root permission)

Command:

$ which gem

If you do not find, you need to set the environment variables, there is no need to set up, after the content will not go to see, la La ~ ~ ~ ~.

Method One,

Directly under the current root directory, it is the installation directory of Ruby. Enter the command VI BASHRC, and then add the following statement at the end:export path=/home/cmfchina/rubygems/rubygems-2.6.12/bin: $PATH, Set the path path, place the installed RUBYGEMSL path in front of the system path, and avoid invoking the operating system's own RubyGems

Save to exit (press ESC, then enter: Wq Save to exit)

Method Two, (the second is recommended, because the first type of BASHRC is a system-level environment variable)

Enter the command vim/etc/profile to add the bin directory path to the installation RubyGems in the file path. Then save the Execute command:source/etc/profile

$ vi/etc/profile

On the last side of the file, path adds the bin path to the RubyGems,

Save to exit (press ESC, and then enter: Wq save exit), where you set the path path, put the installed RubyGems in front of the system path, avoid calling the operating system's own RubyGems

Finally, you need to execute the command:source/etc/profile to take effect immediately

$ source/etc/profile

Special Note:

You will normally need to unregister the system to take effect, and finally you can test it with the echo command:

See if the output is already/home/cmfchina/rubygems/rubygems-2.6.12/bin this path.

At this point, Ruby installation is complete!

Linux Offline Installation RubyGems detailed

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.