Linux 安装redis 和activemq

本文详细介绍了如何在Linux环境下安装Redis及ActiveMQ,并提供了Redis配置开机自启动的方法。包括下载、解压、编译安装步骤,以及通过脚本设置服务自启动的过程。

                              redis 

1.下载redis-2.8.22.tar.gz 包放在 /opt/Front 下

2. 解压tar zxvf redis-2.8.22.tar.gz

3. cd redis-2.8.22 进入解压包下,

    make 

4. cd src 

    ./redis-server

                             activemq

1.下载  apache-activemq-5.9.0-bin.tar.gz 包放在 /opt/Front 下

2. 解压tar zxvf apache-activemq-5.9.0-bin.tar.gz

3. cd /opt/Front/apache-activemq-5.9.0/bin
    进入解压包下,

    ./activemq

4.启动 ./activemq start


redis 开机自启动 具体操作,实验有效

(1.复制redis_init_script 到/etc/init.d/redis下 2.修改安装路径 3.添加服务)


1、拷贝 redis 安装目前下的 /usr/local/redis-4.0.2/utils/redis_init_script 到 /etc/init.d/redis文件中;

cp /usr/local/redis-4.0.2/utils/redis_init_script /etc/init.d/redis
  • 1

2、修改/etc/init.d/redis 文件。修改redis安装的相关文件安装目录

#!/bin/sh
# chkconfig: 2345 10 90  
# description: Start and Stop redis

# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.

REDISPORT=6379
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli

PIDFILE=/var/run/redis_${REDISPORT}.pid
#CONF="/etc/redis/${REDISPORT}.conf"
CONF="/usr/local/redis-4.0.2/redis.conf"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

这里写图片描述

#!/bin/sh
# chkconfig: 2345 10 90  
# description: Start and Stop redis
  • 1
  • 2
  • 3

备注:上面的注释的意思是,redis服务必须在运行级2,3,4,5下被启动或关闭,启动的优先级是90,关闭的优先级是10。从redis 安装目录中拷贝过来,可能没有,需要添加 上去; 否则 chkconfig 命令 会失败;

3、开机启动设置,执行一下命令:

  • 添加redis服务:
chkconfig --add redis
  • 1
  • 设为开机启动 :
chkconfig redis on
  • 1
  • 打开redis命令:
service redis start
  • 1
  • 关闭redis命令:
service redis stop
  • 1

4、重启动检查 
init 6

ps -ef|grep redis

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值