Linux上安装redis,和启动方式service redisd start

[root@localhost redissofts]# wget http://download.redis.io/releases/redis-6.0.5.tar.gz
-bash: wget: 未找到命令
[root@localhost redissofts]# yum -y install wget

安装好了wget之后继续执行 wget http://download.redis.io/releases/redis-6.0.5.tar.gz

下载好之后解压

[root@localhost redissofts]# tar xzf redis-6.0.5.tar.gz
[root@localhost redissofts]# ls
redis-6.0.5  redis-6.0.5.tar.gz
[root@localhost redissofts]# cd redis-6.0.5
[root@localhost redis-6.0.5]# make

执行make之后好像没执行成功,报错了,

==================

[root@localhost redis-6.0.5]# make
cd src && make all
make[1]: 进入目录“/home/redissofts/redis-6.0.5/src”
    CC Makefile.dep
make[1]: 离开目录“/home/redissofts/redis-6.0.5/src”
make[1]: 进入目录“/home/redissofts/redis-6.0.5/src”
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark
rm -f adlist.d quicklist.d ae.d anet.d dict.d server.d sds.d zmalloc.d lzf_c.d lzf_d.d pqsort.d zipmap.d sha1.d ziplist.d release.d networking.d util.d object.d db.d replication.d rdb.d t_string.d t_list.d t_set.d t_zset.d t_hash.d config.d aof.d pubsub.d multi.d debug.d sort.d intset.d syncio.d cluster.d crc16.d endianconv.d slowlog.d scripting.d bio.d rio.d rand.d memtest.d crcspeed.d crc64.d bitops.d sentinel.d notify.d setproctitle.d blocked.d hyperloglog.d latency.d sparkline.d redis-check-rdb.d redis-check-aof.d geo.d lazyfree.d module.d evict.d expire.d geohash.d geohash_helper.d childinfo.d defrag.d siphash.d rax.d t_stream.d listpack.d localtime.d lolwut.d lolwut5.d lolwut6.d acl.d gopher.d tracking.d connection.d tls.d sha256.d timeout.d setcpuaffinity.d anet.d adlist.d dict.d redis-cli.d zmalloc.d release.d ae.d crcspeed.d crc64.d siphash.d crc16.d ae.d anet.d redis-benchmark.d adlist.d dict.d zmalloc.d siphash.d
(cd ../deps && make distclean)
make[2]: 进入目录“/home/redissofts/redis-6.0.5/deps”
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: 离开目录“/home/redissofts/redis-6.0.5/deps”
(rm -f .make-*)
echo STD=-std=c11 -pedantic -DREDIS_STATIC='' >> .make-settings
echo WARN=-Wall -W -Wno-missing-field-initializers >> .make-settings
echo OPT=-O2 >> .make-settings
echo MALLOC=jemalloc >> .make-settings
echo CFLAGS= >> .make-settings
echo LDFLAGS= >> .make-settings
echo REDIS_CFLAGS= >> .make-settings
echo REDIS_LDFLAGS= >> .make-settings
echo PREV_FINAL_CFLAGS=-std=c11 -pedantic -DREDIS_STATIC='' -Wall -W -Wno-missing-field-initializers -O2 -g -ggdb   -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
echo PREV_FINAL_LDFLAGS=  -g -ggdb -rdynamic >> .make-settings
(cd ../deps && make hiredis linenoise lua jemalloc)
make[2]: 进入目录“/home/redissofts/redis-6.0.5/deps”
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
(echo "" > .make-cflags)
(echo "" > .make-ldflags)
MAKE hiredis
cd hiredis && make static
make[3]: 进入目录“/home/redissofts/redis-6.0.5/deps/hiredis”
cc -std=c99 -pedantic -c -O3 -fPIC   -Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -g -ggdb net.c
make[3]: cc:命令未找到
make[3]: *** [net.o] 错误 127
make[3]: 离开目录“/home/redissofts/redis-6.0.5/deps/hiredis”
make[2]: *** [hiredis] 错误 2
make[2]: 离开目录“/home/redissofts/redis-6.0.5/deps”
make[1]: [persist-settings] 错误 2 (忽略)
    CC adlist.o
/bin/sh: cc: 未找到命令
make[1]: *** [adlist.o] 错误 127
make[1]: 离开目录“/home/redissofts/redis-6.0.5/src”
make: *** [all] 错误 2

======================================================

网上找说是没安装gcc,然后安装

安装的时候下载很慢,网上一顿搜索Yum下载慢 的问题

 

 

 

===============

开启 Redis 服务

在redis的安装目录下,进入到/home/redissofts/redis-6.0.5/utils这个目录下,找到redis_init_script这个文件,针对这个文件做了下修改,

其中
/home/redissofts/redis-6.0.5/etc

/home/redissofts/redis-6.0.5/bin

这两个目录都是新增的。

----------------------------------------------------------------------------------------------------

[root@localhost redissofts]# cd redis-6.0.5
[root@localhost redis-6.0.5]# ls
00-RELEASENOTES  COPYING  Makefile   redis.conf       runtest-moduleapi  src     utils
BUGS             deps     MANIFESTO  runtest          runtest-sentinel   tests
CONTRIBUTING     INSTALL  README.md  runtest-cluster  sentinel.conf      TLS.md
[root@localhost redis-6.0.5]#
[root@localhost redis-6.0.5]# ls
00-RELEASENOTES  COPYING  Makefile   redis.conf       runtest-moduleapi  src     utils
BUGS             deps     MANIFESTO  runtest          runtest-sentinel   tests
CONTRIBUTING     INSTALL  README.md  runtest-cluster  sentinel.conf      TLS.md
[root@localhost redis-6.0.5]# mkdir etc
[root@localhost redis-6.0.5]# ls
00-RELEASENOTES  COPYING  INSTALL    README.md   runtest-cluster    sentinel.conf  TLS.md
BUGS             deps     Makefile   redis.conf  runtest-moduleapi  src            utils
CONTRIBUTING     etc      MANIFESTO  runtest     runtest-sentinel   tests
[root@localhost redis-6.0.5]# pwd
/home/redissofts/redis-6.0.5
[root@localhost redis-6.0.5]# mv redis.conf /home/redissofts/redis-6.0.5/etc
[root@localhost redis-6.0.5]# ls
00-RELEASENOTES  COPYING  INSTALL    README.md        runtest-moduleapi  src     utils
BUGS             deps     Makefile   runtest          runtest-sentinel   tests
CONTRIBUTING     etc      MANIFESTO  runtest-cluster  sentinel.conf      TLS.md

 

[root@localhost redis-6.0.5]# mkdir bin
[root@localhost redis-6.0.5]# ls
00-RELEASENOTES  CONTRIBUTING  etc       MANIFESTO  runtest-cluster    sentinel.conf  TLS.md
bin              COPYING       INSTALL   README.md  runtest-moduleapi  src            utils
BUGS             deps          Makefile  runtest    runtest-sentinel   tests
[root@localhost redis-6.0.5]# cd src
[root@localhost src]# mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-server /home/redissofts/redis-6.0.5/bin/
[root@localhost src]# cd ../bin
[root@localhost bin]# ls
mkreleasehdr.sh  redis-benchmark  redis-check-aof  redis-check-rdb  redis-cli  redis-server
[root@localhost bin]#

----------------------------------------------------------------------------------------------------

主要修改了:

1,

EXEC=/home/redissofts/redis-6.0.5/bin/redis-server
CLIEXEC=/home/redissofts/redis-6.0.5/bin/redis-cli

PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/home/redissofts/redis-6.0.5/etc/${REDISPORT}.conf"

 

2,在该文件的第二行加了 # chkconfig 2345 90 10

service redis does not support chkconfig的解决办法

https://www.cnblogs.com/goodspeed/archive/2012/10/18/2729615.html

service redisd start

https://blog.csdn.net/Mrqiang9001/article/details/80295261

---------------------------------------------------------------------------

[root@localhost utils]# pwd
/home/redissofts/redis-6.0.5/utils
[root@localhost utils]# cp redis_init_script /etc/init.d/redisd
[root@localhost utils]# service redisd start
/var/run/redis_6379.pid exists, process is already running or crashed

----网上百度了下这个启动错误提示,按照一下的命令执行过后就能启动成功了:rm -rf redis_6379.pid

[root@localhost bin]# cd /var/run
[root@localhost run]# ls
auditd.pid   cryptsetup       firewalld    mount           setrans      tuned
chrony       dbus             initramfs    netreport       sshd.pid     udev
chronyd.pid  dmeventd-client  lock         NetworkManager  sudo         user
console      dmeventd-server  log          plymouth        syslogd.pid  utmp
crond.pid    ebtables.lock    lvm          redis_6379.pid  systemd      vmware
cron.reboot  faillock         lvmetad.pid  sepermit        tmpfiles.d   xtables.lock
[root@localhost run]# vi redis_6379.pid
[root@localhost run]# rm -rf redis_6379.pid


[root@localhost utils]# service redisd start
Starting Redis server...
8403:C 24 Jul 2020 13:57:56.631 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
8403:C 24 Jul 2020 13:57:56.631 # Redis version=6.0.5, bits=64, commit=00000000, modified=0, pid=8403, just started
8403:C 24 Jul 2020 13:57:56.631 # Configuration loaded
[root@localhost utils]#

[root@localhost utils]# ps -ef|grep redis
root       8434      1  0 14:00 ?        00:00:00 /home/redissofts/redis-6.0.5/bin/redis-server *:6379
root       8439   7667  0 14:00 pts/2    00:00:00 grep --color=auto redis
[root@localhost utils]#

 

 

下面的这个命令不知道有没有用,待研究

[root@localhost etc]# cp redis.conf 6379.conf
[root@localhost etc]# ls
6379.conf  redis.conf
[root@localhost etc]# cd /usr
[root@localhost usr]# ls

。。。由于时间问题,未完待续

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值