linux下源码安装apache+mysql+php5和几种论坛的安装

 

1,  准备工作

 下载最新版本的apache软件httpd-2.2.17.tar.bz2

下载mysql软件mysql-5.1.50-linux-i686-glibc23.tar.gz

下载php软件php-5.3.5.tar.bz2

下载wordpress博客安装软件 wordpress-3.0.4-zh_CN.zip

下载论坛安装软件phpwind_GBK_8.3.zip等软件

2,  安装apache软件

(1)       解压apache软件

#tar –jxf httpd-2.2.17.tar.bz2

#cd  httpd-2.2.17

(2) 配置源码./configure –prefix=/usr/local/apache –sysconfdir=/etc/httpd –enable-so  –enable-modules=most –enable-mod-shared=most –enable-proxy –enable-rewrite

其中 –prefix=/usr/local/apache 指的是apache的安装位置为/usr/local/apache

 --sysconfdir=/etc/httpd 设置apache的配置文件的存放位置

 --enble-so appache加载dso功能

--enable-modules=most apache加载大部分的模块

--enable-mod-shared=most 将大部分的模块编译为dso

--enable-rewrite 启用apache的重载功能

--enable-proxy 启用apache的代理功能

 

(3) 编译apache源码

#make

(4) 安装apache

#Make install

(5)设置环境变量和apache的库文件头文件帮助文件等的链接

A,设置环境变量

#vim /etc/profile  打开/etc/profile文件

添加一行 PATH=$PATH:/usr/local/apache/bin保存退出

B,链接apche头文件

#ln –sv /usr/local/apache/include /usr/include/httpd

C,链接apache库文件到系统库文件

#vim /etc/ld.so.d/httpd.conf

在文档里输入 /usr/local/apache/lib

保存并退出

(6)创建httpd的启动文件

Vim /etc/rc.d/init.d/httpd

在文件里面输入以下代码

#!/bin/bash

. /etc/rc.d/init.d/functions

apachectl='/usr/local/apache/bin/apachectl'

httpd='/usr/local/apache/bin/httpd'

prog=httpd

pidfile=${PIDFILE-/usr/local/apache/logs/httpd.pid}

lockfile=${LOCKFILE-/var/lock/subsys/httpd}

RETVAL=0

start() {

        echo -n $"Starting $prog: "

        daemon --pidfile=${pidfile} $httpd $OPTIONS

        RETVAL=$?

        echo

        [ $RETVAL = 0 ] && touch ${lockfile}

        return $RETVAL

}

stop() {

                                                                      echo -n $"Stopping $prog: "

                                                                      killproc -p ${pidfile} -d 10 $httpd

                                                                      RETVAL=$?

                                                                      echo

                                                                      [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}

}

reload() {

    echo -n $"Reloading $prog: "

    if ! $httpd -t >&/dev/null; then

        RETVAL=$?

        echo $"not reloading due to configuration syntax error"

        failure $"not reloading $httpd due to configuration syntax error"

    else

        killproc -p ${pidfile} $httpd -HUP

        RETVAL=$?

    fi

    echo

}

 

# See how we were called.

case "$1" in

  start)

                                                                      start

                                                                      ;;

  stop)

                                                                      stop

                                                                      ;;

  status)

        status -p ${pidfile} $httpd

                                                                      RETVAL=$?

                                                                      ;;

  restart)

                                                                      stop

                                                                      start

                                                                      ;;

  condrestart)

                                                                      if [ -f ${pidfile} ] ; then

                                                                        stop

                                                                        start

                                                                      fi

                                                                      ;;

  reload)

        reload

                                                                      ;;

  graceful|help|configtest|fullstatus)

                                                                      $apachectl $@

                                                                      RETVAL=$?

                                                                      ;;

  *)

                                                                      echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"

                                                                      exit 1

esac

 

exit $RETVAL

这样我们就可以使用

Service httpd {start|stop|restart|reload|statue}来启动关闭httpd服务

如果使用yum的方式安装httpd的话还需要安装软件包httpd-devel.软件包,因为当安装php5时需要用到

3,  安装mysql

(1),解压mysql文件

 #tar –xf mysql-5.1.50-linux-i686-glibc23.tar.gz –C /usr/local/

#ln mysql mysql-5.1.50

  # cd  mysql-5.1.50

   (2)由于mysql是绿色软件所以不需要安装,下面我们将链接mysql的头文件,库文件和帮助文件

   A,链接mysql的头文件

    # Ln –sv /usr/local/mysql/include /etc/include/mysql

   B,设置环境变量

  #vim /etc/profile

 在文件里加入 PATH=$PATH:/usr/local/mysql/bin

   C,链接mysql的帮助文件

#vim /etc/man.conf

在文件里面加入

MANPATH /usr/local/mysql/man

保存并退出

4,  安装并配置php5

(1)     解压php5

#tar  -xf php-5.3.5.tar.bz2

#cd  php

(2)     配置./configure

#./configure –prefix=/usr/local/php5 –sysconfdir=/etc/php5 –with-mysql=/usr/mysql –with-apx2=/usr/local/apache/bin/apxs

(3)     编译并安装php5

#make

#make  install

(4)     httpd.conf中配置php5的支持选项

打开httpd.conf文件

#vim /httpd/httpd.conf

在文件中输入以下几行

Addtype application/x-httpd-php .php

    Addtype application/x-httpd-php-source .phps

找到DirectoryIndex index.html 在其后添加index.php

   5,安装phpwindphpbb3wordpress discuz等论坛软件

(1),创建四个基于域名的虚拟主机分别为www.phpwind.com www.eordpress.com www.phpbb3.com www.dicuz.com

 #vim /etc/httpd/extra/httpd-vhost.conf

在文本内添加以下代码:

<VirtualHost *:80>
    DocumentRoot "/www/qingzhu1/wordpress"
    ServerName www.WordPress.org
    ErrorLog "/var/log/httpd/access_wordpress.org"
    CustomLog "/var/log/httpd/error_wordpress.org" common
 <Directory "/www/qingzhu1/wordpress">

<VirtualHost *:80>
    DocumentRoot "/www/qingzhu1/phpwind"
    ServerName www.php
wind.org
    ErrorLog "/var/log/httpd/access_phpwind.org"
    CustomLog "/var/log/httpd/error_phpwind.org" common
 <Directory "/www/qingzhu1/wordpress">

 

<VirtualHost *:80>
    DocumentRoot "/www/qingzhu1/phpbb3"
    ServerName www.phpbb3.org
    ErrorLog "/var/log/httpd/access_phpbb3.org"
    CustomLog "/var/log/httpd/error_phpbb3.org" common
 <Directory "/www/qingzhu1/wordpress">

 

然后建立三个数据库分别叫做 WordPress phpwind

phpbb3 .代码如下

#mysql

>create database wordpress phpword phpbb3

>\q

q然后将phpwind_GBK_8.3.zip等软件解压到相应的文件夹里

按照安装说明相应的步骤一步步安装!

 

 

 

 

 

 

 

你可能感兴趣的:(linux,mysql,数据库,休闲,linux服务)