close
這兩篇Freebsd安裝PORTS都抄來改寫的,改的幅度不大就是了,畢竟這類安裝都大同小異

ⓞ前置作業:為加快檔案下載,所以加上一些下載地清單(台灣)
================================================
於/etc/make.conf 加上以下內容

MASTER_SITE_BACKUP?= \
ftp://freebsd.csie.nctu.edu.tw/pub/distfiles/${DIST_SUBDIR}/ \
ftp://ftp2.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ \
ftp://ftp11.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ \
ftp://ftp4.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ \
ftp://ftp10.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ \
ftp://ftp.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ \
ftp://ftp7.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ \
ftp://ftp1.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ \
ftp://ftp6.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ \
ftp://ftp15.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP}

一、將Port Tree更新至最新

(一)、安裝 portupgrade ,才能portsdb (一定要先作)
# cd /usr/ports/sysutils/portupgrade
or
# cd /usr/ports/ports-mgmt/portupgrade

# make install clean

#cd /usr/ports/net/cvsup-without-gui/
#make install clean
#cd /usr/share/examples/cvsup/ //切換到更新範例檔路徑
#cp ports-supfile /root/ //複製到root目錄底下
#cd /root/ //切換路徑
#vi ports-supfile //編輯設定檔
*default host=CHANGE_THIS.FreeBSD.org //官方站台(預設值)
*default host=cvsup.tw.freebsd.org //改為國內站台交大資工如此下載速度較快(還有cvsup1~13都可使用)
*default release=cvs tag=RELENG_6 //預設值
*default release=cvs tag=RELENG_6_3 //更改後只有安全更新會進入這個 branch的 source code
#cd /root
#rehash
#cvsup -g -L 2 ports-supfile //開始更新
Shutting down connection to server
……
Finished successfully
//看到上面代表更新source code成功

#portsdb -Fu //當每次採用 CVSup 更新完 port tree 後,執行portsdb -Fu 來及時更新您的 port

二、安裝Mysql
(一)安裝 Mysql 5.0 / Mysql 5.1
#cd /usr/ports/databases/mysql50-server/ or mysql51-server
#make WITH_CHARSET=utf8 WITH_XCHARSET=all WITH_COLLATION=utf8_unicode_ci BUILD_OPTIMIZED=yes install clean

(三)
#vi /etc/rc.conf
最後一行加入mysql_enable="YES"

(四)啟用 mysql 與設定 mysql root 密碼
#/usr/local/etc/rc.d/mysql-server.sh start
#/usr/local/bin/mysqladmin -u root password 'newpassword'

(五)測試密碼與登入
#mysql -u root -p
打exit離開mysql

複製 Mysql 服務使用規模的設定檔至 /etc/my.cnf
#cp /usr/local/share/mysql/my-xxx.cnf /etc/my.cnf

三、安裝 Apache22 與 PHP5
(一)、安裝 Apache 22
#cd /usr/ports/www/apache22
#make install
Apache 安裝完後先不 make clean,因馬上要安裝 PHP5 結合Apache。

(二)安裝 PHP5 主程式:
#cd /usr/ports/lang/php5/
#make config 勾選安裝選項(一定要勾選 Apache,Apache 才會認得 PHP)
#make install clean

(三)安裝php相關模組
#cd /usr/ports/lang/php5-extensions/
#make config 勾選安裝選項(勾選Mysql、Gd、Session等模組)
#make WITHOUT_X11=yes install

這些模組安裝完的模組.so檔會記錄在 /usr/local/etc/php/extension.ini

(四)修改apache設定檔
#vi /usr/local/etc/apache22/httpd.conf

在檔案最下加如下內容,讓 Apache 能解析 php script
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

修改 DirectoryIndex 加上 index.php
DirectoryIndex index.php index.html index.html.var

(五)開機啟動設定
#vi /etc/rc.conf

最後一行加上
apache22_enable="YES"
apache22_http_accept_enable="YES"

(六)啟動服務
# cd /usr/local/etc/rc.d/apache22 start

(七)測試是否正常運作
# cd /usr/local/www/data/ (可在DocumentRoot設定路徑)
#vi phpinfo.php

編輯內容如下

存檔離開

打開Browser:

http://ip/phpinfo.php

若有看到 php的模組相關表格,即表示安裝成功。

 
arrow
arrow
    全站熱搜

    Matt 發表在 痞客邦 留言(0) 人氣()