centos6 一键配置部署nginx php-fpm redis httpsqs

慕俊语
2023-12-01
#安装163的源
/etc/yum.repos.d
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
yum makecache
yum update
#关闭httpd
chkconfig httpd off
yum -y install vim (:set nu!)
#安装nginx的源
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum -y install nginx
yum -y install gcc gcc-c++
#安装php
yum -y install php-fpm php-common php-gd php-pdo php-cli php-devel php-xml php-mbstring php-ldap php-pear php-xmlrpc php-curl php-sockets
chkconfig php-fpm on
chkconfig sshd on
chkconfig nginx on
/etc/init.d/php-fpm restart

#下载phpredis
https://github.com/nicolasff/phpredis
https://github.com/nicolasff/phpredis/archive/master.zip
./phpize
./configure
make&&make install
/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/

#下载httpsqs扩展
http://code.google.com/p/php-httpsqs-client/downloads/list
http://php-httpsqs-client.googlecode.com/files/php_httpsqs_client_0.2.1.tar.gz
./phpize
./configure
make&&make install
/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
vim /etc/php.ini
extension=redis.so;
extension=httpsqs.so;

#防火墙
vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
/etc/init.d/iptables restart
##############################################################
#httpsqs的类
wget http://httpsqs.googlecode.com/files/libevent-2.0.12-stable.tar.gz
tar zxvf libevent-2.0.12-stable.tar.gz
cd libevent-2.0.12-stable/
./configure --prefix=/usr/local/libevent-2.0.12-stable/
make
make install
cd ../
 
wget http://httpsqs.googlecode.com/files/tokyocabinet-1.4.47.tar.gz
tar zxvf tokyocabinet-1.4.47.tar.gz
cd tokyocabinet-1.4.47/
./configure --prefix=/usr/local/tokyocabinet-1.4.47/
#注1:在32位Linux操作系统上编译Tokyo cabinet,请使用./configure --enable-off64代替./configure,可以使 数据库文件突破2GB的限制。
 
#./configure --enable-off64 --prefix=/usr/local/tokyocabinet-1.4.47/
#注2:bzlib.h is required,如果出现这个错误,可以这样安装所需要的lib
#yum install zlib* make*
#yum install bzip* make*
make
make install
cd ../
 #安装httpsqs
wget http://httpsqs.googlecode.com/files/httpsqs-1.7.tar.gz
tar zxvf httpsqs-1.7.tar.gz
cd httpsqs-1.7/
make
make install
cd ../
ulimit -SHn 65535
httpsqs -d -p 1218 -x /data0/queue  
###########################################################
#redis-server安装
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum install redis

############################################################
防火墙
iptables -I INPUT -p tcp --dport 6379  -j ACCEPT
iptables -I INPUT -p tcp --dport 1218  -j ACCEPT
service iptables save
/etc/init.d/iptables restart
##############################################################
#支持php路径和php优化
mkdir -p /usr/local/php/
ln -s /usr/bin /usr/local/php/bin
vim /etc/php.ini
date.timezone = "Asia/Shanghai"
error_reporting = E_ALL & ~E_NOTICE
#################################################################
开机后根据需要运行
/etc/init.d/redis restart
ulimit -SHn 65535
httpsqs -d -p 1218 -x /data0/queue

 类似资料: