2010年3月28日 星期日

LAMP安裝設定-UBUNTU

在ubuntu上安裝LAMP非常簡單
1.Synaptic套件管理裡面選擇LAMP sever安裝即可

2.apt-get

安裝後可在/var/www/建立test.php
內容打入:

查看php版本,並檢視有無正常支援
如果一直出現叫你下載
請到/etc/apache2/mods-enabled/ 檢查
php5.conf , php5.load 這兩個檔案有沒存在
若沒有,請下指令
$sudo a2enmod php5
加入
然後重起Apache在測試

2010年2月9日 星期二

HDLM install on RHEL5.2

為了測試MultipathCluster,我準備了以下環境
主機1



Hostname
node1.tedpc.com

IP
10.101.24.182


192.168.0.1

Share Lun
10GB*2(Multipath)
主機2



Hostname
node2.tedpc.com

IP
10.101.24.183


192.168.0.2

Share Lun
10GB*2(Multipath)
Storage

USP100

HDLM6.0 install procedure
1.License Key 改名hdlm_license後放在/var/tmp
#mv license.plk /var/tmp/hdlm_license

2.產生安裝之Key
#mkdir /etc/opt/DynamicLinkManager
#echo "
license-key" >/etc/opt/DynamicLinkManager/dlm.lic_key

3.掛載光碟或ISO
#mount /dev/cdrom /media/cdrom
or
#mount -t iso9660 -t loop HDLM.iso /media/cdrom

4.確認HDLM版本
#/media/cdrom/installhdlm -v

5.安裝HDLM
#/media/cdrom/installhdlm
KAPL09210-I installhdlm will now start.
KAPL09093-I HDLM x.x.x-xx will be installed. Is this OK ? [y/n]: y
Preparing packages for installation...
KAPL09076-I The permanent license was installed.
HDLM-x.x.x.x.xxx-xx
KAPL09043-I The installation of HDLM-x.x.x.x.xxx-xx completed successfully.
KAPL09211-I installhdlm completed successfully.


6.安裝完成,檢查是否安裝成功
#rpm –qi HDLM
Name : HDLM Relocations: (not relocatable)
Version : 6.0.0.1.801 Vendor: Hitachi, Ltd.
Release : 1 Build Date: 西元20080509(週五) 231449
Install Date: 西元20100208(週一) 164636Build Host: inspire.hitachi.co.jp
Group : System Environment/Driver Source RPM: HDLM-6.0.0.1.801-1.src.rpm
Size : 13653222 License: All Rights Reserved. Copyright (C) 2003, 2008, Hitachi, Ltd.
Signature : (none)
Packager : Hitachi, Ltd.
Summary : I/O Path Management Software
Description :
HDLM manages paths between a host and storage subsystem.
HDLM evenly distributes the load across paths and switches to another path if there is a failure in a path being used, thus improving system reliability.

7.載入HDLM alert driver and the filter driver.
#/opt/DynamicLinkManager/bin/dlminsadrv
#modprobe sddlmfdrv

8.執行HDLM設定程式設定LDEV
#/sbin/dlmcfgmgr -r

9.啟動HDLM
#/etc/init.d/DLMManager start

10.增加HDLM環境變數
When the BourneAgain shell or Korn shell is used:
#PATH=$PATH:/opt/DynamicLinkManager/bin ; export PATH
When the C shell is used:
#set path= ( $path /opt/DynamicLinkManager/bin )

11.執行dlnkmgr確認HDLM詳細狀況與設定
# /opt/DynamicLinkManager/bin/dlnkmgr view -sys
HDLM Version : 6.0.0-01
Service Pack Version :
Load Balance : on(rr)
Support Cluster :
Elog Level : 3
Elog File Size (KB) : 9900
Number Of Elog Files : 2
Trace Level : 0
Trace File Size (KB) : 1000
Number Of Trace Files : 4
Path Health Checking : on(30)
Auto Failback : on(1)
Reservation Status :
Intermittent Error Monitor : off
HDLM Manager Ver WakeupTime
Alive 6.0.0-01 2010/02/08 17:10:28
HDLM Alert Driver Ver WakeupTime ElogMem Size
Alive 6.0.0-01 2010/02/08 17:09:17 1000
HDLM Driver Ver WakeupTime
Alive 6.0.0-01 2010/02/08 17:09:40
License Type Expiration
Permanent -
KAPL01001-I The HDLM command completed normally. Operation name = view, completion time = 2010/02/09 15:00:43

firefox調整與加入好用插件

最近在調整firefox與加入插件,作個紀錄以免忘記:

1.about:config
javascript.options.jit.content true (加速)
javascript.options.jit.chrome true (加速)

2.加入好用插件
新同文堂 (繁簡翻譯)
adblock (廣告阻擋)
Xmark (書籤同步)
FireFTP (整合FTP功能)
Download Statusbar (下載管理)
gTranslate (線上翻譯)





2010年1月22日 星期五

RHEL 與 SAN

在Linux上遇到SAN環境時,要如何處理一些常見的問題:

1.OS 版本:
#uname -a
and
#cat /etc/*-release

1.查出HBA廠牌與型號:
#lspci |grep -i fib

2.查出driver版本
Qlogic:
#lsmod |grep -i gla
Emulex:
#lsmod |grep -i lpfc

2.查出所有HBA WWN
#systool -av -c fc_host
or
#cat /sys/class/fc_host/hostX/port_name (一次單張卡,X請自己代入card no.)
#cat /sys/class/fc_host/hostX/node_name

3.不重開機即可scan HBA 上的LUN
#echo "1" > /sys/class/fc_host/hostX/issue_lip (X請自己代入card no.)
#echo "- - -" > /sys/class/scsi_host/hostX/scan

4.File system Check:
#fdisk -l

5.File system Create:
#mkfs -t ext3 /dev/sdX (sdX以fdisk抓到的為準,給錯會消除原有資料,請小心)

6.開機掛載:
#vim /etc/fstab
加入
/dev/sdx /mountpoint ext3 defaults 0 0

**注意:修改fstab的行為可能會造成系統無法開機,請謹慎處理,不要修改到其他參數**

2009年12月25日 星期五

Kickstart 操作

為了玩RHEL5 cluster方便安裝,順便玩了一下kickstart大量佈署方式安裝系統
參考文件:
1.鳥哥網站的網友分享篇裡面彥明大的幾篇文章
2.CentOS官網

設定方式如下:
1.DHCP server (如已有可跳過)
# cp /usr/share/doc/dhcp-3.0pl2/dhcpd.conf.sample /etc/dhcpd.conf
# more /etc/dhcpd.conf 內容如下根據自己需求更改
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 192.168.1.1;
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 192.168.0.128 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;
#/etc/init.d/dhcpd restart
#chkconfig dhcpd on

2.準備install server (建議與DHCP server放一起,可以再建立yum)
可以使用httpftpnfs方式來作,我測試以ftp為主,可以設定帳密來登入:
#yum install vsftpd
#chkconfig vsftpd on
#/etc/init.d/vsftpd restart (預設有開匿名登入,可根據自己需求調整)
#mount -t iso9660 -o loop CentOS.iso /mnt (放光碟或mount ISO)
#mkdir /var/ftp/pub/CentOS (建立資料夾)
#cp -av /mnt/. /var/ftp/pub/CentOS (將安裝資料放到ftp)
#yum install system-config-kickstart (設定kickstart參數的gui)
#system-config-kickstart (設定安裝相關資料)
GUI畫面下設定完成後選file → save 可存成一個自動安奘的文字檔
我的設定如下
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use graphical install
graphical
# Firewall configuration
firewall --enabled --ssh --trust=eth0
# Run the Setup Agent on first boot
#firstboot --enable
# System keyboard
keyboard us
# System language
lang zh_TW.UTF-8
#Language modules to install
langsupport en_US --default=zh_TW.UTF-8
# Installation logging level
logging --level=info
# Use network installation
url --url=ftp://10.101.20.244/pub/mnt
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $1$FZr8YqVs$W4ykp.eMFp97IIkE8xIvn.


# SELinux configuration
selinux --disabled
# System timezone
timezone Asia/Taipei
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --defaultdesktop=GNOME --depth=8 --resolution=800x600 --startxonboot
# Disk partitioning information
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part swap --bytes-per-inode=4096 --fstype="swap" --size=2048
part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1


%packages
@chinese-support
@office
@editors
@text-internet
@gnome-desktop
@dialup
@core
@base
@games
@base-x
@graphics
@printing
@sound-and-video
@graphical-internet
device-mapper-multipath
xorg-x11-server-Xnest
libsane-hpaio
-sysreport
將此檔案跟開機光碟燒在一起,也可以放在ftp

3.安裝:
放入做好之開機光碟,開機
執行:
linux ks=/cdrom
or
(將檔案放在ftp)

這樣應該會自己安裝好嚕

kickstart檔案內容可參考:http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/sysadmin-guide/s1-kickstart2-file.html

2009年12月14日 星期一

Rsync Server建置

我最近幫部門的FTP Server搬家,也順便做了自動化備份,設定流程如下:

一、Server端設定:

1.確定xinet服務有安裝並開機有啟動
  #chkconfig xinet --list

如果找不到表示沒有安裝,則輸入
  #yum install xinet
開機啟用
  #chkconfig xinet on
  #chkconfig rsync on

2.自己建立rsync server config檔
  #vim /etc/rsyncd.conf
 
port = 873            #rsync server啟用的port
#max connections=3
log file = /var/log/rsyncd.log    #放log的位置
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock

[ftpbackup]           #module名稱,極重要,每個Client都有自己的module名稱
uid = root            #用哪個user啟用服務
gid = root
use chroot = no
path = /samba_win      #要跟本機哪個目錄作rsync
comment = BACKUP for FTP
#ignore errors
read only = no          #如果會寫入資料,則不可使用read only
#list = no
auth users = tedpc      #Client登入時帳號,可以非本機帳號
secrets file = /root/rsync.secrets    #帳號的密碼放置位置

3.建立密碼檔,位置可以隨自己放置,但必須與設定檔同一位置
  格式為:username1:password1 (可多組)
        
  #vim /root/rsync.secrets
 tedpc:1qaz2wsx

更改密碼檔權限,最好只有root可以看,確保安全姓
  #chmod 600 /root/rsync.secrets

二、Client 設定
基本上Client只要能使用rsync指令來跑就ok嚕
1.Windows:
基本上可以安裝cwRsync,至於怎樣安裝及設定請自行研究

2.Linux:
基本上裝好應該都有嚕,沒有請打
  RH:
  #yum install rsync
  ubuntu:
  $sudo apt=get install rsync

裝好後請建立密碼檔,只要給密碼就可以嚕
#vim /root/rsync.secrets
1qaz2wsx

#rsync -av --password-file=/root/rsync.secrets /Data/ tedpc@IP::ftpbackup
這樣如果沒有錯誤即可將其配合crontab來使用

參考資料:http://samba.anu.edu.au/rsync/documentation.html

2009年10月9日 星期五

VirtualBox下Guest OS為Linux時分享資料夾使用

我因為使用Linux作為日常使用的OS,常會碰到某些沒有開發在Linux上的程式
只好使用Virtualbox作為變通,不過最近發現當Guest OS為Linux時
分享資料夾不知道要如何使用,後來找到資料說明:
參考:http://ubuntufish.blogspot.com/2008/04/virtualbox.html

* 客端作業系統為Windows時:當你在功能表列上選取裝置→安裝客端額外功能,
他就會開始安裝,直到結束。他就會將相關的虛擬驅動程式安裝完成,定打開主客
間很重要的資料夾分享的功能,可以直接使用網路磁碟機方式連接

* 客端作業系統為Linux時:在功能表列上選取和按下裝置→安裝客端額外功能後,
就會掛載上一個虛擬光碟,然後利用root的權限執行VBoxLinuxAdditions.run,
就會將額外的功能來開啟。而在主客間的資料夾分享功能,在使用手冊上說明
mount -t vboxsf [-o OPTIONS] sharename mountpoint
其中”sharename”是
你自訂分享資料夾的名字,”mountpoint”是在linux裡所要掛載對應的資料夾位置,
例如:
/mnt/share,而在/mnt下的”share”目錄夾,你可要用root的身份去自己建立
,所以你也可以自行去命名,所以自行可用如”sudo
mount -t vboxsf myz /mnt/zd“。

2009年8月20日 星期四

Oracle 11g install in linux

最近剛考過RHCE之後,下個目標便放在Oracle 的OCA嚕

那既然要考OCA,那第一件事便是練習安裝,畢竟有了環境才能練習


第一步先去官網下載檔案
Oracle Database 11g Release 1 (11.1.0.6.0) for Linux x86(需註冊登入)
http://download.oracle.com/otn/linux/oracle11g/linux_x86_11gR1_database.zip


下載好以後不知道要怎麼下手說~
這時只好在請出Google大神加持,在Google中找到下面這個網站說得很清楚

http://cenote.wordpress.com/2008/10/01/%E4%BD%9C%E6%A5%AD2install-oracle-11g-on-linuxfedora-9/

以下節錄上述網站資料





--待續--

2009年8月13日 星期四

讓ubuntu支援4g以上ram

2010/01/19更新 ubuntu9.10安裝好即為PAE版本,故不需在安裝Server版本

現在的ram真的超便宜,所以隨便也可以買到超過4g,可是在32bit的作業系統天生不支援超過3.2g
那要如何讓 Ubuntu OS 支援 4G 以上記憶體?有兩種選擇方式:

選擇一:

大膽前進開始使用 64bit 的 OS,但max試用了以後感覺9.04好像不是太穩....不知是我不會調還是怎的,
常常當機呀,或突然開機Xorg就有問題= =,所以放棄這想法

選擇二:

在ubuntu 32bit 下,可安裝有開啟 PAE ( Physical Address Extension ) 的 Kernel
一般 Linux Server 版本的 OS 都有支援,只介紹ubuntu的安裝方式,其安裝方式如下:

$ sudo apt-get update
$ sudo sudo apt-get install linux-headers-server linux-image-server linux-server
$ sudo reboot

Reference:

http://www.cyberciti.biz/faq/ubuntu-linux-4gb-ram-limitation-solution/

2009年8月6日 星期四

Linux 常用指令

1.find:
<1.>find /etc -type d
#找出/etc底下所有的子目錄
<2.>find /etc/ -type d -exec chmod 664 {} \;
#找出後丟給後面指令處理
<3.>find /etc -name marcus
#在/etc找出名為marcus的檔案

2.rsync:
<1.>rsync -av /etc/passwd .
#基本用法與cp一樣,也可以目錄對拷,差別在於rsync會檢查兩個目錄檔案有無一樣,一致的話就不做拷貝
<2.>rsync -av marcus@192.168.1.1:/tmp/. .
#將遠端主機/tmp下的所有檔案copy到現在目錄

3.cut:
<1.>ifconfig -a | grep A1 eth0 | cut -d ' ' -f 1,3
#將ifconfig中與eth0相關資訊(兩行)秀出,並以空格為條件分隔後秀出第一與第三欄

4.tr:
<1.>tr -d '\n'
#將兩行文字合併為同一行
<2.>tr -s ' '
#將多個'空格'合併為一個




待續