Respect originality: https://www.cnblogs.com/codersay/p/4301677.html , and correct the following red words
Redis official website address: http://www.redis.io/
1. Download the source code, decompress it and compile the source code.
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
cp redis.conf /usr/redis ( this file does not exist, it needs to be downloaded and imported from other places )
$ redis-server redis.conf is not the previous command, it is the latter command to start ( ./redis-server )
4. Then use the client to test whether the startup is successful.
$ redis-cli (./redis-cli)
If the installation process appears (refer to: http://blog.csdn.net/luyee2010/article/details/18766911 )
wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
sudo tar xzvf tcl8.6.1-src.tar.gz -C /usr/local/
cd /usr/local/tcl8.6.1/unix/
sudo ./configure
sudo make
sudo make install
[html] view plaincopy
-
vi /etc/redis.conf
-
#Find daemonize no to change to
-
#Run as a daemon
-
daemonize yes
-
#Modify dir ./ to absolute path,
-
#By default, redis-server will generate or read dump.rdb in the current directory when it starts
-
#So if you execute redis-server /etc/redis.conf in the root directory,
-
#Read the dump.rdb in the root directory, so that redis-server can be executed in any directory
-
#So change dir to absolute path here
-
dir /usr/local/redis
-
#Modify appendonly to yes
-
#Specify whether to log after each update operation,
-
#Redis writes data to disk asynchronously by default,
-
#If not turned on, it may cause data loss for a period of time when power is lost.
-
#Because redis itself synchronizes data files according to the save conditions above,
-
#So some data will only exist in memory for a period of time. Default is no
-
appendonly yes
-
#Add redis to self-startup
-
echo "/usr/local/bin/redis-server /etc/redis.conf" >> /etc/rc.d/rc.local
-
#start redis
-
redis-server /etc/redis.conf
-
#Check if redis has been started
-
ps -ef | grep redis
2>【Open redis port】
[html] view plaincopy
-
#Turn off the firewall
-
service iptables stop
-
vi /etc/sysconfig/iptables
-
#Add to
-
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT
-
#Restart firewall
-
service iptables restart
3>[Install phpredis extension]
[html] view plaincopy
-
tar -zxvf owlient-phpredis-2.1.1-1-g90ecd17.tar.gz
-
cd owlient-phpredis-90ecd17
-
/usr/local/php/bin/phpize
-
./configure --with-php-config=/usr/local/php/bin/php-config
-
make
-
make install
-
#After executing make install, it will be generated
-
#Installing shared extensions: /usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/
-
#Modify php.ini
-
vi /usr/local/php/etc/php.ini
-
#Find extension_dir and modify it to
-
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
-
#Add redis
-
extension = redis.so
-
# restart apache
-
service httpd restart