在openSUSE上安裝和配置LAMP

openSUSE上安裝和配置LAMP步驟如下:

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 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"

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

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript

這樣就行了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章