LAMP环境配置安装注意安装步骤及说明事项。

(一)           安装gcc

gcc

glibc-devel

glibc-headers

kernel-headers

libgomp

gcc-c++

libstdc++-devel

(二)           安装zlib压缩库

zlib-1.2.5.tar.gz

shell> cd /home/shuhua/tar

shell> tar –zxvf zlib-1.2.5.tar.gz

shell> cd zlib-1.2.5

shell> ./configure //这个配置编译命令不要加目录参数

shell>make && make install

(三)           安装apache

shell> cd /home/shuhua/tar

shell> tar -jxvf httpd-2.2.19.tar.bz2

shell> cd httpd-2.2.19

shell>./configure --prefix=/usr/local/http2  \

--enable-modules=all \

--enable-rewrite \

--enable-mods-shared=all \

--enable-so

shell> make && make install

#启动Apache

shell> /usr/local/http2/bin/apachectl start

#测试apache

浏览器打开: http://虚拟机IP

看到 "it works!",即为成功

配置虚拟主机

1)配置host文件

打开C:/windows/system32/drivers/etc/hosts 文件

增加域名记录

如:

192.168.1.246 www.ec1.com

192.168.1.246 www.ec2.com

2) 增加虚拟主机

vi /usr/local/http2/conf/httpd.conf

取消#Include conf/extra/httpd-vhosts.conf

这一行前面的#号

保存退出

vi /usr/local/http2/conf/extra/httpd-vhosts.conf

增加虚拟主机记录

<VirtualHost *:80>

ServerAdmin webmaster@dummy-host.example.com

DocumentRoot "/usr/local/http2/htdocs/ec1"

ServerName www.ec1.com

ServerAlias www.dummy-host.example.com

ErrorLog "logs/dummy-host.example.com-error_log"

CustomLog "logs/dummy-host.example.com-access_log" common

</VirtualHost>

<VirtualHost *:80>

ServerAdmin webmaster@dummy-host2.example.com

DocumentRoot "/usr/local/http2/htdocs/ec2"

ServerName www.ec2.com

ErrorLog "logs/dummy-host2.example.com-error_log"

CustomLog "logs/dummy-host2.example.com-access_log" common

</VirtualHost>

3)

shell> cd /usr/local/http2/htdocs

shell> mkdir ec1 ec2

shell> echo this is ec1.com > ec1/index.html

shell> echo this is ec2.com > ec2/index.html

4)重启apache

/usr/local/http2/bin/apachectl restart

5)浏览器打开www.ec1.com,和www.ec2.com

看到不同的网站内容,虚拟主机创建完毕!

安装图形库,为编译PHP做准备

libxml2-2.7.2.tar.gz

jpegsrc.v8b.tar.gz

libpng-1.4.3.tar.gz

freetype-2.4.1.tar.gz

gd-2.0.35.tar.gz

(四)             安装libxml2

shell> cd /home/shuhua/tar

shell> tar zxvf libxml2-2.7.2.tar.gz

shell> cd libxml2-2.7.2

shell>./configure --prefix=/usr/local/libxml2

shell> make && make install

(五)             安装jpeg8

shell> cd /home/shuhua/tar

shell> tar -zxvf jpegsrc.v8b.tar.gz

shell> cd jpeg-8b

shell>./configure --prefix=/usr/local/jpeg \

--enable-shared --enable-static

shell> make && make install

(六)             安装libpng

shell> cd /home/shuhua/tar

shell> tar zxvf libpng-1.4.3.tar.gz

shell> cd libpng-1.4.3

shell>./configure  #和zlib一样不要带参数,让它默认安装到相应目录

shell> make && make install

(七)             安装freetype

shell> cd /home/shuhua/tar

shell> tar zxvf freetype-2.4.1.tar.gz

shell> cd freetype-2.4.1

shell>./configure --prefix=/usr/local/freetype

shell> make && make install

(八)             安装GD库

shell> cd /home/shuhua/tar

shell> tar -zvxf gd-2.0.35.tar.gz

shell> mkdir -p /usr/local/gd

shell> cd gd-2.0.35

shell>./configure --prefix=/usr/local/gd  \

--with-jpeg=/usr/local/jpeg/   \

--with-png --with-zlib \

--with-freetype=/usr/local/freetype

shell> make && make install

(九)             安装 php5

shell> cd /home/shuhua/tar

shell> tar -jxvf php-5.3.6.tar.bz

shell> cd php-5.3.6

shell>./configure --prefix=/usr/local/php \

--with-apxs2=/usr/local/http2/bin/apxs \

--with-mysql=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-mysqli=mysqlnd \

--with-freetype-dir=/usr/local/freetype \

--with-gd=/usr/local/gd \

--with-zlib --with-libxml-dir=/usr/local/libxml2 \

--with-jpeg-dir=/usr/local/jpeg \

--with-png-dir \

--enable-mbstring=all \

--enable-mbregex \

--enable-shared

shell> make && make install

shell> cp php.ini-development /usr/local/php/lib/php.ini

配置Apache使其支持php

vi /usr/local/http2/conf/httpd.conf

1)        在httpd.conf(Apache主配置文件)中增加:

AddType application/x-httpd-php .php

2)        找到下面这段话:

<IfModule dir_module>

DirectoryIndex index.html

</IfModule>

在index.html 前面添加index.php

3)        建立php测试网页

vi /usr/local/apache2/htdocs/index.php

输入如下内容:

<?php

phpinfo();

?>

4)        重启apache

shell> /usr/local/http2/bin/apachectl restart

5)        再次浏览器查看http://虚拟机IP

如果看到php信息,工作就完成了!

(十)             安装MySQL

1)        编译安装MySQL

shell> cd /home/shuhua/tar

shell> tar -xzvf mysql-5.1.58.tar.gz

shell> cd mysql-5.1.58

shell> ./configure --prefix=/usr/local/mysql \

--with-charset=utf8 \

--with-extra-charsets=gbk,gb2312,binary

shell> mount .....挂载光盘
   shell> rpm -ivh libtermcap-devel-2.0.8-46....

shell> make && make install

2)        配置并初始化MySQL

shell> groupadd mysql

shell> useradd  -g mysql mysql

shell> cp support-files/my-medium.cnf /etc/my.cnf

shell> cd /usr/local/mysql

shell> chown -R mysql.mysql .

shell> bin/mysql_install_db --user=mysql \

--datadir=/usr/local/mysql/var

创建mysql测试数据库和系统的数据库

shell> chown -R root .

把当前目录文件的主人都改为root,避免数据库恢复为出厂设置。

shell> chown -R mysql var

shell> bin/mysqld_safe --user=mysql &

启动mysql,& 后台运行mysql服务

3)        测试数据库

shell> bin/mysql –uroot

mysql> show databases;

4)        接上步,修改mysql密码(可不做此步,默认无密码)

mysql>UPDATE user SET

password=PASSWORD('new_password')

WHERE user='root';

mysql>flush privileges;

1.php模块安装完毕后重启apache如果提示如下信息(apache重启失败):

[root@localhost php-5.3.6]# /usr/local/http2/bin/apachectl restart

httpd: Syntax error on line 105 of /usr/local/http2/conf/httpd.conf: Cannot load /usr/local/http2/modules/libphp5.so into server: /usr/local/libxml2/lib/libxml2.so.2: symbol gzopen64, version ZLIB_1.2.3.3 not defined in file libz.so.1 with link time reference

解决办法:

[root@localhost sbin]# echo "/usr/local/lib" >> /etc/ld.so.conf

[root@localhost sbin]# ldconfig

http://lipengyu2006.iteye.com/blog/1780042

2.

1)      重新安装apache启动失败

[root@localhost httpd-2.2.19]# /usr/local/htt2/bin/apachectl restart

httpd not running, trying to start

(98)Address already in use: make_sock: could not bind to address [::]:80

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

no listening sockets available, shutting down

Unable to open logs

原因是80端口被占用

解决:

查看80端口使用情况

[root@localhost httpd-2.2.19]# netstat -lnp|grep 80

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

unix  2      [ ACC ]     STREAM     LISTENING     6580   1957/gpm            /dev/gpmctl

unix  2      [ ACC ]     STREAM     LISTENING     5422   1800/pcscd          /var/run/pcscd.comm

查看80的使用者是谁端口

[root@localhost httpd-2.2.19]# ps 28195

PID TTY      STAT   TIME COMMAND

28195 ?        Ss     0:00 /usr/local/http2/bin/httpd -k restart

经过分析知道了80端口被系统的一个进程占用,这个进程是旧的apache服务

将这个进程杀之

[root@localhost httpd-2.2.19]# kill -9 28195

[root@localhost httpd-2.2.19]#

LAMP搭建 转的更多相关文章

  1. 买错的电影票,含着泪也得看-LAMP搭建&Linux基础

    hi 没说过,上周五室友过生请客,在龙湖里吃嗨了喝爽了,回去的路上侃侃而谈.说好的这周一起去看年内最后的大片,火星救援的,谁知道老子眼神不好,买错了电影的时间...把周六的约定提前到了今儿个下午,ma ...

  2. (原创)LAMP搭建之二:apache配置文件详解(中英文对照版)

    LAMP搭建之二:apache配置文件详解(中英文对照版) # This is the main Apache server configuration file. It contains the # ...

  3. (原创)LAMP搭建之一:图解如何安装并检查LAMP

    LAMP搭建之一:图解如何安装并检查LAMP 第一步:安装Linux(RedHat5) 第二步:rpm -qa httpd(查看apache是否安装) rpm -qa php(查看php是否安装) r ...

  4. LAMP 搭建wordpress部署教程贴.

    LAMP 搭建wordpress部署教程贴.这是一篇主要将LAMP,并且通过wordpress来进行验证,演示.如何去部署PHP CMS很多新手看到LAMP就很很头大,觉得很难搞,编译安装,搞了好几天 ...

  5. Ubuntu 14.04 LAMP搭建(Apache 2.47+MySQL 5.5+PHP5.5)

    原文:Ubuntu LAMP搭建 为了数据库课程设计,只好自己搭一个数据库系统,采用LAMP方式. 一.安装 1.安装Apache sudo apt-get install apache2 Apach ...

  6. LVS之-LAMP搭建wordpress

    author:JevonWei 版权声明:原创作品 LVS搭建wordpress,涉及的知识点有DNS,LAMP,NFS及LVS 网络拓扑图 网络环境 NFS 192.168.198.130 mysq ...

  7. LAMP 搭建

    p { margin-bottom: 0.25cm; line-height: 120% } LAMP 搭建 承 Ubuntu 17.10.1安装, 定制. 参考 电子工业出版社, Ubuntu完美应 ...

  8. Linux:LAMP搭建DISCU!论坛

    LAMP搭建DISCU!论坛 试验机为centos6.8 i686 应用的包 mysql-5.1.73-linux-i686-glibc23.tar.gz httpd-2.2.24.tar.bz2 p ...

  9. 生产环境LAMP搭建 - 基于 fastcgi

    生产环境LAMP搭建 - 基于 fastcgi 由于在module模式,php只是已http的模块形式存在,无形中加重了http的服务负载,通常在企业架构中,使用fastcgi的模式,将所有的服务都设 ...

  10. LAMP 搭建练习

    目录 LAMP 搭建 1:CentOS 7, lamp (module): http + php + phpMyAdmin + wordpress 192.168.1.7 配置虚拟主机 xcache ...

随机推荐

  1. tensorflow GPU的使用

    参考:https://blog.csdn.net/mzpmzk/article/details/78647711 import os # 默认情况,TF 会占用所有 GPU 的所有内存, 我们可以指定 ...

  2. Hello!OA!Hello!工作流!寻找OA和工作流的旅途记录

    最近新到了一家公司,这家公司做的人力资源管理,需要一个OA系统,所以就让我做一个选型,经过我2周时间的筛选,试用,沟通,测试,最终确定了几款,这个艰辛的路程,在这里记录一下~ 寻找OA的路程----- ...

  3. AcWing 309. 装饰围栏

    题目链接 这道题与下一章的数位\(dp\)解题思路十分一致. 把寻找答案变成按位(并且是字典序从小到大)枚举当前这一位可以填的情况. 通过\(dp\)预处理的信息告诉我们可行性,就可以把答案紧逼到一个 ...

  4. C++ 虚函数表与多态 —— 多态的简单用法

    首先看下边的代码,先创建一个父类,然后在来一个继承父类的子类,两个类中都有自己的 play() 方法,在代码的第35-37行,创建一个父类指针,然后将子类地址引用赋值给父类,这时调用 P 指针的 pl ...

  5. Linux修改系统时间为东八区北京时间(上海时间)

    1. Linux时间   Linux的时间分为 System Clock(系统时间)和 Real Time Clock(硬件时间,简称RTC).   系统时间:指系统内核中的时间.   硬件时间:指主 ...

  6. 解析SwiftUI布局细节(一)

    前言 在前面的文章中谈了谈对SwiftUI的基本的认识,以及用我们最常见的TB+NA的方式搭建了一个很基本的场景来帮助认识了一下SwiftUI,具体的文章可以在SwiftUI分类部分查找,这篇我准备在 ...

  7. 拒绝造轮子!如何移植并使用Linux内核的通用链表(附完整代码实现)

    在实际的工作中,我们可能会经常使用链表结构来存储数据,特别是嵌入式开发,经常会使用linux内核最经典的双向链表 list_head.本篇文章详细介绍了Linux内核的通用链表是如何实现的,对于经常使 ...

  8. html 02-浏览器的介绍

    02-浏览器的介绍 #常见的浏览器 浏览器是网页运行的平台,常见的浏览器有谷歌(Chrome).Safari.火狐(Firefox).IE.Edge.Opera等.如下图所示: 我们重点需要学习的是 ...

  9. 移动端 Swiper

    一.什么是swiper 开源.免费.强大的触摸滑动插件 Swiper常用于移动端网站的内容触摸滑动 Swiper能实现触屏焦点图.触屏Tab切换.触屏多图切换等常用效果 #二.如何使用 1.首先加载插 ...

  10. 2020软件测试工程师面试题汇总(内含答案)-看完BATJ面试官对你竖起大拇指!

    测试技术面试题 1.什么是兼容性测试?兼容性测试侧重哪些方面? 参考答案: 兼容测试主要是检查软件在不同的硬件平台.软件平台上是否可以正常的运行,即是通常说的软件的可移植性. 兼容的类型,如果细分的话 ...