搭建基于PHP的www服务器

安装MySQL

#!/bin/bash
mount |grep "/dev/sr0"
if [ "$?" != 0 ];then
    mount /dev/sr0 /media
fi
[ "$?" != 0 ]&& echo "fail to mount ! exit " && exit
yum -y install gcc-c++ ncurses-devel perl-devel
rpm -q  gcc-c++ ncurses-devel perl-devel
if [ "$?" != 0 ]; then
    echo "install error "
    yum -y remove gcc-c++ ncurses-devel perl-devel
    if [ "$?" != 0 ]; then
    echo "remove error "
    fi
fi
# install Cmake
cmake
if [ "$?" != 0 ];then
    cd /root/db/
    tar zxf /root/db/cmake-3.1.0-rc3.tar.gz
    # get the directory after unzip
    dname=`ls -al /root/db/ |grep "^d" |grep ".*cmake.*"|awk ‘{print $9}‘`
    echo "directory: "$dname
    if [ ! -d $dname ]; then
        echo "fail unzip "
        exit
    fi
    cd /root/db/$dname
    echo "enter " `pwd`
    ./bootstrap
    if [ "$?" == 0 ];then
        gmake
        if [ "$?" == 0 ]; then
            gmake install
            if [ "$?" == 0 ]; then
                echo "success"
            else
                echo "gmake install fail ! exit "
                exit
            fi
        else
            echo "gmake fail ! exit "
        fi
    else
        echo " ./bootstrap fail exit "
        exit
    fi
else
    echo "Cmake already installed "
fi
# install mysql
cd /root/db/
tar zxvf /root/db/mysql-5.6.20.tar.gz

mysqlD=`ls -al /root/db/ |grep "^d" |grep ".*mysql.*"|awk ‘{print $9}‘` 

echo "mysql directory: "$mysqlD
if [ ! -d $mysqlD ]; then
    echo "mysql fail unzip "
    exit
fi
cd /root/db/$mysqlD
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
make && make install
# configure mysql
echo "PATH=$PATH:/usr/local/mysql/bin/" >> /etc/profile
source /etc/profile
useradd mysql
if [ "$?" != 0 ]; then
    echo "adduser error "
    exit
fi
chown -R mysql:mysql /usr/local/mysql/
cd /usr/local/mysql/
echo "enter "`pwd`
./scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql
cp support-files/mysql.server /etc/init.d/mysqld
chkconfig mysqld on
mv /etc/my.cnf /etc/my.cnf.bk
service mysqld start 

搭建www服务器以及PHP功能

#!/bin/bash

mount |grep "/dev/sr0"
if [ "$?" != 0 ]; then
    mount /dev/sr0 /media
fi
[ "$?" != 0 ] && echo "fail to mount ! exit " && exit
# install gcc-c++
rpm -q gcc-c++
if [ "$?" != 0 ]; then
    yum -y install gcc-c++
fi
# remove httpd
rpm -q httpd
if [ "$?" == 0 ]; then
    rpm -e httpd --nodeps
fi
yum -y install perl-devel freetype-devel libxml2-devel libXpm-devel zlib-devel libpng-devel
[ "$?" != 0 ] && echo "perl-devel freetype-devel libxml2-devel libXpm-devel zlib-devel libpng-devel yum error ! exit " && exit
# install APR(Apache Portable Runtime)
tar -jxvf /root/web/apr-1.5.1.tar.bz2

APR=`ls -al /root/web/ |grep "^d" |grep ".*apr.*"|awk ‘{print $9}‘`
[ "$APR" == "" ] && echo " apr unzip error ! exit " && exit
cd /root/web/$APR
echo "enter " `pwd`
./configure --prefix=/usr/local/apr
if [ "$?" ==  0 ];then
    make && make install
    if [ "$?" == 0 ]; then
        echo "apr install success"
    else
        echo "apr make && make install error ! exit "
        exit
    fi
else
    echo "apr ./configure error ! exit "
    exit
fi
# install apr-util
tar -jvxf /root/web/apr-util-1.5.3.tar.bz2

APRU=`ls -al /root/web/ |grep "^d" |grep ".*apr-util*"|awk ‘{print $9}‘`
[ "$APRU" == "" ] && echo " apr-util unzip error ! exit " && exit
echo "apr-util "$APRU
cd /root/web/$APRU
echo "enter "$APRU
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
if [ "$?" ==  0 ];then
    make && make install
    if [ "$?" == 0 ]; then
        echo "apr-util install success"
    else
        echo "apr-util make && make install error ! exit "
        exit
    fi
else
    echo "apr-util ./configure error ! exit "
    exit
fi
#install pcre
echo "start instal pcre "
echo "current directory is : " `pwd`
cd /root/web/
tar -jvxf /root/web/pcre-8.35.tar.bz2
PCRE=`ls -al /root/web/ |grep "^d" |grep ".*pcre.*"|awk ‘{print $9}‘`
echo "find pcre in /root/web/" $PCRE
[ "$PCRE" == "" ] && echo " pcre unzip error ! exit " && exit
echo "pcre : "$PCRE
cd /root/web/$PCRE
echo "enter pcre: " $PCRE
./configure --prefix=/usr/local/pcre
if [ "$?" ==  0 ];then
    make && make install
    if [ "$?" == 0 ]; then
        echo "pcre install success"
    else
        echo "pcre make && make install error ! exit "
        exit
    fi
else
    echo "pcre ./configure error ! exit "
    exit
fi
#apache install
cd /root/web/
tar -jvxf /root/web/httpd-2.4.10.tar.bz2
HTTPD=`ls -al /root/web/ |grep "^d" |grep ".*httpd.*"|awk ‘{print $9}‘`
[ "$HTTPD" == "" ] && echo " httpd unzip error ! exit " && exit
cd /root/web/$HTTPD
./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-cgi --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/
if [ "$?" ==  0 ];then
    make && make install
    if [ "$?" == 0 ]; then
        echo "httpd install success"
    else
        echo "httpd make && make install error ! exit "
        exit
    fi
else
    echo "httpd ./configure error ! exit "
    exit
fi
时间: 2024-10-21 06:22:57

搭建基于PHP的www服务器的相关文章

linux学习笔记——搭建基于nginx的web服务器、多核配置、nginx配置参数

############ 认识nginx #############Nginx:(发音同 engine x)是一款轻量级的Web服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行.由俄罗斯的程序设计师Igor Sysoev所开发,最初供俄国大型的入口网站及搜寻引擎Rambler(俄文:Рамблер)使用.  其优点是轻量级(占有内存少),高并发(并发能力强),事实上nginx的并发能力确实在同类型的网页伺服器中表现较好.目前中国大陆使用ngi

Windows 7下 搭建 基于 ssh 的sftp 服务器

Windows  xp 下 搭建 基于  ssh 的sftp 服务器,服务器端可以用 freesshd,F-secure server等,filezilla server不可用,之前傻乎乎的用filezilla 来做服务器,找不到任何有关sftp的配置选项,推荐用freesshd,免费.简单,直观,客户端可以用一般的支持sftp的都可以,filezilla,f-secure client 等,我用freesshd和filezillazilla 搭建sftp 服务,我在内网搭建的,如果在外网发布,

Redhat 5 搭建基于 ftp 的 yum 服务器

YUM是Yellow dog Updater, Modified的缩写,是由Duke University所发起的计划,目的就是为了解决RPM的依赖关系的问题,方便使用者进行软件的安装.升级等等工作.在此在特别说明的是,YUM只是为了解决RPM的依赖关系的问题,而不是一种其它的软件安装模式.而在redhat系统中未经授权是无法使用yum的,这里就介绍一种利用redhat光盘搭建本地yum服务器的方法. 系统环境:  Red Hat 5.9 Server IP: 192.168.100.211 C

ubuntu上开启ssh服务,并搭建基于ssh的git服务器

维基百科上SSH的定义如下 Secure Shell(縮寫为SSH),由IETF的網路工作小組(Network Working Group)所制定:SSH為一项建立在应用层和传输层基础上的安全协议,为计算机上的Shell(壳层)提供安全的传输和使用环境. 安装ssh服务器 安装openssh-server $sudo apt-get install openssh-server 安装成功之后,通过以下命令来确保server已经启动 $sudo start ssh 如果出现以下结果,则说明已经开始

Linux搭建基于BIND的DNS服务器

实验目标:通过本实验掌握基于Linux的DNS服务器搭建. 实验步骤:1. 安装BIND2. 防火墙放通DNS服务3. 编辑BIND的主配置文件4. 编辑BIND的域管理文件5. 编辑相应域的记录文件6. 开启或重启BIND服务7. 在客户端测试 参考命令: 1. 安装BINDBIND是Linux平台最常用的DNS软件[[email protected] Desktop]# yum install bind -y 2. 防火墙放通DNS服务 3. 编辑BIND主配置文件[[email prote

Git使用之搭建基于SSH的Git服务器(中篇) -- fatal protocol error bad line length character: micr

在连接Git服务器的过程中,可能出现fatal protocol error bad line length character: micr的错误.原因是Git服务器搭建时,选择错误的协议了,不要选Windows Shell,选择Linux shell and Sftp即可.

Windows下搭建基于SSH的Git服务器

Git客户端安装 客户端要同时安装在远程服务器和自己的电脑上,下载地址:http://msysgit.github.io/ 选择安装组件 :也可以默认选择; 图标组件(Addition icons) : 选择是否创建快速启动栏图标 或者 是否创建桌面快捷方式; 桌面浏览(Windows Explorer integration) : 浏览源码的方法, 单独的上下文浏览 只使用bash 或者 只用Git GUI工具; 高级的上下文浏览方法 使用git-cheetah plugin插件; 关联配置文

Linux搭建基于FTP的YUM服务器

1.挂载光盘 mount /dev/cdrom /mnt 2.安装VSFTP服务.createrepo软件包 rpm -ivh vsftpd-2.0.5-24.el5.x86_64.rpm rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm 3.拷贝光盘内容 cp -a /mnt/* /var/ftp/pub/ 4.创建YUM仓库 cd /var/ftp/pub/ createrepo . createrepo报错如下的解决办法 解决方法: [[email p

基于webrtc的apprtc服务器的搭建

基于webrtc的apprtc服务端搭建 基于webrtc的apprtc示例发布在公网https://apprtc.webrtc.org上(需要FQ),本文在本地ubuntu14.04 32bit搭建该系统,需要搭建房间服务器,信令服务器,TURN穿透服务器.最好使用VPN搭建环境,否则会遇到网络引起的各种错误,相关资源如下: 1.房间服务器apprtc项目源码地址: https://github.com/webrtc/apprtc a.房间服务器搭建参考链接中的步骤就可以,如果网络环境良好,搭