centos6 安裝 redis、phpredis、phpredisadmin


先安裝 redis

[root@localhost ~]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

[root@localhost ~]# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

[root@localhost ~]# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm


[root@localhost ~]# yum install redis -y

[root@localhost ~]# service  redis  start
Starting redis-server:                                     [  OK  ]
[root@localhost ~]# chkconfig redis on
[root@localhost ~]# yum list | grep redis
redis.x86_64                                2.4.10-1.el6                 @epel
hiredis.i686                                0.10.1-3.el6                 epel
hiredis.x86_64                              0.10.1-3.el6                 epel
hiredis-devel.i686                          0.10.1-3.el6                 epel
hiredis-devel.x86_64                        0.10.1-3.el6                 epel
php-nrk-Predis.noarch                       0.8.6-1.el6                  epel
php-pecl-redis.x86_64                       2.2.7-1.el6                  epel
php-redis.x86_64                            2.2.2-5.git6f7087f.el6       epel
python-redis.noarch                         2.0.0-1.el6                  epel
uwsgi-logger-redis.x86_64                   2.0.11.1-1.el6               epel
uwsgi-router-redis.x86_64                   2.0.11.1-1.el6               epel
[root@localhost ~]# ps aux | grep redis
redis     1891  0.0  0.6  39936  6988 ?        Ssl  14:03   0:00 /usr/sbin/redis-server /etc/redis.conf
root      1930  0.0  0.0 103304   888 pts/1    S+   14:04   0:00 grep redis

[root@localhost ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]

[root@localhost ~]# redis-cli set foo bar
OK
[root@localhost ~]# redis-cli get foo
"bar"

[root@localhost ~]# yum  -y  install  telnet

[root@localhost ~]# telnet 127.0.0.1 6379
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
set foo 3
+OK
get foo
$1
3
^C
^]
^]'
quit
+OK
Connection closed by foreign host.

安裝 lamp

yum install php php-pear mysql mysql-server httpd php-devel gcc-c++

更新 pecl

pecl channel-update pecl.php.net

使用 pecl 安裝 php redis

pecl install redis

在 php.ini 中

找到extension_dir,後面地址改為/usr/lib64/php/modules
增加 extension=redis.so
extension=mbstring.so

安裝 php-mbstring

yum -y install php-mbstring


安裝 phpredisadmin
git clone https://github.com/nrk/predis.git
git clone https://github.com/ErikDubbelboer/phpRedisAdmin.git
cd phpRedisAdmin
git submodule init
git submodule update
mv phpRedisAdmin /var/www/html/
mv predis /var/www/html/phpRedisAdmin

留言

這個網誌中的熱門文章

c語言-關於#define用法

CMD常用網管指令

PHP 與 JavaScript 之間傳值利用 json