debian系統安裝最新lnmp編譯最新php7.1.2及nginx1.10.3及mysql5.7及5.6
aptitude 安裝nginx/mysql,編譯安裝php7.1.2
Created 星期四 23 二月 2017
一、配置映象源,預設debian沒有Nginx最新版本,以及php7.0版本(編譯安裝),mysql5.7版本!
1.1 vim /etc/apt/sources.list 新增如下
deb http://nginx.org/packages/debian/ jessie nginx
deb-src http://nginx.org/packages/debian/ jessie nginx
完成後匯入key
#wget http://nginx.org/packages/keys/nginx_signing.key
#apt-key add nginx_signing.key
1.2安裝mysql社群版本5.7
wget https://repo.mysql.com//mysql-apt-config_0.8.2-1_all.deb
dpkg -i mysql-apt-config_0.8.2-1_all.deb
選擇對應的版本,有5.6及5.7兩個版本,還有工具。
安裝Nginx1.10.3
aptitude install nginx
檢視版本
root@user:~# /usr/sbin/nginx -v
nginx version: nginx/1.10.3
安裝mysql
aptitude install mysql-server-5.6
版本資訊:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 3
Server version: 5.6.35 MySQL Community Server (GPL)
編譯安裝php7.1.2
make編譯安裝
build-essential autoconf automake libtool bison re2c
依賴包安裝(大部分依賴包都在此若是還缺少請查詢)
libxml2-dev libssl-dev libbz2-dev libjpeg-dev libpng-dev
libxpm-dev libfreetype6-dev libgmp-dev libgmp3-dev
libmcrypt-dev libmysqlclient15-dev libpspell-dev librecode-dev
libcurl4-gnutls-dev libgmp-dev libgmp3-dev librecode-dev
libpspell-dev libmysqlclient15-dev libmcrypt-dev
libreadline-dev libtidy-dev libxslt-dev -y
openssl報錯:
ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/
或者編譯安裝
wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
tar zxf openssl-1.0.2k.tar.gz
cd openssl-1.0.2k
./config
make && make install
下載php7.1.2
wget http://cn2.php.net/distributions/php-7.1.2.tar.gz
tar zxf php-7.1.2.tar.gz
cd php-7.1.2
./configure –prefix=/usr/local/php7 –sysconfdir=/etc/php7
–with-config-file-path=/etc/php7 –enable-fpm –with-mysqli=mysqlnd
–with-pdo-mysql=mysqlnd –with-mhash –with-openssl –with-zlib
–with-bz2 –with-curl –with-libxml-dir –with-gd –with-jpeg-dir –with-png-dir
–with-zlib –enable-mbstring –with-mcrypt –enable-sockets –with-iconv-dir
–with-xsl –enable-zip –with-pcre-dir –with-pear –enable-session
–enable-gd-native-ttf –enable-xml –with-freetype-dir –enable-gd-jis-conv
–enable-inline-optimization –enable-shared –enable-bcmath
–enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-mbregex
–enable-pcntl –with-xmlrpc –with-gettext –enable-exif –with-readline
–with-recode –with-tidy
編譯安裝
make && make install
配置nginx php檔案
配置檔案都在/etc目錄下,先備份好
#cd /etc/nginx
#cp nginx.conf nginx.conf.bak
#vim nginx.conf
把user XXX;改成如下:
user www-data;
退出在進入
cd conf.d/
cp default.conf default.conf.bak
vim default.conf
修改成如下:
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ .php$ {
root /usr/share/nginx/html;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
配置php檔案
#cd /etc/php7
#cp php-fpm.conf.default php-fpm.conf
# cd /etc/php7/php-fpm.d
# cp www.conf.default www.conf.default.bak
# mv www.conf.default lnmp.conf
# vim lnmp.conf
user = nobody 改成 user = www-data
group = nobody 改成 group = www-data
listen = 127.0.0.1:9000改成listen = /run/php/php7.0-fpm.sock
listen.owner = www-data 取消註釋改成如此
listen.group = www-data 取消註釋改成如此
listen.mode = 0660 取消註釋改成如此
然後在解壓的安裝包裡複製php.ini-production 在/etc/php7/目錄下。
啟動服務
/etc/init.d/nginx start /restart /stop
/usr/local/php7/sbin/php-fpm
/etc/init.d/mysql start
或者
啟動服務
systemctl start mysql.service (stop)
systemctl start nginx.service (stop)
檢視啟動狀態
systemctl status nginx.service
systemctl status mysql.service
注意若是啟動服務報錯,可以看下是否有/run/php,若無請建立目錄,然後賦予php7.0-fpm.sock 許可權
程式
root@user:~# ps -ef | grep php-fpm
root 1070 1 0 10:33 ? 00:00:00 php-fpm: master process (/etc/php7/php-fpm.conf)
www-data 1071 1070 0 10:33 ? 00:00:00 php-fpm: pool www
www-data 1072 1070 0 10:33 ? 00:00:00 php-fpm: pool www
root 1106 1065 0 10:42 pts/0 00:00:00 grep php-fpm
root@user:~# ps -ef | grep nginx
root 512 1 0 10:29 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
www-data 513 512 0 10:29 ? 00:00:00 nginx: worker process
root 1108 1065 0 10:42 pts/0 00:00:00 grep nginx
root@user:~# ps -ef | grep mysql
mysql 1179 1 0 10:47 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql 1455 1179 1 10:47 ? 00:00:00 /usr/sbin/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib/mysql/plugin –log-error=/var/log/mysql/error.log –pid-file=/var/run/mysqld/mysqld.pid –socket=/var/run/mysqld/mysqld.sock –port=3306
root 1505 1065 0 10:47 pts/0 00:00:00 grep mysql
結束程式
killall php-fpm
大部分報錯都可以進入cat /var/log/nginx/error.log檢視,然後google!
!!!!附件
本文一鍵安裝lnmp指令碼,需要聯網,但資料庫為debian8預設mysql5.5!,取消TXT字尾。
相關文章
- yum方式安裝及配置最新的mysql5.7MySql
- Debian11系統編譯安裝MySQL5.7教程。編譯MySql
- 編譯安裝最新的Linux系統核心編譯Linux
- Linux編譯安裝MySQL5.6及修改字符集Linux編譯MySql
- debian安裝及使用mysqlMySql
- windows安裝及配置mysql5.7WindowsMySql
- 國內CRM系統最新排行及優點
- Android NDK開發掃盲及最新CMake的編譯使用Android編譯
- Debian9 (Stretch) 下編譯安裝 LNMP 環境編譯LNMP
- Debian9(Stretch) 下編譯安裝LNMP環境編譯LNMP
- Debian11系統編譯安裝Nginx教程。編譯Nginx
- Debian11系統編譯安裝PHP教程。編譯PHP
- Debian11系統編譯安裝Apache教程。編譯Apache
- Debian11系統編譯安裝Docker教程。編譯Docker
- Debian11系統編譯安裝Memcached教程。編譯
- Debian11系統編譯安裝Redis教程。編譯Redis
- Typescript安裝及編譯《CMD命令列方法》TypeScript編譯命令列
- MySQL免編譯安裝及登入(5.6.36)MySql編譯
- Debian 8.x “jessie” 使用 Dotdeb 安裝最新版本 LEMP / LNMPLNMP
- Ubuntu 20.04系統編譯安裝MySQL5.7教程。Ubuntu編譯MySql
- 在ubuntu上安裝最新穩定版本的node及npmUbuntuNPM
- mysql5.7安裝及問題處理MySql
- Centos7.3 升級最新Openssl1.1.0e同時編譯安裝lnmp環境(使用最新openssl1.1.0e)CentOS編譯LNMP
- Debian11系統編譯安裝phpMyAdmin教程。編譯PHP
- Debian11系統編譯安裝Tomcat教程。編譯Tomcat
- LNMP—Nginx的編譯安裝LNMPNginx編譯
- LNMP編譯安裝配置+discuzLNMP編譯
- Ewebeditor最新漏洞及漏洞大全Web
- Windows系統安裝及啟用Windows
- unix系統安裝及應用
- Centos8 stream系統編譯安裝MySQL5.7教程。CentOS編譯MySql
- 最新最全mysql8.0.15安裝配置及連線Navicat教程MySql
- CentOS6.5編譯安裝最新MySQL 5.7.11CentOS編譯MySql
- Debian11系統編譯安裝Pure-Ftpd教程。編譯FTP
- 最新macOS Big Sur11.1系統的特色及系統要求Mac
- debian下編譯2.6.13.2核心的步驟及感受(轉)編譯
- Linux系統下自行編譯安裝MySQL及基礎配置全過程解析Linux編譯MySql
- Debian的U盤安裝及SecureCRT登入Securecrt