FreeBSD   全球資訊網伺服器


Apache-modssl + MySQL +PHP

.逸晨


在這兒,我們將採用目前全球使用率最高的 Apache 來當我們的 Web Server;使用 MySQL 來做資料庫的伺服器;並且為 Apache 加入 PHP 的功能。
首先請先更新您的 ports-tree,然後依據下列的軟體順序進行安裝。

安裝流程解說

首先,請先以 su 指令取得系統管理員權限,然後要切換路徑到 /usr/ports/databases/mysql323-server
如果您參閱本章節時,找不到此目錄,那很有可能︰
  • 您安裝的 FreeBSD 版本與筆者撰寫此書時所安裝的版本不同,且尚未更新您的 ports-tree
  • MySQL 已釋放出更新版本,並且已被正式移植到 ports
此時您需要先到 http://www.mysql.org 中查看 Stable 系列中,最新的版本編號為何,再將其版本編號對映更換到上述所提及的路徑中。
假設目前最新的版本為 MySQL 3.29.6 ,我們取主要與次要的版本編號,來對映更換,因此上述中切換的路徑就要改為 /usr/ports/databases/mysql329-server

再來,我們要先查看 pkg-descrpkg-comment 兩個檔案內容,看看是否這個 port 就是我們所要安裝的套件,如果是的話,繼續查看 Makefile 這個檔案,看看我們能有哪些參數可以在下達編譯安裝指令時使用,或是直接修改其中的編譯參數。
當然,如果您沒有任何高階的程式語言基礎,更沒有一絲絲 C 語言的概念的話,您肯定會看不懂 Makefile 中到底是寫了些什麼,相信您也一定會看不下去。不過還是要請您忍下您的不耐煩,從頭至尾仔細的看過一遍,縱使您現在看不懂,但您或多或少總是能夠在其中發現某些您可能需要的訊息;就算是沒有任何所得,在多次的翻閱與編譯安裝之後,您一定多多少少都能理解其中的敘述有哪些是您可以來做修改或提示您可以使用哪些參數來做安裝的指定。在取得所需之後,我們該辦正事了,您可以開始下達編譯、安裝的指令了。

整個安裝 MySQL 的指令流程如下︰

  • su => 輸入正確密碼後,變換身份為『系統管理員 (root)』
  • cd /usr/ports/databases/mysql323-server
  • cat pkg-descr
  • cat pkg-comment
  • less Makefile
  • make install clean => 將編譯、安裝、清除 work 子目錄等指令合併為一的語法

實際安裝流程

  • su
  • cd /usr/ports/databases/mysql323-server
  • cat pkg-descr
  • cat pkg-comment
  • less Makefile
  • make WITH_CHARSET=big5 DB_DIR=/home/mysql install clean && rehash
在下完最後一道指令之後,系統便會開始編譯然後安裝 MySQL 到您的系統中,因為 MySQL 算是個大型套件,所以整個編譯安裝過程會需要滿久的,比較慢的電腦系統的話,一個小時以上算是正常,所以您可以去看一下您愛看的電視、洗個澡或溫習其他章節。


返回首頁目錄索引回上一頁

To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! This is done with: /usr/local/bin/mysqladmin -u root password 'new-password' /usr/local/bin/mysqladmin -u root -h old2 password 'new-password' See the manual for more instructions. You can start the MySQL daemon with: cd /usr/local ; /usr/local/bin/safe_mysqld & You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory: cd sql-bench ; run-all-tests Please report any problems with the /usr/local/bin/mysqlbug script! The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at https://order.mysql.com Added group "mysql". Added user "mysql". /bin/mkdir -p /usr/local/share/doc/mysql/Flags install -c -o root -g wheel -m 444 /usr/ports/databases/mysql323-server/work/mysql-3.23.52/Docs/manual.html /usr/local/share/doc/mysql install -c -o root -g wheel -m 444 /usr/ports/databases/mysql323-server/work/mysql-3.23.52/Docs/manual.ps /usr/local/share/doc/mysql install -c -o root -g wheel -m 444 /usr/ports/databases/mysql323-server/work/mysql-3.23.52/Docs/manual_toc.html /usr/local/share/doc/mysql install -c -o root -g wheel -m 444 /usr/ports/databases/mysql323-server/work/mysql-3.23.52/Docs/manual.txt /usr/local/share/doc/mysql install -c -o root -g wheel -m 444 /usr/ports/databases/mysql323-server/work/mysql-3.23.52/Docs/manual.texi /usr/local/share/doc/mysql install -c -o root -g wheel -m 444 /usr/ports/databases/mysql323-server/work/mysql-3.23.52/Docs/include.texi /usr/local/share/doc/mysql install -c -o root -g wheel -m 444 /usr/ports/databases/mysql323-server/work/mysql-3.23.52/Docs/Flags/*.gif /usr/local/share/doc/mysql/Flags install -c -o root -g wheel -m 444 /usr/ports/databases/mysql323-server/work/mysql-3.23.52/Docs/mysql.info /usr/local/info ===> Registering installation for mysql-server-3.23.52 ===> SECURITY NOTE: This port has installed the following startup scripts which may cause network services to be started at boot time. /usr/local/etc/rc.d/mysql-server.sh If there are vulnerabilities in these programs there may be a security risk to the system. FreeBSD makes no guarantee about the security of ports included in the Ports Collection. Please type 'make deinstall' to deinstall the port if this is a concern. For more information, and contact details about the security status of this software, see the following webpage: http://www.mysql.com/