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

雖然個人是騰訊雲的服務器,可是我仍是找了阿里雲的yum安裝教程,先試着安裝,仍是發現了很多須要注意的地方。php

https://ninghao.net/blog/1368html

從前面設置密碼開始一步步按照教程走,到安裝倉庫IUS命令的時候,發現報錯了,好像是找不到什麼來着,當時沒注意,繼續往下執行了。知道安裝完nginx都沒什麼問題,配置好nginx後,打開網址:mysql

nginx就安裝好了,接着我選擇安裝沒mariadb,由於我按照教程安裝PHP出現了不少錯誤。nginx

http://www.cnblogs.com/starof/p/4680083.htmlc++

查資料發現是CentOS 7 版本將MySQL數據庫軟件從默認的程序列表中移除,用mariadb代替了。因此選擇安裝mriadb。sql

按照這個教程裏面的方法一也順利安裝好了mariadb數據庫

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

按照這裏面安裝,命令都加sudo就ok了api

統計了一下安裝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/

相關文章
相關標籤/搜索