Tuesday, June 19, 2012

Modify Linux MAC Address

方法一

使用 ifconfig 指令的 hw class address 參數:
$ /sbin/ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx

其中 xx:xx:xx:xx:xx:xx 為欲使用的 MAC address。

方法二

修改 /etc/sysconfig/network-scripts/ifcfg-eth0 檔案,使用 MACADDR 以增加欲使用的 MAC address:
MACADDR=xx:xx:xx:xx:xx:xx

執行指令:
$ sudo /sbin/ifdown eth0
$ sudo /sbin/ifup eth0
$ sudo /sbin/service network restart

參考資料 Red Hat Enterprise Linux Deployment Guide: 13.2. Interface Configuration Files

HWADDR=MAC-address where MAC-address is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:FF. This directive must be used in machines containing more than one NIC to ensure that the interfaces are assigned the correct device names regardless of the configured load order for each NIC's module. This directive should not be used in conjunction with MACADDR.

MACADDR=MAC-address where MAC-address is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:FF. This directive is used to assign a MAC address to an interface, overriding the one assigned to the physical NIC. This directive should not be used in conjunction with HWADDR.


CentOS 6
/etc/udev/rules.d/70-persistent-net.rules 在開機時判斷 network interface 資訊。


參考資料

Sunday, June 17, 2012

Linux Booting Tips

顯示開機過程的詳細資訊

在 GRUB 選單中,刪除 kernel command line 中的 quiet 和 rhgb。

參考資料 http://blog.nexcess.net/2011/08/22/making-the-centos-6-boot-splash-screen-more-verbose/


互動式開機

在 GRUB 選單中,增加 PROMPT=yes 至 kernel command line。或者新增 confirm,則不需要於出現 interactive startup 詢問時按 i。


Monday, May 7, 2012

Vi Vim text editor

執行 vimdiff 時顯示以下錯誤訊息:
This Vim was not compiled with the diff feature.

安裝 vim-full 套件
$ sudo apt-get install vim-full

Saturday, April 28, 2012

Apache HTTP Server Authentication Access Control

修改 httpd.conf 設定檔,允許 AllowOverride AuthConfig 選項。

於欲限制存取目錄的 .htaccess 檔案新增以下內容。
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /home/doe/public_html/.htpasswd
Require valid-user

新增使用者 jsmith 至已存在的 /home/doe/public_html/.htpasswd 密碼檔:
$ htpasswd /home/doe/public_html/.htpasswd jsmith

若密碼檔不存在,產生新密碼檔(-c 參數) 且新增使用者 jane:
$ htpasswd -c /home/doe/public_html/.htpasswd jane

參考資料



Thursday, April 26, 2012

Microsoft Office versions

新筆記型電腦j通常已經預先安裝 Microsoft Office 2010,需要購買產品金鑰(product key) 以啟用完整功能。若無金鑰,僅能使用 Office Starter 2010。

Office Starter 2010 是 Microsoft Office 2010 的簡易版,僅包括預先載入且非試用版的 Word Starter 2010 與 Excel Starter 2010,但是不包括 PowerPoint 2010 或 Outlook 2010。

Friday, April 20, 2012

QualNet Installation

安裝 QualNet 軟體。

Ubuntu 8.10 (Intrepid Ibex)

安裝 OpenGL drivers 以便使用 QualNet GUI 介面,選擇安裝 NVIDIA binary Xorg driver:
$ sudo apt-get install nvidia-glx-180

重新編譯 QualNet 時,安裝必要編譯套件(build-essential) 以解決 "make: g++: Command not found" 問題,
$ sudo apt-get install build-essential

重新編譯 QualNet 時,安裝 XML parsing C library development kit 以解決 "/usr/bin/ld: cannot find -lexpat" 問題:
$ sudo apt-get install libexpat1-dev
$ yum install expat-devel (若使用 yum 更新)


References

Thursday, March 22, 2012

Ubuntu Linux

使用 Ubuntu Linux 的相關資訊。

查看 Ubuntu Linux 版本資訊
於安裝 Ubuntu 8.10 (Intrepid Ibex) 64-bit PC (AMD64) Server 的機器
$ cat /etc/issue
Ubuntu 8.10 \n \l

$ uname -a
Linux hostname 2.6.27-7-server #1 SMP Fri Oct 24 07:20:47 UTC 2008 x86_64 GNU/Linux

於安裝 Ubuntu 8.10 (Intrepid Ibex) 64-bit PC (AMD64) Desktop 的機器
$ uname -a
Linux hostname 2.6.27-7-generic #1 SMP Fri Oct 24 06:40:41 UTC 2008 x86_64 GNU/Linux

或者使用 lsb_release 指令以顯示 distribution-specific information。
$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 8.10
Release:        8.10
Codename:       intrepid
更新套件

The software repositories configuration file: /etc/apt/sources.list

$ apt-get update

$ apt-get install package

更新舊版 Ubuntu
備份原來的 software repositories configuration file
$ sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

因為舊版 Ubuntu 已經移至 old-releases.ubuntu.com,修改 source.list 檔案
$ sudo sed -i -e 's/tw.archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
$ sudo sed -i -e 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

先使用 update 選項與 /etc/apt/sources.list 中的安裝來源同步化 package index files,然後使用 dist-upgrade 選項(必須先使用 update 選項) 將系統已安裝的 package 升級(即安裝新版 package)。
$ sudo apt-get update && sudo apt-get dist-upgrade
$ sudo apt-get -f install

參考 How do I install packages to an 8.10 system?, http://askubuntu.com/questions/104373/how-do-i-install-packages-to-an-8-10-system

安裝常用套件

安裝 GNU libc manual pages
$ sudo apt-get install manpages-dev


安裝 Desktop 環境於 Ubuntu Server

安裝 Ubuntu (Gnome) desktop
$ sudo apt-get install ubuntu-desktop

或者安裝 Kubuntu (KDE) desktop
$ sudo apt-get install kubuntu-desktop

參考 Add a desktop to an Ubuntu Server, http://ubuntuguide.org/wiki/Ubuntu:All#Add_a_desktop_to_an_Ubuntu_Server

修正 Static IP address 問題 (Ubuntu 8.10)
參考 How to Set a Static IP address in Ubuntu 8.10 (Intrepid Ibex)

References:
RepositoriesUbuntu, https://help.ubuntu.com/community/Repositories/Ubuntu