【1】下载Redis安装包 wgethttp://download.redis.io/releases/redis-2.8.13.tar.gz 注:wget 时提示 -bash:wget command not found,很明显没有安装wget软件包。一般linux最小化安装时,wget不会默认被安装,这里是CentOS 6.3 32位系统
解决方法:(本人采用的是yum安装yum -y install wget,详见【安装wget】)
下载截图:
[iyunv@kf55 tmp]# tar -zxvf redis-2.8.13.tar.gz 注:【2】之后的操作都需要使用root权限。 【3】编译 [iyunv@kf55 tmp]#cd redis-2.8.11/ linux系统用 make MALLOC=libc mac os x系统用 make MALLOC=jemalloc 编译打印: [iyunv@kf55 redis-2.8.13]# make MALLOC=libc cd src && make all make[1]: Entering directory`/tmp/redis-2.8.13/src' rm -rf redis-server redis-sentinelredis-cli redis-benchmark redis-check-dump redis-check-aof *.o *.gcda *.gcno*.gcov redis.info lcov-html (cd ../deps && make distclean) make[2]: Entering directory`/tmp/redis-2.8.13/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]: Leaving directory`/tmp/redis-2.8.13/deps' (rm -f .make-*) echo STD=-std=c99 -pedantic >>.make-settings echo WARN=-Wall >> .make-settings echo OPT=-O2 >> .make-settings echo MALLOC=libc >> .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=c99 -pedantic-Wall -O2 -g -ggdb -I../deps/hiredis-I../deps/linenoise -I../deps/lua/src >> .make-settings echo PREV_FINAL_LDFLAGS= -g -ggdb -rdynamic >> .make-settings (cd ../deps && make hiredislinenoise lua) make[2]: Entering directory`/tmp/redis-2.8.13/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-ldflags) (echo "" > .make-cflags) MAKE hiredis cd hiredis && make static make[3]: Entering directory`/tmp/redis-2.8.13/deps/hiredis' cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings-g -ggdb net.c cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings-g -ggdb hiredis.c cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings-g -ggdb sds.c cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings-g -ggdb async.c ar rcs libhiredis.a net.o hiredis.o sds.oasync.o make[3]: Leaving directory`/tmp/redis-2.8.13/deps/hiredis' MAKE linenoise cd linenoise && make make[3]: Entering directory`/tmp/redis-2.8.13/deps/linenoise' cc -Wall -Os -g -c linenoise.c make[3]: Leaving directory`/tmp/redis-2.8.13/deps/linenoise' MAKE lua cd lua/src && make allCFLAGS="-O2 -Wall -DLUA_ANSI " MYLDFLAGS="" make[3]: Entering directory`/tmp/redis-2.8.13/deps/lua/src' cc -O2 -Wall -DLUA_ANSI -c -o lapi.o lapi.c cc -O2 -Wall -DLUA_ANSI -c -o lcode.o lcode.c cc -O2 -Wall -DLUA_ANSI -c -o ldebug.o ldebug.c cc -O2 -Wall -DLUA_ANSI -c -o ldo.o ldo.c cc -O2 -Wall -DLUA_ANSI -c -o ldump.o ldump.c cc -O2 -Wall -DLUA_ANSI -c -o lfunc.o lfunc.c cc -O2 -Wall -DLUA_ANSI -c -o lgc.o lgc.c cc -O2 -Wall -DLUA_ANSI -c -o llex.o llex.c cc -O2 -Wall -DLUA_ANSI -c -o lmem.o lmem.c cc -O2 -Wall -DLUA_ANSI -c -o lobject.o lobject.c cc -O2 -Wall -DLUA_ANSI -c -o lopcodes.o lopcodes.c cc -O2 -Wall -DLUA_ANSI -c -o lparser.o lparser.c cc -O2 -Wall -DLUA_ANSI -c -o lstate.o lstate.c cc -O2 -Wall -DLUA_ANSI -c -o lstring.o lstring.c cc -O2 -Wall -DLUA_ANSI -c -o ltable.o ltable.c cc -O2 -Wall -DLUA_ANSI -c -o ltm.o ltm.c cc -O2 -Wall -DLUA_ANSI -c -o lundump.o lundump.c cc -O2 -Wall -DLUA_ANSI -c -o lvm.o lvm.c cc -O2 -Wall -DLUA_ANSI -c -o lzio.o lzio.c cc -O2 -Wall -DLUA_ANSI -c -o strbuf.o strbuf.c cc -O2 -Wall -DLUA_ANSI -c -o lauxlib.o lauxlib.c cc -O2 -Wall -DLUA_ANSI -c -o lbaselib.o lbaselib.c cc -O2 -Wall -DLUA_ANSI -c -o ldblib.o ldblib.c cc -O2 -Wall -DLUA_ANSI -c -o liolib.o liolib.c cc -O2 -Wall -DLUA_ANSI -c -o lmathlib.o lmathlib.c cc -O2 -Wall -DLUA_ANSI -c -o loslib.o loslib.c cc -O2 -Wall -DLUA_ANSI -c -o ltablib.o ltablib.c cc -O2 -Wall -DLUA_ANSI -c -o lstrlib.o lstrlib.c cc -O2 -Wall -DLUA_ANSI -c -o loadlib.o loadlib.c cc -O2 -Wall -DLUA_ANSI -c -o linit.o linit.c cc -O2 -Wall -DLUA_ANSI -c -o lua_cjson.o lua_cjson.c cc -O2 -Wall -DLUA_ANSI -c -o lua_struct.o lua_struct.c cc -O2 -Wall -DLUA_ANSI -c -o lua_cmsgpack.o lua_cmsgpack.c ar rcu liblua.a lapi.o lcode.o ldebug.oldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.olstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o strbuf.o lauxlib.olbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o loadlib.olinit.o lua_cjson.o lua_struct.o lua_cmsgpack.o # DLL needs all object files ranlib liblua.a cc -O2 -Wall -DLUA_ANSI -c -o lua.o lua.c cc -o lua lua.o liblua.a -lm liblua.a(loslib.o): In function`os_tmpname': loslib.c:(.text+0x35): warning: the use of`tmpnam' is dangerous, better use `mkstemp' cc -O2 -Wall -DLUA_ANSI -c -o luac.o luac.c cc -O2 -Wall -DLUA_ANSI -c -o print.o print.c cc -o luac luac.o print.o liblua.a -lm make[3]: Leaving directory`/tmp/redis-2.8.13/deps/lua/src' make[2]: Leaving directory`/tmp/redis-2.8.13/deps' CC adlist.o CC ae.o CC anet.o anet.c: 在函数‘anetSockName’中: anet.c:535: 警告:dereferencing pointer ‘s’ does breakstrict-aliasing rules anet.c:533: 附注:initialized from here anet.c:539: 警告:dereferencing pointer ‘s’ does breakstrict-aliasing rules anet.c:537: 附注:initialized from here anet.c: 在函数‘anetPeerToString’中: anet.c:513: 警告:dereferencing pointer ‘s’ does breakstrict-aliasing rules anet.c:511: 附注:initialized from here anet.c:517: 警告:dereferencing pointer ‘s’ does breakstrict-aliasing rules anet.c:515: 附注:initialized from here anet.c: 在函数‘anetTcpAccept’中: anet.c:481: 警告:dereferencing pointer ‘s’ does breakstrict-aliasing rules anet.c:479: 附注:initialized from here anet.c:485: 警告:dereferencing pointer ‘s’ does breakstrict-aliasing rules anet.c:483: 附注:initialized from here CC dict.o CC redis.o CC sds.o CC zmalloc.o CC lzf_c.o CC lzf_d.o CC pqsort.o CC zipmap.o CC sha1.o CC ziplist.o CC release.o CC networking.o CC util.o CC object.o CC db.o db.c: 在函数‘scanGenericCommand’中: db.c:420: 警告:此函数中的‘pat’在使用前可能未初始化 db.c:421: 警告:此函数中的‘patlen’在使用前可能未初始化 CC replication.o CC rdb.o CC t_string.o CC t_list.o CC t_set.o CC t_zset.o CC t_hash.o CC config.o CC aof.o CC pubsub.o CC multi.o CC debug.o CC sort.o CC intset.o CC syncio.o CC migrate.o CC endianconv.o CC slowlog.o CC scripting.o CC bio.o CC rio.o CC rand.o CC memtest.o CC crc64.o CC bitops.o CC sentinel.o CC notify.o CC setproctitle.o CC hyperloglog.o CC latency.o CC sparkline.o LINK redis-server INSTALL redis-sentinel CC redis-cli.o LINK redis-cli CC redis-benchmark.o LINK redis-benchmark CC redis-check-dump.o LINK redis-check-dump CCredis-check-aof.o LINK redis-check-aof Hint: To run 'make test' is a good idea ;) make[1]: Leaving directory`/tmp/redis-2.8.13/src' [iyunv@kf55 redis-2.8.13]# 【4】测试编译是否成功:make test make test时出现一下错误提示: You need tcl 8.5 or newer in order to runthe Redis test make: *** [test] Error 1 则需要安装tcl,详见【安装tcl】,安装成功后,make test便可以顺利通过。 (或者参考:http://www.linuxfromscratch.org/blfs/view/cvs/general/tcl.html) 出现一下打印表示测试通过: 【5】安装,make install 出现一下错误时,切换root用户重新make install即可。 install: cannot create regular file ‘/usr/local/bin/redis-server’: Permission denied make[1]: *** [install] Error 1 make[1]: Leaving directory`/home/kevent/Templates/redis-2.8.9/src' 成功后,可以看到: [iyunv@localhost redis-2.8.9]#ls /usr/local/bin/ iconv redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server 有的版本没有拷贝,需要手动拷贝: udo cpredis-server /usr/local/bin/ sudo cpredis-cli /usr/local/bin/ 【6】启动服务器并测试:redis-server 启动后的打印 【6】配置Redis服务器并测试 [iyunv@kf55 redis-2.8.13]# cd utils/ [iyunv@kf55 utils]# ls build-static-symbols.tcl install_server.sh redis_init_script speed-regression.tcl generate-command-help.rb mkrelease.sh redis_init_script.tpl whatisdoing.sh hyperloglog redis-copy.rb redis-sha1.rb [iyunv@kf55 utils]# [iyunv@kf55 utils]# ./install_server.sh 检测是否配置成功并运行:redis-cli ping返回PONG 则运行OK
【8】更改redis_6379服务的名字
[iyunv@kf55utils]# cd /etc/init.d/
[
root@kf55init.d]# ls -l
总用量 172
-rwxr-xr-x.1 root root 3378 5月 28 22:37 auditd
-r-xr-xr-x.1 root root 1340 11月 24 2013 blk-availability
-rwxr-xr-x.1 root root 2826 11月 23 2013 crond
-rw-r--r--.1 root root 19175 7月 10 21:47 functions
-rwxr-xr-x.1 root root 5866 10月 10 2013 halt
-rwxr-xr-x.1 root root 10804 11月 23 2013 ip6tables
-rwxr-xr-x.1 root root 10688 11月 23 2013 iptables
-rwxr-xr-x.1 root root 4535 10月 8 2013 iscsi
-rwxr-xr-x.1 root root 3990 10月 8 2013 iscsid
-rwxr-xr-x.1 root root 652 10月 10 2013 killall
-r-xr-xr-x.1 root root 2134 11月 24 2013 lvm2-lvmetad
-r-xr-xr-x.1 root root 2665 11月 24 2013 lvm2-monitor
-rwxr-xr-x.1 root root 2571 4月 7 2014 mdmonitor
-rwxr-xr-x.1 root root 2523 6月 23 15:37 multipathd
-rwxr-xr-x.1 root root 2989 10月 10 2013 netconsole
-rwxr-xr-x.1 root root 5428 10月 10 2013 netfs
-rwxr-xr-x.1 root root 6334 10月 10 2013 network
-rwxr-xr-x.1 root root 1923 7月 15 2013 ntpd
-rwxr-xr-x.1 root root 2043 7月 15 2013 ntpdate
-rwxr-xr-x.1 root root 3912 2月 20 2014 postfix
-rwxr-xr-x.1 root root 1513 9月 17 2013 rdisc
-rwxr-xr-x.1 root root 1677 10月 9 14:17 redis_6379
-rwxr-xr-x.1 root root 1822 11月 23 2013 restorecond
-rwxr-xr-x.1 root root 2011 8月 15 2013 rsyslog
-rwxr-xr-x.1 root root 1698 11月 23 2013 sandbox
-rwxr-xr-x.1 root root 2056 11月 20 2012 saslauthd
-rwxr-xr-x.1 root root 647 10月 10 2013 single
-rwxr-xr-x.1 root root 4534 11月 23 2013 sshd
-rwxr-xr-x.1 root root 1144 11月 23 2013 sysstat
-rwxr-xr-x.1 root root 2294 11月 23 2013 udev-post
[
root@kf55init.d]# mv redis_6379 redis
【9】刚才已经启动服务,现在使用service关闭服务和开启服务
[
root@kf55init.d]# service redis stop
Stopping...
Waitingfor Redis to shutdown ...
Redisstopped
[
root@kf55init.d]#
[
root@kf55init.d]# service redis start
StartingRedis server...
[
root@kf55init.d]#
【10】用客户端连接测试
[iyunv@kf55 init.d]# redis-cli
127.0.0.1:6379>
127.0.0.1:6379>set mykey 123
OK
127.0.0.1:6379> get mykey
"123"
127.0.0.1:6379>quit
[
root@kf55init.d]#
【11】根据自己的需求修改配置,并重启Redis服务
Redis配置文件所在目录为:/etc/redis/6379.conf
修改“#maxclients 10000” 为”maxclients 10000”,目前限制连接数10000,修改后续重启Redis服务。
[iyunv@kf55 init.d]# service redisrestart
Stopping ...
Redis stopped
Starting Redis server...
[iyunv@kf55 init.d]#
【12】安装Redis C语音API——hiredis包
[iyunv@kf55src]# cd /tmp/redis-2.8.13
[
root@kf55redis-2.8.13]# ls
00-RELEASENOTES COPYING Makefile redis.conf sentinel.conf utils
BUGS deps MANIFESTO runtest src
CONTRIBUTING INSTALL README runtest-sentinel tests
[
root@kf55redis-2.8.13]# cd deps/hiredis/
[iyunv@kf55hiredis]# make;make install
cc-shared -Wl,-soname,libhiredis.so.0.11 -o libhiredis.so net.o hiredis.o sds.o async.o
mkdir -p/usr/local/include/hiredis /usr/local/lib
cp -ahiredis.h async.h adapters /usr/local/include/hiredis
cp -alibhiredis.so /usr/local/lib/libhiredis.so.0.11
cd/usr/local/lib && ln -sf libhiredis.so.0.11 libhiredis.so.0
cd/usr/local/lib && ln -sf libhiredis.so.0 libhiredis.so
cp -alibhiredis.a /usr/local/lib
[iyunv@kf55hiredis]#
[iyunv@kf55hiredis]# ls
adapters CHANGELOG.md examples hiredis.o net.c sds.c zmalloc.h
async.c COPYING fmacros.h libhiredis.a net.h sds.h
async.h dict.c hiredis.c
libhiredis.so net.o sds.o
async.o dict.h hiredis.h Makefile README.md test.c
[iyunv@kf55hiredis]#
这种方式安装的安装库,没有到达默认目录,需要我们拷贝动态库到系统lib目录,(若是32系统只需要运行 cp libhiredis.so /usr/lib)
[iyunv@kf55hiredis]# cp libhiredis.so /usr/lib64/
[iyunv@kf55hiredis]# cp libhiredis.so /usr/lib/
【13】更新一下系统动态库配置
[iyunv@kf55hiredis]# /sbin/ldconfig
1、rpm 安装
下载wget的RPM包:
rpm ivhwget-1.12-1.4.el6.i686.rpm安装即可;64位当然选择wget-1.12-1.4.el6.x86_64.rpm了
2、yum安装
yum -y install wget
【安装
tcl
】
(1)下载tcl命令:wget -c
http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
(2)解压 tar -zxvf tcl8.6.1-src.tar.gz
(3)编译 cd tcl8.6.1/ 后,将一下命令作为一条命令运行
#################################################
cd unix &&
./configure --prefix=/usr \
--without-tzdata \
--mandir=/usr/share/man \
$([ $(uname -m) = x86_64 ] && echo --enable-64bit) &&
make &&
sed -e"s@^\(TCL_SRC_DIR='\).*@\1/usr/include'@" \
-e"/TCL_B/s@='\(-L\)\?.*unix@='\1/usr/lib@" \
-i tclConfig.sh
#################################################
打印太多了,就不贴图了,安装的时间比较久,大概5分钟。
(4)测试安装是否成功:make test
有如下显示即表示测试成功:
Tcl8.6.1 tests running in interp: /tmp/tcl8.6.1/unix/pkgs/thread2.7.0/../../tcltest
Testsrunning in working dir: /tmp/tcl8.6.1/pkgs/thread2.7.0/tests
Onlyrunning tests that match: *
Skippingtest files that match: l.*.test
Onlysourcing test files that match: *.test
Testsbegan at Thu Oct 09 11:26:08 CST 2014
Thread2.7.0
Mainthreadid is tid0x7fc51f847700
thread.test
tpool.test
tsv.test
ttrace.test
Testsended at Thu Oct 09 11:26:23 CST 2014
all.tcl: Total 116 Passed 116 Skipped 0 Failed 0
Sourced0 Test Files.
(5)安装 用root用户运行下面命令:
#################################################
make install &&
make install-private-headers &&
ln -v -sf tclsh8.6 /usr/bin/tclsh &&
chmod -v 755 /usr/lib/libtcl8.6.so
#################################################
截取部分打印:
(6)安装OptionalDocumentation,运行一下命令,
解压,在tcl8.6.1/目录解压 tar -xf ../tcl8.6.1-html.tar.gz --strip-components=1
安装,注意此时是接着(5)操作的,所以当前所在目录为tcl8.6.1/unix
#################################################
mkdir -v -p /usr/share/doc/tcl-8.6.1&&
cp -v -r ../html/* /usr/share/doc/tcl-8.6.1
#################################################
|
Redis2.8.13安装配置
最新推荐文章于 2024-08-26 16:22:53 发布