在centos6.6上安装apache2.4+php5.6+mysql5.6

(一)安装gcc

  glibc-devel
        glibc-headers  ==>依赖项
           kernel-headers  ==>依赖项
      libgomp
   gcc-c++
      libstdc++-devel  ==>依赖项

linux,linux系统下载

(一)           安装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

浏览器打开:

看到 “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]

            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)        再度浏览器查看

假若看到php音讯,工作就大功告成了!

 

(十)             安装MySQL

1)        编写翻译安装MySQL

shell> cd /home/shuhua/tar

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

LAMP环境安插安装注意安装步骤,linux系统下载。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;

 

(一) 安装gcc gcc glibc-devel
glibc-headers kernel-headers libgomp gcc-c++ libstdc++-devel (二)
安装zlib压缩库 zlib-1.2.5.tar.gz shell cd /home/sh…

LAMP环境布署安装注意安装步骤及注脚事项。

 

(二)安装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

LAMP安装种种题材一挥而就

关于wget的安装

将事先装系统的.iso文件挂载到光驱

 

由于自身在/home/jinnan/下建立了三个cdrom文件夹

 

Shell>#mount /dev/cdrom  /home/jinnan/cdrom

 

Shell># cd /home/jinnan/cdrom

 

Shell># ls

 

Shell># cd Packages

 

Shell>#ls | grep wget

 

Shell># rpm -ivh wget-1.12-5.el6.x86_64.rpm

 

测试wget能或无法下载文件

 

Shell># wget

 

 

依靠软件查询:

 

 

至于lamp环境设置的须要软件的下载地址:

freetype:   

 

libxml2:    

 

jpegsrc:     

 

libpng:     

 

zlib:         

 

libgd:         

 

php:         

 

apache:         

 

apr / apr-util:     

 

pcre:        

 

cmake:         

 

mysql:国内镜像站下载:

           福建镜像站:

           官方下载:   

 

什么样从Mysql官网下载mysql.tar.gz版本的安装包:

【就算压缩包为.tar.bz2,那么解压命令为 tar jxvf  ****.tar.bz2】

 

(三)安装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

浏览器打开:

看到 “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)        再一次浏览器查看

假诺见到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;

 

1. 访问ftp报错

澳门金沙国际 1

解决:

关闭selinux

vi /etc/selinux/config

情节改动为: selinux=disable

自此重启reboot。

下图分别为selinux关闭前 和 关闭后:

澳门金沙国际 2

澳门金沙国际 3

安装gcc:

安装gcc的时候gcc的几个依靠关系如下,lib【是library的缩写】,比如libppl,ppl代表的是包名或软件名

gcc

         cloog-ppl

                   ppl(libppl.so.7/libppl_c.so.2)

         cpp

                   mpfr(libmpfr.so.1)

gcc-c++

         libstdc++-devel

================================================================

 

 

2. 借助软件查询

apr安装【apr-1.6.2.tar.gz】

 

shell>#tar zxvf apr-1.6.2.tar.gz

 

shell>#cd apr-1.6.2

 

shell>#./configure –prefix=/usr/local/apr1.6

 

shell>#make && make install

 

一.安装gcc

gcc

    cloog-ppl

        ppl(libppl.so.7/libppl_c.so.2)

    cpp

mpfr(libmpfr.so.1)

gcc-c++

    libstdc++-devel

mpfr-2.4.1-6.el6.i686.rpm和ppl-0.10.2-11.el6.i686.rpm

 

 

快捷键rz sz:

rz、sz命令没找到?

安装lrzsz即可:

shell># yum -y
install lrzsz

 

安装apr-util:【 apr-util-1.5.4.tar.gz】

 

shell>#tar zxvf apr-util-1.5.4.tar.gz

 

shell>#cd apr-util-1.5.4

 

 

shell>#./configure –prefix=/usr/local/apr-util1.4 \

         –with-apr=/usr/local/apr1.6/

 

shell>#make && make install

 

=============================================================

二.安装zlib压缩库

shell>##
cd /home/jinnan/tar

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

shell>#
cd zlib-1.2.5

shell># ./configure
    //那么些布局编写翻译命令不要加目录参数

shell>#
make && make install

 

安装pcre:【 pcre-8.34.tar.gz】

 

 shell>#./configure –prefix=/usr/local/pcre

 

 shell>#make && make install

 

==========================================================

三.安装apache

shell>#
cd /home/jinnan/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-mods-shared=all
\

        –enable-so

shell>#
make && make install

 

启动Apache

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

 

#测试apache

浏览器打开:

看到 “it works!”,即为成功

 

计划虚拟主机

1)配置host文件

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

充实域名记录

如:

192.168.9.38    www.ec1.com

192.168.9.38    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>

<VirtualHost *:80>

        DocumentRoot “/var/www/shop”

    ServerName www.ec1.com

</VirtualHost>

在意:/var/www/shop
以上多个目录var www shop 的其余用户必须有x可实施权限

澳门金沙国际 4

澳门金沙国际 5

澳门金沙国际 6

 

 

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

 

安装apache2.4【httpd-2.4.27.tar.gz】

 

 shell>#tar zxvf httpd-2.4.27.tar.gz

 

 shell>#cd httpd-2.4.27

 

shell>#./configure –prefix=/usr/local/apache2.4 \

         –with-apr=/usr/local/apr1.6 \

         –with-apr-util=/usr/local/apr-util1.4 \

         –with-pcre=/usr/local/pcre \

         –enable-modules=all \

         –enable-mods-shared=all \

         –enable-so \

         –enable-rewrite

 

四.安装libxml2

shell>#
cd /home/jinnan/tar

shell>#
tar zxvf libxml2-2.7.2.tar.gz

shell>#
cd libxml2-2.7.2

shell>#./configure
–prefix=/usr/local/libxml2 \

–without-zlib

shell>#
make && make install

 

安装zlib【zlib-1.2.11.tar.gz】

shell>#tar zxvf zlib-1.2.11.tar.gz

 

shell>#cd zlib-1.2.11

 

shell>#./configure

shell>#make && make install

============================================================

 

五.安装jpeg8

shell>#
cd /home/jinnan/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

–enable-shared
把jpeg须要的函数库程序都编译到该软件里边

优点:函数调用速度快

                 缺点:软件本人比较大

–enable-static
静态格局函数处理,供给什么函数,登时include来

优点:软件本人相比小

缺点:函数调用速度慢

安装libxml2【libxml2-2.7.3.tar.gz】

 

shell>#tar zxvf libxml2-2.7.3.tar.gz

 

shell>#cd libxml2-2.7.3

 

shell>#./configure –prefix=/usr/local/libxml2  \

         –without-zlib

 

shell>#make && make install

=========================================================

六.安装libpng

shell>#
cd /home/jinnan/tar

shell>#
tar zxvf libpng-1.4.3.tar.gz

shell>#
cd libpng-1.4.3

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

shell>#
make && make install

 

安装jpeg【jpegsrc.v9b.tar.gz】

 

shell>#tar zxvf jpegsrc.v9b.tar.gz

 

shell>#cd jpegsrc.v9b

 

shell>#./configure –prefix=/usr/local/jpeg \

         –enable-shared –enable-static

 

make && make install

==================================================

七.安装freetype(字体库)

shell>#
cd /home/jinnan/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

 

安装libpng【libpng-1.6.30.tar.gz】

shell>#tar zxvf libpng-1.6.30.tar.gz

 

shell>#cd libpng-1.6.30

 

shell>#./configure –prefix=/usr/local/png  \

         –enable-shared –enable-static

 

 

shell>#make  && make install

==========================================================

八.安装GD库

shell>#
cd /home/jinnan/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

 

设置字体库freetype【freetype-2.5.5.tar.gz】

 

shell>#tar zxvf freetype-2.5.5.tar.gz

 

shell>#cd freetype-2.5.5

 

shell>#./configure –prefix=/usr/local/freetype

 

 

shell>#make && make install

 

===============================================

 

九.安装 php5

shell>#
cd /home/jinnan/tar

shell>#
tar -jxvf php-5.3.6.tar.bz2

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

复制php.ini配置文件到钦命目录

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    

 

  1. 找到上面那段话:

<IfModule dir_module>

DirectoryIndex index.html

</IfModule>

在index.html 前边添加index.php

 

  1. 制造php测试网页

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

输入如下内容:

<?php

phpinfo();

?>

 

  1. 重启apache

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

 

  1. 双重浏览器查看

设若见到php新闻,工作就形成了!

 

安装libgd【libgd-2.1.1.tar.gz】

【自己安装php的时候出现一个荒谬,不能够找到二个关于gd的三个文本】,因此在装gd的时候不要指虞诩装目录

 

shell>#tar zxvf libgd-2.1.1.tar.gz

 

shell>#cd libgd-2.1.1

 

 

shell>#./configure –with-jpeg=/usr/local/jpeg/ \

         –with-png=/usr/local/png/ \

         –with-zlib \

         –with-freetype=/usr/local/freetype

 

 

shell>#make && make install

 

==========================================================

 

1. 安装MySQL

1.安装cmake
-----------

*shell&gt;\#* cd
/home/jinnan/tar 

*shell&gt;\#* tar zxvf
cmake-2.8.5.tar.gz 

*shell&gt;\#* cd
cmake-2.8.5 

*shell&gt;\#*
./bootstrap 

*shell&gt;\#* make &&
make install 

2.编译安装MySQL
---------------

*shell&gt;\#*
cd /home/jinnan/tar 

*shell&gt;\#*
tar zxvf mysql-5.5.17.tar.gz 

*shell&gt;\#*
cd mysql-5.5.17 

*shell&gt;\#*
cmake \\ 

-DCMAKE\_INSTALL\_PREFIX=/usr/local/mysql
\\ 

-DMYSQL\_DATADIR=/usr/local/mysql/data
\\ 

-DDEFAULT\_CHARSET=utf8
\\ 

-DDEFAULT\_COLLATION=utf8\_general\_ci


(准备安装到那里 

数据存储目录 

默认的字符集 

校对字符集) 

(报错就安装ncurses-devel) 

shell&gt;\# mount .....挂载光盘/ 


*shell&gt;\#* rpm -ivh ncurses-devel-5.7-3.20090208.el6.i686.rpm


shell&gt;\# rm -f
CMakeCache.txt //删除该文件 

*shell&gt;\#* cmake 。。。 。。。 //重新cmake 

*shell&gt;\#*
make && make install 

*shell&gt;\#*
cp support-files/my-medium.cnf /etc/my.cnf 

3.配置并初始化MySQL
-------------------

shell&gt;\# useradd
mysql    (该mysql用户会存在于同名的组下)


shell&gt;\#
chmod +x /usr/local/mysql 

(数据库用户信息不小心删除光了,删除data目录,从此开始执行以下指令,直至结束) 

shell&gt;\#
chown -R mysql.mysql /usr/local/mysql 

 

初始化mysql数据库 


shell&gt;\#
/usr/local/mysql/scripts/mysql\_install\_db \\ 

--user=mysql
\\ 

--basedir=/usr/local/mysql
\\ 

--datadir=/usr/local/mysql/data
& 

 

把mysql安装文件(除了data)的主人都改为root,避免数据库恢复为出厂设置。 

shell&gt;\#
chown -R root /usr/local/mysql 

shell&gt;\#
chown -R mysql /usr/local/mysql/data 

 

&
后台运行mysql服务 

shell&gt;\#
/usr/local/mysql/bin/mysqld\_safe --user=mysql & 

 

//查看mysql是否有启动 

shell&gt;\# ps –A | grep mysql  

 

测试数据库 

shell&gt;\#
/usr/local/mysql/bin/mysql –u root 

mysql&gt; show
databases;     

 

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


mysql&gt;
UPDATE user SET Password=password('123456') WHERE user='root';


mysql&gt; flush privileges;

安装php5.6:【php-5.6.31.tar.gz】

 

shell>#tar zxvf php-5.6.31.tar.gz

 

shell>#cd php-5.6.31

 

 

shell>#./configure –prefix=/usr/local/php5.6 \

         –with-apxs2=/usr/local/apache2.4/bin/apxs \

         –with-mysql=mysqlnd \

         –with-pdo-mysql=mysqlnd \

         –with-mysqli=mysqlnd \

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

         –with-gd \

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

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

         –with-png-dir=/usr/local/png \

         –enable-mbstring=all \

         –enable-mbregex \

         –enable-shared

 

 

 

shell>#make  &&  make install

 

 

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

 

=============================================

 

2. 安顿开机自运维服务项

shell&gt;\# cp 安装包解压目录/support-files/mysql.server
/etc/init.d/mysqld 

shell&gt;\#
chmod +x /etc/init.d/mysqld 

shell&gt;\#
chkconfig --add mysqld 

shell&gt;\# chkconfig
mysqld on 
//设置开机自启动 

 

配置文件路径: 

shell&gt;\# vi
/etc/rc.d/rc.local 

在 文件中增加启动相关服务的命令如下: 

/usr/local/http2/bin/apachectl
start 

/usr/local/mysql/bin/mysqld\_safe
--user=mysql & 

service
vsftpd start 

 

 

重新安装apache启动失败


\[root@localhost httpd-2.2.19\]\# /usr/local/http2/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 

![](https://images2015.cnblogs.com/blog/540671/201610/540671-20161022233910076-1517548352.png)

查看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

![](https://images2015.cnblogs.com/blog/540671/201610/540671-20161022233910748-2106908500.png)

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

 

将这个进程杀之

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

\[root@localhost httpd-2.2.19\]\#

 

![](https://images2015.cnblogs.com/blog/540671/201610/540671-20161022233911263-141333069.png)

 

 

 

十一.卸载操作系统自带apache
============================

![](https://images2015.cnblogs.com/blog/540671/201610/540671-20161022233912795-1323102193.png)

 

1.  删除默认apache进程 
  • ps –A | grep http

  • 杀死apache对应进度

澳门金沙国际 7

killall httpd 杀死全体的httpd进度

  1. 把暗中认可apache服务给删除

    澳门金沙国际 8

  2. 初步自身的apache

    澳门金沙国际 9

     

     

安插Apache使其协理php

vi /usr/local/apache2.4/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

nginx 的安装

 

下载地址:

安装准备: nginx信赖于pcre库,要先安装pcre

shell># yum install pcre pcre-devel

shell># cd /usr/local/src/

shell># wget

澳门金沙国际 ,shell># tar zxvf nginx-1.4.2.tar.gz

shell># cd nginx-1.4.2

shell># ./configure –prefix=/usr/local/nginx

shell># make && make install

 

nginx+php的编译

apache一般是把php当做自身的三个模块来运行的.

而nginx则是把http请求变量(如get,user_agent等)转载给
php进度,即php独立进度,与nginx举办通讯. 称为 fastcgi运转格局.

从而,为apache所编写翻译的php,是不能用来nginx的.

 

小心: 我们编写翻译的PHP 要有如下效果:

连续mysql, gd, ttf, 以fpm(fascgi)格局运维

教师编写翻译php的参数(未亲测):

shell># ./configure  –prefix=/usr/local/fastphp \

–with-mysql=mysqlnd \

–enable-mysqlnd \

–with-gd \

–enable-gd-native-ttf \

–enable-gd-jis-conv

–enable-fpm

友善编写翻译php采取的是之类参数(亲测成功):

shell>#./configure –prefix=/usr/local/php5.6.nginx \

–with-mysql=mysqlnd \

–with-pdo-mysql=mysqlnd \

–with-mysqli=mysqlnd \

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

–with-gd \

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

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

–with-png-dir=/usr/local/png \

–enable-mbstring=all \

–enable-mbregex \

–enable-shared \

–enable-fpm

shell># make && make install

编写翻译安装完后

shell># cp /usr/local/fastphp/etc/php-fpm.conf.default
 /usr/local/fastphp/etc/php-fpm.conf

shell># cd /home/jinnan/upload/php-5.6.31

shell>#cp php.ini-development  /usr/local/php5.6.nginx/lib/php.ini

编写翻译实现后:

1:

nginx+php的安插相比简单,宗旨就一句话—-

把请求的新闻转载给8000端口的PHP进度,

让PHP进度处理 内定目录下的PHP文件.

 

如下例子:

location ~ \.php$ {

            root html;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME 
$document_root$fastcgi_script_name;

            include        fastcgi_params;

 

        }

 

1:碰到php文件,

2: 把根目录定位到 html,

3: 把请求上下文转交给七千端口PHP进度,

4: 并告诉PHP进度,当前的脚本是 $document_root$fastcgi_scriptname

(注:PHP会去找这么些本子并处理,所以剧本的职责要指对)

=================================================

出于mysql使用更高级的cmake安装,在安装mysql前要先安装cmake

 

安装cmake:【cmake-3.8.2.tar.gz】

 

shell>#tar zxvf cmake-3.8.2.tar.gz

 

shell>#cd cmake-3.8.2

 

shell>#./bootstrap

 

shell>#make && make install

 

安装mysql5.6【mysql-5.6.37.tar.gz】

 

shell>#tar zxvf mysql-5.6.37.tar.gz

 

shell>#cd mysql-5.6.37

 

shell>#cmake \

         -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.6 \

         -DMYSQL_DATADIR=/usr/local/mysql/data \

         -DDEFAULT_CHARSET=utf8 \

         -DDEFAULT_COLLATION=utf8_general_ci

 

 

 

上述编写翻译参数说明(准备安装到那里

数量存款和储蓄目录

暗中同意的字符集

查对字符集)

 

 

 

 

 

 

 

假使出现如下错误:(安装ncurses-devel)

 

 

安装(ncurses-devel):

 

将事先装系统的.iso文件挂载到光驱

 

出于自个儿在/home/jinnan/下建立了3个cdrom文件夹

 

Shell>#mount /dev/cdrom  /home/jinnan/cdrom

 

Shell># cd /home/jinnan/cdrom

 

Shell># ls

 

Shell># cd Packages

 

Shell>#ls | grep ncurses-devel

 

Shell># rpm -ivh ncurses-devel-5.7-3.20090208.el6.x86_64.rpm

 

重新进入到mysql解压后的目录

Shell>#cd mysql-5.6.37

毫无疑问要删减CMakeCache.txt,不然重新cmake会报错

Shell># rm -f CMakeCache.txt    //删除该文件

重新cmake

Shell># cmake \

         -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.6 \

         -DMYSQL_DATADIR=/usr/local/mysql/data \

         -DDEFAULT_CHARSET=utf8 \

         -DDEFAULT_COLLATION=utf8_general_ci

Shell>#make && make install

复制配置文件

shell># cp support-files/my-default.cnf /etc/my.cnf

布署并早先化MySQL

shell># useradd  mysql   (该mysql用户会存在于同名的组下)

shell># chmod +x /usr/local/mysql5.6

(数据库用户音信非常大心删除光了,删除data目录,从此初步施行以下指令,直至截至)

shell># chown -R mysql.mysql /usr/local/mysql5.6

 

初始化mysql数据库  

shell># /usr/local/mysql5.6/scripts/mysql_install_db \

–user=mysql \

–basedir=/usr/local/mysql5.6 \

–datadir=/usr/local/mysql5.6/data &

 

把mysql安装文件(除了data)的主人都改为root,防止数据库苏醒为出厂设置。

shell># chown -R root /usr/local/mysql5.6

shell># chown -R mysql /usr/local/mysql5.6/data

 

& 后台运转mysql服务

shell># /usr/local/mysql5.6/bin/mysqld_safe –user=mysql &

 

//查看mysql是不是有起步

shell># ps –A | grep mysql   

 

测试数据库

shell># /usr/local/mysql5.6/bin/mysql –u root

mysql> show databases;  

 

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

Mysql>use mysql

 

mysql> delete from user where host != ‘localhost’;

 

mysql> delete from user where user != ‘root’;

 

mysql> update user set password=password(‘root’) where user=’root’;

mysql> flush privileges;

 

 

一旦期望在其余几个索引下都得以进来mysql数据库,则必要在/root/.bash_profile中添加mysql命令的门径:/home/mysql/bin

 

若是要让具有用户都能够在富有目录下进入mysql数据库,那么修改环境变量
/etc/profile

铺排开机自运营服务项

shell># cp 安装包解压目录/support-files/mysql.server
/etc/init.d/mysqld

shell># chmod +x /etc/init.d/mysqld

shell># chkconfig –add mysqld

shell># chkconfig mysqld on    //设置开机自运转

 

布置文件路径:

shell># vi /etc/rc.d/rc.local

在  文件中加进运转有关服务的指令如下:

/usr/local/apache2.4/bin/apachectl start

/usr/local/mysql5.6/bin/mysqld_safe –user=mysql &

service vsftpd start

 

相关文章