redis 6.2.5源码包制作rpm包——筑梦之路

redis 6.2.5源码包制作rpm包教程

源码地址:https://download.redis.io/releases/redis-6.2.5.tar.gz

依赖包:gcc make  tcl bash jemalloc

环境:
centos 7 

yum install epel-release -y

yum install rpm-build gcc make tcl jemalloc -y

redis.spec

Name: redis
Version:6.2.5
Release: 1%{?dist}
Summary:redis

Group:Applications/Archiving
License:GPL
URL: http://redis.io
Source0:redis-6.2.5.tar.gz

BuildRequires: gcc
Requires: bash,jemalloc

%description
redis server and client

%prep
%setup -q
mkdir -p /usr/local/redis/conf
mkdir -p /usr/local/redis/data
mkdir -p /usr/local/redis/logs

%build

make %{?_smp_mflags}

%install
rm -rf

make install PREFIX=%{buildroot}/usr/local/redis

%files
/usr/local/redis

%doc
%post
mkdir -p /usr/local/redis/{conf,data,logs}

echo "Unit]
Description=Redis server v6.2.5  daemon
After=network.target
 
[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf --daemonize yes 
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/usr/local/redis/bin/redis-cli -p 6379 shutdown
User=root
Group=root
PrivateTmp=true
 
[Install]
WantedBy=multi-user.target" > /usr/lib/systemd/system/redis-server.service

echo 'daemonize yes
pidfile /var/run/redis/redis.pid
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 0
loglevel notice
logfile "/usr/local/redis/logs/redis.log"
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /usr/local/redis/data
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
bind 127.0.0.1
appendonly yes
appendfsync no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
' > /usr/local/redis/conf/redis.conf

chown -R root:root /usr/local/redis
systemctl daemon-reload
systemctl start redis-server.service > /dev/null 2>&1
systemctl enable redis-server.service > /dev/null 2>&1

%changelog
%clean
%preun
#/usr/local/redis/bin/redis-cli shutdown

%postun
rm -rf /usr/local/redis
rm -rf /etc/systemd/system/multi-user.target.wants/redis-server.service
rm -rf /usr/lib/systemd/system/redis-server.service


rpmbuild -ba redis.spec

已经制作好的rpm包见我的资源

说明:

安装位置:/usr/local/redis/bin

配置文件位置:/usr/local/redis/conf

数据存放位置:/usr/local/redis/data

日志存放位置:/usr/local/redis/logs

你可能感兴趣的:(linux系统运维,redis,数据库)