CentOS 7 原始碼編譯安裝 Redis

2021-09-07 19:06:28 字數 2789 閱讀 6671

wget 

tar -xzf redis-4.0.10.tar.gz

cd redis-4.0.10

yum -y install gcc gcc-c++ kernel-devel

make

等待編譯完成

make prefix=/usr/local/redis install

mkdir /usr/local/redis/etc/

cp redis.conf /usr/local/redis/etc/

cd /usr/local/redis/bin/

cp redis-benchmark redis-cli redis-server /usr/bin/

vim /usr/local/redis/etc/redis.conf

# 修改一下配置

# redis以守護程序的方式執行

# no表示不以守護程序的方式執行(會占用乙個終端)

daemonize yes

# 客戶端閒置多長時間後斷開連線,預設為0關閉此功能

timeout 300

# 設定redis日誌級別,預設級別:notice

loglevel verbose

# 設定日誌檔案的輸出方式,如果以守護程序的方式執行redis 預設:""

# 並且日誌輸出設定為stdout,那麼日誌資訊就輸出到/dev/null裡面去了

logfile stdout

# 設定密碼授權

requirepass 《設定密碼》

# 監聽ip

bind 127.0.0.1

vim /etc/profile

export path="$path:/usr/local/redis/bin"

# 儲存退出

# 讓環境變數立即生效

source /etc/profile

#!/bin/bash

#chkconfig: 2345 80 90

# ****** redis init.d script conceived to work on linux systems

# as it does use of the /proc filesystem.

path=/usr/local/bin:/sbin:/usr/bin:/bin

redisport=6379

exec=/usr/local/redis/bin/redis-server

redis_cli=/usr/local/redis/bin/redis-cli

pidfile=/var/run/redis.pid

conf="/usr/local/redis/etc/redis.conf"

case "$1" in

start)

if [ -f $pidfile ]

then

echo "$pidfile exists, process is already running or crashed"

else

echo "starting redis server..."

$exec $conf

fiif [ "$?"="0" ]

then

echo "redis is running..."

fi;;

stop)

if [ ! -f $pidfile ]

then

echo "$pidfile does not exist, process is not running"

else

pid=$(cat $pidfile)

echo "stopping ..."

$redis_cli -p $redisport shutdown

while [ -x $ ]

doecho "waiting for redis to shutdown ..."

sleep 1

done

echo "redis stopped"

fi;;

restart|force-reload)

$ stop

$ start

;;*)

echo "usage: /etc/init.d/redis " >&2

exit 1

esac

# 複製指令碼檔案到init.d目錄下

cp redis /etc/init.d/

# 給指令碼增加執行許可權

chmod +x /etc/init.d/redis

# 檢視服務列表

chkconfig --list

# 新增服務

chkconfig --add redis

# 配置啟動級別

chkconfig --level 2345 redis on

systemctl start redis   #或者 /etc/init.d/redis start  

systemctl stop redis #或者 /etc/init.d/redis stop

# 檢視redis程序

ps -el|grep redis

# 埠檢視

netstat -an|grep 6379

Centos 7 原始碼編譯安裝mysql

1.安裝相關包 yum install bison bison devel zlib devel libcurl devel libarchive devel boostdevel gcc gcc c cmake ncurses devel gnutls devel libxml2 devel op...

centos7編譯原始碼安裝nginx

1 安裝依賴 yum y install gcc zlib zlib devel pcre devel openssl openssl devel 下面說說這些依賴 gcc 因為nginx是由c編寫的,gcc gnu compiler collection,gnu編譯器套件 是由 gnu 開發的程式...

Centos7原始碼編譯安裝python3

解決方法 修改為其他映象源 例如阿里的yum 1.mv etc yum.repos.d centos base.repo etc yum.repos.d centos base.repo.backup 做事前最好留一手 備份 2.wget o etc yum.repos.d centos base....