In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you what to pay attention to when deploying the ruby environment, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Foreword:
More than a year ago, the business used the redis-cluster cluster, but at that time, the redis-cluster cluster used the script redis-trib.rb developed by the ruby language to manage the cluster. So the ruby environment was installed on the server at that time. Recently, the project once again used the redis-cluster cluster, so I didn't think much about it, but it didn't work directly according to the documentation at that time, but it didn't work. I encountered all kinds of errors. This record is convenient for subsequent use.
Server environment: centos7.6x84_64 bit, minimizing installation
Deploy the ruby environment directly:
Yum-y install ruby ruby-develyum-y install rubygems [root@localhost ~] # which gem/usr/bin/gem [root@localhost ~] # gem sources-- remove http://rubygems.org/ http://rubygems.org/ removed from sourcessource http://rubygems.org/ not present in cache [root@localhost ~] # gem sources-l***CURRENT SOURCES * * https://rubygems.org/[root@localhost ~] # curl-L get.rvm.io | bash-s stable% Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed100 194 100 194 00 379 0--:-379curl: (7) Failed connect to raw.githubusercontent.com:443 Deny connection
So add Taobao ruby source:
[root@localhost] # gem sources-- add https://ruby.taobao.org/ https://ruby.taobao.org/ added to sourcesError fetching https://ruby.taobao.org/: hostname "ruby.taobao.org" does not match the server certificate (https://ruby.taobao.org/specs.4.8.gz)
The original taobao Gems source has stopped maintenance, but now ruby-china provides mirroring service, that is, we need to change the source.
Reference address: https://blog.csdn.net/chris_ime/article/details/52013349
Gem sources-a https://gems.ruby-china.com/[root@localhost ~] # gem sources-a https://gems.ruby-china.com/https://gems.ruby-china.com/ added to sources [root@localhost ~] # gem sources-lump * CURRENT SOURCES * * https://rubygems.org/https://gems.ruby-china.com/
Install RVM:
[root@localhost soft] # curl-L get.rvm.io | bash-s stable% Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed100 194 100 194 00 99 00: 00:01 0:00:01--:-99100 24535 100 24535 00 5477 00: 00:04 0 : 00:04--:-20299Downloading https://github.com/rvm/rvm/archive/1.29.9.tar.gzDownloading https://github.com/rvm/rvm/releases/download/1.29.9/1.29.9.tar.gz.ascgpg: created directory'/ root/.gnupg'gpg: new configuration file'/ root/.gnupg/gpg.conf' established gpg: warning: in'/ root/.gnupg/ Options in gpg.conf' are not used during this run gpg: keyring'/ root/.gnupg/pubring.gpg' established gpg: signature created by CST at 16:31:02 on Wednesday, July 10, 2019 Using RSA, key number 39499BDBgpg: unable to check signature: no public key GPG signature verification failed for'/ usr/local/rvm/archives/rvm-1.29.9.tgz'-'https://github.com/rvm/rvm/releases/download/1.29.9/1.29.9.tar.gz.asc'! Try to install GPG v2 and then fetch the public key: gpg2-keyserver hkp://pool.sks-keyservers.net-recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDBor if it fails: command curl-sSL https://rvm.io/mpapis.asc | gpg2-- import-command curl-sSL https://rvm.io/pkuczynski.asc | gpg2-- import-In case of further problems with validation please refer to https://rvm.io/rvm/security[root@localhost soft] # echo $? 2
If an error has been reported, follow the prompts as follows:
[root@localhost soft] # gpg-- keyserver hkp://keys.gnupg.net-- recv-keys ^ C [root@localhost soft] # gpg2-- keyserver hkp://pool.sks-keyservers.net-- recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB gpg: key ring'/ root/.gnupg/secring.gpg' has been established gpg: download key 'D39DC0E3', from hkp server pool.sks-keyservers.netgpg: download key '39499BDB' Trust database established from hkp server pool.sks-keyservers.netgpg: / root/.gnupg/trustdb.gpg: gpg: key D39DC0E3: public key "Michal Papis (RVM signing)" imported gpg: key 39499BDB: public key "Piotr Kuczynski" imported gpg: no absolutely trusted keys found gpg: total number of keys processed: 2gpg: imported: 2 (RSA: 2) [root@ Localhost soft] # curl-L http://get.rvm.io | bash-s stable% Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed100 194 100 194 00 97 00: 00:02 0:00:01 0:00:01 97curl: (7) Failed connect to raw.githubusercontent.com:443 Refuse to connect [root@localhost soft] # curl-L http://get.rvm.io | bash-s stable% Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed100 194 100 194 00 94 00: 00:02 0:00:02 -::-94100 24535 100 24535 00 2868 00: 00:08 0:00:08--:-5254Downloading https://github.com/rvm/rvm/archive/1.29.9.tar.gzDownloading https://github.com/rvm/rvm/releases/download/1.29.9/1.29.9.tar.gz.ascgpg: signature created at 16:31:02 CST on Wednesday, July 10, 2019 Using RSA, key number 39499BDBgpg: intact signature, from "Piotr Kuczynski" gpg: warning: this key has not been authenticated by a trusted signature! Gpg: there is no evidence that this signature belongs to the holder it claims to be. Master key fingerprint: 7D2B AF1C F37B 13E2 069D 6956 105B D0E7 3949 9BDBGPG verified'/ usr/local/rvm/archives/rvm-1.29.9.tgz'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 upright rwx journal gendarwx journal 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. * Please do NOT forget to add your users to the rvm group. The installer no longer auto-adds root or users to the rvm group. Admins must do this. Also, please note that group memberships are ONLY evaluated at login time. This means that users must log out then back in before group membership takes thanks for installing RVM [root@localhost soft] # echo $? 0
Rvm installed successfully here
Load the rvm environment:
[root@localhost soft] # find /-name rvm-print/usr/local/rvm/usr/local/rvm/src/rvm/usr/local/rvm/src/rvm/bin/rvm/usr/local/rvm/src/rvm/lib/rvm/usr/local/rvm/src/rvm/scripts/rvm/usr/local/rvm/bin/rvm/usr/local/rvm/lib/rvm/usr/local/rvm/scripts/rvm [root@localhost soft] # source / usr/local/rvm/scripts/rvm
Rvm to view the versions of the ruby environment that are currently available for installation:
[root@localhost soft] # rvm list known#MRI Rubies [ruby-] 1.8.6 [- p420] [ruby-] 1.8.7 [- head] # security released on head [ruby-] 1.9.1 [- p431] [ruby-] 1.9.2 [- p330] [ruby-] 1.9.3 [- p551] [ruby-] 2.0.0 [- p648] [ruby-] 2.1 [.10] [ruby-] 2.2 [.10] [ Ruby-] 2.3 [.8] [ruby-] 2.4 [.6] [ruby-] 2.5 [.5] [ruby-] 2.6 [.3] [ruby-] 2.7 [.0-preview1] ruby-head#for forks use: rvm install ruby-head- url https://github.com/github/ruby.git-- branch 2.2#JRubyjruby-1.6 [.8] jruby-1.7 [.27] jruby-9.1 [.17 .0] jruby [- 9.2.7.0] jruby-head
This demo ruby environment is installed with ruby-2.4.6:
[root@localhost soft] # rvm install 2.4.6Searching for binary rubies, this might take some time.No binary rubies available for: centos/7/x86_64/ruby-2.4.6.Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.Checking requirements for centos.Installing requirements for centos.Installing required packages: libffi-devel, readline-devel, sqlite-devel.Requirements installation successful.Installing Ruby from source to: / usr/local/rvm/rubies/ruby-2.4.6, this may take a while depending on your cpu (s)... ruby-2.4.6-# downloading ruby-2.4.6, this may take a while depending on your connection... % Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed100 12.0M 100 12.0M 00 54872 00: 03:50 0:03:50 -: -:-38723ruby-2.4.6-# extracting ruby-2.4.6 to / usr/local/rvm/src/ruby-2.4.6.ruby-2 .4.6-# configuring.ruby-2.4.6-# post-configuration..ruby-2.4.6-# compiling Ruby-2.4.6-# installing. .ruby-2.4.6-# making binaries executable..ruby-2.4.6-# downloading rubygems-3.0.6% Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed100 866k 100 866k 00 40767 00: 00:21 0:00:21 -::-39023No checksum for downloaded archive Recording checksum in user configuration.ruby-2.4.6-# extracting rubygems-3.0.6.ruby-2.4.6-# removing old rubygems.ruby-2.4.6-# installing rubygems-3.0.6...ruby-2.4 .6-# gemset created / usr/local/rvm/gems/ruby-2.4.6@globalruby-2.4.6-# importing gemset / usr/local/rvm/gemsets/global.gems....ruby-2.4.6- # generating global wrappers.ruby-2.4.6-# gemset created / usr/local/rvm/gems/ruby-2.4.6ruby-2.4.6-# importing gemsetfile / usr/local/rvm/gemsets/default.gems evaluated to empty gem listruby-2.4.6-# generating default wrappers.ruby-2.4.6-# adjusting # shebangs for (gem irb erb ri rdoc testrb rake). Install of ruby-2.4.6-# complete Ruby was built without documentation To build it run: rvm docs generate-ri [root@localhost soft] # [root@localhost soft] # echo $? 0
The ruby-2.4.6 environment is installed successfully at this time
View the current version of ruby:
[root@localhost soft] # ruby-- version
Ruby 2.4.6p354 (2019-04-01 revision 67394) [x86_64-linux]
Switch to the ruby-2.4.6 environment:
[root@localhost soft] # rvm use 2.4.6
Using / usr/local/rvm/gems/ruby-2.4.6
[root@localhost soft] # ruby-- version
Ruby 2.4.6p354 (2019-04-01 revision 67394) [x86_64-linux]
Set the ruby-2.4.6 environment to default:
[root@localhost soft] # rvm use 2.4.6-default
Using / usr/local/rvm/gems/ruby-2.4.6
[root@localhost soft] # ruby-- version
Ruby 2.4.6p354 (2019-04-01 revision 67394) [x86_64-linux]
To install redis.gem, redis-4.1.3 is installed directly by default:
[root@localhost soft] # gem install redisFetching redis-4.1.3.gemSuccessfully installed redis-4.1.3Parsing documentation for redis-4.1.3Installing ri documentation for redis-4.1.3Done installing documentation for redis after 1 seconds1 gem installed [root@localhost soft] # echo $? 0
Installation succeeded:
[root@localhost soft] # / data/soft/redis-4.0.12/src/redis-trib.rb Usage: redis-trib create host1:port1... HostN:portN-replicas check host:port info host:port fix host:port-timeout reshard host:port
Friendly reminder:
When managing redis-cluster clusters, the rvm environment is often used. Every time the / data/soft/redis-4.0.12/src/redis-trib.rb command is executed, source / usr/local/rvm/scripts/rvm must be loaded in advance.
Then switch to the ruby-2.4.6 environment: rvm use 2.4.6; it's a bit cumbersome, so write directly to the environment variable file, so that when you log in to the machine with the redis-trib.rb command, the ruby environment is automatically loaded, which reduces the number of commands that load rvm on the command line each time.
[root@mysql-redis182] # cat .bashrc # bashrc # User specific aliases and functionsalias rm='rm-i'alias cp='cp-i'alias mv='mv-i'#Source global definitionsif [- f / etc/bashrc]; then. / etc/bashrcfi### [[- s "/ usr/local/rvm/scripts/rvm"]] &. "/ usr/local/rvm/scripts/rvm" rvm use 2.4.6 > / dev/null 2 > & 1 the above is what you need to pay attention to when deploying a ruby environment. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.