LAMP Server Configuration

Source: Internet
Author: User
Tags mcrypt zts
1. Install the compiling environment

Yum-y install gcc-c ++ autoconf libjpeglibjpeg-devel libpng-devel freetype-devel libxml2 libxml2-develzlib zlib-devel glibc-devel glib2 glib2-devel bzip2 bzip2-devel unzip-devel curl -devel

Yum-y install fonts-chinese scim-chewingscim-pinyin scim-tables-chinese

Yum-y install libtool

2. install Apache

Download

Http://httpd.apache.org/

Http://labs.xiaonei.com/apache-mirror/httpd/httpd- 2.2.11 .Tar.gz

 

Install Apache

Tar xvzfhttpd- 2.2.11 .Tar.gz

Cd httpd- 2.2.11

./Buildconf

./Configure -- prefix =/usr/local/apache2 -- enable-so -- with-mpm = worker

#./Configure -- prefix =/usr/local/apache2 -- enable-so -- with-mpm = worker -- enable-rewrite -- enable-mods-shared = most

Make

Make install

 

Create www users and groups

/Usr/sbin/groupadd www-g 48

/Usr/sbin/useradd-u 48-g www

Vi/etc/passwd

Www: x: 48: 48:/home/www:/sbin/nologin

 

Configure Apache

Cd/usr/local/apache2/conf

 

Vihttpd. conf

# Use Userdaemon # comment out

# Groupdaemon # comment out

# Add ByAsen

User www

Group www

Includeconf/extra/httpd-mpm.conf

Include conf/extra/httpd-languages.conf

Include conf/extra/httpd-vhosts.conf

 

<Directory "/home/micole/php">

Options FollowSymLinks

AllowOverride None

Order allow, deny

Allow from all

</Directory>

 

VI extra/httpd-mpm.conf

First, comment out the original mpm_worker_module, and add the following content:

# Add by Asen

<Ifmodule mpm_worker_module>

Startservers 10

Serverlimit 2000

Maxclients 1500

Minsparethreads 25

Maxsparethreads 75

Threadsperchild 25

Maxrequestsperchild 0

</Ifmodule>

 

Vi extra/httpd-languages.conf

# Add By Asen

DefaultLanguage zh-CN

 

Vi extra/httpd-vhosts.conf

First comment out all content, and then add the following content

# Add By Asen

NameVirtualHost *

<VirtualHost *>

ServerAdmin asen2000@21cn.com

DocumentRoot/home/micole/php

ServerName www.php.com

</VirtualHost>

 

Edit C: \ WINDOWS \ system32 \ drivers \ etc \ hosts

192.168.3.2 www2.php.com

 

Start

/Usr/local/apache2/bin/apachectl start

 

Access

Setup

Firewall Configuration-open port 80

Http://www.php.com/

 

View installed modules

/Usr/local/apache2/bin/httpd-M

 

Install the mod_rewrite module (this step is not required if -- enable-rewrite is added)

Cd httpd- 2.2.11 /Modules/mappers/

/Usr/local/apache2/bin/apxs-cmod_rewrite.c

/Usr/local/apache2/bin/apxs-I-a-nmod_rewrite mod_rewrite.la

Vi/usr/local/apache2/conf/httpd. conf

LoadModule rewrite_modulemodules/mod_rewrite.so

 

Restart

/Usr/local/apache2/bin/apachectl restart

3. Install MySQL

Download

Http://www.mysql.com/

Http://dev.mysql.com/downloads/mysql/5.1.html

Http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.1/mysql- 5.1.33 .Tar.gz

Asen2000@21cn.com/raebiagaka

 

Create mysql users and groups

/Usr/sbin/groupadd mysql

/Usr/sbin/useradd-g mysql

Vi/etc/passwd

Mysql: x: 501: 501:/home/mysql:/sbin/nologin

 

Install MySQL

Tar xvzf mysql- 5.1.33 .Tar.gz

Cd mysql- 5.1.33

./Configure \

-- Prefix =/usr/local/mysql \

-- Localstatedir =/usr/local/mysql/data \

-- With-unix-socket-path =/usr/local/mysql/tmp/mysql. sock \

-- With-extra-charsets = all \

-- With-charset = utf8 \

-- With-client-ldflags =-all-static \

-- With-mysqld-ldflags =-all-static \

-- With-plugins = all \

-- With-pthread \

-- Enable-thread-safe-client \

-- Enable-Cycler \

-- With-big-tables \

-- With-readline \

-- With-ssl \

-- With-embedded-server \

-- Enable-local-infile

Make

Make install

 

Configure MySQL

Chmod + w/usr/local/mysql

Chown-R mysql. mysql/usr/local/mysql/

Cp support-files/my-medium.cnf/etc/my. cnf

 

Initialize MySQL

/Usr/local/mysql/bin/mysql_install_db -- user = mysql

 

Start

/Usr/local/mysql/bin/mysqld_safe -- user = mysql &

 

Set root Password

/Usr/local/mysql/bin/mysqladmin-urootpassword '000000'

Command Login

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

View Processes

Ps ax | grep mysql

Kill-92911

 

Run the following command to set mysql to run automatically upon startup:
Cd mysql-VERSION
Enter the decompressed directory again, that is, the source code directory.
Cp support-files/mysql. server/etc/init. d/mysql
Copy the mysql. server File to the/etc/init. d/directory and rename it mysql.
Chmod 755/etc/init. d/mysql
Grant the "execution" permission to the/etc/init. d/mysql file.
Chkconfig -- level 345 mysql on
Added to Automatic startup, with a running level of 3 4 5
Service mysql restart
Restart mysql Service

4. install PHP

Download

Http://www.php.net/

Http://downloads.sourceforge.net/mcrypt/

Http://downloads.sourceforge.net/mhash/

Http://php-fpm.anight.org/

Http://eaccelerator.net/

Http://pecl.php.net/package/memcache/

Http://www.phpmyadmin.net/

 

Http://cn.php.net/distributions/php- 5.2.8 .Tar.gz

Http://cn.php.net/distributions/php- 5.2.9 .Tar.gz

 

Http://downloads.sourceforge.net/mcrypt/libmcrypt- 2.5.8 .Tar.gz? Use_mirror = nchc

Http://downloads.sourceforge.net/mcrypt/mcrypt- 2.6.8 .Tar.gz? Use_mirror = nchc

Http://downloads.sourceforge.net/mhash/mhash- 0.9.9 .9.tar.gz? Use_mirror = nchc

Http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.tar.gz

 

Http://php-fpm.anight.org/downloads/head/php- 5.2.8 -Fpm-0.5.10.diff.gz

 

Http://bart.eaccelerator.net/source/ 0.9.5 . 3/eaccelerator-0.9.5.3.tar.bz2

Http://pecl.php.net/get/memcache- 2.2.5 . Tgz

 

Http://prdownloads.sourceforge.net/phpmyadmin/phpMyAdmin- 3.1.3 .1-all-languages.tar.gz #! Md5! 641432aadf6bba 8c 7c 995fd9af5b 168c

 

Supported libraries required for installing PHP

Tar zxvflibiconv-1.13.tar.gz

Cdlibiconv-1.13/

./Configure -- prefix =/usr/local

Make

Make install

 

Tar zxvf libmcrypt- 2.5.8 .Tar.gz

Cd libmcrypt- 2.5.8 /

./Configure

Make

Make install

/Sbin/ldconfig

Cd libltdl/

./Configure -- enable-ltdl-install

Make

Make install

 

Tar xvzf mhash- 0.9.9 .9.tar.gz

Cd mhash- 0.9.9 . 9

./Configure

Make

Make install

 

Cp/usr/local/lib/libmcrypt. */usr/lib

Ln-s/usr/local/lib/libmhash. so.2/usr/lib/libmhash. so.2

 

Tar zxvf mcrypt- 2.6.8 .Tar.gz

Cd mcrypt- 2.6.8 /

./Configure

Make

Make install

 

Install PHP + Apache

Tar zxvf php- 5.2.9 .Tar.gz

Cd php- 5.2.9

./Configure \

-- Prefix =/usr/local/php5 \

-- With-apache2 =/usr/local/apache2 \

-- With-apxs2 =/usr/local/apache2/bin/apxs \

-- With-config-file-path =/usr/local/apache2/conf \

-- With-mysql =/usr/local/mysql \

-- With-mysqli =/usr/local/mysql/bin/mysql_config \

-- With-iconv-dir =/usr/local \

-- With-freetype-dir \

-- With-jpeg-dir \

-- With-png-dir \

-- With-zlib \

-- With-libxml-dir =/usr \

-- Enable-xml \

-- Disable-rpath \

-- Enable-discard-path \

-- Enable-safe-mode \

-- Enable-bcmath \

-- Enable-shmop \

-- Enable-sysvsem \

-- Enable-inline-optimization \

-- With-curl \

-- With-curlwrappers \

-- Enable-mbregex \

-- Enable-sockets \

-- Enable-roxen-zts \

-- Enable-mbstring \

-- With-mcrypt \

-- With-gd \

-- Enable-gd-native-ttf \

-- With-openssl

Sed-I's #-lz-lm-lxml2-lz-lm-lxml2-lz-lm-lcrypt # &-liconv # 'makefile

Make

Make install

 

Tar zxvf memcache- 2.2.5 . Tgz

Cd memcache- 2.2.5

/Usr/local/php5/bin/phpize

./Configure -- with-php-config =/usr/local/php5/bin/php-config

Make

Make install

 

Tar jxvf eaccelerator- 0.9.5 .3.tar.bz2

Cd eaccelerator- 0.9.5 . 3

/Usr/local/php5/bin/phpize

./Configure -- enable-eaccelerator = shared -- with-php-config =/usr/local/php5/bin/php-config

Make

Make install

 

Configure PHP

Cp php. ini-dist/usr/local/apache2/conf/php. ini

Vi/usr/local/apache2/conf/php. ini

Modify

Extension_dir = "./"

Is

Extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-zts-20060613 /"

Add the following lines

Extension = "memcache. so"

Change output_buffering = Off TO output_buffering = On.

 

Configure eAccelerator to accelerate PHP

Mkdir-p/usr/local/php5/eaccelerator_cache

Vi/usr/local/apache2/conf/php. ini

Add the following lines at the end

Extension = "eaccelerator. so"

Eaccelerator. shm_size = "128"

Eaccelerator. cache_dir = "/usr/local/php5/eaccelerator_cache"

Eaccelerator. enable = "1"

Eaccelerator. optimizer = "1"

Eaccelerator. check_mtime = "1"

Eaccelerator. debug = "0"

Eaccelerator. filter = ""

Eaccelerator. shm_max = "0"

Eaccelerator. shm_ttl = "300"

Eaccelerator. shm_prune_period = "120"

Eaccelerator. shm_only = "0"

Eaccelerator. compress = "1"

Eaccelerator. compress_level = "9"

 

Configure Apache

Vi/usr/local/apache2/conf/httpd. conf

 

AddType application/x-httpd-php. php. php3. phtml

AddType application/x-httpd-php-source. phps

 

DirectoryIndex index.html index.htm index. php

 

Disable SELINUX

Vi/etc/selinux/config change SELINUX = enforcing to SELINUX = disabled to restart

 

Restart Apache

/Usr/local/apache2/bin/apachectl restart

 

 

Install phpMyAdmin

Cd/home/asen/php/

Tar xvzf/home/asen/soft/PHP/phpMyAdmin- 3.1.3 .1-all-languages.tar.gz

Mv phpMyAdmin- 3.1.3 . 1-all-languagesphpMyAdmin

Cd phpMyAdmin

Cp libraries/config. default. php config. inc. php

 

Here, you only need to change $ cfg ['servers'] [$ I] ['host'] = 'localhost' to '2017. 0.0.1. Or change it to localhost. localdomain, which is based on more/etc/hosts. You can see localhost and localhost. localdomain is resolved to 127.0.0.1, while MySQL's my. in CNF, bind-address = 127.0.0.1 is added. Therefore, modify $ cfg ['servers'] [$ I] ['host'].

 

Install memcached

Tar-zxvf libevent- 1.4.11 -Stable.tar.gz

CD libevent- 1.4.11 -Stable

./Configure -- prefix =/usr

Make

Make install

Ls-Al/usr/lib | grep libevent

CD ..

 

Tar-zxvf memcached- 1.2.8 .Tar.gz

CD memcached- 1.2.8

./Configure -- prefix =/usr/local/memcached -- With-libevent =/usr

Make

Make install

# After the installation is complete, create a temporary directory for running memcached:

Mkdir-PV/var/run/memcached

Chown-r nobody: Nobody/var/run/memcached

# Start memcached

/Usr/local/memcached/bin/memcached-p route 11-l 127.0.0.1-d-u nobody-P/var/run/memcached. pid-m 64 M -C 1024

 

Others

Encode

Vi/etc/sysconfig/i18n

LANG = "zh_CN.UTF-8"
Change
LANG = "zh_CN.GB18030"

Remote connection

Start apache

Vi/etc/rc. local

Add/usr/local/apache2/bin/apachectlstart

 

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.