搭建CentOS7.x环境(nginx+mariaDB+php7) YUM安装方式

2017-01-13 10:48:16来源:oschina作者:Jarvix人点击

虽然我的是腾讯云的服务器,但是我还是找了阿里云的yum安装教程,先试着安装,还是发现了不少需要注意的地方。


https://ninghao.net/blog/1368


从前面设置密码开始一步步按照教程走,到安装仓库IUS命令的时候,发现报错了,好像是找不到什么来着,当时没注意,继续往下执行了。知道安装完nginx都没什么问题,配置好nginx后,打开网址:



nginx就安装好了,接着我选择安装没mariadb,因为我按照教程安装PHP出现了很多错误。


http://www.cnblogs.com/starof/p/4680083.html


查资料发现是CentOS 7 版本将MySQL数据库软件从默认的程序列表中移除,用mariadb代替了。所以选择安装mriadb。


按照这个教程里面的方法一也顺利安装好了mariadb


接着安装PHP:https://www.zybuluo.com/gabe/note/241786


按照这里面安装,命令都加sudo就ok了


统计了一下安装php7的命令


sudo yum update


yum install -y gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel


sudo yum install -y gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel


cd /usr/src/


ls -la


ll


wget http://cn2.php.net/distributions/php-7.0.0.tar.gz


sudo wget http://cn2.php.net/distributions/php-7.0.0.tar.gz


tar -zxvg php-7.0.0.tar.gz


tar -zxvf php-7.0.0.tar.gz


sudo tar -zxvf php-7.0.0.tar.gz


cd php-7.0.0/


./configure --prefix=/usr/local/php7 --with-mysql-sock --with-mysqli --enable-fpm--enable-soap --with-libxml-dir --with-openssl --with-mcrypt --with-mhash --with-pcre-regex--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-pdo-mysql --with-zlib-dir--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-intl


php -v


make


make install


sudo make test


sudo make


sudo make install


/usr/local/php7/bin/php -v


ln -sf /usr/local/php7/bin/php /usr/local/bin/php


sudo ln -sf /usr/local/php7/bin/php /usr/local/bin/php


php -v


cp php.ini-development /usr/local/php7/lib/php.ini


sudo cp php.ini-development /usr/local/php7/lib/php.ini


sudo cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf


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


sudo cp /usr/src/php-7.0.0/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm


sudo chmod +x /etc/init.d/php-fpm


service php-fpm start


service nginx restart


sudo service php-fpm start


cd /usr/share/nginx/html/

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台