LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 957|回复: 0

自己在slackware10下安装apache2.0.54+mysql4.1.11+php5.0.4的笔记,希望对大家有用:)

[复制链接]
发表于 2005-5-13 16:29:24 | 显示全部楼层 |阅读模式
###############################################
#
#DocName:slackware10源包安装apache2+mysql4.1+php5
#Writer:nightcat
#Time:2005-1-20
#EMail:liwenfei@21cn.com
#WebSite:nightcat.512j.com
#
###############################################

1.软件硬件:
  1.硬件:p4/256M/
  2.系统:slackware 10
  3.软件:
    apache2.0.54 http://apache.justdn.org/httpd/
    mysql4.1.11  http://dev.mysql.com/get/Downloa ... z/from/pick#mirrors
    php5.0.4    http://www.php.net/downloads.php
   
2.卸载.原来安装的apache 1.3.31+php4.3.7+mysql4.0.20
  #removepkg apache  
  #removepkg php
  #removepkg mysql
  
3.建立目录tmp统计把apache/mysql/php放进去.
  httpd-2.0.54.tar.gz
  mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz
  php-5.0.4.tar.gz
  
4.统一解压
  #tar -zxvf httpd-2.0.54.tar.gz
  #tar -zxvf php-5.0.4.tar.gz
  也能合在一起用 && .则可以逐个解压
  mysql是二进制包,暂时不解压

5.安装mysql
  #cp mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz /usr/local/
  #cd /usr/local
  #tar -zxvf mysql*
  //建立一个连接,方面以后的升级.
  #ln -s mysql*-i686 mysql
  #cd mysql
  
  //建立mysql组和用户mysql
  #groupadd mysql
  #useradd -g mysql mysql
  //以mysql的身份建立数据仓库
  #scripts/mysql_install_db --user=mysql
  //改变文件属主和组属主
  #chown -R root  .
  #chown -R mysql data
  #chgrp -R mysql .
  //以mysql身份启动mysql
  #bin/mysqld_safe --user=mysql &
  
  //登陆
  #bin/mysql
  出错了?!!Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
  如果出现这样的问题,在安装一次
  #scripts/mysql_install_db --user=mysql
  或者
  ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
  
  #bin/mysql正常登陆
  mysql>
  安装完成!
  
  给root加密码:
  //本地登陆密码
        mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY '7350271';
        Query OK, 0 rows affected (0.03 sec)
        //远程登陆密码
        mysql> GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY '7350271';
        Query OK, 0 rows affected (0.00 sec)
  
  
6.安装apache
  进入目录apache解包目录.
          动态模块安装方式/
          安装subversion需要的组件
          自定义目录
  #cd httpd*
  #./configure --prefix=/usr/local/apache2 \
               --enable-so \
               --enable-mods-shared=most \
               --enable-dav \
  #make && make install
  
  测试 http://locahost/.能够看到安装页
  
7.安装php
  进入目录php
  #cd php*
  #./configure --prefix=/usr/local/php \
               --with-mysql=/usr/local/mysql \
               --with-apxs2=/usr/local/apache2/bin/apxs
  #make && make install
  
  //配置php.ini与httpd.conf
  #cp php.ini-dist /usr/local/lib/php.ini
  #vi /usr/local/lib/php.ini 开放
  extension=php_bz2.dll
  extension=php_mysql.dll
  extension=php_
  #vi  /usr/local/apache2/conf/httpd.conf
  添加
  ###for php5
  //支持中文
        defaultlanguage zh-cn
        AddDefaultCharset GB2312

        //添加对php的支持
        AddType application/x-httpd-php .php .php4
        AddType application/x-httpd-php-source .phps
  
  测试,建立一个phpinfo.php
  内容为
  <?php
  echo phpinfo();
  ?>
  
8.修改脚本rc.httpd和rc.mysqld
  rc.httpd脚本为:
  #!/bin/sh
        #
        # /etc/rc.d/rc.httpd
        #
        # Start/stop/restart the Apache web server.
        #
        # To make Apache start automatically at boot, make this
        # file executable:  chmod 755 /etc/rc.d/rc.httpd
        #
       
        case "$1" in
           'start')
              /usr/local/apache2/bin/apachectl start ;;
           'stop')
              /usr/local/apache2/bin/apachectl stop ;;
           'restart')
              /usr/local/apache2/bin/apachectl restart ;;
           *)
              echo "usage $0 start|stop|restart" ;;
        esac
       
        rc.mysqld脚本为:
        #!/bin/sh
        # Start/stop/restart mysqld.
        #
        # Copyright 2003 Patrick J. Volkerding, Concord, CA
        # Copyright 2003 Slackware Linux, Inc., Concord, CA
        #
        # This program comes with NO WARRANTY, to the extent permitted by law.
        # You may redistribute copies of this program under the terms of the
        # GNU General Public License.
       
        # To start MySQL automatically at boot, be sure this script is executable:
        # chmod 755 /etc/rc.d/rc.mysqld
       
        # Before you can run MySQL, you must have a database.  To install an initial
        # database, do this as root:
        #
        #   su - mysql
        #   mysql_install_db
        #
        # Note that step one is becoming the mysql user.  It's important to do this
        # before making any changes to the database, or mysqld won't be able to write
        # to it later (this can be fixed with 'chown -R mysql.mysql /var/lib/mysql').
       
        # To disallow outside connections to the database (if you don't need them, this
        # is recommended to increase security), uncomment the next line:
        #SKIP="--skip-networking"
       
        # Start mysqld:
        mysqld_start() {
          if [ -x /usr/local/mysql/bin/mysqld_safe ]; then
            # If there is an old PID file (no mysqld running), clean it up:
            if [ -r /usr/local/mysql/data/server.pid ];then
              if [ ! ps ax | grep mysqld 1> /dev/null 2> /dev/null ]; then
               echo "Cleaning up old /usr/local/mysql/data/server.pid."
                rm -f /usr/local/mysql/data/server.pid
              fi
            fi
            /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/server.pid $SKIP &
          fi
        }
       
        # Stop mysqld:
        mysqld_stop() {
          # If there is no PID file, ignore this request...
          if [ -r /usr/local/mysql/data/server.pid ];then
            killall mysqld
            # Wait at least one minute for it to exit, as we don't know how big the DB is...
            for second in 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 \
              0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 60 ; do
              if [ ! -r /usr/local/mysql/data/server.pid ];then
                break;
              fi
              sleep 1
            done
            if [ "$second" = "60" ]; then
              echo "WARNING:  Gave up waiting for mysqld to exit!"
              sleep 15
            fi
          fi
        }
       
        # Restart mysqld:
        mysqld_restart() {
          mysqld_stop
          mysqld_start
        }
       
        case "$1" in
        'start')
          mysqld_start
          ;;
        'stop')
          mysqld_stop
          ;;
        'restart')
          mysqld_restart
          ;;
        *)
          echo "usage $0 start|stop|restart"
        esac
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表