lamp环境搭建
1、apahce安装
(1)安装相关的依赖包
[[email protected]~]#yum–y install gcc make openssl-devel c++ libxml2-devel
(2).编译安装apahce
[[email protected]]# tar -zxf httpd-2.2.25
[[email protected]]#cd httpd-2.2.25
[[email protected] src]# ./configure--prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-cgi--enable-ssl --enable-charset-lite --enable-suexec --with-suexec-caller=daemon--with-suexec-docroot=/usr/local/httpd/htdocs
[[email protected] src]#make&& make install
(3)、编译安装完之后启动apache测试
[[email protected]]# /usr/local/httpd/bin/apachectl start
[[email protected] httpd-2.2.25]# netstat-tlnp | grep :80
tcp 0 0 :::80 :::* LISTEN 56629/httpd
(4)、把apache加为系统服务
[[email protected] init.d]# cp/usr/local/httpd/bin/apachectl /etc/init.d/myhttpd
[[email protected] init.d]# vim/etc/init.d/myhttpd
在#!/bin/bash下面加上如下两行:
# chkconfig: 35 85 15
# description: 描述信息
[[email protected] init.d]# chkconfig --add myhttpd
2、安装mysql
(1)、解压并编译安装
[[email protected] src]# useradd -M -u 49 -s/sbin/nolog mysql
[[email protected] src]# tar -zxfmysql-5.1.62.tar.gz
[[email protected]]# cd mysql-5.1.62
[[email protected] mysql-5.1.62]# ./configure--prefix=/usr/local/mysql --with-charset=utf8 --with-collation=utf8_general_ci--with-extra-charsets=gbk,gb2312
[[email protected] mysql-5.1.62]# make&& make install
(2)、数据库配置
[[email protected]]# cp support-files/my-medium.cnf /etc/my.cnf
[[email protected]]# cd /usr/local/mysql/bin/
[[email protected]]# ./mysql_install_db --user=mysql
[[email protected] bin]#chown -R root:mysql /usr/local/mysql/
[[email protected] bin]#chown -R mysql /usr/local/mysql/var/
[[email protected] bin]#ln -s /usr/local/mysql/bin/* /usr/local/bin/
[[email protected] bin]#ln -s /usr/local/mysql/lib/mysql/* /usr/lib64/
[[email protected] bin]#ln -s /usr/local/mysql/include/mysql/* /usr/include/
(3)、把mysqld加为系统服务
[[email protected] bin]#cd /usr/src/mysql-5.1.62/support-files/
[[email protected]]# cp mysql.server /etc/init.d/mysqld
[[email protected] support-files]# chmod +x /etc/rc.d/init.d/mysqld
[[email protected]]# chkconfig --add mysqld
(4)、启动mysql测试
[[email protected] support-files]# servicemysqld start
[[email protected] support-files]# netstat-tlnp | grep :3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 18314/mysqld
[[email protected] support-files]#
3、php源码包安装
(1)、解压并编译安装
1、 [[email protected] src]# tar -zxf php-5.4.19.tar.gz
2、 [[email protected] src]# cdphp-5.4.19
3、 [[email protected] php-5.4.19]# ./configure --prefix=/usr/local/php--enable-mbstring --enable-sockets --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php
[[email protected] php-5.4.19]# make && make install
[[email protected] php-5.4.19]# cpphp.ini-development /usr/local/php/php.ini
(2)、修改httpd配置文件,以便支持php格式文件
[[email protected] httpd]# vim/usr/local/httpd/conf/httpd.conf,添加一行:
AddType application/x-httpd-php .php
[[email protected] httpd]#vim /var/www/html/index.php
<?
php phpinfo();
?>
源码包搭建lamp