首页 > 代码库 > 源码包搭建lamp

源码包搭建lamp

lamp环境搭建

1apahce安装

1)安装相关的依赖包

         [root@localhost~]#yum–y install gcc make openssl-devel c++ libxml2-devel

 

2).编译安装apahce

 

[root@localhostsrc]# tar -zxf httpd-2.2.25

[root@localhostsrc]#cd httpd-2.2.25

[root@localhost 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

[root@localhost src]#make&& make install

3)、编译安装完之后启动apache测试

[root@localhosthttpd-2.2.25]# /usr/local/httpd/bin/apachectl start

[root@localhost httpd-2.2.25]# netstat-tlnp | grep :80

tcp        0     0 :::80                       :::*                        LISTEN      56629/httpd

4)、把apache加为系统服务

[root@localhost init.d]# cp/usr/local/httpd/bin/apachectl /etc/init.d/myhttpd

[root@localhost init.d]# vim/etc/init.d/myhttpd 

#!/bin/bash下面加上如下两行:

# chkconfig: 35 85 15

# description: 描述信息

[root@localhost init.d]# chkconfig --add myhttpd

2、安装mysql

1)、解压并编译安装

[root@localhost src]# useradd -M -u 49 -s/sbin/nolog mysql

[root@localhost src]# tar -zxfmysql-5.1.62.tar.gz

 [root@localhostsrc]# cd mysql-5.1.62

[root@localhost mysql-5.1.62]# ./configure--prefix=/usr/local/mysql --with-charset=utf8 --with-collation=utf8_general_ci--with-extra-charsets=gbk,gb2312

[root@localhost mysql-5.1.62]# make&& make install

2)、数据库配置

[root@localhostmysql-5.1.62]# cp support-files/my-medium.cnf /etc/my.cnf

[root@localhostmysql-5.1.62]# cd /usr/local/mysql/bin/

[root@localhostbin]# ./mysql_install_db --user=mysql

 

[root@svr5 bin]#chown -R root:mysql /usr/local/mysql/

[root@svr5 bin]#chown -R mysql /usr/local/mysql/var/

 

[root@svr5 bin]#ln -s /usr/local/mysql/bin/* /usr/local/bin/

[root@svr5 bin]#ln -s /usr/local/mysql/lib/mysql/* /usr/lib64/

[root@svr5 bin]#ln -s /usr/local/mysql/include/mysql/* /usr/include/

3)、把mysqld加为系统服务

[root@svr5 bin]#cd  /usr/src/mysql-5.1.62/support-files/

[root@svr5support-files]# cp  mysql.server  /etc/init.d/mysqld

 [root@svr5 support-files]# chmod  +x /etc/rc.d/init.d/mysqld

[root@svr5support-files]# chkconfig  --add  mysqld

4)、启动mysql测试

[root@localhost support-files]# servicemysqld start

[root@localhost support-files]# netstat-tlnp | grep :3306

tcp       0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      18314/mysqld

[root@localhost support-files]#

 

3php源码包安装

1)、解压并编译安装

1、  [root@localhost src]# tar -zxf php-5.4.19.tar.gz

2、   [root@localhost src]# cdphp-5.4.19

3、  [root@localhost 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

[root@svr5 php-5.4.19]# make  && make install

[root@svr5 php-5.4.19]# cpphp.ini-development /usr/local/php/php.ini

2)、修改httpd配置文件,以便支持php格式文件

[root@localhost httpd]# vim/usr/local/httpd/conf/httpd.conf,添加一行:

AddType application/x-httpd-php  .php 

[root@localhost httpd]#vim /var/www/html/index.php

<?

php phpinfo();

?>

 


本文出自 “linux学习” 博客,请务必保留此出处http://2993336.blog.51cto.com/2983336/1439708