Introduction of Lamp
Linux+apache+mysql/mariadb+perl/php/python a group of open-source software that is often used to build dynamic Web sites or servers is itself a separate program, but because it is often used together, it has a higher degree of compatibility, Together make up a powerful Web application platform.
Lamp Build-up process
installation order: httpd-->mysql-->php
because PHP's compilation and installation relies on the development environment of HTTPD and the development environment of MySQL, PHP is finally installed
First, prepare the environment
Install development tools and servers first
Yum Groupinstall "Development Tools" "Server Platform Development"
Yum Install-y pcre-devel
Yum install-y gcc
Yum Install OpenSSL
Yum Install Openssl-devel
Next download Arp and api-util
: arp.apache.org
Compile and install:
[[email protected] ~]# tar xf apr-1.5.2.tar.bz2 [[email protected] ~]# cd apr-1.5.2[[email protected] apr-1.5.2]# ./ configure --prefix=/usr/local/apr[[email protected] apr-1.5.2]# make && Make install[[email protected] ~]# tar xf apr-util-1.5.4.tar.bz2 [[email protected] ~]# cd apr-util-1.5.4[[email protected] apr-util-1.5.4]# ./ configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr[[email protected] Apr-util-1.5.4]# make && make install
two , installation httpd
installed version : httpd-2.2.31.tar.bz2
: httpd.apache.org
installation process :
1) Installation
Tar XF httpd-2.2.31.tar.bz2cd httpd-2.2.31.tar.bz2[[email protected] httpd-2.2.31]#./configure--prefix=/usr/local/ Apache22--sysconfdir=/etc/httpd22--enable-so--enable-ssl--enable-cgi--enable-rewrite--with-zlib--with-pcre-- WITH-APR=/USR/LOCAL/APR--with-apr-util=/usr/local/apr-util--with-modules=most--enable-mpms-shared=all-- With-mpm=prefork[[email protected] httpd-2.2.31]# make && make install
--PREFIX=/USR/LOCAL/APACHE22: Installation path
-SYSCONFDIR=/ETC/HTTPD22: Configuration file path
--ENABLE-SO: Let Apache core load DSO
--ENABLE-SSL: Support SSL
--ENABLE-CGI: Support CGI
--enable-rewrite: Support rewrite feature
--with-zlib: Supports data compression
--with-pcre: Support Pcre Regular
--WITH-APR=/USR/LOCAL/APR:APR Location
--with-apr-util=/usr/local/apr-util:apr-util Location
--with-modules=most: Support for more modules
--enable-mpms-shared=all: Supports all modes of MPMS
--with-mpm=prefork: Set MPM mode to Prefork
2) Configure path
[Email protected] ~]# cat/etc/profile.d/httpd22.shexport path=/usr/local/apache22/bin: $PATH
3) Configuring the service script
[Email protected] ~]# cp/etc/rc.d/init.d/httpd/etc/rc.d/init.d/httpd22 #直接拷贝原先系统中的脚本修改 [[email protected] ~]# CAT/ etc/rc.d/init.d/httpd22prog=httpdhttpd=${httpd-/usr/local/apache22/bin/httpd}pidfile=${pidfile-/usr/local/ Apache22/logs/${prog}.pid} #pidfile =${pidfile-/var/run/${prog}.pid}lockfile=${lockfile-/var/lock/subsys/${prog} }retval=0
Note: The httpd.pid location of the httpd-2.2.31 version is changed, so the Pidfile file location needs to be modified
Start the service to run normally, at this time the browser can see whether it is normal, note, with the extranet browsing, need to turn off SELinux, configure Iptable.
three , installing MySQL (mariadb)
Universal binary format installation MySQL: (: https://mariadb.org)
Installation process:
1) New MySQL group and User:
Groupadd-r MySQL useradd-r-g MySQL MySQL
2). Unzip for MySQL
Tar XF mariadb-5.5.36-linux-i686.tar.gz-c/usr/local #必须解压这里 cd/usr/local ln-sv mariadb-5.5.36-linux-i686 MySQL #必须建立连接
3). Create required directories and Modify permissions
CD Mysql/mkdir mydata #创建数据的存放位置 pvcreate/dev/sda3 vgcreate myvb/dev/sda3 lvcreate-l 10g-m mylv #创建逻辑卷 mkfs- T ext4/dev/myvg/mylv vim/etc/fstab/dev/myvg/mylv/mydata xfs defaults #将mydata目录挂载至新建的逻辑卷上 mount-a Mount mkdir /mydata/data chown-r Mysql:mysql/mydata/data #修改存放数据目录的用户及权限
4) Initialize MySQL
scripts/mysql_install_db--help scripts/mysql_install_db--user=mysql--datadir=/mydata/data #将用户设为mysql, data present in/ Under the Mydata/data directory
5) Verification:
Ls/mydata/data #如果有文件, Description created successfully
6). configuration file:
[Email protected] mysql]# Mkdir/etc/mysql
[email protected] mysql]# CP support-files/my-large.cnf/etc/mysql/my.cnf [[email protected] mysql]# vim/etc/mysql/my. CNF [mysqld] Port = 3306 socket =/tmp/mysql.sock skip-external-locking key_buffer_size = 256M max_allowed_packet = 1M ta Ble_open_cache = Sort_buffer_size = 1M Read_buffer_size = 1M Read_rnd_buffer_size = 4M myisam_sort_buffer_size = 64M t Hread_cache_size = 8 query_cache_size= 16M # Try number of CPU ' s*2 for thread_concurrency thread_concurrency = 8 datadir=/ Mydata/data innodb_file_per_table=on#innodb_file_per_table parameter, you can modify the InnoDB as a standalone tablespace pattern, and each table in each database generates a data space
#注意: MySQL extract directory has support-files directory, through this directory can set most of the configuration files
Service script:
CP Support-files/mysql.server/etc/rc.d/init.d/mysqld
Chkconfig--add mysqld
Service mysqld Start
Ls/mydata/data
Vim/etc/profile.d/mariadi.sh Plus Bin
Exprot Path=/usr/local/mysql/bin: $PATH
Mysql
Show DATABASES Displays the existing database
At this point, the installation of MARIADB is complete.
Four, modular way to install PHP:
Yum install libxml2-devel libmcrypt-devel bzip2-devel/configure--help |less/configure--prefix=/usr/local/php--wit h-mysql=/usr/local/mysql/--with-openssl--with-mysqli=/usr/local/mysql/bin/mysql_config--enable-mbstring-- With-freetype-dir--with-jpeg-dir--with-zlib--with-libxml-dir=/usr--enable-xml--enable-sockets--with-apxs2=/usr /local/apache22/bin/apxs--with-mcrypt--with-bz2--with-config-file-path=/etc/php/php.ini-- with-config-file-scan-dir=/etc/php/php.d/
The configuration file needs to be created automatically:
MKDIR-PV/ETC/PHP/PHP.DCP Php.ini-production/etc/php/php.ini
Configuring the HTTPD program
Cd/etc/httpd22/vim httpd22 addtype application/x-httpd-php. php addtype application/x-httpd-php-source. Phps loadmoudle php5_module modules/libphp5.so directoryindex index.php index.html
Configure index.html
<?php $conn =mysql_cnnect (' 127.0.0.1 ', ' root ', '); if ($conn) echo "Success"; else echo "failure"; Mysql_close () <?php>
Deployment: PhpMyAdmin
to set up users for MySQL users:
1.SET PASSWORD for ' username ' @ ' host ' =password (' Your_password ')
2.update Mysql.user set Password=password (' You_password ') where user= "Your user"
MySQL use MySQL upadate user set Password=password (' magedu ') where user= ' root ' select User,host,password FR OM user; Fluse Privileges
mysql-uroot-p link mysql, re-login
Unzip Phpayadmin-4.0.5-all-languages.zip CD phpayadmin-4.0.5-all-languages MV */USR/LOCAL/APACHE/HTDOCS/PMA cd/usr/ LOCAL/APACHE/HTDOCS/PMA CP config.sample.inc.php config.inc.php
Installation of pressure test tool XCache
/usr/local/php/bin/phpize./configure--help./conifgure--with-php-config=/usr/local/php/bin/php-config Make & & make install//compile complete finally there is an extension path/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/recorded [[email protected ] xcache-3.1.2]# CP xcache.ini/etc/php/php.d/[[email protected] xcache-3.1.2]# Cd/etc/php/php.d[[email protected] php.d]# vim Xcache.ini[xcache-common];; Non-windows example:extension =/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/xcache.so #改路径;; Windows Example:; Extension = Php_xcache.dll
Restart HTTPD service, configuration complete
This article is from the "Lifelong Learning" blog, please be sure to keep this source http://chickengg.blog.51cto.com/10402610/1688160
Building a lamp-based Web application platform