• Home
    • English
    • 中文
  • About Us
  • Services
    • SEO Services
    • Website Design Service
  • Projects
  • Docs
  • Blog
    • Affiliate
    • Ecommerce
    • Frontend
    • linux
      • nginx
    • PHP
      • Magento
      • wordpress
    • Python
    • SEO
    • Web
  • Contact Us

Subscribe to Updates

Get the latest creative news from FooBar about art, design and business.

What's Hot

Design a plugin for wordpress woocommerce to display a tab to show attachment download

2024-04-06

TranslatePress v2.6.9 – WordPress Translation Plugin

2023-12-25

A Linux batch script converting pictures to webp format

2023-07-10
Facebook Twitter Instagram
  • 中文
  • English
Facebook Twitter Instagram Pinterest VKontakte
Weilai Tech Weilai Tech
  • Home
    • English
    • 中文
  • About Us
  • Services
    • SEO Services
    • Website Design Service
  • Projects
  • Docs
  • Blog
    • Affiliate
    • Ecommerce
    • Frontend
    • linux
      • nginx
    • PHP
      • Magento
      • wordpress
    • Python
    • SEO
    • Web
  • Contact Us
Weilai Tech Weilai Tech
Home»Uncategorized»centos 7 yum install memcached
Uncategorized

centos 7 yum install memcached

OxfordBy Oxford2020-05-26No Comments2 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter LinkedIn Pinterest Email

linux下配置使用memcache功能,比win下稍微复杂一点,主要包括:安装libevent函数库、安装memcached、配置php扩展。

一、安装libevent函数库
libevent各版本地址:http://libevent.org/old-releases.html
在此我安装当前最稳定版本:libevent-2.0.21
1.下载:#

wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
2.解压:

#tar -zxvf libevent-2.0.21-stable.tar.gz
3 配置及编译安装:

#cd ibevent-2.0.21-stable
#./configure --prefix=/usr/local/libevent-2.0.21-stable 
#make
#make install
(我安装到了/usr/local/libevent-2.0.21-stable/下)

4.检查是否安装成功:

#ls -al /usr/local/libevent-2.0.21-stable/lib | grep libevent

这里写图片描述

二、安装memcached

memcached各版本下载地址:https://github.com/memcached/memcached/wiki/ReleaseNotes
在此我安装当前最稳定版本: memcache-1.5.9
1.下载:#wget http://memcached.org/files/memcached-1.5.9.tar.gz
2.解压:#tar -zxvf memcached-1.5.9.tar.gz
3. 配置及编译安装:

#cd memcached-1.4.32
#./configure -with-libevent=/usr/local/libevent-2.0.21-stable/ --prefix=/usr/local/memcached-1.5.9
#make
#make install

(同样安装到了/usr/local/memcached-1.5.9/下)
4.查看是否安装成功:
这里写图片描述

5.安装成功后启动一下看安装是否成功

# /usr/local/memcached-1.5.9/bin/memcached -d -m 1028 -p 11211 -u root

# ps -ef|grep memcached

 

6、配置开机自启动

# vim /etc/init.d/memcached

#! /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=nobody
MAXCONN=1024
CACHESIZE=64
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 /usr/local/java/memcached-1.5.9
daemon /usr/local/java/memcached-1.5.9/bin/memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /usr/local/java/memcached-1.5.9/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 /usr/local/java/memcached-1.5.9/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 /usr/local/java/memcached-1.5.9 ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
exit 1
esac

exit $?


并通过chmod命令赋予权限执行命令:

chmod 755 /etc/init.d/memcached

将memcached加入系统服务

执行命令:

# chkconfig --add memcached

# chkconfig memcached on

启动memcached服务

执行命令:

# service memcached start

通过命令 ps -ef|grep memcached 查看memcached服务是否启动成功,如果没有成功,检查脚本里的memcached目录是否正确,或者memcached是否安装完整。

reboot重启linux ,然后再用ps命令查看memcached是否自启动成功

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Avatar photo
Oxford

Related Posts

nginx multi sub domain proxy

2021-06-05

How TO – Position Text Over an Image

2021-05-24

bootstrapstudio.io

2021-03-25

how to get wordpress theme getmetrix and google speed insight 100 scores?

2021-03-12
Recent Posts
  • Design a plugin for wordpress woocommerce to display a tab to show attachment download
  • TranslatePress v2.6.9 – WordPress Translation Plugin
  • A Linux batch script converting pictures to webp format
  • Hearing aid listed company official website SEO case
  • how to use docker to run php5.6 plus apache
May 2020
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031
« Apr   Jun »
Tags
app branding design digital Docly docs etc faq fix github Helpdesk Image issue magento Manual marketing memecached Photography planing seo sequrity tips Travel ui/ux web WordPress 爬虫
Editors Picks
About Us

Guangzhou Weilai Technology is a foreign trade integrated marketing service provider focusing on Google as the drainage center and marketing self-built website as the carrier.

Email Us: [email protected]
Contact: +86 18676917505

Facebook Pinterest YouTube LinkedIn
Recent Posts
  • Design a plugin for wordpress woocommerce to display a tab to show attachment download
  • TranslatePress v2.6.9 – WordPress Translation Plugin
  • A Linux batch script converting pictures to webp format
  • Hearing aid listed company official website SEO case
  • how to use docker to run php5.6 plus apache
From Flickr
Website Design Case
© 2024 Copyright by Guangzhou Weilai Technology Co.,Ltd..
  • Home
  • About Us
  • SEO Services
  • Website Design Service
  • Projects
  • Blog
  • Contact Us

Type above and press Enter to search. Press Esc to cancel.