Notes on installation and configuration of apache, mysql, and php in linux

Source: Internet
Author: User
Tags perl script

Software preparation:
Mysql-5.0.56.tar.gz
Http://dev.mysql.com/get/Downloads/

Httpd-2.2.12.tar.gz
Http://labs.xiaonei.com/apache-mirror/httpd/

Php-5.3.0.tar.gz
Http://cn.php.net/get/php-5.3.0.tar.gz/from/this/mirror

1. Install MYSQL

Copy codeCode: groupadd mysql # Add a MYSQL Group
Useradd-g mysql # Add a user to the MYSQL Group
Tar zxvf mysql-5.0.56.tar.gz
Cd mysql-5.0.56
Cat README | less # view User Manual
Cat INSTALL-SOURCE | less # view installation instructions
./Configure -- help # view configuration help
./Configure -- prefix =/usr/local/mysql5 -- enable-thread-safe-client -- with-charset = utf8
# Set: sets the installation directory. The client supports threads and sets the font to utf8.
# -- Enable-thread-safe-if the client is not enabled, PHP compilation may encounter problems.
Make # compile
Make install # install
Cp support-files/my-medium.cnf/etc/my. cnf # copy the default configuration file
Scripts/mysql_install_db -- user = mysql # initialization: the mysql_install_db file must be included in the decompressed compiled directory.
Cd/usr/local/mysql # enter the installation directory
Chown-R root. # Grant root permission to the mysql5 directory.
Chown-R mysql var # Grant mysql permissions to the var directory
Chgrp-R mysql. # Grant mysql group permissions to the mysql5 directory
Bin/mysqld_safe -- user = mysql & # Start the MYSQL service.
Bin/mysql # log on to MYSQL
Mysql> grant all on *. * to root @ '192. 192.% 'identified by 'Password'; # Set the root manageable network segment and password
Mysql> flush privileges; # The refresh takes effect.
Ps: You can modify the my. cnf file to optimize MYSQL.

Ii. install APACHE

Copy codeThe Code is as follows: tar zxvf httpd-2.2.12.tar.gz
Cd httpd-2.2.12
Vi server/mpm/worker. c # modify the number of source file connections
# Define DEFAULT_SERVER_LIMIT 16 # default number of sub-Processes
# Define MAX_SERVER_LIMIT 20000 # maximum number of sub-Processes
# Define DEFAULT_THREAD_LIMIT 64 # default number of linked threads
# Define MAX_THREAD_LIMIT 20000 # maximum number of linked threads
#### You can modify the default Size Based on your server configuration.
Cat README | less # view User Manual
Cat INSTALL | less # view installation instructions
./Configure -- help # view configuration help
./Configure \
-- Prefix =/usr/local/apache2 \
-- Enable-module = 'most' # install some commonly used
-- Enable-mod-shared = "all" # share all.
-- Enable-file-cache # file cache.
-- Enable-cache # cache
-- Enable-disk-cache # hard disk cache
-- Enable-mem-cache # Memory cache
-- Enable-headers # http header Control Module
-- Enable-expires # expires header Control Module
-- Enable-proxy # apache proxy Module
-- Enable-proxy-balancer # apache proxy balancing Module
-- Enable-ssl # HTTPS
-- Enable-rewrite # rewrite
-- Enable-so # compatibility
-- With-mpm = worker
Make # compile
Make install # install

Iii. install PHP extension LIB Library

Copy codeCode: gd-2.0.35.tar.gz
Jpegsrc.v7.tar.gz
Libpng-1.4.0beta73.tar.gz
Libxml2-sources-2.7.3.tar.gz
Libxslt-1.1.24.tar.gz
Zlib-1.2.3.tar.gz # directly./configure & make install can default lib directory installed in/usr/local/lib.

4. install PHP

Copy codeThe Code is as follows: tar zxvf php-5.3.0.tar.gz
Cd php-5.3.0
Cat README | less # view User Manual
Cat INSTALL | less # view installation instructions
./Configure -- help # view configuration help
./Configure \
-- Prefix =/usr/local/php5 \
-- With-apxs2 =/usr/local/apache2/bin/apxs \ # Your APACHE installation path apxs is a small perl script generated during apache installation configuration. It allows modules such as resin to obtain all the configuration paths of apache.
-- With-mysql =/usr/local/mysql5 \ # MYSQL installation path
-- Enable-ftp \ # enable the FTP Module
-- Enable-debug \ # enable DEBUG
-- Enable-mbstring \ # enable mbstring
-- Enable-mbregex \ # Regular Expression
-- With-gd =/usr/local \ # gd library
-- With-png-dir =/usr/local/lib \ # png
-- With-zlib-dir =/usr/local/lib \ # zlib
-- With-jpeg-dir =/usr/local/lib \ # jpeg
-- Enable-libxml \
-- With-libxml-dir =/usr/local/lib \ # libxml Extension
# -- With-xsl =/usr/local/lib \ # xslt Extension
-- Enable-pdo \
-- With-pdo-sqlite \
-- With-pdo-mysql =/usr/local/mysql5/bin/mysql_config \ # pdo
-- Enable-soap \ # soap Service Extension
-- Enable-sockets \ # sockets Extension
-- With-xmlrpc # xmlrpc Extension
-- With-config-file-path =/etc # Set the storage location of PHP. INI
./Configure -- prefix =/usr/local/php5 -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-mysql =/usr/local/mysql5
-- Enable-ftp -- enable-debug -- enable-mbstring -- enable-mbregex -- with-gd =/usr/local
-- With-png-dir =/usr/local/lib -- with-zlib-dir =/usr/local/lib -- with-jpeg-dir =/usr/local/lib
-- Enable-libxml -- with-libxml-dir =/usr/local/lib -- enable-pdo -- with-pdo-sqlite
-- With-pdo-mysql =/usr/local/mysql5/bin/mysql_config -- enable-soap
-- Enable-sockets -- with-xmlrp
Make
Make install

Configure APACHE, PHP, and MYSQL to start
Automatically Start MYSQL

Copy codeThe Code is as follows: cp/usr/local/mysql5/share/mysql. server/etc/init. d/mysqld
Ln-s/etc/init. d/mysqld/etc/rc3.d/Kmysqld
Ln-s/etc/init. d/mysqld/etc/rc3.d/Smysqld
Service mysqld start
/Usr/local/apache2/bin/apachectl start
Related Article

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.