centos 7.4 服务器环境安装-aliyun

安装

yum install -y screen vim

vim /etc/hostname




yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel autoconf -y

php

下载http://php.net/get/php-7.1.3.tar.gz/from/a/mirror

tar zxvf php-7.1.3.tar.gz
cd php-7.1.3

./configure --prefix=/usr/local/php --enable-fpm --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-libxml-dir --with-xmlrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear --enable-opcache



make & make install

出错:
libtool: link: `ext/opcache/ZendAccelerator.lo' is not a valid libtool object


解决办法: make clean

然后运行: make
最后: make install



Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/
Installing PHP CLI binary:        /usr/local/php/bin/
Installing PHP CLI man page:      /usr/local/php/php/man/man1/
Installing PHP FPM binary:        /usr/local/php/sbin/
Installing PHP FPM defconfig:     /usr/local/php/etc/
Installing PHP FPM man page:      /usr/local/php/php/man/man8/
Installing PHP FPM status page:   /usr/local/php/php/php/fpm/
Installing phpdbg binary:         /usr/local/php/bin/
Installing phpdbg man page:       /usr/local/php/php/man/man1/
Installing PHP CGI binary:        /usr/local/php/bin/
Installing PHP CGI man page:      /usr/local/php/php/man/man1/
Installing build environment:     /usr/local/php/lib/php/build/
Installing header files:          /usr/local/php/include/php/
Installing helper programs:       /usr/local/php/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php/lib/php/
[PEAR] Archive_Tar    - installed: 1.4.2
[PEAR] Console_Getopt - installed: 1.4.1
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util       - installed: 1.4.2
[PEAR] PEAR           - installed: 1.10.3
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/root/src/php-7.1.3/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f phar.phar /usr/local/php/bin/phar
Installing PDO headers:           /usr/local/php/include/php/ext/pdo/



cp php.ini-production /usr/local/php/lib/php.ini

cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
cp php-fpm.d/www.conf.default  php-fpm.d/www.conf

cd php-7.1.3
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm

yaf扩展

参考: http://php.net/manual/zh/yaf.installation.php

http://pecl.php.net/package/yaf 下载最新的 yaf


tar zxvf yaf-3.0.6.tgz

cd yaf-3.0.6

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


cd /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303

修改 php.ini
增加:
[yaf]
extension = yaf.so


extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/"

Redis 及 PHP扩展

1.download redis
http://redis.io/download
wget http://download.redis.io/releases/redis-4.0.8.tar.gz

redis-4.0.8.tar.gz

2.tar zxvf redis-4.0.8.tar.gz

cd redis-4.0.8

make

cp src/redis-benchmark src/redis-cli src/redis-server src/redis-sentinel /usr/local/bin/

cp redis.conf /usr/local/src/
vim /etc/rc.local
增加 :
/usr/local/bin/redis-server /usr/local/src/redis.conf

3.安装 redis php 驱动

yum install git -y 

#git clone https://github.com/nicolasff/phpredis

#cd phpredis

#/usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config
# make
# make install

#vim /usr/local/lib/php.ini
 增加:
    extension=redis.so

//重启php-fpm
#killall php-fpm
#/usr/local/sbin/php-fpm

即可使用 redis

Mecached && PHP Memecached 扩展

yum install libevent-devel libevent -y


wget http://www.memcached.org/files/memcached-1.5.4.tar.gz


tar zxvf memcached-1.5.4.tar.gz

 /usr/local/php/bin/phpize 
 
 ./configure --prefix=/usr/local/memcached
 
 make
 make install
 
 
 
yum install -y g++ c++

wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz

tar zxvf libmemcached-1.0.18.tar.gz

./configure

make
make install

扩展安装
参考: http://php.net/manual/zh/memcached.installation.php

yum install cyrus-sasl-devel cyrus-sasl -y

wget http://pecl.php.net/get/memcached-3.0.4.tgz

tar zxvf memcached-3.0.4.tgz

./configure --with-php-config=/usr/local/php/bin/php-config  
//./configure --with-php-config=/usr/local/php/bin/php-config  --disable-memcached-sasl


make

make install


php.ini增加扩展:

[memcache]
extension = memcache.so

Openresty

参考: http://openresty.org/cn/linux-packages.html

yum install yum-utils

Percona

参考:https://www.percona.com/doc/percona-server/LATEST/installation/yum_repo.html

Supervisor


easy_install supervisor 

Installing echo_supervisord_conf script to /usr/bin 
Installing pidproxy script to /usr/bin 
Installing supervisorctl script to /usr/bin 
Installing supervisord script to /usr/bin 


wget https://pypi.python.org/packages/source/s/supervisor/supervisor-3.2.2.tar.gz
#tar zxvf supervisor-3.2.2.tar.gz 
#cd supervisor-3.2.2 
#python setup.py install

echo_supervisord_conf > /etc/supervisord.conf

supervisord -c /etc/supervisord.conf

vim /etc/supervisord.conf


;[include]
;files = relative/directory/*.ini

>>



mac:

/usr/local/bin/supervisorctl status

/usr/local/bin/supervisord -c /etc/supervisord.conf

supervisorctl reload

 killall supervisord
supervisord -c /etc/supervisord.conf
 supervisorctl start all
 supervisorctl status
 supervisorctl restart all
 supervisorctl stop all


demo

/etc/supervisord.conf.d/message.conf
[program:message]
command = php message.php
directory = /home/www/html/ycg/cron
process_name = %(program_name)s_%(process_num)s
numprocs = 1
autorestart = true
startsecs = 1



参考

http://type.so/linux/supervisor-install-and-configure.html

/etc/rc.local

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值