龙空技术网

单节点Redis4 CentOS安装流程说明

码农1号 154

前言:

此刻朋友们对“centos69安装步骤”都比较关怀,咱们都想要知道一些“centos69安装步骤”的相关知识。那么小编同时在网络上收集了一些对于“centos69安装步骤””的相关内容,希望姐妹们能喜欢,各位老铁们一起来学习一下吧!

技术简介:

Redis是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的API。从2010年3月15日起,Redis的开发工作由VMware主持。从2013年5月开始,Redis的开发由Pivotal赞助。redis 的作者,叫Salvatore Sanfilippo,来自意大利的西西里岛,现在居住在卡塔尼亚。目前供职于Pivotal公司。他使用的网名是antirez。

环境说明:

CentOS6.8

Java 1.7

SSH工具:XShell

安装账号: root

安装步骤:

1、安装依赖包

yum -y install ruby ruby-devel rubygems rpm-build

2、安装Redis

[root@bigdata006 redis-4.0.1]# gem install redis ERROR: Error installing redis: redis requires Ruby version >= 2.2.2.

如果出现ruby版本低的异常则说明先安装满足条件版本的ruby。

解决该问题,先安装rvm,再把ruby版本提升至2.3.3

2.1、安装curl命令

yum install curl

2.2、安装rvm

curl -L get.rvm.io | bash -s stable

如果报出下面的信息:

[root@bigdata006 ~]# curl -L get.rvm.io | bash -s stable

 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 24173 100 24173 0 0 12970 0 0:00:01 0:00:01 --:--:-- 54511Downloading  : 于 2019年01月04日 星期五 06时01分48秒 CST 创建的签名,使用 RSA,钥匙号 39499BDBgpg: 无法检查签名:No public keyGPG signature verification failed for '/usr/local/rvm/archives/rvm-1.29.7.tgz' - ''! 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  | gpg2 --import - command curl -sSL  | gpg2 --import -In case of further problems with validation please refer to 

则需要根据上面的提示先执行:

2.3、 设置gpg2的key

gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

再次执行:

curl -L get.rvm.io | bash -s stable

正确执行的情况下,得到下面提示信息:

[root@bigdata006 local]# curl -L get.rvm.io | bash -s stable% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 24173 100 24173 0 0 14731 0 0:00:01 0:00:01 --:--:-- 105kDownloading  : 于 2019年01月04日 星期五 06时01分48秒 CST 创建的签名,使用 RSA,钥匙号 39499BDBgpg: 完好的签名,来自于“Piotr Kuczynski <piotr.kuczynski@gmail.com>”gpg: 警告:这把密钥未经受信任的签名认证!gpg: 没有证据表明这个签名属于它所声称的持有者。主钥指纹: 7D2B AF1C F37B 13E2 069D 6956 105B D0E7 3949 9BDBGPG verified '/usr/local/rvm/archives/rvm-1.29.7.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 u=rwx,g=rwx,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 effect!

2.4 执行提示信息中要求的操作:

source /etc/profile.d/rvm.sh

2.5 查看目前ruby的版本信息

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[.5][ruby-]2.5[.3][ruby-]2.6[.0]ruby-head# for forks use: rvm install ruby-head-<name> --url  --branch 2.2# JRubyjruby-1.6[.8]jruby-1.7[.27]jruby-9.1[.17.0]jruby[-9.2.5.0]jruby-head# Rubiniusrbx-1[.4.3]rbx-2.3[.0]rbx-2.4[.1]rbx-2[.5.8]rbx-3[.100]rbx-head# TruffleRubytruffleruby[-1.0.0-rc10]# Opalopal# Minimalistic ruby implementation - ISO 30170:2012mruby-1.0.0mruby-1.1.0mruby-1.2.0mruby-1.3.0mruby-1[.4.1]mruby-2[.0.0]mruby[-head]# Ruby Enterprise Editionree-1.8.6ree[-1.8.7][-2012.02]# Topaztopaz# MagLevmaglev-1.0.0maglev-1.1[RC1]maglev[-1.2Alpha4]maglev-head# Mac OS X Snow Leopard Or Newermacruby-0.10macruby-0.11macruby[-0.12]macruby-nightlymacruby-head# IronRubyironruby[-1.1.3]ironruby-head

2.6 安装符合条件的ruby版本:

rvm install 2.3.3

正确执行情况下,得到的执行信息如下:

Searching for binary rubies, this might take some time.Found remote file  requirements for centos.Installing requirements for centos.Installing required packages: autoconf, automake, bison, libtool......Requirements installation successful.ruby-2.3.3 - #configureruby-2.3.3 - #download % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 21.9M 100 21.9M 0 0 45395 0 0:08:27 0:08:27 --:--:-- 249kNo checksum for downloaded archive, recording checksum in user configuration.ruby-2.3.3 - #validate archiveruby-2.3.3 - #extractruby-2.3.3 - #validate binaryLibraries missing for ruby-2.3.3: libyaml-0.so.2. Refer to your system manual for installing librariesMounting remote ruby failed with status 10, trying to compile.Checking requirements for centos.Requirements installation successful.-bash: /usr/local/rvm/scripts/functions/manage/install/centos: 没有那个文件或目录Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.3.3, this may take a while depending on your cpu(s)...ruby-2.3.3 - #downloading ruby-2.3.3, this may take a while depending on your connection... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 13.7M 100 13.7M 0 0 341k 0 0:00:41 0:00:41 --:--:-- 1844kruby-2.3.3 - #extracting ruby-2.3.3 to /usr/local/rvm/src/ruby-2.3.3.....ruby-2.3.3 - #applying patch /usr/local/rvm/patches/ruby/ruby_2_3_gcc7.patch.ruby-2.3.3 - #applying patch /usr/local/rvm/patches/ruby/2.3.3/random_c_using_NR_prefix.patch.ruby-2.3.3 - #configuring..........................................................ruby-2.3.3 - #post-configuration..ruby-2.3.3 - #compiling.........................................................................................ruby-2.3.3 - #installing...........................ruby-2.3.3 - #making binaries executable..ruby-2.3.3 - #downloading rubygems-2.7.9 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 842k 100 842k 0 0 13116 0 0:01:05 0:01:05 --:--:-- 14973No checksum for downloaded archive, recording checksum in user configuration.ruby-2.3.3 - #extracting rubygems-2.7.9.....ruby-2.3.3 - #removing old rubygems........ruby-2.3.3 - #installing rubygems-2.7.9....................................ruby-2.3.3 - #gemset created /usr/local/rvm/gems/ruby-2.3.3@globalruby-2.3.3 - #importing gemset /usr/local/rvm/gemsets/global.gems................................................................ruby-2.3.3 - #generating global wrappers.......ruby-2.3.3 - #gemset created /usr/local/rvm/gems/ruby-2.3.3ruby-2.3.3 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem listruby-2.3.3 - #generating default wrappers.......ruby-2.3.3 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).Install of ruby-2.3.3 - #completePlease be aware that you just installed a ruby that requires 2 patches just to be compiled on an up to date linux system.This may have known and unaccounted for security vulnerabilities.Please consider upgrading to ruby-2.6.0 which will have all of the latest security patches.Ruby was built without documentation, to build it run: rvm docs generate-ri

2.7 选用满足条件的ruby版本:

[root@bigdata006 local]# rvm use 2.3.3Using /usr/local/rvm/gems/ruby-2.3.3

3、安装Redis

正确执行得到的执行信息如下:

[root@bigdata006 local]# gem install redisFetching: redis-4.1.0.gem (100%)Successfully installed redis-4.1.0Parsing documentation for redis-4.1.0Installing ri documentation for redis-4.1.0Done installing documentation for redis after 1 seconds1 gem installed

4、创建redis的规范目录软连接

ln -s /home/bigdata/application/redis-4.0.1 redis

5、修改redis的权限为普通用户

chown -R bigdata:bigdata redis

6、启动redis (start.sh的内容)

nohup src/redis-server conf/redis.conf >> logs/redis.log 2>&1 &

启动命令涉及指定配置文件,大家可以参考我的这种方式,能比较方便的启停和收集日志信息。 redis-server前面增加src的目的就是为了解决下面的问题,在有些时候,安装完没有把路径自动加到path中,因此需要执行详细路径。

[bigdata@bigdata006 logs]$ more redis.lognohup: failed to run command `redis-server': No such file or directorynohup: 无法运行命令"redis-server": 没有那个文件或目录nohup: failed to run command `redis-server': No such file or directory

7、关闭redis(stop.sh的内容)

src/redis-cli -h 127.0.0.1 -p 16379 shutdown

注意端口号是redis.conf中配置的端口。

附录:

redis.conf 关键信息配置:

logfile "/usr/local/redis/logs/redis.log"pidfile /usr/local/redis/run/redis.pidport 1637bind 0.0.0.0save 900 1save 300 10save 60 10000dbfilename dump.rdb

标签: #centos69安装步骤