LNMP的安装

LNMP的安装感谢大家观看这期的内容,这期我们主要是部署LNMP。首先,我们先看NMP的软件版本N nginx-1.20.2M mysql-5.6.39P p

大家好,欢迎来到IT知识分享网。

LNMP的安装

感谢大家观看这期的内容,这期我们主要是部署LNMP。

首先,我们先看NMP的软件版本

N nginx-1.20.2

M mysql-5.6.39

P php-5.6.40

而L,则为上两期安装的Ubuntu 20.04(192.168.48.93)与Centos 7 2009(192.168.48.92)的linux系统

接着,安装目录都定在/usr/local,即三个软件的安装路径为

/usr/local/nginx

/usr/local/php

/usr/local/mysql

而mysql的数据目录为 /data/dbs/mysql5.6

各个软件包都可以从官网上下载到,在这笔者就不啰嗦了,如果有不知道怎么下载的读者,可以留言。

在安装NMP之前,我们先安装一些基础包

在Centos中:

# yum install -y vim wget unzip make cmake nmap automake lrzsz gcc gcc-c++ openssl openssl-devel pcre pcre-devel zlib zlib-devel ncurses-devel ncurses libtool-ltdl libtool-ltdl-devel bison openssh-clients rsync gd-devel libcurl-devel libxml2 libxml2-devel libjpeg-devel libpng-devel libpng freetype freetype-devel glibc glibc-devel glib2 glib2-devel xinetd bind-utils ntpdate sysstat iptraf bc screen net-tools

LNMP的安装

Centos截图1

LNMP的安装

Centos截图2

而在Ubuntu中:

# apt-get update -y && apt-get install -y wget unzip zip make cmake lrzsz nmap xinetd bind9utils automake gcc g++ openssl bison rsync php-gd libxml2 libxml2-dev libjpeg-dev libpng-dev ntpdate sysstat iptraf bc screen net-tools libpcre3 libpcre3-dev libssl-dev zlib1g-dev libcurl4-openssl-dev libfreetype6 libfreetype6-dev libcurl4-openssl-dev

LNMP的安装

Ubuntu截图1

LNMP的安装

Ubuntu截图2

第2步,我们开始安装Nginx

LNMP的安装

在Centos与Ubuntu中,同一样命令

tar zxf nginx-1.20.2.tar.gz cd nginx-1.20.2 ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module make && make install

安装完成,检测是否安装成功

#/usr/local/nginx/sbin/nginx -V

centos:

LNMP的安装

centos的nginx

ubuntu:

LNMP的安装

ubuntu的nginx

出现nginx版本信息,这就证明安装成功。

第3步,我们来安装php

LNMP的安装

php

在Centos中,先安装libmcrypt,这个yum安装比较折腾,在这就改为源码安装

tar zxf libmcrypt-2.5.7.tar.gz cd libmcrypt-2.5.7 ./configure --prefix=/usr/local/libmcrypt make && make instal

然后就安装php

tar zxf php-5.6.40.tar.gz cd php-5.6.40 ./configure --prefix=/usr/local/php --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --disable-debug --with-iconv --enable-inline-optimization --with-zlib --enable-zip --enable-mbstring --enable-soap --with-curl --enable-pcntl --enable-bcmath --enable-sockets --enable-ftp --enable-exif --enable-gd-native-ttf --with-gd --with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-openssl --with-mcrypt=/usr/local/libmcrypt --with-gettext make && make  install

在Ubuntu中,可以apt安装libmcrypt

apt-get install -y mcrypt libmcrypt-dev

由于在20.04中,freetype版本2.10.1对于php-5.6.40来说,版本过高,需要安装一个低一点的版本,freetype-2.8.1

#tar zxf freetype-2.8.1.tar.gz #cd freetype-2.8.1 #./configure --prefix=/usr/local/freetype #make && make install

并且在20.04中,OpenSSL 1.1.1f对于php-5.6.40来说,版本也过高,需要安装一个低一点的版本,openssl-1.0.2k

#tar zxf openssl-1.0.2k.tar.gz #cd openssl-1.0.2k #./config --prefix=/usr/local/openssl #make && make install

然后就安装php-5.6.40了

#tar zxf php-5.6.40.tar.gz #cd php-5.6.40 #./configure --prefix=/usr/local/php --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --disable-debug --with-iconv --enable-inline-optimization --with-zlib --enable-zip --enable-mbstring --enable-soap --with-curl --enable-pcntl --enable-bcmath --enable-sockets --enable-ftp --enable-exif --enable-gd-native-ttf --with-gd --with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-openssl=/usr/local/openssl/ --with-mcrypt --with-gettext #make && make install

这个的安装时间有点长,安装完成后,可以查看到版本信息,证明php安装成功

LNMP的安装

centos中的php

LNMP的安装

ubuntu中的php

第4步,安装mysql5.6.36

LNMP的安装

由于我们在第1步的时候安装了很多的基础依赖包,所以这里并未需要安装什么依赖包

centos:

yum install -y libxml2-python libxml2-static zlib-static 

ubuntu:

apt-get install -y libncurses5-dev

开始安装:

chown mysql.mysql /data/dbs/mysql5.6 tar zxf mysql-5.6.39.tar.gz cd mysql-5.6.39 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/dbs/mysql5.6 -DSYSCONFDIR=/srv/mysql5.6 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306 -DWITH_DEBUG=0 -DENABLED_LOCAL_INFILE=1 make && make install 

安装完成后,查看版本信息

centos:

LNMP的安装

ubuntu

LNMP的安装

至此,LNMP安装完成,安装完成,还没有配置相关软件,若读者需要知道如何配置,可以评论留言,根据评论数来决定要不要单独做一期LNMP的配置

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/48571.html

(0)

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

关注微信