2010年11月29日 星期一

OTRS 程式更新

OS:CentOS 5.5

1. 安裝網頁伺服器
        yum  install  httpd
        /etc/init.d/httpd  restart; chkconfig  httpd  on

2. 安裝資料庫
        yum  groupinstall  'MySQL Database'
        yum  install  mysql-server  mysql  php-mysql
        /etc/init.d/mysqld  restart; chkconfig mysqld on

3. 設定資料庫安全資訊
        /usr/bin/mysql_secure_installation
        Enter current password for root (enter for none):  [預設沒有密碼]
        ...
        Set root password? [Y/n] y
        ... Success!
        Remove anonymous users? [Y/n] y
        ... Success!
        Disallow root login remotely? [Y/n] y
        ... Success!
        Remove test database and access to it? [Y/n] y
        - Dropping test database...
        ... Success!
        - Removing privileges on test database...
        ... Success!
        Reload privilege tables now? [Y/n] y
        ... Success!
        Cleaning up...

4. 下載OTRS主程式
        wget  http://ftp.otrs.org/pub/otrs/RPMS/fedora/4/otrs-3.0.1-01.noarch.rpm

5. 檢查OTRS所需相依套件
        rpm  -qpR  otrs-3.0.1-01.noarch.rpm

6. 安裝OTRS套件
        yum  install  perl-TimeDate  perl-XML-Parser
        yum  --nogpgcheck  install  otrs-3.0.1-01.noarch.rpm

7. 啟動OTRS相關服務
        /etc/init.d/httpd  restart
        /etc/init.d/mysqld  restart

8. 線上安裝OTRS
http://localhost.localdomain/otrs/installer.pl


















































































9. 啟動OTRS服務
        /etc/init.d/otrs  restart
        http://localhost.localdomain/otrs/index.pl
        帳號:root@localhost
        密碼:root


10. 更新OTRS至3.0.2
        wget  http://ftp.otrs.org/pub/otrs/RPMS/fedora/4/otrs-3.0.2-01.noarch.rpm
        yum  --nogpgcheck  install  otrs-3.0.2-01.noarch.rpm
        /etc/init.d/httpd  restart
        /etc/init.d/mysqld  restart
        http://localhost.localdomain/otrs/index.pl
        帳號:root@localhost
        密碼:root

參考資料:
http://otrs.org/
http://wiki.otrs.org/index.php?title=Installation_of_OTRS_3.0b1_on_CentOS_5.5

2010年11月20日 星期六

自己的酒窖自己管 - MyWineCellar

OS:CentOS 4.8

Requirments:
Apache
php  php-mysql  php-devel
mysql  mysql-server

1. 下載MyWineCellar安裝檔案
wget  http://sourceforge.net/projects/mywinecellar/files/mywinecellar/0.2/mywinecellar-0.2.tar.gz/download

2. 解壓縮,搬移網站檔案至網頁根目錄
tar  -zxvf  mywinecellar-0.2.tar.gz
mv  mywinecellar  /var/www/html/mywine
chown  -R  apache  /var/www/html/mywine

3. 設定開機啟動服務
service  httpd  start: chkconfig  httpd  on
service  mysqld  start: chkconfig mysqld on

4. 建立對應資料庫
mysqladmin  -u  root  password  '管理這密碼'
mysql  -u  root  -p
create  database  wine;
grant  all  on  wine.*  to  root@localhost  identified  by  '資料庫擁有者密碼';
quit

5. 匯入資料庫初始數據
cd  /var/www/html/mywine
vi  wine.mysql
205  order2  smallint(5)  unsigned  NOT  NULL  default  '99',
因為order為SQL語法中的關鍵字所以會出現匯入失敗,之後再將order2轉換回原來order

mysql  -u  root  -p
use  wine;
ALTER TABLE `winedata` CHANGE `ORDER2` `ORDER` SMALLINT( 5 ) UNSIGNED NOT NULL DEFAULT '99';
quit

6. 修改網站組態設定
vi  /var/www/html/mywine/wine.inc
$cfg['db'] = "wine";
$cfg['dbuser'] = "root";
$cfg['dbpass'] = "資料庫擁有者密碼";
$cfg['dbhost'] = "localhost";


7. 完成
http://your server name/mywine

MySQL Web GUI - phpMyAdmin

OS:CentOS 5.5

Requirments:
Apache
php  php-mysql  php-devel  php-mbstring
mysql

1. 安裝相依套件
       yum  install  httpd  php  php-mysql  php-devel  php-mbstring  mysql

2. 開機啟動服務
       service  httpd  start; chkconfig  httpd  on
       service  mysqld start; chkconfig mysqld on
       mysqladmin  -u  root  password  '管理者密碼'

2. 下載phpMyAdmin安裝檔案
wget  http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/2.11.11/phpMyAdmin-2.11.11-all-languages.tar.gz

4. 配置phpMyAdmin設定
       tar  -zxvf  phpMyAdmin-2.11.11-all-languages.tar.gz
       mv  phpMyAdmin-2.11.11-all-languages  /var/www/html/phpadmin
       cd  /var/www/html/phpadmin
       cp  config.sample.inc.php  config.inc.php
       vi  config.inc.php
       /* Authentication type */
       $cfg['Servers'][$i]['auth_type'] = 'http';

5. 瀏覽phpMyAdmin管理介面
       http://your server name/phpadmin
       帳號:資料庫管理者帳號(root)
       密碼:資料庫管理者密碼

FreeRADIUS帳號驗證機制整合(OpenLDAP)

OS:CentOS 5.3


1. 安裝相依套件
        yum  install  freeradius2  freeradius2-utils  freeradius2-ldap

2. 配置RADIUS使用LDAP機制
        vi  /etc/raddb/modules/ldap
server  =  "ldap.bigone.com"  [ldap server位置]
identity  =  "cn=Manager,dc=bigone,dc=com"  [ldap管理者帳號]
password  =  testing  [ldap管理者密碼]
basedn  =  "ou=user,ou=login,dc=bigone,dc=com"  [ldap使用者對應位置]
        vi  /etc/raddb/site-enabled/default
authorize {
...
#       files
ldap
...
        authenticate {
        ...
        Auth-Type LDAP {
        ldap
        }
        ...
}
        

3. 驗證使用者帳號
        radius  -X
        radtest  ldap使用者帳號  ldap使用者密碼  127.0.0.1  0  testing123

FreeRADIUS帳號驗證機制整合(MySQL)

OS:CentOS 5.3

1. 安裝相依套件
        yum  install  freeradius2  freeradius2-mysql  freeradius2-utils  mysql  mysql-server

2. 資料庫設定
        /etc/init.d/mysqld  start
        chkconfig  mysqld  on
        mysqladmin  -u  root  password  '管理者密碼'

3. 建立對應驗證資料庫
        mysql  -u  root  -p
        create  database  radius;
        grant  all  on  radius.*  to  radius@localhost identified  by  'radius';
        exit

4. 建立驗證資料庫資料結構
        mysql  -u  root  -p  radius  <  /etc/raddb/sql/mysql/schema.sql

5. 設定RADIUS使用資料庫驗證
        vi  /etc/raddb/sql.conf
database  =  "mysql"
server  =  "localhost"
login  =  "radius"
password  =  "radius"
radius_db  =  "radius"
        vi  /etc/raddb/radiusd.conf
$INCLUDE  sql.conf
        vi  /etc/raddb/sites-enabled/default
authorize {
...
#       files
sql
...
}
accounting {
...
sql
...
}
post-auth {
...
sql
...
}

6. 建立測試驗證使用者帳號
        mysql -u root -p
        INSERT  INTO  `radius`.`radcheck`  (`id`,  `username`,  `attribute`,  `op`,  `value`)  VALUES  (NULL,  'test',  'Cleartext-Password',  ':=',  'testing');
        exit

7. 驗證使用者帳號
        radius  -X
        radtest  test  testing  127.0.0.1  0  testing123

2010年11月12日 星期五

全文索引開機自動啟動 - IBM OmniFind

之前記錄了使用排程啟動與關閉搜索網站指令,
今天遇到一新狀況,
原來放在"開始"  -->  "所有程式"  -->  "啟動"
裡面的程式需要使用者登入才會執行
今天找到可以手動將執行檔轉變成系統服務進而開機啟動,

1. 下載windows server工具包(WindowsServer2003ResourceKitTools)


2. 將安裝好工具包中的"instsrv.exe"&"srvany.exe"放置同一個資料夾


3. 在步驟二的資料夾中建立batch檔,內容如下
"C:\Program Files\IBM\OmniFindYahooEdition\bin\startup.vbs"


4. 使用工具包程式將batch轉換成系統服務
"C:\Program Files\Windows Resource Kits\Tools\instsrv.exe"  自定服務名稱  "C:\Program Files\Windows Resource Kits\Tools\srvany.exe"


5. 開啟登錄編輯程式
開始 --> 執行 --> regedit
變更路徑至HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\自定服務名稱
"自訂服務名稱" 按滑鼠右鍵新增機碼 "Parameters"
"Parameters" 上按右鍵新增字串值 "Application"
修改 "Application" 字串值為 "步驟三batch檔的檔案路徑"


6. 開機自動啟動服務
"我的電腦" 滑鼠右鍵 "管理" 選擇 "服務"
找到 "自訂服務名稱" 設為自動即可


參考文章:
http://blog.netkoala.idv.tw/2008/09/vmware.html

2010年11月11日 星期四

Captive Portal - CoovaChilli

OS:CentOS 5.5

Requirment:
gcc
openssl  openssl-devel
haserl
coovachilli
freeradius2  freeradius2-utils
iptables

1. 安裝二片網卡
vi  /etc/sysconfig/network-scripts/ifcfg-eth0  [外網卡]
DEVICE=eth0
BOOTPROTO=static
  ONBOOT=yes
  IPADDR=192.168.173.103
  NETMASK=255.255.255.0
  GATEWAY=192.168.173.1
vi  /etc/sysconfig/network-scripts/ifcfg-eth1  [內網卡]
DEVICE=eth1
BOOTPROTO=static
ONBOOT=yes
IPADDR=10.1.0.1
NETMASK=255.255.255.0
GATEWAY=192.168.173.103

2. 安裝相依套件
        yum  install  gcc  openssl  openssl-devel

3. 下載Haserl套件包
        wget  http://sourceforge.net/projects/haserl/files/haserl-devel/0.9.26/haserl-0.9.26.tar.gz/download

4. 解壓縮,編譯安裝
        tar  -zxvf  haserl-0.9.26.tar.gz
        cd  haserl-0.9.26
        ./configure
        make; make  install


5. 下載Coova-Chilli套件包
        cd  ~
        wget  http://ap.coova.org/chilli/coova-chilli-1.2.5.tar.gz

6. 解壓縮,編譯安裝
        tar  -zxvf  coova-chilli-1.2.5.tar.gz
        cd coova-chilli-1.2.5
        ./configure  --enable-miniportal  --with-openssl
        make; make install

7. 建置Coova-Chilli程式執行PID存放目錄
        mkdir  -p  /usr/local/var/run

8. 修改chilli script執行檔
        vi  /usr/local/etc/init.d/chilli
start)
...
$(which  start-stop-daemon  2>/dev/null)
stop)
...
$(which  start-stop-daemon  2>/dev/null)

9. 設定開機啟動chilli
        ln  -s  /usr/local/etc/init.d/chilli  /etc/init.d/chilli
        chkconfig  chilli  on


10. 設定chilli組態檔
        cd  /usr/local/etc/chilli
        cp  defaults  config
        vi  config
        HS_WANIF=eth0   [對外網卡]
        HS_LANIF=eth1   [對內網卡]
        HS_NETWORK=10.1.0.0   [內網網段]
        HS_NETMASK=255.255.255.0   [內網netmask]
        HS_UAMLISTEN=10.1.0.1   [內網卡IP]
        HS_DNS1=168.95.1.1   [指派內往使用DNS]
        HS_RADIUS=localhost   [radius server]
        HS_RADSECRET=testing123   [radius溝通密碼]

11. 設定Chilli主機路由
        yum  install  iptables

12. 設定chilli server的NAT機制,並且開機啟動
vi  /etc/sysctl.conf
net.ipv4.ip_forward  =  1
echo  "1"  >  /proc/sys/net/ipv4/ip_forward
iptables  -t  nat  -A  PREROUTING  -s  10.1.0.0/24  -d  192.168.173.103  -j  ACCEPT
iptables  -t  nat  -A  PREROUTING  -s  192.168.173.103  -d  10.1.0.0/24  -j  ACCEPT
iptables  -t  nat  -A  POSTROUTING  -s  10.1.0.0/24  -d  192.168.173.103  -j  ACCEPT
iptables  -t  nat  -A  POSTROUTING  -s  192.168.173.103  -d  10.1.0.0/24  -j  ACCEPT
iptables  -t  nat  -A  POSTROUTING  -s  10.1.0.0/24  -o  eth0  -j  SNAT  --to-source  192.168.173.103
iptables-save  >  nat_rule
cp  nat_rule  /etc/sysconfig/iptables
      
13. 安裝radius機制驗證
        yum  install  freeradius2  freeradius2-utils

14. 建立使用者,驗證radius機制
        vi  /etc/raddb
        test  Cleartext-Password  :=  "testing"
        radiusd  -X
        radtest  test  testing  127.0.0.1  0  testing123

15. 使用內網主機測試
開啟瀏覽器上網,會自動導到Chiili Captive Portal驗證頁面,輸入radius上建立的帳密即可































參考文章:
http://coova.org/CoovaChilli
http://www.communig8.com/articles/78-coovachilli-test-vm-configuration-part-i-31-august-2010.html
http://www.communig8.com/articles/79-coovachilli-test-vm-configuration-part-ii-1-september-2010.html
http://www.freeradius.org

網路廣播系統 - Campcaster

今天終於完成Campcaster
說起來慚愧自認為Redhat體系的Linux系統,
沒有不可能完成的專案,
這次始終建置失敗,只好依照官網的建議操作。
雖然步驟不多,但還是會忘記記下作備頻。

OS:Ubuntu 9.10

Requirment:
campcaster-libs
campcaster-station
campcaster-studio

1. 網路卡設定
        sudo  vi  /etc/network/interfaces
        auto lo
        iface lo inet loopback
        auto eth0
        iface eth0 inet static
        address 192.168.173.105
        netmask 255.255.255.0
        gateway 192.168.173.1

2. 重啟網路服務
        sudo  /etc/init.d/networking  restart

3. 增加線上安裝套件寶庫位址
        sudo  nano  /etc/apt/sources.list
        deb  http://apt.64studio.com/backports/  karmic-backports  main

4. 安裝新加寶庫的驗證碼
        sudo  apt-get  install  64studio-apt

5. 更新線上安裝套件資料庫
        sudo  apt-get  update

6. 安裝Campcaster相關套件
        sudo  apt-get  install  campcaster-libs  campcaster-station  campcaster-studio

7. 檢查城市是否正常啟動
        sudo  /etc/init.d/campcaster-station  restart
        sudo  /etc/init.d/campcaster-station  status

8. Log In
        http://Campcaster Server Name/campcaster
        帳號:root

2010年11月9日 星期二

MySQL Cluster

參考文章:
http://www.osslab.org.tw/User:Alang/%E8%8D%89%E7%A8%BF%E6%96%87%E4%BB%B6/MySQL_Cluster

Zabbix Alert Mail

OS:CentOS 5.5

1. 設定Zabbix Media Type內容(Email)
"Administration  ->  Media Type"










Description:media type敘述
Type:選擇是哪種media type
SMTP server:mail server 主機名稱(or IP)
SMTP helo:指定localhost主機名稱即可
SMTP email:寄件人信箱


2. 指定Media Type對應使用者帳號
"Administration  ->  Users  ->  Media[Add]"

















Type:使用哪種media type
Send to:收件人信箱
When active:指定什麼時間啟動
Use if severity:指定那些等級監聽
Status:指定啟用或不啟用


3. 指定事件觸發Media Type(Email)
"Configuration  ->  Actions"






















Action:定義Alert Mail內容敘述
Action conditions:定義Alert Mail監控那些事件觸發
Action operations:定義哪的使用者帳號接收Alert Mail


參考文章:
http://www.zabbix.com/forum/showthread.php?t=5645

網管工具 - Zabbix

OS:CentOS 5.5


Requirments:
httpd
php  php-gd  php-bcmath  php-xml  php-mbstring  php-mysql
mysql  mysql-devel
OpenIPMI  
openssh
net-snmp  net-snmp-devel

curl  curl-devel
gcc
zabbix-1.8.3

1.安裝相依套件
        yum  install  httpd  php  php-gd  php-bcmath  php-xml  php-mbstring  php-mysql  mysql  mysql-devel  OpenIPMI  openssh  net-snmp  net-snmp-devel  curl  curl-devel  gcc

2.下載Zabbix Source Code,解壓縮
        tar  -zxvf  zabbix-1.8.3.tar.gz

3.起動相關服務
        service  httpd  start; service  mysqld  start
        chkconfig  httpd  on; chkconfig  mysqld  on

4.設定Zabbix使用資料庫
        mysqladmin  -u  root  password  '管理者密碼'
        mysql  -u  root  -p
        create  database  zabbix  character  set  utf8;
        quit

5.建立Zabbix資料庫內容
        cd  zabbix-1.8.3/create/schema
        mysql  -u  root  -p  zabbix  <  mysql.sql
        cd  ../data
        mysql  -u  root  -p  zabbix  <  data.sql
        mysql  -u  root  -p  zabbix  <  images_mysql.sql

6.編譯Zabbix Source Code
        cd  /root/zabbix-1.8.3
        ./configure  --enable-server  --enable-agent  --with-mysql  --with-net-snmp  -with-libcurl
        make; make  install

7.著名Zabbix服務站用port
        vi  /etc/service
zabbix-agent     10050/tcp   Zabbix Agent
zabbix-agent     10050/udp  Zabbix Agent
zabbix-trapper  10051/tcp    Zabbix Trapper
zabbix-trapper  10051/udp   Zabbix Trapper 

8.修改組態檔
        mkdir  /etc/zabbix
        cp  /root/zabbix-1.8.3/misc/conf/zabbix_agent.conf  /etc/zabbix
vi  /etc/zabbix/zabbix_agent.conf
Server=Zabbix Server IP
        cp  /root/zabbix-1.8.3/misc/conf/zabbix_agentd.conf  /etc/zabbix
vi  /etc/zabbix/zabbix_agentd.conf
LogFile="Zabbix Agentd Log 位置"
Server="Zabbix Server IP"
Hostname="Zabbix Agent Hostname"

        cp  /root/zabbix-1.8.3/misc/conf/zabbix_server.conf  /etc/zabbix
        vi  /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=root
DBPassword=daniel
Timeout=3

9.設定Zabbix開機啟動
        mkdir  /usr/local/zabbix
        cp  /usr/local/sbin/zabbix_agentd  /usr/local/zabbix/bin
        cp  /usr/local/sbin/zabbix_server  /usr/local/zabbix/bin


        cd  /root/zabbix-1.8.3/misc/init.d/redhat/8.0
cp  zabbix_agentd  /etc/init.d/
cp  zabbix_server  /etc/init.d/
        service  zabbix_server  start; service zabbix_agentd start
        chkconfig  zabbix_server  on; chkconfig zabbix_agentd on

10.複製Zabbix網站檔案至網頁根目錄
        mkdir  /var/www/html/zabbix
        cp  /root/zabbix-1.8.3/frontends/php/*  /var/www/html/zabbix

11.安裝Zabbix Web GUI
        http://localhost/zabbix
        依照指示操作(圖形介面)

12.完成,登入(帳號:admin,密碼:zabbix)

參考文章:
http://www.zabbix.com/documentation/1.8/complete#installation

2010年11月7日 星期日

Google網站弱點分析工具 - ratproxy

OS:CentOS 5.3

Requirments:
gcc
openssl
openssl-devel

1. 安裝相依套件
        yum  install  gcc  openssl  openssl-devel

2. 下載ratproxy主程式
        wget  http://ratproxy.googlecode.com/files/ratproxy-1.58.tar.gz

3. 編譯source sode
        tar  -zxvf  ratproxy-1.58.tar.gz
        cd  ratproxy; make

4. 啟動弱點分析機制
        ./ratproxy  -v  <outdir>  -w  <outfile>  -d  <domain>  -P  <host:port>  -lextifscgjmr

5. 將分析的Log檔輸出成html
        ./ratproxy-report.sh  <outdir/outfile>  >  report.html

參考文章:
http://code.google.com/p/ratproxy/
http://knowledge.twisc.ntust.edu.tw/doku.php?id=3%E4%BC%BA%E6%9C%8D%E7%AB%AF%E5%AE%89%E5%85%A8:3-6%E6%AA%A2%E6%B8%AC%E5%B7%A5%E5%85%B7:%E5%8B%95%E6%85%8B%E5%88%86%E6%9E%90:ratproxy
http://blog.miniasp.com/post/2008/07/Google-opens-up-ratproxy-code-to-secure-your-web-environment.aspx

資產管理系統 - tracmor

OS:CentOS 5.3

Requirments:
php 5.2

1. 安裝套件
        yum  install  httpd  php  php-devel  php-mysql  mysql  mysql-server
        service  httpd  start; service  mysqld  start
        mysqladmin  -u  root  password  '管理者密碼'

2. 下載source code
        wget  http://tracmor.googlecode.com/files/tracmor-0.3.0.tar.gz

3. 搬移source code到網頁根目錄底下
        tar  -zxvf  tracmor-0.3.0.tar.gz
        mv tracmor-0.3.0/ /var/www/html/tracmor
        cd  /var/www/html/tracmor

4. 建立網站專用資料庫
        mysql  -u  root  -p
        create database tracmor;
        quit

5. 匯入tracmor  sql  data
        cd  data_model
        mysql  -u  root  -p  tracmor  <  create.sql
        mysql  -u  root  -p  tracmor  <  data.sql

6. 修改網站組態檔
        cd  ../includes
        vi  configuration.inc.php
define ('__DOCROOT__', '/var/www/html/tracmor');
define ('__SUBDIRECTORY__', '/tracmor'); [如果是使用"虛擬主機"的配置,這裡請留白]
define('DB_CONNECTION_1', serialize(array(
               'adapter' => 'MySqli5',
               'server' => 'localhost',
               'port' => null,
               'database' => 'tracmor',
               'username' => 'root',
               'password' => 'daniel',
               'profiling' => false)));

7. 測試
        http://tracmor server IP/tracmor

參考文章
http://www.tracmor.com/
http://code.google.com/p/tracmor/downloads/list
http://www.tracmor.com/forum/topic/13/tracmor-open-source-install/