Compile and install LAMP in Linux and separate it into multiple servers

Source: Internet
Author: User
Tags mysql host

[: [Linux86]: Apache host [Linux87]: PHP host [Linux88]: MySQL host

Internal test. In windows, you need to change the hosts file to the httpd host.

Add the hosts file in the example: 172.16.251.86 www.Androidj.com

172.16.251.86 www.bkjia.com

--------------------------------------------------------------------------------

LAMP is the abbreviation of a group of free software that is usually used together to run dynamic websites or servers:

Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04

Compile and install LAMP in CentOS 5.9 (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12)

Source code for Web server architecture in RedHat 5.4 build the LAMP environment and application PHPWind

Build a WEB Server Linux + Apache + MySQL + PHP in the LAMP source code Environment


1. Linux; operating system;

2. Apache; web server;

3. MariaDB or MySQL, database management system (or database server );

4. PHP, Perl or Python, script language;

Before compilation and installation, we need to first understand the separate working modes between them:

It is roughly marked as the working mode When Apache, php, and mysql are separated into separate servers. Next, compile and install them directly. First, prepare three VMS. Test Machine version:

[Linux86] # lsb_release-

LSB Version: base-4.0-amd64: base-4.0-noarch: core-4.0-amd64: core-4.0-noarch: graphics-4.0-amd64: graphics-4.0-noarch: printing-4.0-amd64: printing-4.0-noarch:

Distributor ID: CentOS

Description: CentOS release 6.5 (Final)

Release: 6.5

Codename: Final

Because all the operations are code insertion, the Code is not pasted during command execution, and only the last few lines are pasted;

1. Compile and install Apache2.4.9

1. Solve the dependency:

[Linux86] # yum grouplist

#

Installed Groups:

Additional Development

Base

Console internet tools

Desktop

Desktop Platform

Development tools # Check whether the package group is installed

Server Platform Development # Check whether the package group is installed

If not, install these two groups first.

#

[Linux86] # rpm-qa pcre-devel

Pcre-devel-7.8-6.el6.x86_64

#

Check whether the tool is installed. If the tool is not installed, install it in advance.

[Linux86] # ls

Apr-1.5.0.tar.bz2 apr-util-1.5.3.tar.bz2 httpd-2.4.9.tar.bz2

[Linux86] #

# Install the apr package first. decompress the package and enter the directory.

[Linux86] # pwd

/Root/program/apr-1.5.0

[Linux86] #./configure -- prefix =/usr/local/apr

Config. status: executing default commands

Config. status: include/apr. h is unchanged

Config. status: include/arch/unix/apr_private.h is unchanged # continue if no error is reported

[Linux86] # make & make install

/Usr/bin/install-c-m 644 build/apr_rules.out/usr/local/apr/build-1/apr_rules.mk

/Usr/bin/install-c-m 755 apr-config.out/usr/local/apr/bin/apr-1-config # continue to install the apr-util package without any errors

[Linux86] #

# Decompress the package to the directory

[Linux86] #./configure -- prefix =/usr/local/apr-util -- with-apr =/usr/local/apr/

Config. status: creating test/Makefile

Config. status: creating include/private/apu_config.h

Config. status: executing default commands

[Linux86] # make & make install

/Usr/bin/install-c-MB 644 aprutil. exp/usr/local/apr-util/lib

/Usr/bin/install-c-m 755 apu-config.out/usr/local/apr-util/bin/apu-1-config

[Linux86] # installation is successful


2. Compile Apache:

[Linux86] # rpm-qa httpd

Httpd-2.2.15-29.el6.centos.x86_64

#

# The httpd2.2 version has been installed by the system itself. The httpd2.2 version is compiled here, but the old version does not need to be uninstalled;

# The dependency is unstable after uninstallation, and the module will be automatically installed later;

# Compile the program as long as the default path is not specified. Make sure that the program is stopped before installation and enable Automatic startup.

#

#

[Linux86] #. /configure -- prefix =/usr/local/apache -- sysconfdir =/etc/httpd24 -- enable-so -- enable-ssl -- enable-cgi -- enable-rewrite -- with-zlib -- -pcre -- with-apr =/usr/local/apr -- with-apr-util =/usr/local/apr-util -- enable-modules = most -- enable-mpms-shared = all -- with-mpm = event -- enable-proxy-fcgi

You can view the parameters through./configure -- help; enable what you need.

# If no error is reported, install the agent directly.

[Linux86] # make & make install

Mkdir/usr/local/apache/build

Installing man pages and online manual

Mkdir/usr/local/apache/man

Mkdir/usr/local/apache/man/man1

Mkdir/usr/local/apache/man/man8

Mkdir/usr/local/apache/manual

Make [1]: Leaving directory '/root/program/httpd-2.4.9' # Installation Complete

[Linux86] #


3. Configure Apache:

# Because the previous httpd has not been uninstalled, You Can cp a STARTUP script as the current httpd script; change the parameters in

#

[Linux86] # cp/etc/rc. d/init. d/httpd/etc/rc. d/init. d/httpd24

[Linux86] # vi/etc/rc. d/init. d/httpd24

# Path to the apachectl script, server binary, and short-form for messages.

# The following variables are defined as the current path, and the corresponding values are changed in the main configuration file.

Achectl =/usr/local/apache/bin/apachectl

Httpd =$ {HTTPD-/usr/local/apache/bin/httpd}

Prog = httpd

Pidfile =$ {PIDFILE-/var/run/httpd. pid}

Lockfile =$ {LOCKFILE-/var/lock/subsys/httpd24}

RETVAL = 0

STOP_TIMEOUT =$ {STOP_TIMEOUT-10}

# Modifying the master configuration file

[Linux86] # vi/etc/httpd24/httpd. conf

# Same ServerRoot for multiple httpd daemons, you will need to change

# Least PidFile.

#

ServerRoot "/usr/local/apache"

Pifile "/var/run/httpd. pid" # Add a pid file path, which corresponds to the script file.

# Save and exit

[Linux86] # service httpd24 start

Starting httpd: [OK]

[Linux86] # ss-tnl

State Recv-Q Send-Q Local Address: Port Peer Address: Port

LISTEN 0 128: 111 :::*

LISTEN 0 128 *: 111 *:*

LISTEN 0 128: 80 :::*

# Port 80 is listened on


Apache has been compiled and installed. You can also enter an IP address in your browser to test the installation.

  • 1
  • 2
  • 3
  • 4
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.