2013年8月22日 星期四

ssh login send env



在使用中文LINUX 系統內建的ssh client 登入其它機器時,client 端自帶的語言參數會讓被登入的機器顯示的語言也受影響。

最明顯的差異就在日期顯示的部份。
可以經由調整 ssh client 的設定來改善這個狀況~~

在 ssh_config 可以看到 SendEnv 指到的參數是 LANG 和  LC_*
這種確認系統環境變數符合的有兩個,後者就是中文了。
-----------------------------------------------------------------------------------------------
root@localhost:/etc# tail /etc/ssh/ssh_config 
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
    #SendEnv LANG LC_*
    SendEnv LANG
    HashKnownHosts yes
    GSSAPIAuthentication yes
    GSSAPIDelegateCredentials no


這時直接把 SendEnv  指向只為英文的環境變數就行了,不用特地再更改系統的語言變數。也可以選擇直接把 SendEnv 標計起來,讓它不要帶任何變數。


root@localhost:/etc# env |grep LC_
LC_ALL=en_US.UTF-8
LC_TIME=zh_TW.UTF-8


root@localhost:/etc# env|grep en_US
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8




-----------------------------------------------------------------------------------------------
## 更改前
-r--r--r--   1 root  root    2386  5月 18  2011 xpair.c
-rw-r--r--   1 root root    2902  5月 19  2011 xpair_xglob_20110519.tar.gz


## 更改後
-r--r--r--   1 root root    2386 May 18  2011 xpair.c
-rw-r--r--   1 root root    2902 May 19  2011 xpair_xglob_20110519.tar.gz



Done




2013年8月15日 星期四

Install Kubuntu 13.04 on notebook FUJITSU SH561


安裝版本使用 Kubuntu 13.04 64-bit.
http://www.kubuntu.org/getkubuntu

- 下載完 ISO 之後,使用 unetbootin 把KUBUNTU 做成 USB安裝碟。
- 插入USB 重新開機,開機時按 F12 指定 boot device , 選USB
- 進入 unetbootin 製做的開機選擇時,選擇 "start kubuntu"
- 一樣是有"試用"和"直接安裝"的選項可以選~~
- 使用直接安裝,就可以開始進行語言、鍵盤、硬碟規畫。
  這邊保留原先windows 的分割,/dev/sda1   /dev/sda2  /dev/sda3  /dev/sda4
  把剩餘的空間分成根目錄、家目錄、SWAP. (重灌時家目錄不用格式化)

--------------
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0062bf5f
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    67110911    33554432   27         Hidden NTFS WinRE/dev/sda2   *    67110912    67520511      204800    7       HPFS/NTFS/exFAT/dev/sda3        67520512   522143743   227311616    7   HPFS/NTFS/exFAT/dev/sda4       522145790   976771071   227312641    5  Extended/dev/sda5       522145792   678393855    78124032   83  Linux/dev/sda6       678395904   879116287   100360192   83 Linux/dev/sda7       879118336   976771071    48826368   82  Linux swap / Solaris--------------

- 之後就等安裝跑完,重開機應該就要可以完成………


** 在重開機的時候出現一個問題,系統抓不到開機磁區。畫面顯示:

error:unknown filesystem
Grub rescue >


這時再次使用安裝USB 開機,當開到unetbootin install 畫面時,按 Ctrl+Alt +F2 切換到tty2
這裡可以有一些基本的shell 可用。

                                
# 確認分割的情況
cat /proc/partitions

# 把原先安裝根目錄的分割掛起來,如果 /boot 有特別切出來的話,這裡就要掛 /boot 的那個分割
sudo mount   /dev/sda5   /mnt

# 使用 grub-install 再把grub 重新裝一次
sudo grub-install --boot-directory=/mnt/boot   /dev/sda

sudo reboot 





Done!





_____________________________________________________________________________________

$ dmesg |grep -i fujitsu
[    0.000000] DMI: FUJITSU LIFEBOOK SH561/FJNB227, BIOS Version 1.06 03/28/2011
[   13.460452] input: Fujitsu FUJ02B1 as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:07/FUJ02B1:00/input/input5
[   13.460527] fujitsu_laptop: ACPI: Fujitsu FUJ02B1 [FJEX] (on)
[   13.460748] input: Fujitsu FUJ02E3 as /devices/LNXSYSTM:00/LNXSYBUS:00/FUJ02E3:00/input/input6
[   13.461329] fujitsu_laptop: ACPI: Fujitsu FUJ02E3 [FEXT] (on)
[   13.461635] fujitsu_laptop: BTNI: [0x10f0101]
[   13.461709] fujitsu_laptop: driver 0.6.0 successfully loaded


$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 13.04
Release:        13.04
Codename:       raring


$ uname -a
Linux XXXXXX 3.8.0-27-generic #40-Ubuntu SMP Tue Jul 9 00:17:05 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux


## 安裝之後就可以有基本的driver 可以驅動獨顯,不過要有比較好的表現,還是要自己另外安裝
$ dpkg-query --list|grep -i nvidia
ii  libkwinnvidiahack4                    4:4.10.5-0ubuntu0.1                  amd64        library used by nvidia cards for the KDE window manager
ii  nvidia-common                         1:0.2.76                             amd64        transitional package for ubuntu-drivers-common

2013年7月20日 星期六

google chrome File System


OS: KUBUNTU 11.10
Chrome vsersion: 28.0.1490.2 dev

在備份家目錄資料時發現的,一個蠻佔空間的目錄。
在網路查到的說明,是google 開放 api 使用的檔案系統,可以用來當網頁或檔案傳輸的BUFFER ? 之類的。
像是最近很紅的檔案空間"MEGA",下載時使用即時的加解密就有使用到google file system 來放解密前的暫存檔。

PS:如果覺得佔位的話,應該是可以把它刪掉(不負責發言^ ^)

$ pwd
/home/USERNAME/.config/google-chrome/Default/File System

$ du -sh *
36K     000
11M     003
675M    004
4.5M    005
24K     Origins


$ file *
00000037: ISO Media, MPEG v4 system, version 1
00000038: ISO Media, MPEG v4 system, version 1
00000039: ISO Media, MPEG v4 system, version 1
00000040: ISO Media, MPEG v4 system, version 1
$ pwd
/home/USERNAME/.config/google-chrome/Default/File System/004/p/00




2013年7月12日 星期五

some file path change on RHEL 6 (1)

部份檔案的位置在 RHEL 6 的時候有了一些轉變,先列出目前遇到的幾個檔案。

/etc/modprobe.conf  
在之前的版本中,寫入 modprobe 參數的位置為 /etc/modprobe.conf
近幾個版本建議把參數改寫在 /etc/modprobe.d/XXXX 底下分類好的檔案中。

[root@local ~]# ll /etc/modprobe.conf
-rw-r--r-- 1 root root 198 Mar  8  2012 /etc/modprobe.conf
[root@local ~]# ll /etc/modprobe.d/
total 32
-rw-r--r-- 1 root root    0 Mar  8  2012 anaconda.conf
-rw-r--r-- 1 root root  833 Oct 12  2010 blacklist-compat
-rw-r--r-- 1 root root  810 Feb 23  2012 blacklist.conf
-rw-r--r-- 1 root root   83 Mar  7  2012 blacklist-firewire

-rw-r--r-- 1 root root 6111 Oct 12  2010 modprobe.conf.dist


在更動 modprobe.d 的資料後,可以執 mkinitrd 把新的設定編譯到之後的 boot image 裡。

mkinitrd -f /boot/initramfs-2.6.32-358.el6.x86_64.XXX.img `uname -r`
## XXX 是跟舊的版本做區隔,把舊的 boot image 留下來之後

在 grub.conf 進行修改,加入新的 boot image 的選項


#boot=/dev/sdb
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Scientific Linux (2.6.32-358.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=UUID=e7351324-1408-496b-915a-3de50c8f4a84 nomodeset rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-358.el6.x86_64.XXX.img
title Scientific Linux (2.6.32-358.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=UUID=e7351324-1408-496b-915a-3de50c8f4a84 nomodeset rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-358.el6.x86_64.img



--
rc.local
記載在 rc.local 的指令,會在開機執行一次~~
rhel 6 被 slink 到 /etc/rc.d/rc.local 


[root@local ~]# ll /etc/rc.local 
lrwxrwxrwx. 1 root root 13 May 15 05:18 /etc/rc.local -> rc.d/rc.local

2013年6月16日 星期日

Promise Vtrak Ex30 storage support ALUA on RHEL 6


- Configure the ALUA option on Promise storage (use WebPAM)

1. Device > Component List > Controller > setting
    Choose the option what's "LUN Affinity" and "ALUA".
2. Distribute the RAID to preferred Controller ID when build up LD (Logical Device) .

- Configure the partition and multipath on OS

1. Check the partition ready on system.
cat /proc/partitions

major minor  #blocks  name

   8        0  488386584 sda
... ...
   8       48 21484373504 sdd
   8       32 21484373504 sdc

2. If not dm-X device , then need to install and start the multipath daemon on the system.
# Install device mapper
yum install device-mapper-multipath -y

# Install Promise alua driver
rpm -ivh scsi_dh_alua_Vtrak-2-1.x86_64.rpm

# Configure multipath.conf
cat /etc/multipath.conf
------------------------------
defaults {
        user_friendly_names yes
}

blacklist {
        devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
        devnode "^(hd|xvd)[b-z][[0-9]*]"
        devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*"
}

devices {
        device {
        vendor                  "Promise"
        product                 "VTrak"
        path_grouping_policy    group_by_prio
        getuid_callout          "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
        prio                    alua
        path_checker            tur
        path_selector           "round-robin 0"
        hardware_handler        "1 alua"
        failback                immediate
        rr_weight               uniform
        rr_min_io               5000
        no_path_retry           queue
        features                "1 queue_if_no_path"
        product_blacklist "VTrak V-LUN"
        }
}
----------------------

# Start the multipath daemon, and add into chkconfig.
/etc/init.d/multipathd start

chkconfig multipathd on

chkconfig --list multipathd
multipathd      0:off   1:off   2:on    3:on    4:on    5:on    6:off

# Confirm the multipath status
multipath -ll -v2
... ...
mpatha (222XXXXXXXXXXXXXX) dm-0 Promise,VTrak E830f
size=20T features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
|-+- policy='round-robin 0' prio=130 status=active
| `- 7:0:0:5 sdc 8:32 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
  `- 8:0:0:5 sdd 8:48 active ready running

- Format file system, and mounting

1. Format to xfs file system.
# need to install xfsprogs on system . sunit dependent on RAID strip size (unit: block size)
yum install xfsprogs -y

mkfs -t xfs -f -d sunit=128,swidth=128 /dev/dm-0

2. Label the partition
xfs_admin -L "test01" /dev/dm-0

3. Edit the fstab to mount.
#Add configuration into /etc/fstab
LABEL="test01"          /test01                 xfs     defaults,sunit=128,swidth=128 0 0

mkdir /test01

mount -a

3. df -h to check the  partition status. Run touch to test the function.
df -h

touch /test01/test.file










Done




--
OS: Scientific Linux  6.4
(base on RHEL 6)

Promise Vtrak support alua on RHEL 5.4 
http://kb.promise.com/KnowledgebaseArticle10261.aspx



2013年5月25日 星期六

disable yum auto update on rhel 6


使用的開發版本為  scientific linux cern  &  scientific linux  ,都是基於 rhel 的開發版。

rhel 6 沒辦法像 5 一樣,使用 chkconfig --list|grep yum 看到的那種 update 來關閉
可以從下面兩個地方來做。讓系統不會在不知情之下,自動被更新。


# 直接把 autoupdate 移除
rpm -qa|grep yum|grep auto
yum-autoupdate-2-5.2.noarch

rpm -e yum-autoupdate-2-5.2.noarch

rpm -qa|grep yum-autoupdate




#或是在  /etc/sysconfig/yum-autoupdate 設定檔裡面加上 ENABLED="false"
sed -i '/ENABLED=/s/true/false/' /etc/sysconfig/yum-autoupdate

cat /etc/sysconfig/yum-autoupdate |grep -B5 'ENABLE'
# This file controls the configuration of yum-autoupdate
# For it to work as expected it should be /etc/sysconfig/yum-autoupdate
# ENABLED
#     true - Run yum-autoupdate
#     false - Do not run yum-autoupdate (default)
#   + anything other than true defaults to false
ENABLED="false"



修改 linux 時區設定



修改 linux 系統所使用的時區:
- 先到 /etc/sysconfig/clock 更改成想要的時區。
- 再從 /usr/share/zoneinfo 裡選擇要使用的時區,把檔案複製到 /etc/localtime (覆蓋原檔案)
- 可以再執行一次對時。已確認時間已校準正確。




date
Sat May 25 06:37:09 UTC 2013

cat /etc/sysconfig/clock
ZONE="UTC"

vim /etc/sysconfig/clock
# 把內容改成  ZONE="Asia/Taipei"

cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime
cp: overwrite `/etc/localtime'? y

ntpdate <time_server>
# 可以使用國內幾個校時的伺服器
        tock.stdtime.gov.tw
 watch.stdtime.gov.tw
 time.stdtime.gov.tw
 clock.stdtime.gov.tw 
 tick.stdtime.gov.tw


date
Sat May 25 14:41:15 CST 2013