Install LAMP in source code in CentOS 6.2
Purpose
Install LAMP in source code mode.
Major software version information
Linux: CentOS 6.2 32
Apache: 2.2.29
MySQL: 5.6.22
PHP: 5.2.17
Instructions for use
All source code packages and one-click automated installation scripts have been packaged and uploaded to my cloud disk.
All source code packages are downloaded from the official website or from the officially recommended website.
Related attachments Baidu cloud disk download: http://pan.baidu.com/s/12JCku
Or:
------------------------------------------ Split line ------------------------------------------
FTP address: ftp://ftp1.bkjia.com
Username: ftp1.bkjia.com
Password: www.bkjia.com
Install LAMP in source code on LinuxIDC.com/CentOS 6.2 on April 9
For the download method, see
------------------------------------------ Split line ------------------------------------------
Upload the downloaded package to the/tmp directory of Linux and decompress it.
Execute the following command. The installation process takes a long time.
Sh/tmp/lamp. sh
After installation, run source/etc/profile to add the bin directory of mysql to the environment variable.
The default htdocs directory is located in the/usr/local/apache directory.
The default httpd. conf file is located in the/usr/local/apache/conf directory.
The default php. ini file is located in the/usr/local/php/lib directory.
The default my. cnf file is located in the/etc directory.
After installation, you can use netstat-nltp to check whether httpd and mysqld are started.
You can create a phpinfo. PHP file in the/usr/local/apache/htdocs directory to check whether php works properly. The content of phpinfo. PHP is as follows:
<? Php
Phpinfo ();
?>
If you see the following information on your phpinfo. php page, it means ZendOptimizer is working properly.
You can access the database through http: // server IP Address/phpMyAdmin.
To verify that PHP works properly, you can run it in the next project, such as ECSHOP.
After the download, upload the entire site to the/usr/local/apache/htdocs directory and execute the following command.
Chown-R apache: apache/usr/local/apache/htdocs /*
Script
#! /Bin/bash
# Script Name: One-key Automatic Install LAMP Server
# Author: yestreenstars
# Create Time: 2015-01-08
# Update Time:
DOMAIN_NAME = 'www .example.com '# You can change this.
MYSQL_ROOT_PASSWORD = 'mypassword' # You can change this.
MYSQL_BASEDIR = '/usr/local/mysql' # You can change this.
MYSQL_DATADIR = '/data' # You can change this.
Echo-n' -- Stopping iptables and SELinux ...'
(
Service iptables stop
Chkconfig iptables off
Setenforce 0
[-F/etc/selinux/config] & sed-I '/^ SELINUX =/s/=. */= disabled/'/etc/selinux/config
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing related software ...'
(
Yum-y install gcc-c ++ make cmake openssl-devel bison ncurses-devel perl python-devel freetype-devel wget patch libtool-ltdl-devel
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing apr ...'
(
Tar xjf/tmp/lamp/apr-1.5.1.tar.bz2-C/usr/local/src/
Cd/usr/local/src/apr-1.5.1/
./Configure
Make & make install
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing apr-util ...'
(
Tar xjf/tmp/lamp/apr-util-1.5.4.tar.bz2-C/usr/local/src/
Cd/usr/local/src/apr-util-1.5.4/
./Configure -- with-apr =/usr/local/apr/-- with-crypto
Make & make install
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing pcre ...'
(
Tar xjf/tmp/lamp/pcre-8.36.tar.bz2-C/usr/local/src/
Cd/usr/local/src/pcre-8.36/
./Configure -- prefix =/usr/local/pcre
Make & make install
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing zlib ...'
(
Tar xzf/tmp/lamp/zlib-1.2.8.tar.gz-C/usr/local/src/
Cd/usr/local/src/zlib-1.2.8/
./Configure -- prefix =/usr/local/zlib
Make & make install
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing apache ...'
(
Useradd-M-s/sbin/nologin apache
Tar xjf/tmp/lamp/httpd-2.2.29.tar.bz2-C/usr/local/src/
Cd/usr/local/src/httpd-2.2.29/
./Configure \
-- Prefix =/usr/local/apache \
-- With-z =/usr/local/zlib \
-- Enable-so -- enable-static-support \
-- Enable-deflate = shared \
-- Enable-expires = shared \
-- Enable-rewrite = shared
Make & make install
Sed-I '69, 70 s/daemon/apache/; 101 s /. */servername' $ DOMAIN_NAME ': 80/; 170 s/$/index. php/; 312a \ AddType application/x-httpd-php. php '/usr/local/apache/conf/httpd. conf
/Bin/cp-f/tmp/lamp/httpd/etc/init. d/
Chmod 755/etc/init. d/httpd
Chkconfig -- add httpd
Chkconfig httpd on
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing mysql ...'
(
Useradd-M-s/sbin/nologin mysql
Mkdir-p $ MYSQL_DATADIR
Chown-R mysql: mysql $ MYSQL_DATADIR
Tar xzf/tmp/lamp/mysql-5.6.22.tar.gz-C/usr/local/src/
Cd/usr/local/src/mysql-5.6.22/
Cmake \
-DMYSQL_BASEDIR = $ MYSQL_BASEDIR \
-DMYSQL_DATADIR = $ MYSQL_DATADIR \
-DDEFAULT_CHARSET = 'utf8 '\
-DDEFAULT_COLLATION = 'utf8 _ general_ci'
Make & make install
Cd/usr/local/mysql/
./Scripts/mysql_install_db -- user = mysql -- basedir = $ MYSQL_BASEDIR -- datadir = $ MYSQL_DATADIR
/Bin/cp-f $ PWD/support-files/mysql. server/etc/init. d/mysqld
/Bin/cp-f $ PWD/support-files/my-default.cnf/etc/my. cnf
Echo "PATH = $ MYSQL_BASEDIR/bin/: $ PATH">/etc/profile
Chkconfig -- add mysqld
Chkconfig mysqld on
Service mysqld start
$ MYSQL_BASEDIR/bin/mysqladmin-uroot password $ MYSQL_ROOT_PASSWORD
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing re2c ...'
(
Tar xzf/tmp/lamp/re2c-0.13.7.5.tar.gz-C/usr/local/src/
Cd/usr/local/src/re2c-0.13.7.5/
./Configure
Make & make install
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing libxml2 ...'
(
Tar xzf/tmp/lamp/libxml2-2.9.2.tar.gz-C/usr/local/src/
Cd/usr/local/src/libxml2-2.9.2/
./Configure -- prefix =/usr/local/libxml2
Make & make install
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing libpng ...'
(
Tar xzf/tmp/lamp/libpng-1.6.16.tar.gz-C/usr/local/src/
Cd/usr/local/src/libpng-1.6.16/
./Configure -- prefix =/usr/local/libpng
Make & make install
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing jpeg ...'
(
Mkdir/usr/local/jpeg
Mkdir/usr/local/jpeg/bin
Mkdir/usr/local/jpeg/lib
Mkdir/usr/local/jpeg/include
Mkdir-p/usr/local/jpeg/man/man1
Tar xzf/tmp/lamp/jpegsrc.v9a.tar.gz-C/usr/local/src/
Cd/usr/local/src/jpeg-9a/
./Configure -- prefix =/usr/local/jpeg -- enable-shared -- enable-static
Make & make install
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing freetype ...'
(
Tar xjf/tmp/lamp/freetype-2.5.5.tar.bz2-C/usr/local/src/
Cd/usr/local/src/freetype-2.5.5/
./Configure -- prefix =/usr/local/freetype
Make & make install
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing libmcrypt ...'
(
Tar xzf/tmp/lamp/libmcrypt-2.5.7.tar.gz-C/usr/local/src/
Cd/usr/local/src/libmcrypt-2.5.7/
./Configure -- prefix =/usr/local/libmcrypt
Make & make install
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing libgd ...'
(
Tar xzf/tmp/lamp/libgd-2.1.0.tar.gz-C/usr/local/src/
Cd/usr/local/src/libgd-2.1.0/
. /Configure -- prefix =/usr/local/libgd -- with-zlib =/usr/local/zlib/-- with-jpeg =/usr/local/jpeg/-- with-png = /usr/local/libpng/-- with-freetype =/usr/local/freetype/
Make & make install
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing libiconv ...'
(
Tar xzf/tmp/lamp/libiconv-1.14.tar.gz-C/usr/local/src/
Cd/usr/local/src/libiconv-1.14/
./Configure -- prefix =/usr/local/
Make & make install
Ln-s/usr/local/lib/libiconv. so.2/usr/lib/
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing bzip2 ...'
(
Tar xzf/tmp/lamp/bzip2-1.0.6.tar.gz-C/usr/local/src/
Cd/usr/local/src/bzip2-1.0.6/
Make install PREFIX =/usr/local/bzip2
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing php ...'
(
Tar xzf/tmp/lamp/php-5.2.17.tar.gz-C/usr/local/src/
Cd/usr/local/src/php-5.2.17/
Wget https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt
Patch-p0-B <txtbgxGXAvz4N.txt
./Configure \
-- Prefix =/usr/local/php \
-- With-apxs2 =/usr/local/apache/bin/apxs \
-- With-libxml-dir =/usr/local/libxml2 \
-- With-gd \
-- With-jpeg-dir =/usr/local/jpeg \
-- With-png-dir =/usr/local/libpng \
-- With-zlib-dir =/usr/local/zlib \
-- With-freetype-dir =/usr/local/freetype \
-- With-mcrypt =/usr/local/libmcrypt \
-- With-mysql =/usr/local/mysql \
-- With-mysqli =/usr/local/mysql/bin/mysql_config \
-- Enable-soap \
-- Enable-mbstring \
-- Enable-sockets
Make ZEND_EXTRA_LIBS = '-liconv'
Make install
Cp/usr/local/src/php-5.2.17/php. ini-dist/usr/local/php/lib/php. ini
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing ZendOptimizer ...'
(
Tar xzf/tmp/lamp/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz-C/usr/local/src/
Mv/usr/local/src/ZendOptimizer-3.3.9-linux-glibc23-i386/usr/local/ZendOptimizer
Echo-e '\ n [ZendOptimizer] \ nzend_extension =/usr/local/ZendOptimizer/data/5_2_x_comp/ZendOptimizer. so '>/usr/local/php/lib/php. ini
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Installing phpMyAdmin ...'
(
Tar xjf/tmp/lamp/phpMyAdmin-4.0.10.7-all-languages.tar.bz2-C/usr/local/src/
Mv/usr/local/src/phpMyAdmin-4.0.10.7-all-languages/usr/local/apache/htdocs/phpMyAdmin
Cd/usr/local/apache/htdocs/phpMyAdmin
/Usr/local/mysql/bin/mysql-uroot-p $ MYSQL_ROOT_PASSWORD <examples/create_tables. SQL
Cp config. sample. inc. php config. inc. php
Sed-I '48, 60 s # // # 'config. inc. php
) &>/Dev/null & echo 'completed! '| Exit
Echo-n' -- Starting apache ...'
(
Service httpd start
) &>/Dev/null & echo 'completed! '| Exit
Echo 'completed! '
------------------------------------ Split line ------------------------------------
CentOS 6.5 system installation and configuration LAMP (Apache + PHP5 + MySQL) server environment
Configure the LAMP + phpMyAdmin PHP (5.5.9) development environment in Ubuntu 14.04
Ubuntu 14.10 text tutorial on hard drive installation in Windows 7
Install Ubuntu 14.10 on a USB flash drive
Official release and download of Ubuntu 14.10
How to upgrade Ubuntu 14.04 LTS to Ubuntu 14.10
Install LAMP in Ubuntu 14.10