[更新][系統]Upgrade FreeBSD (二) vi your kernel

No Comments

cd /usr/src/sys/i386/conf

vi YOUR-KERNEL

cd ../complie/i386/

config YOUR-KERNEL

make cleandepend ; make depend ; make ; makeinstall

reboot

vi YOUR-KERNEL 時
若有編輯到 umass (USB 大容量存儲)時
需要加上
device scbus # SCSI bus (required for SCSI)
device da # Direct Access (disks)
這兩個 device, 不然會出現
undefined reference to `xpt_done’
的錯誤

[更新][系統]Upgrade FreeBSD (一) cvs up

No Comments

REF: http://cu.ttc.edu.tw/wordpress/?p=15

Freebsd 6.1 ->Freebsd 6.2

1.安裝cvsup

#cd /usr/ports/net/cvsup-without-gui/ (進入cvsup安裝路徑)

#make install clean (安裝套件並清除安裝過程中產生不必要檔案)
皆下來設定修改stable-supfile

#cd /usr/share/examples/cvsup/

#vi standard-supfile
修改以下資料

*default host=cvsup13.tw.freebsd.org (改為國內站台giga如此下載速度較快,還有cvsup1~13都可使用)

*default release=cvs tag=RELENG_6_2

存檔,皆下來開始更新

#rehash (才不會出現指令無效訊息)

#cvsup -g -L2 stable – supfile (再來就開始檢查有哪些更新檔案,跑完會顯示 Finished successfully)

#cd /usr/src

#make update
準備開始編譯新的核心

#cd /usr/src/sys/i386/conf

#cp GENERIC /root/MYKERNEL

#ln -s /root/MYKERNEL

#vi MYKERNEL (修改核心設定)
省略

#cd /usr/src

#make buildworld

#make buildkernel KERNCONF=MYKERNEL

#make installkernel KERNCONF=MYKERNEL

#sync;sync;sync; reboot(更新完後重新開機)

————————————————————————————–
(此段請參考 http://hina.ushiisland.net/blog/445)
CVSup 的部分
備份這兩個檔案

/etc/master.passwd
/etc/group
如果要整個 /etc 備份也可以,不過如果是新安裝的主機,是可以不用啦。安裝 CVSup 請參考之前的文章。安裝完畢之後,請更新 Source 檔案,確認安裝 FreeBSD 時有將 source code 裝進來,接著按照以下步驟更新整個系統。

make buildworld
編譯所有的系統程式。

make buildkernel KERNCONF=MYKERNEL
編譯新的系統核心。系統核心檔案(MYKERNEL)請依照自己的系統與需求修改,詳細的核心資料可以參考這篇文章,twbsd.org, 第八章 編譯核心。

make installkernel KERNCONF=MYKERNEL
安裝新的核心。

make installworld
安裝新的系統程式。

mergemaster
用來檢查並升級你的設定檔。他會將 CVSup 抓回來的新的檔案與現有的設定檔做比對,然後讓你決定是否要使用新的設定檔案。除了 master.passwd group aliases 三個檔案可以沿用舊的設定之外,其他的幾乎都可以更新。
最後 sync;sync;sync;reboot 重新開機。
————————————————————————————–

重開機進入 singl mode ( 單人模式 )

#mount -a

#cd /usr/src

#make installworld

#sync;sync;sync;reboot

此時再 uname -a 看一下,嘿,升級成功囉!

不過此時你的 uname -r 會變成是 6.3-RELEASE-p1, 這會造成 sysinstall 安裝 packages 時
出現找不到套件的問題

要在 Options 裡改掉 RELEASE 的資訊為 6.3-RELEASE
(這個問題困擾我很久, 還找錯解決方向, 害我重編核快3次)

[不再修正][網路][服務] OpenSER under Fedora 7

3 Comments

因 Fedora 10 與 OpenSIPs 的出現, 此篇文章已不具修改必要性。

REF: http://top12345tw.blogspot.com/2008/05/openser.html (better)

REF: http://www.hk-pub.com/forum/archiver/tid-1064603.html

website: http://www.openser.org/

download: http://ftp.upjs.sk/pub/users/sal/Fedora/7/

Files to donwload:
openser-1.2.2-10.fc7.i386.rpm
openser-mysql-1.2.2-10.fc7.i386.rpm

設定檔:
/etc/openser/openser.cfg
/etc/openser/openserctlrc

# vi /etc/openser/openser.cfg
找到以下各行文字, 並移除前頭的井字符號
# loadmodule “mysql.so”
#loadmodule “auth.so”
#loadmodule “auth_db.so”
#modparam(“usrloc”, “db_mode”, 2)
#modparam(“auth_db”, “calculate_ha1”, yes)
#modparam(“auth_db”, “password_column”, “password”)

#if (!www_authorize(“openser.org”, “subscriber”)) {
#       www_challenge(“openser.org”, “0”);
#       exit;
#};
(以上四行裡的 operser.org 改成你主機的 FDQN)

建立資料庫表單在 MySQL 裡
# vi /usr/sbin/openser_mysql.sh (可以先編輯這個檔案, 裡面包含了可能會使的資訊)
# /usr/sbin/openser_mysql.sh (編輯後就執行它)
可用的參數有:
usage: openser_mysql.sh create
openser_mysql.sh drop   (!!entirely deletes tables)
openser_mysql.sh reinit (!!entirely deletes and than re-creates tables
openser_mysql.sh backup (dumps current database to stdout)
openser_mysql.sh restore <file> (restores tables from a file)
openser_mysql.sh copy <new_db> (creates a new db from an existing one)
openser_mysql.sh migrate <old_db> <new_db> (migrates DB from 1.1 to 1.2)
openser_mysql.sh presence (adds the presence related tables)
openser_mysql.sh extra (adds the extra tables – imc,cpl,siptrace,domainpolicy)
openser_mysql.sh serweb (adds the SERWEB specific tables)

建立環境:
export SIP_DOMAIN=your-ip.address (也可以把這行寫到 /etc/profile 裡)

建立一個資料庫給 OpenSER
# /usr/sbin/openser_mysql.sh create (然後會需要你的資料庫管理員的密碼, ex: root 的密碼)
MySQL password for root: xxxxxxxx

設定開機啟動:
chkconfig openser on

手動啟用:
service openser start

紀錄檔管理:
REF: http://www.openser.org/dokuwiki/doku.php/utils:basic-syslog-configuration
# vi openser.cfg

touch /var/log/openser
(選用)安裝管理程式 OpenSER Admin:
REF: http://www.read8.org/20080918/35617/
yum install ruby ruby-libs rubygems
http://sourceforge.net/projects/openseradmin
wget http://nchc.dl.sourceforge.net/sourceforge/openseradmin/openseradmin-0.3.tar.bz2
tar jxvf openseradmin-0.3.tar.bz2

http://lightyror.thegiive.net/2007/06/fedora-7-ruby-on-rails.html
gem i rails -y
gem install rails –include-dependencies

在 /etc/rc.local 裡加入
/var/www/oseradm/script/server -p 3000 -d
(-p 是指定 port , -d 表示以 daemon 執行)

[管理][網路]流量分析軟體 cacti

No Comments

REF: http://www.cacti.net/downloads/docs/html/install_unix.html

tar zxvf
cd …
mysqladmin –user=dbadm create cacti -p
mysql cacti < cacti.sql -p -u dbadm

mysql –user=dbadm -p
GRANT ALL ON cacti.* TO dbadm@localhost IDENTIFIED BY ‘your-password’;
flush privileges;

cd include
vi config.php
$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “dbadm”;
$database_password = “dbadm-passwd”;
chown -R httpd.httpd rra/ log/
mv cacti-xxx.xx /home/httpd/html/

*/5 * * * * httpd php /home/httpd/html/cacti/poller.php > /dev/null 2>&1

http://libil.dyndns.org/cacti

進入web install 程序
會出現[NOT FOUND], 要補齊

swup –install net-snmp net-snmp-utils php-cli(可獲得 /usr/bin/php)

將缺漏的補齊後, 要用 admin: admin 進入, 並強制改密碼

進入系統後, 把需要改的設定改一下, 如軟體版本(rrd 1.2.x, snmp )

[待補] Rsync over SSH

No Comments

Rsync over SSH

A: 被備援(丟資料) libil (Trustix Linux 3.0.5)
B: 做備援(收資料) libcy (Trustix Linux 3.0.5)

準備工作
vi /etc/ssh/sshd_config
把 PermitRoot 改成 foced-command-only

libcy 啟動 rsync 服務(不用在防火牆上開 873的port)

主機帳戶以root執行
(用其他的, 應該也行, 因為 /etc/rsync.conf 裡面會定義 uid & gid)

先到 libcy 上

安裝 rsync-server 軟體
swup –install rsync-server rsync

# vi /etc/rsync.conf
—- top of the file —-
transfer logging = yes
log file = /var/log/rsync/rsync
pid file = /var/run/rsyncd.pid
timeout = 600

[libil]
path = /home/rsync
# auth users = rsync
auth users = linux
uid = root
gid = root
read only = no
secrets file = /etc/rsyncd.secrets
—- bottom of the file —-

# vi /etc/rsyncd.secrets
—- top of the file —-
root:pass4libil
—- bottom of the file —-

service rsyncd restart

[網路][安全][設定]NAT under Fedora 7

No Comments

REF: http://blog.candyz.org/20070904/1536

# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT – [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp –icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp –dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp –dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp –dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 1194 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 3128 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT –reject-with icmp-host-prohibited
#-A FORWARD -j REJECT –reject-with icmp-host-prohibited
-A FORWARD -j ACCEPT
COMMIT

*nat
:PREROUTING ACCEPT [491:43530]
:POSTROUTING ACCEPT [2:120]
:OUTPUT ACCEPT [43:3236]
-A POSTROUTING -s 192.168.203.0/255.255.255.0 -j MASQUERADE
COMMIT

系統監控軟體 cacti

No Comments

REF: http://www.cacti.net/downloads/docs/html/install_unix.html

tar zxvf
cd …
mysqladmin –user=dbadm create cacti -p
mysql cacti < cacti.sql -p -u dbadm

mysql –user=dbadm -p
GRANT ALL ON cacti.* TO dbadm@localhost IDENTIFIED BY ‘dbadm-passwd’;
flush privileges;

cd include
vi config.php
$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “dbadm”;
$database_password = “dbadm-passwd”;
chown -R httpd.httpd rra/ log/
mv cacti-xxx.xx /home/httpd/html/

*/5 * * * * httpd php /home/httpd/html/cacti/poller.php > /dev/null 2>&1

http://libil.dyndns.org/cacti

進入web install 程序
會出現[NOT FOUND], 要補齊

swup –install net-snmp net-snmp-utils php-cli(可獲得 /usr/bin/php)

將缺漏的補齊後, 要用 admin: admin 進入, 並強制改密碼

進入系統後, 把需要改的設定改一下, 如軟體版本(rrd 1.2.x, snmp )

Older Entries