📜 ⬆️ ⬇️

Installing RubyGems on hosting

Today I decided to test one of my rail projects on hosting. At home, everything works great, but in production mode did not want to. Firstly, it turned out that the rails on the hosting were not installed, and secondly, RubyGems is old. Well, at least Ruby himself worked, and thanks for that ((-:
First of all, I decided to update RubyGems in order to avoid further questions from the gem manager. This is done like this:
  1. First of all, you need to think of a way to your personal repository of gems. Useful, I promise. By default, the latest versions offer the path of the form /home/username/.gem/ . Thus, you need to enter in the console:
      export GEM_HOME = ~ / .gem 

  2. Then you need to download the latest version of RubyGems and, in fact, install it. You need to install in some secluded place in the home directory. I chose ~/ruby/gem for this purpose. The latest version of RubyGems can be downloaded from the official site . Now the latest stable version is 1.0.1
    Execute commands:
      mkdir ~ / temp 
     mkdir ~ / ruby ​​/ gem 
     cd ~ / temp 
     wget http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz 
     tar -zxf rubygems-1.0.1.tgz 
     cd rubygems-1.0.1 
     ruby setup.rb all --prefix = ~ / ruby ​​/ gem 

    In case of successful circumstances - the installation was successful. To check, type in the console gem . If everything is successful - help is displayed on this command. It is possible, however, that an error about the missing file appears. In this case, you need to export another environment variable - RUBYLIB following command:
      export RUBYLIB = ~ / ruby ​​/ gem / lib 

    Now let the system call the newly installed instance by the word gem :
      export PATH = ~ / ruby ​​/ gem / bin: $ PATH 

  3. During the installation of RubyGems, a new gem repository was created at ~/.gem . Let's tell the system that gems now need to be dragged from there:
      export GEM_PATH = ~ / .gem 

    You already see the second environment variable starting in GEM_ . And both of them point to the same directory, let's see why:
    • GEM_HOME points to the directory GEM_HOME new gems will be installed . If you wish, you can add the --install-dir parameter when installing, but I personally feel lazy, so I chose to set the environment variable once.
    • GEM_PATH in turn, indicates the directory in which the search for installed gems will occur.


')

Source: https://habr.com/ru/post/19957/


All Articles