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

Build LNMP environment with source code package

2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1. Download the LNMP.ISO image file to / root

2. Mount the CD image and copy the LNMP.ISO content into / soft.

Mkdir / soft

Mount-o loop LNMP.ISO / media

Cd / media

Cp-a * / soft

3. Installation

3.1. Decompress all the software

Tar-xvf nginx-1.0.8.tar.gz

Tar-xvf ncurses-5.9.tar.gz

Tar-xvf mysql-5.5.23.tar.gz

Tar-xvf php-5.3.6.tar.gz

Tar-xvf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz

Configure the local yum source and pre-install the relevant software that LNMP depends on

Yum-y install gcc* cmake bison pcre-devel zlib-devel

Ncurses-devel openssl-devel libxml2-devel libpng-devel

3. Install nginx

Nginx service programs run as nobody by default. It is recommended to create special user accounts in order to control their access rights more accurately. Increase mobility and reduce security risks.

Useradd-r-s / sbin/nologin nginx

3.3.1, compile and install

Mkdir / usr/local/nginx

Cd / soft/nginx-1.0.8

. / configure-- prefix=/usr/local/nginx--user=nginx-- group=nginx-- with-http_ssl_module--with-http_stub_status_module

Cp-a / usr/local/nginx/ / etc/init.d/

Chmod 777 / etc/init.d/nginx

/ usr/local/nginx/sbin/nginx starts the nginx service

Netstat-antp | grep 80 to see if the port is up

3.3.2. End verification result

3.4. install MYSQL

3.4.1. Install the software Ncurese first:

Provides a character terminal processing library, including panels and menus. It provides a set of functions that control the cursor, create windows, change the background color of the foreground, and handle mouse operations. Use the program to directly control the function library displayed on the terminal screen.

Cd / soft/ncurses-5.9/

. / configure--with-shared-without-debug-without-ada-enable-overwrite & & make & & make install

3.4.2. Install Mysql

Groupadd mysql create database group mysql

Useradd-g mysql mysql creates the database user mysql, and specifies that the initial group is mysql

Cd / soft/mysql-5.5.23/

Cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_UNIX_ADDR=/tmp/mysql.sock-DEXTRA_CHARSETS=all-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DWITH_MYISAM_STORAGE_ENGINE=1-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_MEMORY_STORAGE_ENGINE=1-DWITH_READLINE=1-DENABLED_LOCAL_INFILE=1-DMYSQL_USER=mysql-DMYSQL_TCP_PORT=3306

Make & & make install

3.4.3, related instructions for compilation

3.4.4. Endow the directory under the mysql installation location with corresponding permissions and partial optimization.

Cd / usr/local/mysql/

Chown-R root. Specifies that the owner of all files in the current directory is root

Chown-R mysql data specifies that the data owner is mysql

Cp-a support-files/my-medium.cnf / etc/my.cnf

/ usr/local/mysql/scripts/mysql_install_db-- user=mysql

/ usr/local/mysql/bin/mysqld_safe-user=mysql &

/ usr/local/mysql/bin/mysqladmin-uroot password 123456 sets the password of the mysql user root to 123456

Cp-a / soft/mysql-5.5.23/support-files/mysql.server / etc/init.d/mysqld

Chmod 777 / etc/init.d/mysqld modifies the permissions of mysql and adds boot

Chkconfig-add mysqld

Chkconfig mysqld on

3.4.5. Log in to mysql and view the existing database

/ usr/local/mysql/bin/mysql-uroot-p123456

Mysql > show databases

3.5. install PHP

This version of PHP already has its own FPM (fastCGI proxess manager,FastCGI process management module) module, which is used to manage PHP parsing instances and optimize the parsing effect, so you need to add-enable-fpm to start this module when configuring and compiling PHP.

Ln-s / usr/lib64/libpng.so* / usr/lib softly connects all modules of libpng.so* to / usr/lib

Cd / soft/php-5.3.6/

/ configure-- prefix=/usr/local/php5-- with-gd-- with-zlib-- with-mysql=/usr/local/mysql-- with-configpath=/usr/local/php5-- enable-mbstring-- enable-fpm

Make & & make install

Cp php.ini-development / usr/local/php5/php.ini

Ln-s / usr/local/php5/bin/*/usr/local/bin/

Ln-s / usr/local/php5/sbin/*/usr/local/sbin/

Install ZendGuardLoader-php-5.3-linux-glibc23-x86_64 to improve PHP parsing efficiency

Cp-a / soft/ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so / usr/local/php5/lib/php/

Echo "zend_extension=/usr/local/php5/lib/php/ZendGuardLoader.so" > > / usr//local/php5/php.ini echo "zend_loader.enable=1" > > / usr/local/php5/php.ini

Cd / usr/local/php5/etc/

Cp-a php-fpm.conf.defaultphp-fpm.conf

Vi php-fpm.conf

Open a few lines and modify

3.6. connect Nginx and Php-fpm modules

Vi / usr/local/nginx/conf/nginx.conf

Restart the Nginx service to write a php web page

Vi / usr/local/nginx/html/index.php

Browser access authentication

4. Install the log analysis software webalizer

1. Prerequisite: the LAMP or LNMP environment has been set up.

2. Download the Webalizer software to / root and decompress it

Tar xzf webalizer-2.23-05-src.tgz

3. Webalizer installation also depends on several software.

Rpm-Q gd-devel libpng-devel zlib-devel

If there is no installation, you need to install.

Yum install gd-devel libpng-develzlib-devel

4. Compile and install

. / configure--prefix=/usr/local/webalizer-- with-language=simplified_chinese

Make & & makeinstall

5. Modify webalizer.conf file

Cd / usr/local/webalizer/etc/

Cp webalizer.conf.sample webalizer.conf

Vi webalizer.conf

The main changes are as follows:

LogFile / home/wwwlog / access.log

Storage location of OutputDir / home/wwwroot/default/log/ analysis results

Incremental yes

HostName bclahyl

LogFile / home/wwwlog / access.log

# specify the logs to be analyzed (find your own web page file location)

When Incremental yes # is yes, the daily analysis results exist, otherwise it will only be analyzed at that time.

HostName bclahyl # is used for the display of html titles, etc. (casually write)

6. Execution

/ usr/local/webalizer/bin/webalizer-c / usr/local/webalizer/etc/webalizer.conf

Command to start generating html files

The analysis files generated in / home/wwwroot/default/log/

Analysis results of the web version

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

Servers

Wechat

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

12
Report