Compile and install lamp + tomcat7.0

Source: Internet
Author: User
Tags apache log

Compile and install lamp + tomcat7.0

 

Installation Process:

1) Mysql-5.5.15

2) Httpd-2.2.19

3) php5.3.6

4) tomcat7.0

 

1. Install MySQL (Binary Package)

(1) create a user

Groupadd mysql-G 3306

Useradd mysql-u 3306-G MySQL

Id MySQL

Uid = 3306 (MySQL) gid = 3306 (MySQL) groups = 3306 (MySQL)

 

(2) initialize MySQL

Tar xf mysql-5.5.15-linux2.6-i686.tar.gz-C/usr/local/

Ln-SV/usr/local/mysql-5.5.15-linux2.6-i686 // usr/local/MySQL

CD/usr/local/MySQL

CP support-files/MySQL. Server/etc/init. d/mysqld

CP support-files/my-large.cnf/etc/My. CNF

Vim/etc/My. CNF

# Add the following line in the [mysqld] Field

Datadir =/mydata/Data

 

Scripts/mysql_install_db -- datadir =/mydata/data/-- user = MySQL

 

Chown MYSQL: MySQL/mydata/data/-R

Chown root/usr/local/MySQL-R

 

(3) Start MySQL

# Make sure SELinux is disabled

Setenforce 0

 

Service mysqld start

Starting MySQL... success!

Export Path = $ path:/usr/local/MySQL/bin/

MySQL

 

Type 'help; 'or' \ H' for help. type' \ C' toclear the current input statement.

Mysql>

 

(4) add boot start

Chkconfig-add mysqld

Chkconfig mysqld on

 

Ii. Compile and install httpd

(1) Compile httpd

Yum-y install zlib-devel OpenSSL-devel

Cd ~

Tar xf httpd-2.2.19.tar.bz2

CD httpd-2.2.19

. /Configure -- prefix =/usr/local/Apache -- With-stored ded-Apr -- With-MPM = worker -- enable-Deflate -- enable-Cache -- enable-disk-Cache -- enable- file-Cache -- enable-Mem-Cache -- enable-Rewrite -- enable-so -- enable-speling -- enable-SSL -- With-Apr-util -- With-SSL -- with-z
-- Enable-modules = all -- enable-mod-shared = all

Make & make install

 

Instructions for compiling commands: (Source: http://crazyming.blog.51cto.com/1048571/388611)

-- Prefix =/usr/local/apache2

// Apache installation directory.

-- Enable-module = so

// Open the so module. The so module is the Apache core module supported by DSO.

-- Enable-Deflate = shared // supports webpage Compression

-- Enable-expires = shared // supports HTTP Control

-- Enable-Rewrite = shared // supports URL rewriting

-- Enable-Cache // supports caching

-- Enable-file-Cache // supports file caching.

-- Enable-Mem-Cache // supports memory cache.

-- Enable-disk-Cache // supports disk caching.

-- Enable-static-support // supports static connections (Dynamic connections by default)

-- Enable-static-htpasswd

// Use static connections to compile htpasswd-manage user files for Basic Authentication

-- Enable-static-htdigest

// Use static connections to compile htdigest-manage user files used for digest Authentication

-- Enable-static-rotatelogs

// Use a static connection to compile the rotatelogs-pipeline log program for Rolling Apache logs

-- Enable-static-logresolve

// Use static connections to compile logresolve-resolve the IP address in the Apache log as the host name

-- Enable-static-htdbm

// Use a static connection to compile htdbm-operate the DBM Password Database

-- Enable-static-AB

// Use static connections to compile the AB-Apache HTTP Server Performance Testing Tool

-- Enable-static-checkgid

// Use static connections to compile checkgid

-- Disable-cgid

// Disable the use of an external CGI daemon to execute the CGI script

-- Disable-CGI // disable compilation of CGI PHP

-- Disable-userdir // disable users from providing pages in their home directories.

-- With-MPM = worker // run Apache in worker Mode

-- Enable-Authn-dBm = shared // operate on a dynamic database. Required for rewrite.

According to the official Apache documentation, -- enable-mod-shared = all is not enabled.

To install all the additional modules, use

-- Enable-mod-shared = "all SSL ldap cache proxy authn_alias mem_cache

File_cache authnz_ldap charset_lite dav_lock disk_cache"

The same applies to -- enable-modules.

 

(2) start the service

CD/usr/local/Apache/bin

./Apachectl start

Httpd (PID 17149) already running

 

# Add boot start

CP/usr/local/Apache/bin/apachectl/etc/rc. d/init. d/httpd

Chmod 755/etc/rc. d/init. d/httpd

 

3. Compile and install PHP

(1) install the GD library so that PHP supports GIF | JPEG | PNG

Yum install GD Gd-devel-y

 

(2) install libxml2 to manage XML files

Yum install libxml2-devel libxml2-y

 

(3) Compile PHP

Cd ~

Tar xf php-5.3.6.tar.bz2

CD php-5.3.6

 

. /Configure -- prefix =/usr/local/PHP -- with-apxs2 =/usr/local/Apache/bin/apxs -- With-mysql =/usr/local/MySQL -- enable-FTP -- with-libxml -- enable-soap -- With-Gd -- With-JPEG -- With-zlib -- With-PNG -- With-FreeType

Make & make install

Cp php. ini-production/usr/local/PHP/lib/PHP. ini

 

(Source: http://crazyming.blog.51cto.com/1048571/388611)

The./configure

-- Prefix =/usr/local/PHP

-- With-apxs2 =/usr/local/Apache/bin/apxs

-- With-mysql =/usr/local/MySQL/

-- With-libxml-Dir =/usr/local/libxml2

Is a required Option

-- With-Gd

-- With-JPEG

-- With-PNG

-- With-zlib

-- With-FreeType

This is the configuration option for PHP to support the GD library

-- Enable-FTP support for opening FTP library functions

-- Enable-soap -- With-XSL =/usr/local/libxslt -- enable-XSLT

Let PHP support soap, which is usually used less and can be removed

 

(4) set Apache to support PHP pages

Vim/usr/local/Apache/CONF/httpd. conf

Search for index.html and add index. php.

Find addtype application/X and add a line of addtype application/X-httpd-PHP. php below

 

Edit a PHP page

Vim/usr/local/Apache/htdocs/index. php

<? PHP

Phpinfo ();

?>

 

Enter http: // your_ip/index. php In the browser to check whether PHP is enabled and MySQL is successfully connected (the mysql version number is displayed)

 

 

4. Install tomcat7.0

(1) install JDK 1.6.0 or later. We recommend that you use 1.6.0 latest 1.7.0. When compiling tomcat, an error is reported.

The latest version is: javase Development Kit 6: http://download.oracle.com/otn-pub/java/jdk/6u27-b07/jdk-6u27-linux-i586-rpm.bin

Installation:

Chmod 755 jdk-6u27-linux-i586-rpm.bin

/Jdk-6u27-linux-i586-rpm.bin

 

In addition, you need to download a ecj-3.6.jar file, otherwise you need to download through the network during Tomcat compilation, the speed is very slow.

Address: http://repo1.maven.org/maven2/org/eclipse/jdt/core/compiler/ecj/3.7/ecj-3.7.jar

Copy the downloaded file to/usr/share/Java/ecj-3.7/

Mkdir/usr/share/Java/ecj-3.7/

CP ecj-3.6.jar/usr/share/Java/ecj-3.7/

 

 

(2) install ant to compile tomcat7.0

: Http://labs.renren.com/apache-mirror//ant/binaries/apache-ant-1.8.2-bin.tar.gz

This is a binary package and can be used directly after decompression. You need to add the bin directory of the software to the PATH variable.

Tar xf apache-ant-1.8.2-bin.tar.bz2-C/usr/local/

Ln-sv apache-ant-1.8.2-bin ant

Export Path = $ path:/usr/local/ANT/bin/

 

Ant version information. Ant indicates normal.

Ant-version

Apache ant (TM) version 1.8.2 compiled on December20 2010

 

(3) edit and install tomcat7.0

Cd ~

Tar xf apache-tomcat-7.0.22-src.tar.gz-C/usr/local

CD/usr/local

Ln-SV apache-tomcat-7.0.22-src Tomcat

Ant # This is a compilation command

 

After compilation, the directory/usr/local/tomcat/output/build/is generated/
/Usr/local/tomcat/output/build/bin/startup. Sh // start Tomcat
Ls/usr/local/tomcat/output/build/logs

If logs are generated, the startup is successful. If you have any questions, check Catalina. Out.

 

(4) add auto start

Echo "/usr/local/tomcat/bin/startup. Sh">/etc/rc. d/rc. Local

 

Port 8080 is enabled after the service is started

[Root @ bogon Tomcat] # netstat-ntlp | grep8080

TCP 0 0: 8080: * Listen 28589/Java

Enter http: // your_ip: 8080 in the browser to view the tomcat7.0 test 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.