Welcome to MyBlog_笑著流淚II
歡迎使用非Internet Explorer瀏覽器,欣賞這裡的一切資訊!!
我是武男, 24歲, 大家都叫我阿男...有的人還會叫我白目研究生...
Recover FreeBSD ROOT Password How To
Autor 白目研究生 | 21.09.2007 | Category FreeBSD, 技術文件
本文出處:http://www.real-blog.com/linux-bsd-notes/399
當在 FreeBSD 忘記了 root 密碼時,可以在開機時進入 single user mode 及重新設定密碼,方法如下:
1. 重新開啟 FreeBSD 主機。
2. 在 “Welcome to FreeBSD!” 開啟選單中按 “4″ 選擇 “Boot FreeBSD in single user mode”。
3. 然後會看到 “When prompted Enter full pathname of shell or RETURN for /bin/sh:”,直接按 Enter。
4. 這時便會直接進入 single user mode,輸入以下指令重新掛載根目錄 “/” 為可讀寫:
# mount -u /
# mount -a
5. 用 passwd 重新設定 root 密碼:
# passwd
6. 最後重新啟動即可:
# sync;sync;sync;reboot
phpMyVisites Install Steps How To
Autor 白目研究生 | 28.07.2007 | Category FreeBSD, Windows, 技術文件
說明:
phpMyVisites is a free and powerful open source (GNU/GPL) software for websites statistics and audience measurements.
phpMyVisites gives a lot of information on websites visitors, visited pages, software/hardware utilization, etc… The GUI Interface is fun and practical. The installation is entirely automated and very simple.
Statistics are very complete and use many clear graphics to present data. The web analytics software is translated in more than 30 languages!
語言:支援多國語言,按這裡查看相關資料
官網:http://www.phpmyvisites.us/
版本:phpMyVisites version 2.3 beta 4 !
下載:Download phpmyvisites_2_2.zip
Demo:Here
測試安裝環境:Win XP SP2、Appserv 2.5.8
Install Steps:
將檔案解壓縮至網頁目錄
開啟下面連結,進行安裝設定
http://localhost/phpmv2/index.php?mod=install_welcome
歡迎! 可以先選擇中文語系在進行下面安裝步驟。下一步。
系統需求 會檢查WebServer的環境設定,請盡量修正到全部都是打綠色勾勾。下一步。
資料庫設定 請輸入您的資料庫設定!
若為首次使用者,在繼續以下操作前請記得先用 phpMyAdmin 於 MySQL 伺服器建立一個以 utf8_unicode_ci 為對應編碼的資料庫,資料庫參考名稱如:phpmv。下一步。
建立資料表 資料表被建立。下一步。
如果出現錯誤,請檢查資料庫使用者權限。
一般設定 phpMyVisites 將僅有一個唯一具有完全存取權限可供檢視或變更所有一切的管理員使用者!請為您的超級管理員帳號設定一個使用者名稱及密碼!您可以在稍後增加其他的使用者!
可以透過Mail Server送出統計結果,不過沒有跑Mail Server服務的機器可以省略。下一步。
建立設定檔 建立管理員設定。下一步。
加入第一個網站 請輸入關於第一個網站的所有資訊!下一步。
顯示 Javascript 碼 要能計數所有的訪客量,您必須插入這些 javascript 碼在您所有的網頁中!
您的網頁並不一定要製作成 PHP, phpMyVisites 將可工作於所有種類的網頁 (像是 HTML, ASP, Perl 或是任何其他語言的網頁)。
以下就是您必須插入的 javascript 碼:(複製並貼在您所有的網頁中)。下一步。
安裝完成! 恭喜! 您的 phpMyVisites 安裝設定已經完成!
◎為使繪圖字型能正常顯示,請記得下載字型檔 simsun.ttc:
http://www.phpmyvisites.net/fichiers/simsun.ttc
並將之置於 phpmv2/libs/artichow/font/ 目錄中!如果是透過上面連結下載的檔案,simsun.ttc已經被我壓縮進去對應目錄了。
如果是透過官網下載的話,則必須要按照上面步驟新增或更新字型檔
字型檔的作用在透過GD Library繪圖時會產生不正確的圖表,可透過simsun.ttc修正,讓圖表的資訊輸出是正確的。
請確定您的 javascript 碼已被插入至您的網頁之中,然後就可以坐著等您的第一位訪客來囉!
透過下面連結開啟剛剛架設的phpMyVisites
結論:
介面的統計資料使用起來感覺很像是Google Analytics,但是功能卻沒有那麼的完整。
這個是透過Java Script更新資料記錄的,不過跟我想要記錄來源IP的流量監控程式好像是有那麼一點點的出入。
功能細節,請看Demo
Awstats Install Steps
Autor 白目研究生 | 26.07.2007 | Category FreeBSD, Windows, 技術文件
說明:
AWStats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically. This log analyzer works as a CGI or from command line and shows you all possible information your log contains, in few graphical web pages. It uses a partial information file to be able to process large log files, often and quickly. It can analyze log files from all major server tools like Apache log files (NCSA combined/XLF/ELF log format or common/CLF log format), WebStar, IIS (W3C log format) and a lot of other web, proxy, wap, streaming servers, mail servers and some ftp servers.
Take a look at this comparison table for an idea on features and differences between most famous statistics tools (AWStats, Analog, Webalizer,…).
AWStats is a free software distributed under the GNU General Public License. You can have a look at this license chart to know what you can/can’t do.
As AWStats works from the command line but also as a CGI, it can work with major web hosting provider which allow Perl, CGI and log access.
官網:http://awstats.sourceforge.net/
語言:英文/繁體中文
版本:Last stable version is 6.7 - 2007-07-07 04:05
下載:按這裡下載
測試安裝環境:FreeBSD 6.2 Release
Install Steps:
安裝目錄
cd /usr/ports/www/awstats; make install clean
安裝完成會出現下面字樣,提示修改http.conf
*****************************************************************
Please add the following to your apache config, and restart.#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses “/usr/local/www/awstats/classes/”
Alias /awstatscss “/usr/local/www/awstats/css/”
Alias /awstatsicons “/usr/local/www/awstats/icons/”
ScriptAlias /awstats/ “/usr/local/www/awstats/cgi-bin/”#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory “/usr/local/www/awstats/”>
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>*****************************************************************
If you are upgrading from AWStats 6.4 or older, please note the following:
If you used the geoip plugin, you must edit your AWStats config file
to change the line
LoadPlugin=”geoip GEOIP_STANDARD”
into
LoadPlugin=”geoip GEOIP_STANDARD /pathto/GeoIP.dat”***************************************************
修改http.conf
ee /usr/local/etc/apache2/httpd.conf;
將下面內容加上去
Alias /awstatsclasses “/usr/local/www/awstats/classes/”
Alias /awstatscss “/usr/local/www/awstats/css/”
Alias /awstatsicons “/usr/local/www/awstats/icons/”
ScriptAlias /awstats/ “/usr/local/www/awstats/cgi-bin/”#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory “/usr/local/www/awstats/”>
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>開始設定awstats
cd /usr/local/www/awstats; ./awstats_configure.pl
開始下面提示安裝訊息設定
—– AWStats awstats_configure 1.0 (build 1.6) (c) Laurent Destailleur —–
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
- You are not an administrator user,
- You want to analyze downloaded log files without web server,
- You want to analyze mail or ftp log files instead of web log files,
- You need to analyze load balanced servers log files,
- You want to ‘understand’ all possible ways to use AWStats…
Read the AWStats documentation (docs/index.html).—–> Running OS detected: Linux, BSD or Unix
Warning: AWStats standard directory on Linux OS is ‘/usr/local/awstats’.
If you want to use standard directory, you should first move all content
of AWStats distribution from current directory:
/usr/local/www/awstats
to standard directory:
/usr/local/awstats
And then, run configure.pl from this location.
Do you want to continue setup from this NON standard directory [yN] ? 這裡按Y—–> Check for web server install
Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path (’none’ to skip web server setup):
> 這裡輸入機器Apache的http.conf設定檔位置,程式會自動檢查該路徑有沒有該檔案—–> Check and complete web server config file ‘/usr/local/etc/apache2/httpd.conf’
Add ‘Alias /awstatsclasses “/usr/local/www/awstats/wwwroot/classes/”‘
Add ‘Alias /awstatscss “/usr/local/www/awstats/wwwroot/css/”‘
Add ‘Alias /awstatsicons “/usr/local/www/awstats/wwwroot/icon/”‘
Add ‘ScriptAlias /awstats/ “/usr/local/www/awstats/wwwroot/cgi-bin/”‘
Add ‘<Directory>’ directive
AWStats directives added to Apache config file.—–> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? 是否加入上面參數設定,這裡按Y—–> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
> 輸入設定檔名稱名稱前置字元—–> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
> 這裡按照預設的路徑輸入,什麼出現下面錯誤訊息。—–> Create config file ‘/usr/local/www/awstats/cgi-bin/awstats.210.71.11.167.conf’
Error: Failed to open ‘/usr/local/www/awstats/wwwroot/cgi-bin/awstats.model.conf’ for read.那是因為該路徑找不到awstats.model.conf檔案可以修改,而該檔案所在目錄為/usr/local/www/awstats/cgi-bin
既然程式只讀固定路徑的話,那就按照他讀取的路徑塞檔案給它
mkdir -pv /usr/local/www/awstats/wwwroot/cgi-bin/;
cp /usr/local/www/awstats/cgi-bin/awstats.model.conf /usr/local/www/awstats/wwwroot/cgi-bin/
重跑一次設定,在上一次出的問題點按ENTER讓他跑預設路徑即可
—–> Create config file ‘/etc/awstats/awstats.ip.conf’
Config file /etc/awstats/awstats.ip.conf created.—–> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/www/awstats/wwwroot/cgi-bin/awstats.pl -update -config=ip
Or if you have several config files and prefer having only one command:
/usr/local/www/awstats/tools/awstats_updateall.pl now
Press ENTER to continue…
A SIMPLE config file has been created: /etc/awstats/awstats.ip.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for ‘ip’ with command:
> perl awstats.pl -update -config=ip
You can also read your statistics for ‘ip’ with URL:
> http://localhost/awstats/awstats.pl?config=ipPress ENTER to finish…
完成安裝可以,透過剛剛結束安裝前的路徑連結
http://ip/awstats/awstats.pl?config=ipCrontab加入設定,讓時間內更新數據
ee /etc/crontab;
58 * * * * root /usr/local/www/awstats/cgi-bin/awstats.pl -config=ip
以上IP字樣可以用欲安裝的機器IP或DOMAIN替代
結論:
原本要找偵測網站流量的,可以完整監測IP的。
在腦海中就有Awstats的字眼了,不過一直沒有機會架設。
Awstats的流量統計是透過PERL去分析LOG檔案所產生的報表,當然也可以架設在Winodws的平台上。
不過前提是要先有PERL模組的功能可以應用。
下次會再介紹,類似Google Analytics的流量監測工具。PhpMyVisites
Awstats介面功能請參考下面列表:
統計網站:
localhost
撮要
按參觀時間:
每月記錄
每日
星期幾
每小時
按參觀者:
國家
全部列出
主機
全部列出
最近參觀日期
無法反解譯的IP位址
搜尋引擎網站的漫遊器
全部列出
最近參觀日期
瀏覽器統計:
每次參觀所花時間
檔案類別
存取次數
全部列出
入站處
出站處
作業系統
版本
無法得知
瀏覽器
版本
無法得知
參考資訊:
來源網址
由那些搜尋引擎轉介
由那些其他網站轉介
搜尋
用以搜尋的關鍵字句
用以搜尋的關鍵字詞
其他:
雜項
HTTP 狀態碼
找不到的網頁
Apache20 + Php5 + Php5-Extensions + PEAR + MySQL50 + PhpMyAdmin on FreeBSD How to
Autor 白目研究生 | 23.07.2007 | Category FreeBSD, PHP, 技術文件
參考資料:http://freebsd.ntut.idv.tw/document/apache20_mysql50_php5_pear.html
測試安裝環境:FreeBSD 6.2 Release
透過PortTree安裝套件
#cd /usr/ports/www/apache20; make install clean
安裝PHP5
#cd /usr/ports/lang/php5; make install clean
注意,在make config時請把APACHE選項選取
安裝 php5-extensions延伸套件
#cd /usr/ports/lang/php5-extensions/; make install clean
安裝 PEAR 套件管理指令 ( 這邊只是 PEAR 的套件管理指令,PEAR 的基本套件要等裝完 lynx 才可加裝 )
#cd /usr/ports/devel/pear/; make install clean
安裝 lynx
#cd /usr/ports/www/lynx/; make install clean
安裝Mysql50
#cd /usr/ports/databases/mysql50-server/; make install clean
安裝PhpMyaAmin
#cd /usr/ports/databases/phpmyadmin; make install clean
進階設定
編輯 FreeBSD 的開機設定檔,設定 mysql 及 apache 開機自動啟動
#vi /etc/rc.conf
mysql_enable=”YES”
apache2_enable=”YES”
#vi httpd.conf # 編輯 Apache 的設定檔,讓網頁認識PHP的網頁
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php
如果有安裝PhpMyAdmin的話,要把目錄權限設定加入httpd.conf
Alias /phpmyadmin/ “/usr/local/www/phpMyAdmin/”
<Directory “/usr/local/www/phpMyAdmin/”>
Options none
AllowOverride LimitOrder Deny,Allow
Deny from all
Allow from 127.0.0.1 .example.com
</Directory>
編輯 PHP5 的設定檔將複製 php.ini-dist 到 php.ini
#cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini
如果必須要相容舊語法可將 Off 改為 On
#vi /usr/local/etc/php.ini
register_globals = On
之後重新開機讓全部的服務跑起來
將 pear 的絕對路徑加到 php.ini 設定檔中
#vi /usr/local/etc/php.ini
include_path = “.:/usr/local/share/pear”
安裝 PEAR 的基本套件
#lynx -source http://go-pear.org | php
檢視目前PEAR安裝的套件清單
#pear_old list;
安裝套件並且測試安裝結果:
修改 pear 套件存放目錄權限
#chown -Rf www:www /usr/local/share/pear
修改 pear 套件目錄權限
#chown www:www /usr/local/share
如何安裝套件
#pear_old install Benchmark
查看所安裝的套件目錄
#ls -al /usr/ports/www/lynx/PEAR/Benchmark/;
如果不知道安裝套件的目錄位置,可以用下面指令查詢
#pear_old list-files Benchmark;
檢視Timer.php 這個套件如何引用 Timer 裡面有說明
#vi Timer.php
寫個 php 的時間計數小程式來測試
#vi /usr/local/www/data-dist/show.php
<?php
require_once ‘Benchmark/Timer.php’;
$timer = new Benchmark_Timer();
$timer->start();echo “Hello World!”;
$timer->stop();
$totaltime=$timer->timeElapsed();
echo ”
This Page Show Time:”.$totaltime.”Sec”;
?>
裝其他套件
#pear install PEAR_Info
#vi /usr/local/www/data-dist/info.php
<?php
require_once ‘PEAR/Info.php’;
$pear_info = new PEAR_info();
$pear_info ->show();
?>
解除安裝套件
#pear uninstall Benchmark
查看 pear 指令
#pear help
找到PhpMyAdmin的目錄設定PhpMyAdmin
#cd /usr/local/www/phpMyAdmin;
複製預設的設定值config.inc.php
#cp libraries/config.default.php ..; mv config.default.php config.inc.php
修改config.inc.php內的參數
$cfg['Servers'][$i]['auth_type'] = ‘http’; //設定http驗證方式
$cfg['Servers'][$i]['user'] = ‘root’; // 設定MySQL username
$cfg['Servers'][$i]['password'] = ”; // 設定MySQL password (only neededwith ‘config’ auth_type)
透過下面連結開啟phpMyadmin
http://u’re ip/phpmyadmin/
Webmin Install Steps How To
Autor 白目研究生 | 23.07.2007 | Category FreeBSD, 技術文件
說明:
Webmin is a web-based interface for system administration for Unix. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a system from the console or remotely. See the standard modules page for a list of all the functions built into Webmin, or check out the demo and screenshots.
語言:各國語系,支援繁體中文(Big5/UTF8),不過翻譯的完整性尚待加強
版本:Webmin development version 1.352 released
測試安裝環境:FreeBSD 6.2 Release
下載:Download
Install Steps:
更新PortTree確認要安裝的套件是在維護後的最新版本
#make update
不確定後續PortTree維護會不會換目錄,所以用以下指令搜尋
#whereis webmin
webmin: /usr/ports/sysutils/webmin找到webmin在PortTree的目錄後安裝
#cd /usr/ports/sysutils/webmin; make install clean;
或者是從這裡下載回來的檔案可以透過下面方式安裝
[root@localhost /tmp]# gunzip webmin-1.350.tar.gz
[root@localhost /tmp]# tar xf webmin-1.350.tar
[root@localhost /tmp]# cd webmin-1.350
[root@localhost /tmp/webmin-1.350]# ./setup.sh /usr/local/webmin#make install clean安裝完成後,會出現下面提示訊息
@comment Insert PLIST.lib-webmin here
===================================To reconfigure webmin you should
run the following command as root:${LOCALBASE}/lib/webmin/setup.sh
You won’t have to perform this step
after every webmin upgrade.Since 1.150_2, to run webmin from
startup, add webmin_enable=”YES”
your /etc/rc.conf.===================================
===> Installing rc.d startup script(s)
===> Registering installation for webmin-1.350_1找到${LOCALBASE}/lib/webmin/開始Webmin的初始化設定,會有自動提示協助完成安裝
#cd /usr/local/lib/webmin; ./setup.sh
***********************************************************************
* Welcome to the Webmin setup script, version 1.350 *
***********************************************************************
Webmin is a web-based interface that allows Unix-like operating
systems and common Unix services to be easily administered.Installing Webmin in /usr/local/lib/webmin …
***********************************************************************
Webmin uses separate directories for configuration files and log files.
Unless you want to run multiple versions of Webmin at the same time
you can just accept the defaults.Log file directory [/var/log/webmin]: 存取Webmin相關的Log目錄,預設按ENTER繼續
***********************************************************************
Webmin is written entirely in Perl. Please enter the full path to the
Perl 5 interpreter on your system.Full path to perl (default /usr/bin/perl): 使用到perl程式的路徑,預設按ENTER繼續
Testing Perl …
Perl seems to be installed ok***********************************************************************
Operating system name: FreeBSD
Operating system version: 6.2***********************************************************************
Webmin uses its own password protected web server to provide access
to the administration programs. The setup script needs to know :
- What port to run the web server on. There must not be another
web server already using this port.
- The login name required to access the web server.
- The password required to access the web server.
- If the webserver should use SSL (if your system supports it).
- Whether to start webmin at boot time.Web server port (default 10000):
12345 設定登入Webmin的port number,建議修改,預設10000
Login name (default admin): heaven 設定登入Webmin的帳號,預設admin
Login password: 設定登入Webmin的帳號
Password again: 設定登入Webmin的帳號
Use SSL (y/n): y 是否啟動SSL連線加密
***********************************************************************
Creating web server config files..
..doneCreating access control file..
..doneCreating start and stop scripts..
..doneCopying config files..
..done
Changing ownership and permissions ..
..doneRunning postinstall scripts ..
..done接著設定開機自動啟動Wemin
#vi /etc/rc.conf; webmin_enable=”YES”
或者是直接啟動
#/usr/local/etc/rc.d/webmin start
透過下面連結Server
https://u’re ip:剛剛設定的port number/
結論:
大致上支援下面列表的功能設定,對使用者來說,網頁的設定介面是比較親善的,推薦給Unix like的初心者使用。不過建議基礎的設定要做好,不然安全性會造成很嚴重的影響。
Login: heaven
Webmin
Backup Configuration Files
Usermin設定
Webmin 伺服器索引
Webmin 使用者
Webmin 組態
Webmin動作紀錄
變更語言和佈景主題系統
LDAP Users and Groups
Log File Rotation
MIME Type Programs
Security Sentries
手冊頁
系統紀錄
使用者與群組
定時執行工作 (Cron)
指令排程
執行中的程序
軟體套件
開機與關機
磁碟配額
磁碟與網路檔案系統
檔案系統備份
變更密碼伺服器
Apache 網頁伺服器
BIND 8 DNS 伺服器
CVS伺服器
DHCP 伺服器
Dovecot IMAP/POP3 Server
FTP 伺服器
Fetchmail取信管理
Frox FTP Proxy
Jabber IM Server
Majordomo 郵遞列表管理者
MySQL 資料庫伺服器
OpenSLP Server
Postfix 組態
PostgreSQL資料庫伺服器
ProFTP伺服器
Procmail Mail Filter
QMail Configuration
SSH Server
Samba 視窗檔案分享
Sendmail 組態
SpamAssassin Mail Filter
Squid Analysis Report Generator
Squid 代理伺服器
流量監控
讀取使用者郵件網路
BSD Firewall
Bandwidth Monitoring
IPFilter Firewall
NFS 匯出
PPTP VPN Server
SSL Tunnels
網路組態
網際網路服務與協定硬體
CD燒錄
印表機管理者
系統時間電腦叢集
Cluster Change Passwords
Cluster Copy Files
Cluster Cron Jobs
Cluster Shell Commands
Cluster Usermin Servers
Cluster Users and Groups
Cluster Webmin Servers
Configuration Engine
Heartbeat MonitorOthers
系統和伺服器的狀態
HTTP Tunnel
PHP Configuration
Perl模組
Shell指令
Telnet 登入
上傳和下載
自訂的命令
網站目錄保護
檔案管理者——————————————————————————–
System Information
登出
比較新一點的文章
比較新一點的回覆
- 系統公告-賀
白目研究生: 請問要轉去哪呢?! - 系統公告-賀
沙拉麵: 要幫你轉貼嗎? XD - 武男亂講-Tipping Point SMS live Demo
白目研究生: :O 專業的學長出現了 - 武男亂講-Tipping Point SMS live Demo
ychsiao: 順便一提 那個不能上網是被ips redirect到某個alert... - 武男亂講-Tipping Point SMS live Demo
ychsiao: bt擋的很乾淨 你要把市面上的p2p裝在 vm測試嗎?XDD
