之前安裝到一半的機器,一邊安裝軟體,一邊弄教學。結果機器堪用之後就懶得繼續裝了(遮臉)。
在這邊分享一下我做的筆記
1.先做FreeBSD的安全更新
freebsd-update fetch freebsd-update install
2.編輯/etc/makefile.conf
,加入以下設定
SUPHOST= cvsup.tw.freebsd.org
SUP_UPDATE= yes
SUP= /usr/bin/csup
SUPFLAGS= -g -L 2
SUPFILE= /usr/share/examples/cvsup/stable-supfile
PORTSSUPFILE= /usr/share/examples/cvsup/ports-supfile
3.更新ports tree
cd /usr/ports
make update
4.編輯/etc/rc.conf
,加入
ntpdate_enable="YES"
ntpdate_flags="clock.stdtime.gov.tw"
sshd_enable="YES"
usbd_enable="YES"
smbftpd_enable="YES"
smbftpd_flags="-D"
mysql_enable="YES"
apache22_enable="YES"
snmpd_enable="YES"
samba_enable="YES"
rsyncd_enable="YES"
named_enable="YES"
5.安裝wget
cd /usr/ports/ftp/wget
make config-recursive
make install clean
6.安裝smbftpd
cd /tmp
wget "http://twbsd.org/download/download.php?file=smbftpd/smbftpd-2.4.tar.gz"
tar -zxvf download.php\?file=smbftpd%2Fsmbftpd-2.4.tar.gz
cd smbftpd
./configure
make
make install
7.安裝Apache22
cd /usr/ports/www/apache22
make config-recursive
make install clean
接下來改一下apache設定值
ee /usr/local/etc/apache22/httpd.conf
7.1 找到DirectoryIndex 加入對.php首頁的支援
DirectoryIndex index.php index.htm index.html
7.2 找到# Include etc/apache22/extra/httpd-userdir.conf
將前面的#號消掉,啟用家目錄功能
7.3 在檔案後面加上下面這兩行,啟動對PHP格式的支援
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
8.安裝PHP
cd /usr/ports/lang/php5
make config-recursive
make install clean
此時必須勾選”Build Apache module” 否則Apache會不認得.php副檔名
9.安裝PHP5外掛 (選擇性)
cd /usr/ports/lang/php5-extensions
make config-recursive
make install clean
10.安裝MySQL server (會順便把client一起裝起來)
cd /usr/ports/databases/mysql55-server/
make config-recursive
make install clean
11.安裝phpMyAdmin
cd /usr/ports/databases/phpmyadmin
make install clean
12.設定MySQL環境
12.1. 啟動server
/usr/local/etc/rc.d/mysql-server restart
12.2. 連上mysql資料庫,更新root密碼,
/usr/local/bin/mysql mysql UPDATE user SET password=password(’123456789′) where user=’root’;
12.3. 重新啟動server
/usr/local/etc/rc.d/mysql-server start
12.4. 修改phpMyAdmin設定檔 – 伺服器部份
ee /usr/local/etc/apache22/httpd.conf 增加 Alias /phpmyadmin/ “/usr/local/www/phpMyAdmin/”
12.5.修改phpMyAdmin設定檔 – 程式本身部份
cd /usr/local/www/phpMyAdmin cp ./libraries/config.default.php ./config.inc.php ee ./config.inc.php 把 $cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’ ; 改成 $cfg[‘Servers’][$i][‘auth_type’] = ‘http’ ;
13. 安裝vim (需要較多時間)
第一次編譯到一半會失敗,估計是套件相依性沒設定好, 編譯第二次就會過了
cd /usr/ports/editors/vim
make config-recursive
make install clean
make install clean