最近裝了不少的FreeBSD的各種版本,有發現到一個方便更新ports的工具先記錄下來,不想每一次都來找了
資料來源: http://www.cyberciti.biz/tips/howto-keep-freebsd-system-upto-date.html
 
Updating FreeBSD server system is quite easy. You can apply security patch to keep freebsd system up to date.
Required tools aka software
You need to have following tools on system
(a) portmanager - FreeBSD ultimate ports update utility.
(b) portsnap - It is a system for securely distributing the FreeBSD ports tree. Approximately once an hour, a snapshot of the ports tree is generated, repackaged, and cryptographically signed. The resulting files are then distributed via HTTP.
(c) pkg_version - List the installed version of the package is older than the current version.
FreeBSD install portsnap (for older system version <6.0)
On FreeBSD 6.0+, portsnap is contained in the FreeBSD base (core) system. You only need to to install portsanp as follows for older FreeBSD system:
# cd /usr/ports/ports-mgmt/portsnap
# make install clean
FreeBSD install portmanager
# cd /usr/ports/ports-mgmt/portmanager
# make install clean
Upgrade FreeBSD ports collection
Run portsnap as follows:
# portsnap fetch extract
OR
# portsnap fetch
# portsnap extract
Update FreeBSD packages / software
Now run portmanager to upgrade installed ports:
# portmanager -u
It will updates ports in the correct order based on their dependencies. If a port fails to "make" during update it is marked as ignored. Portmanager will continue updating any ports not marked as "ignored" so long as they are not dependent on the ignored port. Also note that it may take some time if you have large number of application installed.
If you need to upgrade all installed ports with logging, enter:
# portmanager -u -l
How do I upgrade a single software only?
portmanager allows you to update a single port and all of its dependencies. For example update port called bash i.e. bash shell (shells/bash), enter:
# portmanager shells/bash -l -u -f

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

FreeBSD 使用 GEOM 設定 Software raid1 步驟
  原本想要使用預設的hardware raid但是有的老舊設備不支援,所以改用內建的Software raid,以下為安裝步驟怕哪天又會用到所以先計一下。
安裝步驟說明:
  先使用一般的方式將FreeBSD先裝起來後,將其他的HD插入重開機就可以找到新的HD了,如果不想這樣用請參考前一篇的新增SCSI HD 的方式做也可以,請自行注意因為版本上的差異指令會不一樣請自己看一下man 就知道了。
  # sysctl kern.geom.debugflags=16     # 開啟後就不會有錯誤訊息
  kern.geom.debugflags: 0 -> 16

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

#camcontrol all
#disklabel -r -w da1s1 auto
# disklabel -e da1s1
# /dev/da1s1c:
type: SCSI
disk: IBM
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 1114
sectors/unit: 17912412
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
c: 17912412 0 unused 0 0 # (Cyl. 0 - 1114*)
~
# newfs /dev/da1s1c
Warning: Block size and bytes per inode restrict cylinders per group to 89.
Warning: 3492 sector(s) in last cylinder unallocated
/dev/da1s1c: 17912412 sectors in 4374 cylinders of 1 tracks, 4096 sectors
8746.3MB in 50 cyl groups (89 c/g, 178.00MB/g, 22144 i/g)
super-block backups (for fsck -b #) at:
32, 364576, 729120, 1093664, 1458208, 1822752, 2187296, 2551840, 2916384,
3280928, 3645472, 4010016, 4374560, 4739104, 5103648, 5468192, 5832736,
6197280, 6561824, 6926368, 7290912, 7655456, 8020000, 8384544, 8749088,
9113632, 9478176, 9842720, 10207264, 10571808, 10936352, 11300896, 11665440,
12029984, 12394528, 12759072, 13123616, 13488160, 13852704, 14217248,
14581792, 14946336, 15310880, 15675424, 16039968, 16404512, 16769056,
17133600, 17498144, 17862688
#mount /dev/da1s1c /data1
#df -h
可參考freebsd handbook作法:
http://www.freebsd.org/doc/zh_TW/books/handbook/disks-adding.html

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

我慣用TCSH的方式登入,可以修改家目錄下的.cshrc 檔案新增下列資料
vi 輸入或顯示中文
alias vi 'env LC_CTYPE=en_US.ISO8859-1 vi'
cat , more 顯示中文
setenv ENABLE_STARTUP_LOCALE zh_TW.Big5
setenv LC_CTYPE en_US.ISO8859-1
setenv LANG zh_TW.Big5
如何讓FreeBSD像RedHat那樣按tab列出相關的文件資料
set autolist
如何讓FreeBSD像RedHat那樣在ls時顯示多種顏色的目錄
setenv LSCOLORS ExGxFxdxCxegedabagExEx
setenv CLICOLOR yes

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

因為的我系統一天到晚時間都會跑掉
所以設定其他的方式以避免此問題
ee /etc/crontab
# 時間校正
*       *       */1     *       *       root    ntpdate pool.ntp.org
設定每天執行一次時間校正
因為我時間跑掉的速度太快所以要每天檢查一次
要不應該是15天到1個月再檢查一次即可

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

今天我的機器突然間開機之後出現Enter full pathname of shell of RETURN for /bin/sh:的錯誤訊息
重開無效,使用GOOGLE大神協助處理找到以下的方式處理
我做到重開SWAP後重開機就好了,因為我的程式等相關資料通通沒有備份
實在是嚇了我好大一跳ㄚ,現在趕緊備份資料準備重灌吧順便換新的版本試試看。
 
內文引用:南市資教
進入single-user mode有兩個方式:
以 root身份在console登入主機,接著執行# shutdown now
重新開機,載入loader時,請在10秒內按一下空白鍵,在OK提示符號下,輸入boot -s接著螢幕會出現
Enter full pathname of shell of RETURN for /bin/sh:
(直接按 enter即可以 B shell進入單人模式)
必要時執行以下動作-
# fsck -p    檢查並修正檔案系統(preen filesystem)
# mount -u /    重新載入 / ,-u 代表改變為可讀可寫狀態
# mount -a -t ufs  載入所有 /etc/fstab有記錄、型態為 ufs的檔案系統
# swapon -a   開啟swap
# adjkerntz -i 讀取CMOS clock為當地時間,如果存在/etc/wall_cmos_clock,就參考時區設定,調整 kernel clock為UTC(格林威治時間)

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

如何讓FreeBSD像RedHat那樣在ls時顯示多種顏色的目錄
setenv LSCOLORS ExGxFxdxCxegedabagExEx
setenv CLICOLOR yes
 
然後,執行:
代碼:
sed -i.bak -E s/set\ prompt/#set\ prompt/g /root/.cshrc
 
如何讓FreeBSD像RedHat那樣按tab列出相關的文件資料
set autolist
 
 

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

有牽涉到ipnat的我有在前面加#但是我並沒有實際安裝過僅供參考
但是Ipfilter+Bridge 我測過是OK的
Setp 1.
重新編輯新的Kernel 同時加入bridge 的option
cd /usr/src/sys/i386/conf/
cp /usr/src/sys/i386/conf/GENERIC /etc/NEWIPF
ln -s /etc/NEWIPF
ee NEWIPF
ident NEWIPF      #  ident記得要改成新的NEWIPF
options BRIDGE   #  加入這行即可
##### LOG檔配置 #####
options IPFILTER
options IPFILTER_LOG
options IPFILTER_DEFAULT_BLOCK
cd /usr/src/sys/i386/compile/NEWIPF
make depend all install
 
Setp 2.
ee /etc/sysctl.conf
net.inet.ip.forwarding=1
net.link.ether.bridge.enable=1
net.link.ether.bridge.ipf=1
net.link.ether.bridge.config=lnc0,lnc1
 
ee /etc/rc.conf
ipfilter_enable="YES"             ##啟動IPF
ipfilter_rules="/etc/ipf.rules"    ##設定規則
ipmon_enable="YES"             ##啟動記錄器
ipmon_flags="-D /var/log/ipfilter.log" # D=服務啟動  s=使用記錄
                                   # v=紀錄TCP窗口大小ACK和順序號 n=將IP和端口設定為名稱
#ipnat_enable="YES"                 ##啟動IPNAT
#ipnat_rules="/etc/ipnat.rules "    ##設定規則
vi /var/log/ipfilter.log
chmod 755 /var/log/ipfilter.log
 
網卡ip只要設一塊就可以了
並再起頭設定網卡的地方加入另一張網卡的設定
ifconfig_lnc1="inet 10.10.10.254 netmask 255.255.255.0"
 
Setp 3.
設訂規則
ee /etc/ipf.rules
pass in all
pass out all
 
#ee /etc/ipnat.rules
 
 
指令說明:
#kldstat  ( 看ipfilter有無被驅動 )
#ipf -V  ( -V查看ipfilter的版本 )
#ipf -D  ( 停止 ipfilter )
#ipf -E  ( 啟動 ipfilter )
#ipf -Fa -f /etc/ipf.rules  ( -Fa清除所有rule,-f 導入新的rule,為更新ipf.rules後重新啟動必下指令)
#ipfstats  ( 統計所有封包狀態 )
#ipfstats -o  ( -o看所有output的rule )
#ipfstats -i  ( -i看所以input的rule )
#ipmon  ( 觀查所有ip及封包走向 IP -> host, PORT -> protocol )
#ipnat -C  ( 清除所有規則 )
#ipnat -l  ( 查看目前設置的轉換規則及已經執行過後的轉換關係 )
#ipnat -s  ( 查看ipnat的狀態 )
#ipnat -f /etc/ipnat.rules  ( 重讀 ipnat.rules )

 

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

1.安裝EXIM
cd /usr/ports/mail/exim
make install clean
設定要收信的DOMAIN資料
ee /usr/local/etc/exim/configure
primary_hostname = 主機名稱(要以FQND為主)
domainlist local_domains = @ : test.com.tw   (要收信的DOMAIN)
domainlist relay_to_domains = test.com.tw (要收信的DOMAIN)
hostlist   relay_from_hosts = localhost : 127.0.0.1  (LOCAL IP)
若要增加SMTP驗證發信請在最下面加入
##### SMTP驗證 #####
login:
   driver = plaintext
   public_name = LOGIN
   server_prompts = "Username:: : Password::"
   server_condition = "${if crypteq{$2}{${extract{1}{:}{${lookup{$1}lsearch{/usr/local/etc/exim/exim.passwd}{$value}{*:*}}}}}{1}{0}}"
   server_set_id = $1
 

ee /usr/local/etc/rc.d/eximpasswd.sh  --新增此檔
#!/bin/sh
awk -F: '
/^(sash)?root:/ { next }
/^[^:]*:.[^:]/ { print $1 ":" $2 }
' /etc/master.passwd > /usr/local/etc/exim/auth.passwd.tmp
mv /usr/local/etc/exim/auth.passwd.tmp /usr/local/etc/exim/passwd
 
設定權限
chmod 755 /usr/local/etc/rc.d/eximpasswd.sh
設定每10分鐘COPY一次密碼
ee /etc/crontab
*/10 *       *       *       *       root    /usr/local/etc/rc.d/eximpasswd.sh
設定開機啟動
ee /etc/rc.conf
sendmail_enable="NONE"
exim_enable="YES"
 
2.安裝POP3(cucipop)
cd /usr/ports/mail/cucipop/
make install clean
執行檔是: /usr/local/libexec/cucipop
開機自動執行:
  a.檔案: ee /usr/local/etc/rc.d/cucipop.sh (自己新增檔案)
     內容如下:
     /usr/local/libexec/cucipop -YaSE 2M  (此參數表示超過兩個月的信砍之)
  b.變更權限:
    chmod 700 /usr/local/etc/rc.d/cucipop.sh
  c.手動啟動
    /usr/local/etc/rc.d/cucipop.sh
 
3.安裝openwebmail
因為SUIDPERL的安全性問題所以要移除重裝
cd /usr/ports/lang/perl5.8/   
make deinstall clean  
make -DENABLE_SUIDPERL install clean
cd /usr/ports/mail/openwebmail
make all install clean
設定檔在 ee /usr/local/www/cgi-bin/openwebmail/etc/openwebmail.conf
enable_sshterm          no -關閉ssh的方式
 
4.安裝Clamav
cd /usr/ports/security/clamav
make install clean
在 ee /etc/crontab 檔案中在root欄位中加入:
0 6,18 * * * clamav /usr/local/bin/freshclam --quiet -l /var/log/clam-update.log
即每天上午 6 點和下午 6 點各更新一次病毒碼資料庫
mkdir /var/run/clamav/clamd
ee /usr/local/etc/clamd.conf
# Path to a local socket file the daemon will listen on.
# Default: disabled
#LocalSocket /var/run/clamav/clamd
LocalSocket /tmp/clamd
DatabaseDirectory /usr/local/share/clamav  要變成
DatabaseDirectory /var/db/clamav
User clamav 變更成
User vscan
 
5.安裝amavisd-new
cd /usr/ports/security/amavisd-new
make install clean
設定amavisd-new的設定檔
ee /usr/local/etc/amavisd.conf
$mydomain = 'my-domain.ru';   ---修正DOMAIN
$forward_method = 'smtp:127.0.0.1:10025';  移除前方的#
$notify_method = $forward_method;     增加一個
$inet_socket_port = 10024;    --確定資料
@av_scanners = (  --這是選擇您的掃毒程式將不要的MARK掉要的開起來
 ### http://www.clamav.net/
 ['ClamAV-clamd',
#   \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd"],  --將此行變更成下面的
    \&ask_daemon, ["CONTSCAN {}\n", "/tmp/clamd"],
exim設定
ee /usr/local/etc/exim/configure
於hostlist   relay_from_hosts =之下加入
local_interfaces = 0.0.0.0.25 : 127.0.0.1.10025
於[routers]處加入
amavis:
        driver = manualroute
        condition = "${if eq {$interface_port}{10025} {0}{1}}"
        # if scanning incoming mails, uncomment the following line and
        # change local_domains accordingly
        # domains = +local_domains
        transport = amavis
        route_list = "* localhost byname"
        self = send
       
於[transports]處加入
amavis:
       driver = smtp
       port = 10024
       allow_localhost
6.安裝SpamAssassin
cd /usr/ports/mail/spamd/
make install clean
cp /usr/local/etc/spamd.conf.sample /usr/local/etc/spamd.conf
ee /usr/local/etc/spamd.conf
# Enable the Bayes system. 使用貝氏學習系統
use_bayes               1
# Enable Bayes auto-learning.  開起貝氏自動學習功能
auto_learn              1
# Enable or Disable network checks.  略過 RBLs 之檢查
skip_rbl_checks         0
# Blacklist.  黑色清單,判定減 + 100 分
#blacklist_from *@sohu.com *@mailfb.com
# Whitelist . 白色清單,判定加 -100 分
#whitelist_from *@yahoo.com.tw *@yahoo.com.hk *@yahoogroups.com.hk
#whitelist_from rika@rika.idv.tw
rc.conf 設定 --此處要注意優先順序
ee /etc/rc.conf
spamd_enable="YES"
amavisd_enable="YES"
clamav_clamd_enable="YES"
clamav_freshclam_enable="YES"
exim_enable="YES"
 
細部調整說明
AMaViSd-new
#$QUARANTINEDIR = '/var/virusmails';  --信件預設會保留在該資料夾若不想保留請註解掉即可
AMaViSd-new 會呼叫 Mail::SpamAssassin 計算 Hit,分數越高的越可能是廣告信。
$sa_auto_whitelist = 1;    # 啟用自動學習白名單 White List
$sa_mail_body_size_limit = 200*1024;     # 超過某個特定大小的郵件就不經過 SpamAssassin 的掃瞄。
$sa_tag_level_deflt  = 2.0;     # 超過這個分數標準者,視為垃圾郵件打分數。
$sa_tag2_level_deflt = 6.3;     # 超過這個分數標準者,才允許在郵件標頭加入 Spam 資訊。
$sa_kill_level_deflt = 30 ;   # 超過這個標準者,就直接將信件備份後刪除。
 

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

A.trafshow --loading較輕
cd /usr/ports/net/trafshow
make install clean
rehash  不行就reboot
指令為
trafshow -i 網卡名稱(lnc0)
         -ni 網卡名稱(lnc0)
B.ntop --loading較重
cd  /usr/ports/net/ntop/
make install clean
rehash
ntop -A --設定管理者的密碼,預設帳號是admin
ee /usr/local/etc/rc.d/ntop.sh        //修改ntop.sh內容如下
###Network interface(s) to be monitored;
###may be blank, or comma-separated list
interfaces=' '           //預設值
interfaces='vr0'         //更改後(改成您想要監聽的網路介面)
###[IP:]port for serving HTTP; set to '0' to disable
http_port='3000'         //預設值(http聽的port)
http_port='5678'         //更改後(改成您想要聽的http port)
###[IP:]port for serving HTTPS; set to '0' to disable
###The certificate is /usr/local/etc/ntop/ntop-cert.pem
https_port='3001'        //預設值(https聽的port)
https_port='8765'        //更改後(改成您想要監聽的https port)
cd /usr/local/etc/rc.d              //切換路徑
chmod 755 ntop.sh                   //讓ntop能開機自行啟動
/usr/local/etc/rc.d/ntop.sh start   //啟動ntop(成功訊息如下)

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

A.snmp安裝步驟
1.安裝SNMP
cd /usr/ports/net-mgmt/net-snmp
make install clean
2. 修改 /etc/rc.conf,加入下列:
snmpd_enable="YES"
snmpd_flags="-p /var/run/snmpd.pid"
3. 修改 /etc/hosts.allow,加入下列:
snmpd : localhost : allow
snmpd : ALL : deny
4.新建ee /usr/local/share/snmp/snmpd.conf檔,內容如下:
rocommunity public
syslocation FreeBSD # 作業系統名稱
syscontact brucebin<brucebin@brucebin.idv.tw>  # 網管人員名稱,用mail address 亦可
sysname spam.brucebin.idv.tw # 系統名稱,如:ms19 這一個加上去有時會不行請自行判斷
5. 啟動:/usr/local/etc/rc.d/snmpd.sh start
B.MRTG安裝
安裝MRTG
1. cd /usr/ports/net-mgmt/mrtg
make install clean
2. mkdir /usr/local/www/data/mrtg
chmod -R 755 /usr/local/www/data/mrtg
3.建立 / 修改MRTG設定檔
cd /usr/local/etc/mrtg
cfgmaker public@domain > mrtg.cfg
如:cfgmaker public@ms19.center.kl.edu.tw > mrtg.cfg
    cfgmaker public@spam.brucebin.idv.tw > mrtg.cfg
ee /usr/local/etc/mrtg/mrtg.cfg
修改WorkDir如下:
WorkDir: /usr/local/www/data/mrtg
將Options[_]: growright, bits的#去掉,
增加下列二行:
Language: big5
WithPeak[_]: wmy
4. 建立MRTG的index.html檔
將下列指令複製下來,貼到FreeBSD的命令提示字元後:
indexmaker \
--title 'MRTG - 網路流量分析' \
--addhead='<meta http-equiv="Content-Type" content="text/html; charset=big5">' \
--output /usr/local/www/data/mrtg/index.html \
--columns=1 \
--nolegend \
/usr/local/etc/mrtg/mrtg.cfg
5. 執行mrtg程式:
/usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
第一次執行時會發生錯誤訊息,請再執行,直到沒發生錯誤訊息為止,應該第三次就ok了。
6. 加入排程:
ee /etc/crontab
*/5   *    *    *    *    root  /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
上列不斷行。*與*之間是以TAB區隔。意思是每五分鐘執行一次mrtg程式。
#################### MRTG-CPU Loading ####################
路徑:我在主網頁下的mrtg資料夾下的建了一個名為cpu_user+sys的資料夾,方便管理
mkdir /usr/local/www/data/mrtg/cpu_user+sys
設定檔:ee /usr/local/www/data/mrtg/cpu_user+sys/cpu.cfg
內容如下:
LoadMIBs: /usr/local/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[cpu]:ssCpuRawUser.0&ssCpuRawSystem.0:public@210.68.43.19 --這資料是我的請自行變更
RouterUptime[cpu]: public@210.68.43.19 --這資料是我的請自行變更
MaxBytes[cpu]: 100
Title[cpu]: CPU LOAD
PageTop[cpu]: <H1>SYS Load% (系統負載和使用者負載) </H1>
ShortLegend[cpu]: %
YLegend[cpu]: CPU Utilization
Legend1[cpu]: User CPU in % (Load)
Legend2[cpu]: System CPU in % (Load)Legend3[cpu]:
Legend4[cpu]:
LegendI[cpu]:  使用者負載
LegendO[cpu]:  系統負載
Options[cpu]: growright,nopercent
Language:big5
WorkDir:/usr/local/www/data/mrtg/cpu_user+sys/
◎執行MRTG CPU Loading
a.我在/root/cron 資料夾下 放了一個執行檔權限700 命名為mrtg-cpu.cron
mkdir /root/cron
ee /root/cron/cpu_user+sys.cron
內容如下:
#!/bin/sh
/usr/local/bin/mrtg /usr/local/www/data/mrtg/cpu_user+sys/cpu.cfg
chmod 700 /root/cron/cpu_user+sys.cron
b.第一次執行       
/root/cron/cpu_user+sys.cron
起先因為沒有檔案 所以會有錯誤訊息,run個3到5次就ok囉~~
c.檢視成果
因為之前cpu.cfg中設定工作區為/usr/local/www/data/mrtg/cpu_user+sys/
所以產生的檔案就在於此
http://你的ip位置/mrtg/cpu_user+sys/cpu.html   
當然了,可以為了少打那幾個字,將cpu.html連結為index.htm
cd /usr/local/www/data/mrtg/cpu/
ln -s cpu.html ./index.htm
如此就可以用:http://你的ip位置/mrtg/cpu/ 連結.
d.寫入crontab ee /etc/crontab
我設定每10分鐘run一次.
1,11,21,31,41,51 * * * * root /root/cron/cpu_user+sys.cron
#################### MRTG-CPU Loading ####################
#################### MRTG-RAM+SWAP ####################
◎安裝 MRTG
◎設定MRTG-RamSwap 的設定檔案
路徑:因為我要監控數點,所以我額外建立 ramswap 的資料夾
mkdir /usr/local/www/data/mrtg/ramswap
設定檔:ee /usr/local/www/data/mrtg/ramswap/ramswap.cfg
內容如下:
LoadMIBs: /usr/local/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[ramswap]: memAvailReal.0&memAvailSwap.0:public@spam.brucebin.idv.tw  --這邊自己改
Options[ramswap]: nopercent,growright,gauge,noinfo
Title[ramswap]: RAM & SWAP 使用狀況
PageTop[ramswap]: RAM & SWAP 使用狀況
MaxBytes[ramswap]: 1000000000
kMG[ramswap]: k,M,G,T,P,X
Ylegend[ramswap]: Octets
ShortLegend[ramswap]: octets
LegendI[ramswap]: RAM 可使用
LegendO[ramswap]: Swap 可使用
Legend1[ramswap]: RAM 可使用單位
Legend2[ramswap]: Swap 可使用單位
Language:big5
WorkDir:/usr/local/www/data/mrtg/ramswap/
◎設定自動執行:
a.我在/root/cron 資料夾下 放了一個執行檔權限700 命名為ramswap.cron
chmod 700 /root/cron/ramswap.cron
ee /root/cron/ramswap.cron
內容如下:
#!/bin/sh
/usr/local/bin/mrtg /usr/local/www/data/mrtg/ramswap/ramswap.cfg
b.手動執行
cd /usr/local/www/data/mrtg/ramswap/
mrtg ./ramswap.cfg
起先因為沒有檔案 所以會有錯誤訊息run個3到5次就ok囉~~
c.檢視成果
因為之前ramswap.cfg中設定工作區為/usr/local/www/data/mrtg/ramswap/
所以產生的檔案就在於此
http://你的ip位置/mrtg/ramswap/ramswap.html   
d.寫入crontab (crontab -e) 我設定每10分鐘run一次
ee /etc/crontab
*/10 * * * * root /root/cron/ramswap.cron
#################### MRTG-RAM+SWAP ####################
因為上述步驟皆是分開的網頁,但是一開始其實就已經有做了一個頁面了
請在 ee /usr/local/mrtg/index.html 的<table>標籤下自行調整
以下是我的範例供參考用
<tr>
<td><DIV><B>對外總流量 -- spam.brucebin.idv.tw</B></DIV>
<DIV><A HREF="spam.brucebin.idv.tw_1.html"><IMG BORDER=1 ALT="spam.brucebin.idv.tw_1 Traffic Graph" SRC="spam.brucebin.idv.tw_1-day.png"></A><BR>
<SMALL><!--#flastmod file="spam.brucebin.idv.tw_1.html" --></SMALL></DIV>
</td></tr>
<tr>
<td>
<DIV><B>CPU負載 -- spam.brucebin.idv.tw</B></DIV>
<DIV><A HREF="../mrtg/cpu_user+sys/cpu.html"><IMG BORDER=1 ALT="CPU Traffic Graph" SRC="../mrtg/cpu_user+sys/cpu-day.png"></a><br>
<SMALL><!--#flastmod file="../mrtg/cpu/cpu.html" --></SMALL></DIV>
</td>
</tr>
<tr>
<td>
<DIV><B>MRTG-RAM+SWAP -- spam.brucebin.idv.tw</B></DIV>
<DIV><A HREF="../mrtg/ramswap/ramswap.html"><IMG BORDER=1 ALT="CPU Traffic Graph" SRC="../mrtg/ramswap/ramswap-day.png"></a><br>
<SMALL><!--#flastmod file="../mrtg/ramswap/ramswap.html" --></SMALL></DIV>
</td>
</tr>
 

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

1.cvsup 安裝
cd /usr/ports/net/cvsup-without-gui/
make install clean
reboot
2.port tree 更新
cd /usr/share/examples/cvsup
ee ports-supfile
修改
*default host=CHANGE_THIS.FreeBSD.org
變更為
*default host=freebsd.csie.nctu.edu.tw
cp ports-supfile /usr/
cd /usr
執行下列指令進行更新的動作
cvsup -g -L 2 ports-supfile
完成後即更新了 port tree
 
若用Ports裝好Services之後,遇有軟體更新怎麼辦?
1.先更新 port tree:cvsup -g -L 2 cvsupfile-ports
2.安裝portgrade:
  cd /usr/ports/sysutils/portupgrade
  make instal clean
3. cd /usr/ports
4. /usr/local/sbin/portsdb -Uu
  這一步動作會持續很久沒反應,感覺好像當機了,請耐心等待。
  /usr/local/sbin/pkgdb -F
  /usr/local/sbin/portupgrade -aWy
  ========================================================
利用CVSUP進行安全性更新

改/usr/share/examples/cvsup/standard-supfile
*default
host=CHANGE_THIS.FreeBSD.org改為
--> default
host=cvsup.tw.FreeBSD.org
*default release=cvs
tag=參數(同方法一之參數)
修改/usr/share/examples/cvsup
/ports-supfile中的設定
*default
host=CHANGE_THIS.FreeBSD.org改為
-->default
host=cvsup.tw.FreeBSD.org
*default release=cvs
tag=.修改完
畢後,執行以下兩行指令
/usr/local/bin/cvsup -g -L 2
/usr/share/examples/cvsup/standard-supfile   安全性更新
/usr/local/bin/cvsup
-g -L 2 /usr/share/examples/cvsup/ports-supfile      port tree 更新
 註:port-tree
db 路徑在/var/db/sup/port-all
   src-tree db
路徑在/var/db/sup/src-all

若您的系統為 FreeBSD 4.x 或 FreeBSD 5.1、5.2 那麼您只要執行如下一行指令即可打完收功 (也就是一行指令搞定編輯
/ 安裝系統程式、系統核心)
  • 編譯所有的系統程式 (make buildworld)
  • 編譯新的系統核心
    (make buildkernel)
  • 安裝新的系統核心 (make installkernel)
  • 安裝新的系統程
    式 (make installworld)
  • #cd /usr/src
    #make world kernel //適用於 FreeBSD 4.x
    #make kernel world //適用於 FreeBSD 5.1、5.2
    #reboot
    若您的系統為 FreeBSD 5.3 或之後的版本則因為 make world 必須分開執行 (否則將出現錯誤訊息),所以請執行如下指令
    (詳細內容請參考 /usr/src/Makefile)
    #cd /usr/src
    #make buildworld kernel //等於 make buildworld + make buildkernel + make installkernel
    #reboot
    #make installworld
    #reboot
    ========================================================
    預防萬一 某站台掛掉了
    http://www.freebsd.org/doc/handbook/cvsup.html#HANDBOOK-MIRRORS-CHAPTER-SGML-MIRRORS-TW-CVSUP
    網路上看到的: http://ftp.giga.net.tw/cvsup.php CVSup
    servers updating status
    Taiwan:


  • cvsup.tw.FreeBSD.org

  • cvsup3.tw.FreeBSD.org




  • cvsup4.tw.FreeBSD.org




  • cvsup5.tw.FreeBSD.org




  • cvsup6.tw.FreeBSD.org




  • cvsup7.tw.FreeBSD.org




  • cvsup8.tw.FreeBSD.org




  • cvsup9.tw.FreeBSD.org




  • cvsup10.tw.FreeBSD.org




  • cvsup11.tw.FreeBSD.org




  • cvsup12.tw.FreeBSD.org




  • cvsup13.tw.FreeBSD.org




  • cvsup14.tw.FreeBSD.org



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

    1 2
    Blog Stats
    ⚠️

    成人內容提醒

    本部落格內容僅限年滿十八歲者瀏覽。
    若您未滿十八歲,請立即離開。

    已滿十八歲者,亦請勿將內容提供給未成年人士。