linux - 【LAMP环境配置安装注意安装步骤】 9

(一)           安装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 [email protected]

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 [email protected]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.30.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

shell> chown -R root .

shell> chown -R mysql var

shell> bin/mysqld_safe --user=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;

时间: 2024-10-23 01:47:01

linux - 【LAMP环境配置安装注意安装步骤】 9的相关文章

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

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 s

Linux lamp环境编译安装

1.安装准备: 1)httpd-2.0.52.tar.gz 2)mysql-4.1.12.tar.gz 3)libxml2-2.6.27.tar 4)freetype-2.1.10.tar 5)gd-2.0.33.tar 6)jpegsrc.v6b.tar 7)libpng-1.2.16.tar 8)zlib-1.2.3.tar 9)freetds-0.64.tar.gz 10)php-4.3.9.tar.gz 11)phpMyAdmin292.tar.gz 12)ZendOptimizer-3

LAMP环境配置三步曲之(一) CentOS 编译安装 Apache

LAMP环境的配置现今虽然已比之前大大的简化了,但对于一些不熟悉Linux系统的朋友来说,还是有一定难度的,这里将本人的配置过程记录下来,希望能对大家有一些帮助. 本期介绍CentOS下编译安装Apache的方法: 1. 下载Apache服务器 httpd-2.2.26 wget http://apache.fayea.com/apache-mirror//httpd/httpd-2.2.26.tar.gz 2. 安装gcc等必须的编译器 yum install autoconf automak

[LAMP环境搭建三]PHP安装

****说明:先全部看一遍,再开始安装**** 获取PHP源码包 http://cn2.php.net/get/php-5.5.10.tar.gz/from/this/mirrorwget 安装libxml2:wget ftp://xmlsoft.org/libxml2/libxml2-2.9.1.tar.gz./configure --prefix=/usr/local/libxml2# yum -y install python-devel 安装zlib:wget http://zlib.n

LAMP环境的yum简单安装

LAMP是Linux+Apache+Mysql+Php的平台环境. 它包括: Linux操作系统. Apache网站运行软件. Mysql数据库. Php网站编辑软件. ---------------------------------------------------------------------- 一般来说,LAMP的安装分为RPM安装和源代码编译安装. 而RPM安装可以使用前端yum忽略依赖关系,进行简单化安装. 而源代码编译安装则需要事先安装编译环境和手动指定安装路径和选项. 下

[LAMP环境搭建二]MySQL安装

安装前准备工作:[[email protected] src]# yum -y install bison bison-devel ncurses ncurses-devel openssl openssl-devel cmake下载安装http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz wgettar -zxvfcd./bootstrapgmakegmake install/********************************

[LAMP环境搭建一]Apache安装

vi /etc/sysconfig/network-scripts/ifcfg-eth0加入 ONBOOT=yes //启动时网络接口是否有效这样就可以自动连接网络了 /********************删除自带的apache:service httpd stopyum remove httpd/********************安装前准备:yum -y install gcc gcc-c++ libtool /*******************下载:apache源码包 注意是h

linux php环境搭建以及magento安装教程

听朋友用magento在搭建电商系统,我好奇.遂自己下载了一个包部署了一套. 主机采用linux center os6.5,安装程序非常顺利,部署一套大概费时一个小时左右. #################linux环境搭建################## 安装apache2,然后启动: yum install httpd /etc/init.d/httpd start 此时,apache能提供http服务,但是不能解析php,也不能连数据库. Apache主配置文件:/etc/httpd

mac JDK9的安装与环境配置以及Tomcat安装错误问题的解决

MAC JDK9的安装与环境配置以及Tomcat安装错误问题的解决 在终端出现: Unable to find any JVMs matching version "(null)".No Java runtime present, try --request to install.Neither the JAVA_HOME nor the JRE_HOME environment variable is definedAt least one of these environment

linux相关环境配置

linux相关环境配置 环境说明 [[email protected] Python-3.6.6]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.4 (Maipo) [[email protected] Python-3.6.6]# uname -a Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Thu Jul 6 19:56:57 EDT