zoukankan      html  css  js  c++  java
  • 在openSUSE11.1上安装和配置LAMP(Apache/MySQL/PHP)

    LAMP是由Apache MySQL PHP组成的,是在Linux下最受欢迎的软件组合之一,目前互联网上有很多网站运行在LAMP服务器上。

    Linux - 是富有情味的开源操作系统;Apache - 这个星球上大师级的WEB服务器;MySQL - 是你喜爱的开源数据库软件;PHP - 受欢迎的WEB编程语言。

    安装LAMP服务最简单的方法是在YaST图形界面,按以下步骤安装:

    1、Computer – YaST – Install Software - 选择过渡”Patterns”,然后选择并接受”Web and LAMP”。但是这种方法我们安装了不需要的服务,如DNS,Perl模块等。

    我喜欢手动安装一个LAMP服务。

    所以不要浪费时间了,让我们立即让LAMP在你的openSUSE上运行起来吧。我用的是openSUSE11.0,这个安装过程同样适用早期的10.3、10.2版本,11.1版本也同样适应。

    安装和配置Apache2服务

    安装Apache服务器

    opensuse11:~#yast2 –install apache2

    这就安装了Apache服务,用下面的代码检验:

    opensuse11:~ # rcapache2 status
    Checking for httpd2:                                          unused

    这是告诉我们,Apache服务已经安装上,但是还没有运行。为了测试Apache是否能够运行正常,在/srv/www/htdocs/目录建立一个index.html文件。这个目录是Apache默认的网站根目录。

    opensuse11:~ # cd /srv/www/htdocs
    opensuse11:~ # vi index.html

    在上面键入键入文本“Welcome to openSUSE 11.1”。

    启动Apache2服务

    现在启动Apache2服务,我们看看是否运行正常。

    opensuse11:~ # rcapache2 start
    Starting httpd2 (prefork)                                         done

    现在开启一个浏览器如Firefox,输入http://localhost,那么现在就可以看到刚才你输入的文本了,下面我们安装PHP5。

    安装PHP5

    opensuse11:~ # yast2 –install php5 php5-mysql apache2-mod_php5

    这将安装PHP5, PHP5-MySQL 模块和Apache2 PHP5 模块。为了让Apache2支持PHP5模块,现在重启Apache2让改动生效。

    opensuse11:~ # rcapache2 restart
    Syntax OK
    Shutting down httpd2 (waiting for all children to terminate)          done
    Starting httpd2 (prefork)                                                          done

    安装和配置MySQL

    opensuse11:~ # yast2 –install mysql mysql-tools

    这样就把MySQL数据库和可选安装的mysql-tools(设置工具)安装到openSUSE上了。按以下命令验证是否已经安装上:

    opensuse11:~ # rcmysql status
    Checking for service MySQL:                                           unused

    上面的输出显示MySQL服务已经安装,但是还没有运行。

    启动MySQL服务

    opensuse11:~ # rcmysql start
    Starting service MySQL                                                done

    默认安装是没有root密码的,但是root密码是非常重要的。

    设置root密码

    opensuse11:~ # mysqladmin -u root –p password rootpassword

    这是将root密码设置为”rootpassword”。你可以设置一个安全适当的密码。

    按以下操作检查一下root密码是否已经设置和MySQL Client是否可以登陆到MySQL服务器。

    opensuse11:~ # mysql -u root -p
    Enter password:
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 5.0.51a SUSE MySQL RPM
    Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
    mysql> show databases;
    +——————–+
    | Database           |
    +——————–+
    | information_schema |
    | mysql              |
    | test               |
    +——————–+
    3 rows in set (0.04 sec)
    mysql>

    按以上操作,我用MySQL Client作为root登录,输入了刚才键入的密码,列举了数据库。这样就已经完全在openSUSE上安装了LAMP服务。

    管理MySQL数据库最简易和流行的工具是phpMyAdmin,phpMyAdmin的安装需要我们上面已经进行过的PHP5,Apache2环境,现在可以快速安装和配置phpMyAdmin了。

    安装phpMyAdmin

    opensuse11:~ # yast2 –install phpMyAdmin

    这就安装了phpMyAdmin,并在/srv/www/htdocs/建立了phpMyAdmin目录。进入该目录,并利用config.sample.inc.php快速配置phpMyAdmin。

    opensuse11:~ # cd /srv/www/htdocs/phpMyAdmin
    opensuse11:~ # cp config.sample.inc.php config.inc.php

    查找下列语句修改为:

    $cfg['blowfish_secret'] = ‘mysqladmin’;

    在这里我设置了一个短语密码 ‘mysqladmin’。

    按上面操作并设置了默认配置。 登录http://localhost/phpMyAdmin 到phpMyAdmin 用root帐户和刚才建立的密码。

    RPM安装MySQL

    rpm -ivh MySQL-server-4.0.16-0.i386.rpm

    rpm -ivh MySQL-client-4.0.16-0.i386.rpm

    http://www.linux-cn.com/html/database/mysql/20070422/9875.html

    Mono

    在 Apache2.2 下设置 Mono 的 ASP。Net

    在 Yast2控制中心里选 系统 -> 磁盘分区管理 , 点开左边的树,选择分区,编辑,挂载 /mnt/Music  (Music 是自己起的名字)。然后在 FSTAB 选项中,把 fmask 和 dmask  的值改为 000 ,完成。 就可以自动挂载并可读写了。

    经本人实验, 在OpenSuse11.2 x64 系统下,Apache2.2 建虚拟目录总出现 403 无权限错误,与此有关。

    另外,Ubuntu 下如果出现 403  , 用以下配置文件是正确的. 但是需要注意, NTFS 分区是不能 chmod 的 . 所以,要把 Web 站点放到 Linux分区上,再 sudo chmod -R 777 MyWeb

    在 /etc/apache2/config.d/ 下新建虚拟目录的配置文件: MyTrade.conf (MyTrade 替换成你自己的虚拟目录名,文件名需以 conf 结尾)

      Alias /MyTrade "/mnt/App/MonoApp/MyWebTradeSln/MyTrade"
      # MonoServerPath can be changed to specify which version of ASP.NET is hosted
      # mod-mono-server1 = ASP.NET 1.1 / mod-mono-server2 = ASP.NET 2.0
      # For SUSE Linux Enterprise Mono Extension, uncomment the line below:
      # MonoServerPath MyTrade "/opt/novell/mono/bin/mod-mono-server2"
      # For Mono on openSUSE, uncomment the line below instead:
      MonoServerPath MyTrade "/usr/bin/mod-mono-server2"

      # To obtain line numbers in stack traces you need to do two things:
      # 1) Enable Debug code generation in your page by using the Debug="true"
      #    page directive, or by setting <compilation debug="true" /> in the
      #    application's Web.config
      # 2) Uncomment the MonoDebug true directive below to enable mod_mono debugging
      MonoDebug MyTrade true
     
      # The MONO_IOMAP environment variable can be configured to provide platform abstraction
      # for file access in Linux.  Valid values for MONO_IOMAP are:
      #    case
      #    drive
      #    all
      # Uncomment the line below to alter file access behavior for the configured application
      MonoSetEnv MyTrade MONO_IOMAP=all
      #
      # Additional environtment variables can be set for this server instance using
      # the MonoSetEnv directive.  MonoSetEnv takes a string of 'name=value' pairs
      # separated by semicolons.  For instance, to enable platform abstraction *and*
      # use Mono's old regular expression interpreter (which is slower, but has a
      # shorter setup time), uncomment the line below instead:
      # MonoSetEnv MyTrade MONO_IOMAP=all;MONO_OLD_RX=1

      MonoApplications MyTrade "/MyTrade:/mnt/App/MonoApp/MyWebTradeSln/MyTrade"
      <Location "/MyTrade">
         Options Indexes MultiViews
        Allow from all
        Order allow,deny
        MonoSetServerAlias MyTrade
        SetHandler mono
        SetOutputFilter DEFLATE
        SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
      </Location>
      <IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
      </IfModule>

    这样就行了。

    alarm   作者:NewSea     出处:http://newsea.cnblogs.com/    QQ,MSN:iamnewsea@hotmail.com

      如无特别标记说明,均为NewSea原创,版权私有,翻载必纠。欢迎交流,转载,但要在页面明显位置给出原文连接。谢谢。
  • 相关阅读:
    定时器准确定时八位时钟
    数码管八位显示时钟
    串口通讯
    定时器/计数器0(定时器)
    定时器/计数器0之计数器
    定时器/计数器0(计数器)
    外部中断0
    LCD带字符液晶显示I LOVE YOU
    Altium Designer Summer 09换成中文步骤
    BAT小米奇虎美团迅雷携程等等各大企业校招,笔试面试题。
  • 原文地址:https://www.cnblogs.com/newsea/p/1604988.html
Copyright © 2011-2022 走看看