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 LAMP environment based on CentOS 6.8 platform latest source code package compilation and installation (Apache+MySQL+PHP)

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Deployment environment

System: CentOS 6.8 x8664

Apache:2.4.23

MySQL:5.7.14

PHP:7.0.10

Apr:1.5.2

Apr-util:1.5.4

Boost:1.59.0

Cmake:3.6.1

Pcre:8.39

Package preparation

Here is a brief introduction to the installation process of the CentOS6.8 system (no graphical environment). Use the browser of the personal computer (Windows system) to visit the official Apache website http://www.apache.org/ and click the download page tab.

Click on the suggested image download site

Find the apr directory

Download the latest version of the apr package in tar.gz format here, and right-click to select "copy Link address"

Log in to the CentOS6.8 system, change to the / usr/src directory, and use the curl tool to download the link file you just copied

Curl-O http://mirrors.cnnic.cn/apache/apr/apr-1.5.2.tar.gz

Follow this method to download the apr-util package to the / usr/src directory

Return to the directory at the previous level

Find the httpd directory

Download the latest version of Apache software to the / usr/src directory

Visit the pcre official website http://www.pcre.org/ to enter the download link

Download the latest pcre package to the / usr/src directory

Visit boost official website http://www.boost.org/ to enter 1.59.0 version information

Click the .tar.gz format package

Jump to the download page, automatically activate the browser downloader, and copy the download address to the CentOS system for download.

Visit the cmake official website https://cmake.org/ download page tab

Download the latest release

Visit MySQL's official website https://www.mysql.com/

Since MySQL has been acquired by Oracle, Oracle is required to download MySQL Enterprise Edition, so download the free community version here.

Go to the download page

Available version Select Source Code package

Tar source code package for general Linux platform

Do not log in to the account, just download.

Copy the address of the downloader for download

Visit PHP's official website http://www.php.net/ to download the latest release

Select the mirror site closest to us and choose any node to download.

Copy the link address in the downloader to download

The required software package download is complete

Deployment process

Use yum to install the necessary system packages

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

Install apr software, decompress, configure, there is an error that can not be deleted, can be ignored.

Tar zxf apr-1.5.2.tar.gz

Cd apr-1.5.2

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

Compilation and installation

Make & & make install

Change to the / usr/src directory to continue installing the apr-util software

Tar zxf apr-util-1.5.4.tar.gz

Cd apr-util-1.5.4

. / configure-prefix=/usr/local/apr-util-with-apr=/usr/local/apr/

Compilation and installation

Make & & make install

Change back to the / usr/src directory and continue to install the pcre software

Tar zxf pcre-8.39.tar.gz

Cd pcre-8.39

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

Compilation and installation

Make & & make install

Change back to the / usr/src directory and install Apache

Tar zxf httpd-2.4.23.tar.gz

Cd httpd-2.4.23

. / configure-prefix=/usr/local/apache-enable-so-with-apr-util=/usr/local/apr-util/-with-pcre=/usr/local/pcre/

Compilation and installation

Make & & make install

Switch back to the / usr/src directory to install boost software

Tar zxf boost_1_59_0.tar.gz

Cd boost_1_59_0

. / bootstrap.sh

Compilation and installation, the process is relatively long, wait patiently.

. / b2

Installation

. / b2 install-- prefix=/usr/local/boost

Change back to the / usr/src directory and continue 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

Switch back to / usr/src directory to install MySQL database

Tar zxf mysql-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-DWITH_BOOST=/usr/local/boost/include

Compile and install, waiting a long time.

Make & & make install

Create mysql users and related directories

Useradd-M-s / sbin/nologin mysql

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 the default profile / etc/my.cnf

Rm-f / etc/my.cnf

The new configuration file / usr/local/mysql/etc/my.conf is as follows:

[mysqld]

Datadir=/usr/local/mysql/data

Socket=/usr/local/mysql/mysql.sock

User=mysql

# Disabling symbolic-links is recommended to prevent assorted security risks

Symbolic-links=0

[mysqld_safe]

Log-error=/usr/local/mysql/log/mysqld.log

Pid-file=/usr/local/mysql/run/mysqld.pid

Add mysql rights to a directory

Chown-R mysql:mysql / usr/local/mysql

Initialize the database and note that a temporary login account and password are generated.

/ usr/local/mysql/bin/mysqld-initialize-user=mysql-basedir=/usr/local/mysql/-datadir=/usr/local/mysql/data

Start the database service

/ usr/local/mysql/bin/mysqld_safe &

Log in to the database using the generated temporary password

/ usr/local/mysql/bin/mysql-u root-p

Modify database login password

Alter user 'root'@'localhost' identified by' A2cT1B3'

Modify the following parameters of startup script file / usr/local/mysql/support-files/mysql.server

Basedir=/usr/local/mysql

Datadir=/usr/local/mysql/data

Mysqld_pid_file_path=/usr/local/mysql/run/mysqld.pid

Test startup script

View mysql process and port status

Change back to the / usr/src directory and install php.

Tar zxf php-7.0.10.tar.gz

Cd php-7.0.10

/ configure-- prefix=/usr/local/php-- with-config-file-path=/usr/local/php/etc-- with-apxs2=/usr/local/apache/bin/apxs-- enable-mysqlnd-- with-mysqli=mysqlnd-- with-pdo-mysql=mysqlnd-- enable-mbstring-- with-curl-- with-gd-- enable-fpm

Compilation and installation

Make & & make install

Copy configuration fil

Cp php.ini-production / usr/local/php/etc/php.ini

Modify the configuration file / usr/local/php/etc/php.ini modify the parameters and remove the previous semicolon.

Date.timezone = Asia/Shanghai

Modify the Apache configuration file / usr/local/apache/conf/httpd.conf, modify ServerName, and add the php index.

Add at the end

SetHandler application/x-httpd-php

SetHandler application/x-httpd-php-source

Create the php test file index.php in the Apache document directory

/ usr/local/apache/htdocs/index.html

Vi / usr/local/apache/htdocs/index.php

The contents are as follows

Start the Apache service to view the process and port status.

/ usr/local/apache/bin/apachectl start

Use the browser to access the server IP to see that the php test page is displayed normally.

Information about MySQL

Create Apache and MySQL boot self-startup scripts

Cp / usr/local/apache/bin/apachectl / etc/init.d/

Cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysql

Edit / etc/init.d/apachectl add

# chkconfig: 2345 65 35

# description: A very fast and reliable apache engine.

Add to chkconfig service management

Chkconfig-add apachectl

Chkconfig-add mysql

About the problem that MySQL's error logging time is always 8 hours slower than the system time!

This is because the parameter log_timestamps is added in MySQL version 5.7, and the UTC time is used by default.

Just change it to system time.

SET GLOBAL log_timestamps = SYSTEM

The global variable set in this way will become invalid after the mysql service is restarted. To take effect permanently, you need to add it in the configuration file / usr/local/mysql/etc/my.cnf.

Log_timestamps=SYSTEM

Restart the MySQL service service mysql restart, check the error log again, and find that it is consistent with the system time.

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