Source Code compiling LAMP

Source: Internet
Author: User
Compile the source code LAMP-Linux Enterprise Application-Linux server application information. For more information, see the following section. I made it myself. You can also refer to your own documents on the Internet. I hope you can tell me something wrong. There is also a source code-compiled LAMP post in the Forum, but I can't see the experiment steps. You can only show your ugliness here.

LAMP (Linux + Apache + MySQL + PHP) is a popular Web framework, which includes: Linux operating system, Apache network server, MySQL database, perl, PHP, or Python programming language. All components are open-source software and are internationally mature architecture frameworks. Many popular commercial applications adopt this architecture. Compared with the Java/J2EE architecture, LAMP features rich Web resources, lightweight, and fast development. compared with the NET architecture, LAMP has the advantages of common, cross-platform, high performance and low price. Therefore, LAMP is the preferred platform for enterprises to build websites, regardless of its performance, quality, and price.


I would like to remind you that planning is really important. These configurations affect your subsequent data backup and recovery. Before creating a project, you must make the pre-project plan. Everyone must develop this habit.
After several installation failures today, I found that the pre-installation plan is very important.

1. Partition
/Boot around M
2 times the physical memory of SWAP (If your physical memory is larger than 4 GB, allocate 4 GB)
/15G
/Usr/local 20G (for software installation)
/All data space remaining

This depends on your hard disk. However, I think that lv should be implemented for the extra partitions after the/boot,/, and swap are divided. In this case, if the space is insufficient, you can use lvextend to increase the space.



MySQL database location/data/mysql/data (can be set as needed)

Apache website root directory/data/www/wwwroot (which can be set as needed)

Apache Virtual Host log root directory/data/www/logs (can be set as needed)



1. Build the installation environment. Run the rpm command to install several software packages.

# For I in gcc-c ++ flex bison autoconf automake bzip2-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel; do rpm-q $ I; done
By using this statement, you can clearly see that any software package is not installed, and all software packages that are not installed need to be installed.



Compile GD2

# Tar xf gd-000000000000000000000000.tar.gz

# Cd gd-xxxxxxx

# Configure -- prefix =/usr/local/gd2

# Make

# Make install



Compile libmxml2

# Tar xf libxml2 ****** .tar.gz

# Cd libxml *****

#./Configure -- prefix =/usr/local/libxml2

# Make

# Make install



Compile libmcrypt

# Tar xf libmcrypt ****** .tar.gz

# Cd libmcrypt *****

#./Configure -- prefix =/usr/local/libmcrypt

# Make & make install



Compile OpenSSL

# Tar xf openssl ****** .tar.gz

# Cd openssl *******

#./Config -- prefix =/usr/local/openssl

# Make & make test & make install



Compile mysql # create the/data/mysql/data directory in advance

#. /Configure -- prefix =/usr/local/mysql -- localstatedir =/data/mysql/data -- with-mysqld-user = mysql -- without-debug -- with-big-tables -- -extra-charsets = all -- with-pthread -- enable-static -- enable-thread-safe-client -- with-client-ldflags =-all-static -- with-mysqld-ldflags = -all-static -- enable-validator -- without-isam -- without-innodb -- without-ndb-debug
# Make & make install

# Useradd mysql

# Cd/usr/local/mysq

# Bin/mysql_install_db -- user = mysql

# Chown-R root. mysql.

# Chown-R mysql/data/mysql/data

# Cp share/mysql/my-huge.cnf/etc/my. cnf

# Cp share/mysql. server/etc/rc. d/init. d/mysqld

# Chmod 755/etc/rc. d/init. d/mysqld

# Chkconfig -- add mysqld

#/Etc/rc. d/init. d/mysqld start

# Bin/mysqladmin-u root password 'mysql password'

// Because it is source code compilation, you need to make a soft connection so that/usr/local/mysql/bin/mysql is directed to the bin/directory.

# Ln-s/usr/local/msyql/bin/mysq bin/



Compile apache

# Tar xjvf httpd-2.2.4.tar.bz2
# Cd httpd-2.2.4
#./Configure \
"-- Prefix =/usr/local/apache2 "\
"-- With-defined ded-apr "\
"-- Enable-so "\
"-- Enable-deflate = shared "\
"-- Enable-expires = shared "\
"-- Enable-rewrite = shared "\
"-- Enable-static-support "\
"-- Disable-userdir"
# Make
# Make install
# Echo '/usr/local/apache2/bin/apachectl start>/etc/rc. local


Compile PHP

# Tar xf php ******** .tar.gz

# Cd php ******

#. /Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-config-file-path =/usr/local/php/ etc -- with-mysql =/usr/local/mysql -- with-libxml-dir =/usr/local/libxml2 -- with-gd =/usr/local/gd2 -- with-jpeg -dir -- with-png-dir -- with-bz2 -- with-freetype-dir -- with-iconv-dir -- with-zlib-dir -- with-openssl =/usr/local/openssl -- with-mcrypt =/usr/local/libmcrypt -- enable-soap -- enable-gd-native-ttf -- enable-memory-limit -- enable-ftp -- enable-mbstring -- enable-exif -- disable-ipv6 -- disable-cgi -- disable-cli

# Make & make install

# Mkdir/usr/local/php/etc

# Cp php. ini-dist/usr/local/php/etc/php. ini

Compile Zend Optimizer'

# Tar xf Zendoptimizer ******* .tar.gz

# Cd Zendoptimizer

#./Install. sh

If you want to enter the php. ini directory, point to/usr/local/php/etc.



Integrate Apache with PHP and initial configuration of the system

# Vi/usr/local/apache2/conf/httpd. conf. Note that if the log storage directory is changed. in conf, you also need to change it to the directory where you want to store logs. Here, I did not perform a demonstration. I found logs/to/data/www/logs.

Find:

User daemon

Group daemon

Change to (you can do it without changing it, that is, the group and owner of the created apache website directory must be a daemon user .)

User apache

Group apache
Find:
AddType application/x-gzip. gz. tgz
Add
AddType application/x-httpd-php. php

Find:

DirectoryIndex index.html

Change this row

DirectoryIndex index.html index.htm index. php


Find:
# Include conf/extra/httpd-mpm.conf
# Include conf/extra/httpd-info.conf
# Include conf/extra/httpd-vhosts.conf (virtual host configuration file storage directory .)
# Include conf/extra/httpd-default.conf
Remove the previous "#" and cancel the comment.
Note: Please configure the settings in the above four extension configuration files according to relevant principles!

The following are virtual hosts

# Vi/usr/local/apache/conf/extra/ httpd-vhosts.conf


ServerAdmin root@glory.imbbs.in
DocumentRoot "/data/www/wwwroot/glory. imbbs. in"
ServerName www. glory. imbbs. in
# ServerAlias www.dummy-host.example.com
ErrorLog "/data/www/logs/glory-error_log"
CustomLog "/data/www/logs/glory-access_log" common

Options FollowSymLinks
AllowOverride None
# Order deny, allow
# Deny from all
Order allow, deny
Allow from all
Satisfy all




Add the preceding statement. Save and exit

Add an apache user

# Groupadd www
# Useradd-g www
# Mkdir-p/data/www/wwwroot
# Chmod + w/data/www/wwwroot
# Chown apache. apache/data/www/wwwroot-R

# Mkdir/data/www/wwwroot/glory. imbbs. in

# Cd/data/www/wwwroot/glory. imbbs. in/

# Mkdir/data/www/logs

# Chown-R apache. apache/data/www/logs

# Vi phptest. php


Phpinfo ();

?>

Save and exit. Check whether the owner and group of the glory. imbbs. in directory and phptest. php file belong to apache.



After that, open the FF Browser: www. glory. imbbs. in/phptest. php to check whether the display is normal. If there is an error message, you must go to the log and find the corresponding answer on google based on the error.



After confirming that PHP works properly, we need to improve php security in PHP. ini.

# Vi/usr/local/php/etc/php. ini

Find:

Disable_functions = phpinfo, passthru, exec, system, chroot, scandir, chgrp, chown, shell_exec, proc_open, commit, ini_alter, ini_alter, commit, dl, pfsockopen, openlog, syslog, readlink, symlink, popepassthru, stream_socket_server



DISCUZ can install the discuz and ucenter together with the installation package. I downloaded them separately.

Download DISCUZ UCENTER

Copy the upload directory of discuz to/data/www/wwwroot/glory. imbbs. in/bbs

Copy the ucenter upload directory to/data/www/wwwroot/glory. imbbs. in/ucneter.

Modify the corresponding permissions ~~ Apache is the owner and group.

Here, you need to set up a database for discuz and the ucenter.

# Mysql-uroot-pmysql Password

> Create database ucenter;

> Grant all on ucenter. * to ucenter @ 'localhost' identified by 'Password ';

> Flush privileges

> Exit

Open your browser and enter www. glory. imbbs. in/ucenter/install

After installation, check and install discuz.

I made the steps into a PDF document. You can download, study, and hope to help you.

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.