Home>Article>Backend Development> CentOS6.9 source code compilation and installation of redis and php-redis extension

CentOS6.9 source code compilation and installation of redis and php-redis extension

藏色散人
藏色散人 forward
2019-05-10 10:02:06 2663browse

This article will introduce you to the process of compiling and installing redis from source code in CentOS6.9, starting it, and compiling and installing the php-redis extension from source code

1. Create and enter the source code saving directory , download the source code package, unzip

mkdir -p /usr/local/src cd /usr/local/src wget -c http://download.redis.io/releases/redis-4.0.10.tar.gz tar -zxvf redis-4.0.10.tar.gz cd redis-4.0.10

2. Compile and install

#安装依赖 yum -y install gcc gcc-c++ make MALLOC=libc make PREFIX=/usr/local/redis install

3. Configure

#创建配置文件目录 mkdir -p /usr/local/redis/etc/ #将源码目录下的redis.conf复制到etc cp /usr/local/src/redis-4.0.10/redis.conf /usr/local/redis/etc/ #修改redis.conf vim /usr/local/redis/etc/redis.conf daemonize yes #redis以守护进程的方式运行 #配置环境变量 vim /etc/profile PATH=$PATH:/usr/local/redis/bin export PATH #立即生效 source /etc/profile

4. Set up startup

#将redis的启动脚本复制一份放到/etc/init.d目录下 cp /usr/local/src/redis-4.0.10/utils/redis_init_script /etc/init.d/redisd #创建/etc/redis目录,复制redis.conf mkdir -p /etc/redis cp /usr/local/redis/etc/redis.conf /etc/redis/6379.conf #进入/etc/init.d cd /etc/init.d #修改启动脚本 vim redisd #修改服务的位置 EXEC=/usr/local/redis/bin/redis-server #修改命令行工具的位置 CLIEXEC=/usr/local/redis/bin/redis-cli #开机启动 chkconfig redisd on

5. Start redisd

[root@jmsite init.d]# service redisd start Starting Redis server... 118991:C 21 Dec 08:39:46.508 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 118991:C 21 Dec 08:39:46.509 # Redis version=4.0.10, bits=64, commit=00000000, modified=0, pid=118991, just started 118991:C 21 Dec 08:39:46.509 # Configuration loaded

6. Install php-redis extension

#Enter the source code saving directory, download and unzip

cd /usr/local/src wget -c http://pecl.php.net/get/redis-4.2.0.tgz tar -zxvf redis-4.2.0.tgz cd redis-4.2.0

#Generate configure file

/usr/local/php72/bin/phpize #这是我的phpize的位置

#Configure, compile, install

./configure --with-php-config=/usr/local/php72/bin/php-config make -j4 make install

#Add the redis extension to php.ini

echo "extension=redis.so" >> /usr/local/php72/etc/php.ini

#Restart php and check phpinfo();

CentOS6.9 source code compilation and installation of redis and php-redis extension

The above is the detailed content of CentOS6.9 source code compilation and installation of redis and php-redis extension. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jmsite.cn. If there is any infringement, please contact admin@php.cn delete