Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of compiling, installing and building LNMP environment for the latest source code package under CentOS

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Next, let's learn about the method of compiling and installing the latest source code package under CentOS and building the LNMP environment. I believe you will benefit a lot after reading it. The text is not much in the essence. I hope this short article on the compilation and installation of the latest source code package under CentOS and how to build the LNMP environment is what you want.

Deployment environment

System: CentOS 6.8 x8664

Nginx:1.11.3

MySQL:5.7.14

PHP:7.0.10

Pcre:8.39

Zlib:1.2.8

Openssl:1.0.1t

Freetype:2.6.5

Libmcrypt:2.5.8

Boost:1.59.0

Cmake:3.6.1

Deployment preparation

Use the client browser to visit the https://www.freetype.org/ download page of the freetype official website and select a download address

To download the latest release, right-click-copy download link.

In the CentOS service system, change to the / usr/src directory and use the wget tool to post the download link you just copied.

Cd / usr/src

Wget http://download.savannah.gnu.org/releases/freetype/freetype-2.6.5.tar.gz

Visit the mcrypt official website http://mcrypt.sourceforge.net/ and select a download site

View all files

Select directory libmcrypt

Version 2.5.8

Select a package to download

Visit the https://www.openssl.org/ download page of openssl's official website

Choose to download version 1.0.1t here.

Visit the pcre official website http://www.pcre.org/ and select a download site

Download the latest release

Visit the zlib official website http://www.zlib.net/ and select a download site at the bottom.

Copy the full download address for download

Visit the https://cmake.org/ download page of cmake's official website

Download the latest release

Visit Nginx's official website http://nginx.org/ to download the latest release

Copy the full download address for download

Visit the https://www.mysql.com/ download page of MySQL's official website

Download the free community version

Go to the download page

Platform type: source code package

Select the package that contains the boost header to download

Do not log in to download

After obtaining the full download address, download to the CentOS system

Visit the http://www.php.net/ download page of PHP's official website to select the latest version.

Recent site download

Get the full download address for download

All software packages

Deployment process

Use yum to install the required system packages

Yum install-y gcc gcc-c++ ncurses ncurses-devel libxml2 libxml2-devel curl-devel libpng libpng-devel

Install Nginx

Decompress pcre and zlib package

Tar zxf pcre-8.39.tar.gz

Tar zxf zlib-1.2.8.tar.gz

Tar zxf openssl-1.1.0.tar.gz

Extract nginx package configuration

Tar zxf nginx-1.11.3.tar.gz

Cd nginx-1.11.3

/ configure-- prefix=/usr/local/nginx-- pid-path=/usr/local/nginx/run/nginx.pid-- user=nginx-- group=nginx-- with-http_gunzip_module-- with-http_gzip_static_module-- with-http_ssl_module-- with-zlib=/usr/src/zlib-1.2.8-- with-pcre=/usr/src/pcre-8.39-- with-openssl=/usr/src/openssl-1.0.1t

Compilation and installation

Make & & make install

Create a Nginx user and assign permissions.

Useradd-M-s / sbin/nologin nginx

Chown-R nginx.nginx / usr/local/nginx/

Start the NGINX service

/ usr/local/nginx/sbin/nginx

Create a boot script / etc/init.d/nginx as follows:

#! / bin/sh

#

#

# chkconfig: 2345 66 34

# description: A very fast and reliable nginx engine

#

#

#

BASEDIR=/usr/local/nginx

DAEMON=$BASEDIR/sbin/nginx

PIDFILE=$BASEDIR/run/nginx.pid

Set-e

If [!-x "$DAEMON"]; then

Echo "nginx deamon not exist"

Exit 1

Fi

If [! "$1"]; then

Echo "Usage: {start | stop | reload | restart}"

Exit 2

Fi

_ start () {

$DAEMON

}

_ stop () {

$DAEMON-s stop

}

_ reload () {

$DAEMON-s reload

}

Case "$1" in

Start)

_ start

Echo-e "Starting Nginx: [\ e [0scape 32mOK\ e [0m]"

Stop)

_ stop

Echo-e "Stoping Nginx: [\ e [0scape 32mOK\ e [0m]"

Reload | graceful)

_ reload

Echo-e "Reloading Nginx: [\ e [0scape 32mOK\ e [0m]"

Restart)

_ stop

Echo-e "Stoping Nginx: [\ e [0scape 32mOK\ e [0m]"

_ start

Echo-e "Starting Nginx: [\ e [0scape 32mOK\ e [0m]"

Esac

Exit 0

Add execution permission

Chmod 755 / etc/init.d/nginx

Add to chkconfig service management

Chkconfig-add nginx

Test the script running

Install MySQL

Switch back to the / usr/src directory to install cmake

Tar zxf cmake-3.6.1.tar.gz

Cd cmake-3.6.1

. / configure-- prefix=/usr/local/cmake

Compilation and installation

Make & & make install

MySQL database

Cd / usr/src/

Tar zxf mysql-boost-5.7.14.tar.gz

Cd mysql-5.7.14

/ usr/local/cmake/bin/cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\

-DSYSCONFDIR=/usr/local/mysql/etc-DMYSQL_DATADIR=/usr/local/mysql/data\

-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci-DMYSQL_TCP_PORT=3306\

-DMYSQL_USER=mysql-DWITH_MYISAM_STORAGE_ENGINE=1\

-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1\

-DWITH_BLACKHOLE_STORAGE_ENGINE=1-DWITH_MEMORY_STORAGE_ENGINE=1\

-DDOWNLOAD_BOOST=0-DWITH_BOOST=boost

Compilation and installation

Make & & make install

Create relevant catalogs

Mkdir-p / usr/local/mysql/etc

Mkdir-p / usr/local/mysql/data

Mkdir-p / usr/local/mysql/log

Mkdir-p / usr/local/mysql/run

Delete / etc/my.cnf configuration file, create a new / usr/local/mysql/etc/my.cnf file

Rm-f / etc/my.cnf

Cat > / usr/local/mysql/etc/my.cnf / usr/local/nginx/html/index.php

EOF

Restart the Nginx service and php-fpm service, and turn off the system firewall and selinux service.

Service nginx restart

/ etc/init.d/php-fpm start

/ etc/init.d/iptables stop

Chkconfig iptables off

Setenforce 0

The browser accesses the CentOS CVM address and then displays the details of the php test page.

Note: in order to enable the PHP site to support more extended functions, many supported third-party modules have been installed above, please choose to install them according to the needs of the actual environment!

After reading the article on compiling and installing the latest source code package under CentOS and how to build a LNMP environment, many readers will want to know more about it. For more industry information, you can follow our industry information section.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report