Objective
This article records the installation and configuration of memcached in Linux CentOS 7.
Installation
Before installing memcached, I need to install Libevent first, the version I use here is:? libevent-2.0.22? memcached-1.4.25
First upload these two installation files to a Linux server, it is best to check the installation before decompression, starting from libevent: Rpm-q libevent
The discovery system has installed a version of Libevent: Write a picture description here
Now that we have installed a version of Libevent, we will first uninstall it and then install our own libevent, the uninstall command is as follows: Rpm-e--nodeps libevent-2.0.21-4.el7.x86_64
After the successful uninstall, we can decompress the installation libevent, the command is as follows: TAR-ZXVF libevent-2.0.22-stable.tar.gz
After decompression, the installation package is still removed first: RM-RF libevent-2.0.22-stable.tar.gz
Next go to the Libevent directory, specify the installation location and start the installation and compilation:./configure--prefix=/usr/libevent
However, it seems that the error: here to write a picture description
The hint is clear that the C compiler could not be found, so we should install GCC first and install the command as follows: Yum-y install GCC
Perform installation until installation is complete: Write a picture description here
The next step is to install and compile Libevent: Here's a picture description
You can see the successful execution of the Configure, and finally compile and install: make makes install
After successfully installing Libevent, you can install memcached, first perform decompression: TAR-ZXVF memcached-1.4.25.tar.gz
But again the error: here to write a picture description
Hint is clear, not in gzip format, that is, the official memcached package is not compressed in gzip format, so in the decompression also do not add-Z, directly with-XVF can, so the correct decompression command is as follows: TAR-XVF Memcached-1.4.25.tar.gz
After the successful decompression is still the first to delete the compressed package: RM-RF memcached-1.4.25.tar.gz
The next step is to enter the memcached installation directory to perform configure, note the path to the specified installation path and libevent:./configure--prefix=/usr/memcached--with-libevent=/usr/ Libevent
Finally, it's still compiling and installing: Make make Install
This memcached even if the installation is successful.
Start
After the installation succeeds, enter the memcached bin directory to execute the boot:./memcached-u root-d
It is best to set memcache to boot, open/etc/rc.local with the VI command and append the following configuration at the tail:/usr/local/memcached/bin/memcached-u root-d
Finally, look at the operating status of Memcached: Ps-ef |grep memcached
If you see the following information, it shows that memcached is working properly: write a picture description here
Stop it
Stop memcached is also very simple, first need to check the memcached process PID, query command as follows: Pgrep memcached
The query results are as follows: Write a picture description here
Then kill the process according to the PID (-9 means force kill), the command is as follows: Kill-9 25645
This article is from the Linux commune website (www.linuxidc.com) Source Link: http://www.linuxidc.com/Linux/2016-09/135553.htm
Linux CentOS 7 under memcached installation and configuration