参考资料:http://www.cnblogs.com/handongyu/p/6419305.html

        http://coolnull.com/1986.html

一、安装libevent

首先检查系统中是否安装了libevent

[root@yeebian ~]# rpm -qa | grep libevent

如果安装了则查看libevent的安装路径,后续安装时需要用到

[root@yeebian ~]# rpm -ql libevent

如果没有安装,则先安装libevent

[root@yeebian ~]# cd /opt
[root@yeebian opt]# wget http://192.168.10.173:8080/website/linux/libevent-1.4.12-stable.tar.gz
[root@yeebian opt]# tar -zxvf libevent-1.4.12-stable.tar.gz
[root@yeebian opt]# cd libevent-1.4.12-stable
[root@yeebian libevent-1.4.12-stable]# ./configure -prefix=/opt/libevent/
[root@yeebian libevent-1.4.12-stable]# make && make install
[root@yeebian libevent-1.4.12-stable]# ldconfig #为了让动态链接库为系统所共享,需要执行以下动态链接库的管理命令ldconfig

二、安装memcached

[root@yeebian libevent-1.4.12-stable]# cd /opt
[root@yeebian opt]# wget http://192.168.10.173:8080/website/linux/memcached-1.4.33.tar.gz
[root@yeebian opt]# tar -zxvf memcached-1.4.33.tar.gz
[root@yeebian opt]# cd memcached-1.4.33
[root@yeebian memcached-1.4.33]#./configure --prefix=/opt/memcached-1.4.33/ --with-libevent=/opt/libevent/
[root@yeebian memcached-1.4.33]# make && make install
[root@yeebian memcached-1.4.33]# /opt/memcached-1.4.33/memcached -u root -d -m 128 -p 11211

三、设置memcached为开机自启动

[root@yeebian memcached-1.4.33]# cd /opt/
[root@yeebian opt]# wget http://192.168.10.173:8080/website/linux/memcached.sysv
[root@yeebian opt]# mv memcached.sysv /opt/memcached-1.4.33/scripts/memcached.sysv
[root@yeebian opt]# chmod 775 /opt/memcached-1.4.33/scripts/memcached.sysv
[root@yeebian opt]# cp /opt/memcached-1.4.33/scripts/memcached.sysv /etc/rc.d/init.d/memcached
[root@yeebian opt]# chkconfig --add memcached
[root@yeebian opt]# chkconfig memcached on
[root@yeebian opt]# service memcached restart
Stopping memcached: [ OK ]
Starting memcached: [ OK ]
[root@yeebian opt]# chkconfig | grep memcached
Self-starter configuration...
memcached 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@yeebian opt]# ps aux | grep memcached | grep 11211
Memcached progress...
root 9394 1.0 0.0 341484 3368 ? Ssl 16:31 0:00 /opt/memcached-1.4.33/memcached -d -p 11211 -u root -m 128 -c 1024 -P /var/run/memcached/memcached.pid

memcached.sysv启动脚本是我提前修改好上传到本地服务器的,脚本内容如下:

#! /bin/sh
#
# chkconfig: - 55 45
# description: The memcached daemon is a network memory cache service.
# processname: memcached
# config: /etc/sysconfig/memcached # Source function library.
. /etc/rc.d/init.d/functions PORT=11211
USER=root
MAXCONN=1024
CACHESIZE=128
OPTIONS="" if [ -f /etc/sysconfig/memcached ];then
. /etc/sysconfig/memcached
fi # Check that networking is up.
if [ "$NETWORKING" = "no" ]
then
exit 0
fi RETVAL=0
prog="memcached" start () {
echo -n $"Starting $prog: "
# insure that /var/run/memcached has proper permissions
# chown $USER /var/run/memcached
daemon /opt/memcached-1.4.33/memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached.pid $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached
}
stop () {
echo -n $"Stopping $prog: "
killproc memcached
RETVAL=$?
echo
if [ $RETVAL -eq 0 ] ; then
rm -f /var/lock/subsys/memcached
rm -f /var/run/memcached/memcached.pid
fi
} restart () {
stop
start
} # See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status memcached
;;
restart|reload)
restart
;;
condrestart)
[ -f /var/lock/subsys/memcached ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
exit 1
esac exit $?

  

CentOS6.8下安装memcached并设置开机自启动的更多相关文章

  1. centos下安装memcached并设置开机自动启动-两种方法

    方法一: 安装memcachedyum install memcached 启动服务并初始化service memcached start -p 11211 -l 127.0.0.1 -d 设置mem ...

  2. centos 6.5系统下安装ibus及设置开机自启动

    先说一下系统环境:centos 6.5,然后我是以root身份执行的,没有权限的用户参见sudo用法 第1步:查找并安装ibus安装包,命令如下: 找到一行: ibus-pinyin.x86_64 : ...

  3. CentOS6.8下安装redis并配置开机自启动

    参考资料:http://www.bubuko.com/infodetail-1006383.html   http://www.cnblogs.com/skyessay/p/6433349.html ...

  4. CentOS下安装zookeeper并设置开机自启动

    转自: 一.安装zookeeper # cd /opt/ # mkdir zookeeper # cd zookeeper/ # tar -zxvf zookeeper-3.4.6.tar.gz # ...

  5. CentOS6.5 下安装 texlive2015 并设置 ctex 中文套装

    0 卸载旧版本的 texlive 0.1 卸载 texlive2007 如果系统没有安装过texlive,则跳过第0步. 可以在终端中使用如下命令查询本机已经安装的tex和latex版本: [She@ ...

  6. CentOS 7安装Mysql并设置开机自启动

    CentOS 7不带Mysql数据库了,默认的数据库是MariaDB(Mysql的一个分支). 可以按照以下步骤手动安装Mysql数据库. 1. 下载rpm安装文件 wget http://repo. ...

  7. CentOS 7安装Mysql并设置开机自启动的方法

    CentOS 7不带Mysql数据库了,默认的数据库是MariaDB(Mysql的一个分支). 可以按照以下步骤手动安装Mysql数据库. 1. 下载rpm安装文件 ? 1 wget http://r ...

  8. 在CentOS6.5下安装Memcached

    CentOS 6.5 安装软件非常方便, yum install memcached

  9. Windows 下安装redis 并且设置开机自动启动的过程.

    1. 下载redis 的 windows下的安装文件 https://github.com/MicrosoftArchive/redis/releasesmsi文件下载地址https://github ...

随机推荐

  1. PAT L2-011 玩转二叉树

    https://pintia.cn/problem-sets/994805046380707840/problems/994805065406070784 给定一棵二叉树的中序遍历和前序遍历,请你先将 ...

  2. Analyze a docker instance start failure

      错误信息:Cannot start container xxxxxxxxxxx | Error getting container xxxxxxxxxxxxxxx  from driver dev ...

  3. 设备 VMnet0 上的网桥当前未运行。此虚拟机无法与主机或网络中的其他计算机通信。

    http://www.cnblogs.com/baihuitestsoftware/articles/4223552.html 因为试用Windows10教育版下的Docker打开过Hyper-V,虽 ...

  4. 关于js中this指向的理解总结!

    关于js中this指向的理解! this是什么?定义:this是包含它的函数作为方法被调用时所属的对象. 首先,this的指向在函数定义的时候是确定不了的,只有函数执行的时候才能确定this到底指向谁 ...

  5. [转帖]Nginx的超时keeplive_timeout配置详解

    Nginx的超时keeplive_timeout配置详解 https://blog.csdn.net/weixin_42350212/article/details/81123932   Nginx  ...

  6. Oracle一次可以查询多个表的结果的方法

    select (select count(1) from gspauresult) 权限总表, (select count(1) from gspau01result) 权限总表1, (select ...

  7. Linux下数据库备份恢复过程

    1. 远程进入Linux服务器. 2. 一般登录的是root用户, 第一步切换到Oracle用户, 命令: su - oracle 3. 查看服务器上面数据库的监听的状况 lsnrctl 之后输入命令 ...

  8. 修改maven的默认jdk版本

    问题: 创建maven项目的时候,jdk版本默认使用的是1.5版本. 解决: 1.修改maven的settings.xml文件,添加如下: <profile> <id>jdk- ...

  9. Java之Date Time API (Java 8 新特性)

    Java 8 – Date Time API Java 8 comes with a much improved and much required change in the way date an ...

  10. instanceof判断的对象可以是接口

    instanceof是Java的一个二元操作符(运算符) 用法 boolean result = object instanceof class instanceof通过返回一个布尔值来指出,这个对象 ...