OS Freebsd 8.2
平台 ESX 4.1
===================================
1. 安裝 MySQL ~ 設定編碼為 unicode
===================================
mysql-5.5.9.tar.gz
# cd /usr/ports/databases/mysql55-server
# make WITH_CHARSET=utf8 WITH_XCHARSET=all WITH_COLLATION=utf8_unicode_ci BUILD_OPTIMIZED=yes install clean
************************************************************************
Remember to run mysql_upgrade (with the optional --datadir=<dbdir> flag)
the first time you start the MySQL server after an upgrade from an
earlier version.
************************************************************************
install-info --quiet /usr/local/info/mysql.info /usr/local/info/dir
===> Installing rc.d startup script(s)
===> Compressing manual pages for mysql-server-5.5.9
===> Registering installation for mysql-server-5.5.9
===> SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/mysqld
This port has installed the following startup scripts which may cause
these network services to be started at boot time.
/usr/local/etc/rc.d/mysql-server
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/
===安裝成功===
安裝會因為你的CPU效能時間有所不同要等待一下(約一個小時)之後,要產生
MySQL DB,一開始所要用的 Database,預設會裝在 /var/db/mysql 裡 ( 若不想裝在預設的地方,安裝時下參數 --localstatedir=/path/to/your/location )
# rehash
# mysql_install_db
(其實也可以省略上面動作 等完全安裝後 重新開機
複製
MySQL 的系統設定檔到 /etc 下
# cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf
設定
MySQL 資料庫權限,並且啟動它
# chown -R mysql:mysql /var/db/mysql
# mysqld_safe &
啟動無誤的話,畫面會出現此訊息
Starting mysqld daemon with databases from /var/db/mysql
設定
MySQL Root 的密碼
# mysqladmin -u root password 新密碼
若是更新舊的版本,就稍微注意一下
Remember to run mysql_upgrade (with the optional --datadir=<dbdir> flag) the first time you start the MySQL server after an upgrade from an earlier version.
===================================
2. 安裝 Apache
===================================
# cd /usr/ports/www/apache22
# make install clean
(這要將mysql 選進去)
===================================
3. 安裝 PHP
===================================
# cd /usr/ports/lang/php5
# make config install clean
記得要勾選此選項喔,不然
Apache 會不認得
PHP
APACHE Build Apache module
再安裝 PHP5 Extensions
# cd /usr/ports/lang/php5-extensions
# make config install clean
建議加勾選 GD、MYSQL、MySQLI、MBSTRING、ZIP 和 ZLIB
===================================
4. 安裝 PhpMyadmin phpMyAdmin-3.3.9.1-all-languages.tar.bz2
===================================
# cd /usr/ports/databases/phpmyadmin
# make install clean
****************************************************************************
===> Returning to build of phpMyAdmin-suphp-3.3.9.1
===> phpMyAdmin-suphp-3.3.9.1 depends on file: /usr/local/lib/php/20090626/mbstring.so - found
===> phpMyAdmin-suphp-3.3.9.1 depends on file: /usr/local/lib/php/20090626/zip.so - found
===> Generating temporary packing list
===> Checking if databases/phpmyadmin already installed
===> Creating users and/or groups.
Using existing group `www'.
Creating user `_pma' with uid `336'.
===> Adjusting file ownership in /usr/local/www/phpMyAdmin
phpMyAdmin-suphp-3.3.9.1 has been installed into:
/usr/local/www/phpMyAdmin
Please edit config.inc.php to suit your needs.
To make phpMyAdmin available through your web site, I suggest
that you add something like the following to httpd.conf:
Alias /phpmyadmin/ "/usr/local/www/phpMyAdmin/"
<Directory "/usr/local/www/phpMyAdmin/">
Options none
AllowOverride Limit
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 .example.com
</Directory>
===================================
5. 修改設定檔
===================================
首先設定
PHP 的設定檔,以後就是設定 php.ini 這檔
# cp /usr/local/etc/php.ini-dist php.ini
修改
Apache 的設定
# vi /usr/local/etc/apache22/httpd.conf
在最上面加入
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
找到
DirectoryIndex index.html
把它變成
DirectoryIndex index.php index.html index.htm
修改 phpmyadmin 目錄位置
設定一開機啟動
Apache &
MySQL
# vi /etc/rc.conf
加入這三行
apache22_enable="YES"
apache22_http_accept_enable="YES"
mysql_enable="YES"
在 /usr/local/www/data 裡新增一個檔案叫 index.php,內容如下
<?php phpinfo(); ?>
重新開機,大功告成!