Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15150
  • 博文数量: 11
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 95
  • 用 户 组: 普通用户
  • 注册时间: 2012-12-04 14:07
个人简介

二流子linux 运维

文章分类

全部博文(11)

文章存档

2016年(11)

我的朋友

分类: LINUX

2016-03-29 13:29:05

#!/bin/bash
case "$1" in
  apache)
    echo "install apache"
    cd /home
    tar jxvf httpd-2.2.22.tar.bz2
    cd /home/httpd-2.2.22
    ./configure --prefix=/usr/local/apache --enable-so
    make && make install
    ;;
   mysql)
     echo "install mysql"
     cd /home
     tar zxvf ncurses-5.6.tar.gz
     cd ncurses-5.6
     ./configure
     make
     make install

     groupadd mysql
     useradd -g mysql mysql
     cd /home
     tar zxvf mysql-5.1.65.tar.gz
     cd mysql-5.1.65
     ./configure --prefix=/usr/local/mysql --enable-assembler --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=complex --enable-local-infile --disable-shared --with-plugins=all --with-mysqld-user=mysql --with-pthread --enable-thread-safe-client
     make
     make install
     ;;
   php)
     ls /usr/local/ | grep apache
     if [ $? -eq 0 ]
      then
        echo "install php"
        cd /home
        tar zxvf libxml2-2.7.2.tar.gz
        cd libxml2-2.7.2
        ./configure --prefix=/usr/local/libxml2
        make && make install
        cd /home
        tar jxvf php-5.3.13.tar.bz2
        cd php-5.3.13
        ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-libxml-dir=/usr/local/libxml2
        make && make install
        sed -i '167c DirectoryIndex index.html index.php' /usr/local/apache/conf/httpd.conf
        sed -i '309a AddType application/x-httpd-php .php\nAddType application/x-httpd-php-source .phps' /usr/local/apache/conf/httpd.conf
        echo '> /usr/local/apache/htdocs/index.php
        echo 'phpinfo();' >> /usr/local/apache/htdocs/index.php
        echo '?>' >> /usr/local/apache/htdocs/index.php
      else
        echo "install apache first"
        cd /home
        tar jxvf httpd-2.2.22.tar.bz2
        cd /home/httpd-2.2.22
        ./configure --prefix=/usr/local/apache --enable-so
        make && make install
        echo "install php"
        cd /home
        tar zxvf libxml2-2.7.2.tar.gz
        cd libxml2-2.7.2
        ./configure --prefix=/usr/local/libxml2
        make && make install
        cd /home
        tar jxvf php-5.3.13.tar.bz2
        cd /home/php-5.3.13
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-libxml-dir=/usr/local/libxml2
        make && make install
        sed -i '167c DirectoryIndex index.html index.php' /usr/local/apache/conf/httpd.conf
        sed -i '309a AddType application/x-httpd-php .php\nAddType application/x-httpd-php-source .phps' /usr/local/apache/conf/httpd.conf
        echo '> /usr/local/apache/htdocs/index.php
        echo 'phpinfo();' >> /usr/local/apache/htdocs/index.php
        echo '?>' >> /usr/local/apache/htdocs/index.php
    fi
    ;;
   tomcat)
     echo "install tomcat"
     cd /home
     tar zxvf jdk-7u5-linux-i586.tar.gz
     cp -R /home/jdk1.7.0_05 /usr/local/jdk
     echo 'JAVA_HOME=/usr/local/jdk' >> /etc/profile
     echo 'CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME=/jre/lib' >> /etc/profile
     echo 'PATH=$PATH:$JAVA_HOME/bin:$JAVA/jre/bin' >> /etc/profile
     echo 'export JAVA_HOME CLASSPATH PATH' >> /etc/profile
     source /etc/profile


     cd /home
     tar zxvf apache-tomcat-6.0.35.tar.gz
     cp -R apache-tomcat-6.0.35 /usr/local/tomcat
     cd /usr/local
     echo 'export CATALINA_BASE=/usr/local/tomcat' >> ~/.bashrc
     echo 'export CATALINA_HOME=/usr/local/tomcat' >> ~/.bashrc
     echo 'export JAVA_HOME=/usr/local/jdk' >> ~/.bashrc
     echo 'export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib' >> ~/.bashrc
     echo 'export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin' >> ~/.bashrc
     cd /usr/local/tomcat/bin
     ./startup.sh
     ;;
   all)
    echo "install all apache php mysql tomcat"
    cd /home
    tar jxvf httpd-2.2.22.tar.bz2
    cd /home/httpd-2.2.22
    ./configure --prefix=/usr/local/apache --enable-so
    make && make install

    cd /home
    tar zxvf ncurses-5.6.tar.gz
    cd ncurses-5.6
    ./configure
    make
    make install

    groupadd mysql
    useradd -g mysql mysql
    cd /home
    tar zxvf mysql-5.1.65.tar.gz
    cd mysql-5.1.65
    ./configure --prefix=/usr/local/mysql --enable-assembler --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=complex --enable-local-infile --disable-shared --with-plugins=all --with-mysqld-user=mysql --with-pthread --enable-thread-safe-client
    make
    make install

    cd /usr/local/mysql
    chgrp -R mysql .
    ./bin/mysql_install_db --user=mysql
    chown -R mysql:mysql var


    cd /home
    tar zxvf libxml2-2.7.2.tar.gz
    cd libxml2-2.7.2
    ./configure --prefix=/usr/local/libxml2
    make && make install


    cd /home
    tar jxvf php-5.3.13.tar.bz2
    cd php-5.3.13
    ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-libxml-dir=/usr/local/libxml2
    make && make install


    sed -i '167c DirectoryIndex index.html index.php' /usr/local/apache/conf/httpd.conf
    sed -i '309a AddType application/x-httpd-php .php\nAddType application/x-httpd-php-source .phps' /usr/local/apache/conf/httpd.conf
    echo '> /usr/local/apache/htdocs/index.php
    echo 'phpinfo();' >> /usr/local/apache/htdocs/index.php
    echo '?>' >> /usr/local/apache/htdocs/index.php


    cd /home
    tar zxvf jdk-7u5-linux-i586.tar.gz
    cp -R /home/jdk1.7.0_05 /usr/local/jdk
    echo 'JAVA_HOME=/usr/local/jdk' >> /etc/profile
    echo 'CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME=/jre/lib' >> /etc/profile
    echo 'PATH=$PATH:$JAVA_HOME/bin:$JAVA/jre/bin' >> /etc/profile
    echo 'export JAVA_HOME CLASSPATH PATH' >> /etc/profile
    source /etc/profile


    cd /home
    tar zxvf apache-tomcat-6.0.35.tar.gz
    cp -R apache-tomcat-6.0.35 /usr/local/tomcat
    cd /usr/local
    echo 'export CATALINA_BASE=/usr/local/tomcat' >> ~/.bashrc
    echo 'export CATALINA_HOME=/usr/local/tomcat' >> ~/.bashrc
    echo 'export JAVA_HOME=/usr/local/jdk' >> ~/.bashrc
    echo 'export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib' >> ~/.bashrc
    echo 'export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin' >> ~/.bashrc
    cd /usr/local/tomcat/bin
    ./startup.sh
    ;;
    help)
      cat < apache - install apache only
mysql - install mysql only
阅读(356) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:linux网络相关配置

给主人留下些什么吧!~~