2011年1月18日 星期二

Ubuntu上安裝Squid Proxy Server

1.開啟終端機,安裝Squid

 

# sudo apt-get install squid

 

2. 備份Squid設定檔,改失敗了可以回復

 

# cp /etc/squid/squid.conf /etc/squid/squid.conf.bak

 

3.修改squid.conf

 

加入visible_hostname

visible_hostname spyker729-desktop

 

加入webmaster 管理者mail

cache_mgr spyker729@gmail.com

 

將去除下列設定 前面的井號

# cache_mem 8 MB

# cache_swap_low 90

# cache_swap_high 95

# maximum_object_size_in_memory 1024 KB (容量自訂)

# ipcache_size 1024

# ipcache_low 90

# ipcache_high 95

# fqdncache_size 1024

 

4.重新啟動Squid

 

# sudo /etc/init.d/squid restart

到這裡即可在瀏覽器使用 proxy,IP為架設機器的 IP,port為3128 (squid.conf可更改)

 

5.加入htpasswd認證,需要照號密碼才能使用proxy

 

更改squid.conf,加入下列命令存檔

77          auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd

570        acl password proxy_auth REQUIRED

571         http_access allow password

 

6.設定帳號密碼

 

# htpasswd –c /etc/squid/passwd 帳號

 

謝謝收看!

2011年1月17日 星期一

用Webmin管理Linux系統

1.安裝webmin

到這裡下載 rpm,tar,deb http://www.webmin.com/download.html

2.安裝成功 (用deb安裝)
Screenshot-gdebi-gtk

3.進入Webmin

瀏覽器上輸入http://YourIP:10000

點選藍色連結

webmin
憑證不用理會它
webmin2
root的帳號密碼為登入帳密
webmin3
登入畫面與語言介面修改
webmin4
webmin5webmin6webmin7
謝謝收看 !

2010年11月20日 星期六

如何在FreeBSD上安裝MySQL?

1.先參考前一篇寫的如何在FreeBSD上安裝Apache+Php?

2.安裝MySQL-Server

# cd /usr/ports/databases/mysql51-server

# make WITH_CHARSET=utf8 WITH_XCHARSET=all

# make install

安裝成功

You already have a group "mysql", so I will use it.

mysql:*:88:88::0:0:MySQL Daemon:/nonexistent:/sbin/nologin

You already have a user "mysql", so I will use it.

************************************************************************

Remember to run mysql_upgrade (with the optional --datadir=<dbdir> flag)

the first time you start the MySQL server after an upgrade from an

earlier version.

************************************************************************

install-info --quiet /usr/local/info/mysql.info /usr/local/info/dir

===> Installing rc.d startup script(s)

===> Compressing manual pages for mysql-server-5.1.33

===> Registering installation for mysql-server-5.1.33

===> SECURITY REPORT:

This port has installed the following files which may act as network

servers and may therefore pose a remote security risk to the system.

/usr/local/libexec/mysqld

This port has installed the following startup scripts which may cause

these network services to be started at boot time.

/usr/local/etc/rc.d/mysql-server

If there are vulnerabilities in these programs there may be a security

risk to the system. FreeBSD makes no guarantee about the security of

ports included in the Ports Collection. Please type 'make deinstall'

to deinstall the port if this is a concern.

For more information, and contact details about the security

status of this software, see the following webpage:

http://www.mysql.com/

2.安裝Php5-MySQL

# cd /usr/ports/databases/php5-mysql

# make

# make install

安裝成功

===> Installing for php5-mysql-5.2.9
===> php5-mysql-5.2.9 depends on file: /usr/local/include/php/main/php.h - found
===> php5-mysql-5.2.9 depends on shared library: mysqlclient.14 - found
===> Generating temporary packing list
===> Checking if databases/php5-mysql already installed
===> Registering installation for php5-mysql-5.2.9
****************************************************************************
The following line has been added to your /usr/local/etc/php/extensions.ini
configuration file to automatically load the installed extension:
extension=mysql.so
****************************************************************************

3.讓開機啟動MySQL

# vi /etc/rc.conf

加入mysql_enable=”yes”

4.匯入資料庫 與 設定MySQL密碼

參考之前的文章

(1) Ubuntu 如何用指令匯出 MySQL 的資料庫?

(2) Ubuntu 裡重新設定 MySQL root 密碼

“FreeBSD 停止/啟動 MySQL服務路徑為 /usr/local/etc/rc.d/mysql-server”

5.安裝phpmyadmin

# cd /usr/ports/databases/phpmyadmin

# make

# make install

"建議去官網下載 並解壓到 /usr/local/www/apache22/data/ 會比較快"

6.測試畫面

MySQLphpmyadmin

如何在FreeBSD上安裝Apache+Php?

FreeBSD Version : 7.2
1.切換成 root 權限
# su
2.安裝 Apache
# cd /usr/ports/www/apache22
# make config (想要什麼功能在這裡選擇 Mysql記得勾選 方便日後升級)
# make
# make install (建議make install分開做)
 
成功安裝訊息
Your hostname must be resolvable using at least 1 mechanism in
/etc/nsswitch typically DNS or /etc/hosts or apache might
have issues starting depending on the modules you are using.
===> Installing rc.d startup script(s)
===> Compressing manual pages for apache-2.2.11_4
===> Running ldconfig
/sbin/ldconfig -m /usr/local/lib
===> Registering installation for apache-2.2.11_4
===> SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/lib/libapr-1.so.3
This port has installed the following startup scripts which may cause
these network services to be started at boot time.
/usr/local/etc/rc.d/apache22
/usr/local/etc/rc.d/htcacheclean
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://httpd.apache.org/
 
3.安裝 Php (php5 & php5-extension)
# cd /usr/ports/lang/php5
# make config (想要什麼功能在這裡選擇)
# make
# make install
 
成功安裝訊息
***************************************************************
Make sure index.php is part of your DirectoryIndex.
You should add the following to your Apache configuration file:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
***************************************************************
===> Compressing manual pages for php5-5.2.9
===> Registering installation for php5-5.2.9
===> SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/apache22/libphp5.so
/usr/local/bin/php
/usr/local/bin/php-cgi
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://www.php.net/
 
# cd /usr/ports/lang/php5-extensions
# make config
# make
# make install
 
成功安裝訊息
===> Returning to build of php5-extensions-1.3
===> Configuring for php5-extensions-1.3
===> Installing for php5-extensions-1.3
===> php5-extensions-1.3 depends on file: /usr/local/include/php/main/php.h - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/bz2.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/ctype.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/dom.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/filter.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/ftp.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/hash.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/iconv.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/json.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/mssql.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/mysql.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/mysqli.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/ncurses.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/odbc.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/pcre.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/pdo.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/pdo_sqlite.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/posix.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/session.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/simplexml.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/snmp.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/sockets.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/spl.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/sqlite.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/tokenizer.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/xml.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/xmlreader.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/xmlwriter.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/zip.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/zlib.so - found
===> Generating temporary packing list
===> Checking if lang/php5-extensions already installed
===> Registering installation for php5-extensions-1.3
 
4.Apache 基本設定
# vi /usr/local/etc/apache22/httpd.conf
 
<IfModule dir_module>
    DirectoryIndex index.html index.php (為了支援php格式)
</IfModule>
 
將下列兩列加到最後一行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
 
5.開機時啟動 Apache
# vi /etc/rc.conf
加入 apache22_enable=”YES”
 
6.測試畫面 (預設目錄在/usr/local/www/apache22/data/)



 

2010年10月30日 星期六

如何更換Ubuntu10.04登入畫面(GDM-Gnome Desktop Manager)

如何讓Ubuntu登入畫面不再是死板板的一成不變?
想與其他人與眾不同 ?

1.移除 gdm-2.30
# sudo apt-get autoremove --purge gdm gdm-guest-session ubuntu-desktop

2.移除gdm.conf
# sudo rm /etc/init.d/gdm.conf

3. 下載 gdm-2.20

4.安裝 (32位元)
# dpkg -i gdm-2.20_2.20.10-0ubuntu3_i386.deb  或是 直接點擊安裝
p.s. 過程中可能會出現 libdmx1錯誤 再輸入下列指令
sudo apt-get install libdmx1 or (sudo apt-get isntall -f 修復)

5.重開機
# reboot (root權限)

6.下載不錯的gdm theme
gnome-look.org

7.設定gdm
# sudo gdmsetup

跳出視窗(之後加入或將資料夾解壓所至 /usr/share/gdm/theme/)


8.重新登入後 (run in virtualbox)

Mac風格



追殺Bill


謝謝收看 !

2010年10月24日 星期日

如何在Ubuntu上編譯Android ?


平台: Ubutnu
Android: 2.1

1.apt-get安裝下列套件
•git-core
•sun-java5-jdk
•bison
•flex
•gperf
•libsd1-dev
•libsd0-dev
•build-essential
•libncurses5-dev
•zlib1g-dev
•curl
•libx11-dev

2.建立資料夾
# mkdir ~/bin(名稱隨意) 

3.安裝repo 
# Curl http://android.git.kernel.org/repo > ~/bin/repo

4.指定eclair
# ~/bin/repo init –u git://android.git.kernel.org/platform –b
eclair

Android 1.5 (Cupcake): Kernel 2.6.27
Android 1.6 (Donut): Kernel 2.6.29
Android 2.0/2.1 (Eclair): Kernel 2.6.29
Android 2.2 (Froyo): Kernel 2.6.32 

5.更新(1.5hr~2hr)
# repo sync  

6.編譯(1.5hr~2hr:雙核)
# make -j 2

7.模擬器上執行畫面 



2010年10月22日 星期五

嵌入式系統開發之道 菜鳥成長日誌與專案經理的私房菜



本書以電子產品開發專案的生命週期為經,嵌入式系統技術與觀念為緯,是一本行文輕鬆流暢卻不失嚴謹的技術書籍。透過 書中專案經理與菜鳥工程師的問答,嵌入式系統開發與專案管理的精神躍然於字裡行間,傳達重要觀念與技巧於無形之中。此種風格在市面眾多資訊參考書籍中極為 少見, 對初學者當可趨緩其學習曲線, 更快抓住重要的觀念與學習的重點。對於想邁入專案管理領域的技術人員,可更了解電子產品開發的生命週期與專案管理的技巧。對已有豐富經驗的專案經理,他山 之石,可以攻錯,本書絕對會帶給你許多改善專案運作的靈感。 ─ 吳錦城‧美國Acopia Networks董事長

這本書真的不錯,未來想從事相關產業的一定要買來讀讀。

2010年10月21日 星期四

如何編譯U-boot

1.先到SourceForge下載U-boot

2.解壓縮
$ tar jxvf u-boot-1.1.6.tar.bz2


3.看Makefile 有無自己的config
$vim Makefile

1870 sbc2410x_config: unconfig
1871         @$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
1872
1873 scb9328_config  :       unconfig
1874         @$(MKCONFIG) $(@:_config=) arm arm920t scb9328 NULL imx
1875
1876 smdk2400_config :       unconfig
1877         @$(MKCONFIG) $(@:_config=) arm arm920t smdk2400 NULL s3c24x0
1878
1879 smdk2410_config :       unconfig
1880         @$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 NULL s3c24x0
1881
1882 SX1_config :            unconfig
1883         @$(MKCONFIG) $(@:_config=) arm arm925t sx1

4.建立config.mk
$ make smdk2410_config
Configuring for smdk2410 board...

5.設定CROSS_COMPILE 路徑
$ vim Makfile

127 ifeq ($(ARCH),arm)
128 CROSS_COMPILE = arm-linux-

127 ifeq ($(ARCH),arm)
128 CROSS_COMPILE = YOURPATH/arm-linux-


5.Compile
$make
.
.
.
 /usr/local/arm/4.0.3/bin/arm-linux-objcopy --gap-fill=0xff -O srec u-boot u-boot.srec
/usr/local/arm/4.0.3/bin/arm-linux-objcopy --gap-fill=0xff -O binary u-boot u-boot.bin

完成後目錄下的u-boot.bin就是編譯好的bootloader

2010年10月14日 星期四

如何編譯 X-Loader ?

步驟一
下載x-loader http://git.igep.es/ 解壓縮

還 有到這裡下載toolchain 之後解壓到你的路徑
http://www.codesourcery.com/sgpp/lite/arm
步驟二
#make omap3530beagle_config

出現
rm -f include/config.h include/config.mk
Configuring for omap3devkit8000 board...

步驟三
#vim Makefile

修改
 55 ifndef CROSS_COMPILE
 56 CROSS_COMPILE = arm-none-linux-gnueabi-
 57 #CROSS_COMPILE = arm-linux-
 58 export  CROSS_COMPILE
 59 endif
成為
 55 ifndef CROSS_COMPILE
 56 CROSS_COMPILE = /{your path}/arm-none-linux-gnueabi-
 57 #CROSS_COMPILE = arm-linux-
 58 export  CROSS_COMPILE
 59 endif


步驟四
#make


reference:
http://focus.ti.com/general/docs/wtbu/wtbusplashcontent.tsp?templateId=6123&contentId=4750

https://gforge.ti.com/gf/project/bootloader/wiki/?pagename=X-Loader

2010年9月22日 星期三

.htaccess網頁認證 保護網頁目錄

作業系統 : Ubuntu 8.04LTS

1.編輯
# vim /etc/apache2/http.conf

將上述資料輸入進去存檔
/var/ww/webftp/ 為要保護的網頁目錄


2.新增.htaccess於/var/www/webftp/
# vim /var/www/webftp/.htaccess 

 
AuthName 為視窗的訊息
Authtype 認證模式
AuthUserFile 密碼檔的路徑(盡量別放在網頁目錄裡)
bohan 為使用者

3. 設定密碼
# htpasswd -c /var/www/.htpasswd bohan


4.畫面(Google瀏覽器)