- memcached的安装
- 安装libevent
[[email protected] ~]# wget https://cloud.github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz [[email protected] ~]# tar zxvf libevent-2.0.19-stable.tar.gz [[email protected] ~]# cd libevent-2.0.19-stable [[email protected] libevent-2.0.19-stable]# ./configure --prefix=/usr/ [[email protected] libevent-2.0.19-stable]# make && make install
2.安装memcached
[[email protected] ~]# wget http://www.memcached.org/files/memcached-1.4.22.tar.gz [[email protected] ~]# tar zxvf memcached-1.4.22.tar.gz [[email protected] memcached-1.4.22]# ./configure --prefix=/usr/local/memcached --with-libevent=/usr/ [[email protected] memcached-1.4.22]# make && make install
- magent的安装
magent是一款开源的Memcached代理服务器软件,其项目网址为:
[[email protected] ~]# tar zxvf magent-0.6.tar.gz [[email protected] ~]# mkdir /usr/local/magent [[email protected] magent]# tar zxvf magent-0.6.tar.gz ketama.c ketama.h magent.c Makefile [[email protected] magent]# make gcc -Wall -g -O2 -I/usr/local/include -m64 -c -o magent.o magent.c magent.c: In function ‘writev_list’: magent.c:729: error: ‘SSIZE_MAX’ undeclared (first use in this function) magent.c:729: error: (Each undeclared identifier is reported only once magent.c:729: error: for each function it appears in.) make: *** [magent.o] Error 1 解决方法: [[email protected] magent]# vim ketama.h #ifndef SSIZE_MAX #define SSIZE_MAX 32767 #endif #ifndef _KETAMA_H #define _KETAMA_H struct dot { unsigned int point; int srvid; }; struct ketama { unsigned int numpoints; struct dot *dot; int count; char **name; int *weight; int totalweight; }; int create_ketama(struct ketama *, int); void free_ketama(struct ketama *); int get_server(struct ketama *, const char *); #endif [[email protected] magent]# make gcc -Wall -g -O2 -I/usr/local/include -m64 -o magent magent.o ketama.o /usr/lib64/libevent.a /usr/lib64/libm.a gcc: /usr/lib64/libevent.a: No such file or directory gcc: /usr/lib64/libm.a: No such file or directory make: *** [magent] Error 1 解决方案: [[email protected] magent]# ln -svf /usr/lib/libevent* /usr/lib64/ `/usr/lib64/libevent-2.0.so.5‘ -> `/usr/lib/libevent-2.0.so.5‘ `/usr/lib64/libevent-2.0.so.5.1.7‘ -> `/usr/lib/libevent-2.0.so.5.1.7‘ `/usr/lib64/libevent.a‘ -> `/usr/lib/libevent.a‘ `/usr/lib64/libevent_core-2.0.so.5‘ -> `/usr/lib/libevent_core-2.0.so.5‘ `/usr/lib64/libevent_core-2.0.so.5.1.7‘ -> `/usr/lib/libevent_core-2.0.so.5.1.7‘ `/usr/lib64/libevent_core.a‘ -> `/usr/lib/libevent_core.a‘ `/usr/lib64/libevent_core.la‘ -> `/usr/lib/libevent_core.la‘ `/usr/lib64/libevent_core.so‘ -> `/usr/lib/libevent_core.so‘ `/usr/lib64/libevent_extra-2.0.so.5‘ -> `/usr/lib/libevent_extra-2.0.so.5‘ `/usr/lib64/libevent_extra-2.0.so.5.1.7‘ -> `/usr/lib/libevent_extra-2.0.so.5.1.7‘ `/usr/lib64/libevent_extra.a‘ -> `/usr/lib/libevent_extra.a‘ `/usr/lib64/libevent_extra.la‘ -> `/usr/lib/libevent_extra.la‘ `/usr/lib64/libevent_extra.so‘ -> `/usr/lib/libevent_extra.so‘ `/usr/lib64/libevent.la‘ -> `/usr/lib/libevent.la‘ `/usr/lib64/libevent_pthreads-2.0.so.5‘ -> `/usr/lib/libevent_pthreads-2.0.so.5‘ `/usr/lib64/libevent_pthreads-2.0.so.5.1.7‘ -> `/usr/lib/libevent_pthreads-2.0.so.5.1.7‘ `/usr/lib64/libevent_pthreads.a‘ -> `/usr/lib/libevent_pthreads.a‘ `/usr/lib64/libevent_pthreads.la‘ -> `/usr/lib/libevent_pthreads.la‘ `/usr/lib64/libevent_pthreads.so‘ -> `/usr/lib/libevent_pthreads.so‘ `/usr/lib64/libevent.so‘ -> `/usr/lib/libevent.so‘ [[email protected] magent]# make gcc -Wall -g -O2 -I/usr/local/include -m64 -o magent magent.o ketama.o /usr/lib64/libevent.a /usr/lib64/libm.a gcc: /usr/lib64/libm.a: No such file or directory make: *** [magent] Error 1 解决方案: 如果是64bit的系统则不会在/usr/lib64/libm.a 生成,如果是32bit即会有 [[email protected] magent]# yum install glibc glibc-devel [[email protected] magent]# cp /usr/lib64/libm.so /usr/lib64/libm.a [[email protected] magent]# make gcc -Wall -g -O2 -I/usr/local/include -m64 -o magent magent.o ketama.o /usr/lib64/libevent.a /usr/lib64/libm.a /usr/lib64/libevent.a(event.o): In function `gettime‘: /usr/local/src/libevent-2.0.19-stable/event.c:366: undefined reference to `clock_gettime‘ /usr/lib64/libevent.a(event.o): In function `detect_monotonic‘: /usr/local/src/libevent-2.0.19-stable/event.c:336: undefined reference to `clock_gettime‘ collect2: ld returned 1 exit status make: *** [magent] Error 1 解决方案: [[email protected] magent]# vim Makefile CFLAGS = -Wall -g -O2 -I/usr/local/include $(M64) 改为: CFLAGS = -lrt -Wall -g -O2 -I/usr/local/include $(M64) [[email protected] magent]# make gcc -lrt -Wall -g -O2 -I/usr/local/include -m64 -o magent magent.o ketama.o /usr/lib64/libevent.a /usr/lib64/libm.a [[email protected] magent]# ls 终于成功了- -! ketama.c ketama.h ketama.o magent magent-0.6.tar.gz magent.c magent.o Makefile [[email protected] magent]# cp magent /bin/
时间: 2024-10-19 00:21:08