[Linux] CentOS 6.x / 7.x change Hostname

{Centos 6.x}
step01. check current hostname
# hostname

step02.
# vi /etc/sysconfig/network
———modify———
HOSTNAME=改成你要的主機名稱
———modify———

step03.
# vi /etc/hosts
———modify———
* IP FQDN Hostname *
192.168.1.1  www1.dns.com.tw www1
———modify———

step04.
# service network restart 或 sync;sync;sync;shutdown -r now , init 6

Done.

{Centos 7.x}
step01. check current hostname
# hostname

step02. 永久的名稱
# hostnamectl –static set-hostname www1.dns.com.tw

若暫時等同用CentOS 6.x > hostname www1.dns.com.tw)
# hostnamectl –transient set-hostname www1.dns.com.tw

—-hostnamectl 三個模式—
-static        靜態
–transient 短暫
–pretty       機靈

step03.
systemctl restart network.service  或 sync;sync;sync;reboot , init 6
** Check **
# cat /proc/sys/kernal/hostname
# hostname
# hostname -f  (查詢 FQDN)
# hostname -i  (查詢主機對應IP)
# hostname -I  (查詢主機對應所有IP)

**Caution**
若只用指令hostname來變更CentOS 6.x僅是暫改,若重開機還是會回復原先主機名稱 !

[Linux] How to get Your Public IP Address

# curl ipinfo.io/ip

# curl ifconfig.co

# curl ifconfig.me

# curl icanhazip.com

# curl ipecho.net/plain;echo

# wget -qO- http://ipecho.net/plain | xargs echo

# wget -qO- http://ipecho.net/plain ; echo

# wget -qO – icanhazip.com

# hostname -I


 

Reference :
tecadmin.net – 5 Commands to Get Public IP using Linux Terminal

[Lenovo] LXCA忘記本機帳號密碼 ?

客戶反應當時設定預設帳號 ‘ admin ‘忘記了密碼,因Lenovo XClarity Administrator後台Linux是沒有預設帳密所以無法由後台來重置密碼 .

Solution :
(sample account > admin )
在重置密碼前要確認原這帳號是否有歸屬lxc-recoverylxc-supervisor 角色群組。
** 建議在安裝後LXCA立即將該帳號歸屬lxc-recovery & lxc-supervisor group **

step01. Graceful shutdown LXCA VM

step02. 編輯個文檔檔名叫 " passwordreset.properties "
#vi /tmp/passwordreset.properties
——————-內容——————-
user=admin
password=PASSW0RD
——————-內容——————-

step03. 將該檔案’passwordreset.properties’作成ISO檔。
~Windows
可用像UltraISO或Imgburn製作

~Linux
# mkisofs -V passreset -J -o /tmp/passreset.iso /tmp/passwordreset.properties

step04. 上傳到ESXi datastore 或 Hyper-V Library

step05. 掛載passreset.iso

step06. 開機LXCA過程它會讀取這個檔案即可重置 admin這帳號密碼變為我們所設定"PASSW0RD"

step07. http://lxca-ip-address/ui/index.html 若登入沒問題即立即變更密碼唄!

step08. 退出passreset.iso

Done


Reference :

Lenovo XClarity Administrator > Troubleshooting > Security issues > Password for a local recovery or supervisor user is forgotten

[VMware] Automatic Install VMware-Tools like unattached mode

若在作LAB是Linux environment時,除了template virtual machine  或 .ova/ovf 檔案匯入;安裝Linux後免不了要手動安裝vmware-tools.pl 一直按enter什麼都不想改是可以安裝完畢。但懶人法解開VMwareTools-x.x.x-xxxxxxx.tar.gz後執行

# ./vmware-install.pl -d default


 

Reference :
1. virtuallyGhetto – Automating silent installation of VMware Tools on Linux w/Automatic Kernel Modules

[Linux] RHEL / CentOS 6.x use Bonding(Teaming) NICs

step01. bonding module is not loaded by default
# modprobe –first-time bonding

step02. check
# lsmod | grep -i bond
# modinfo bonding

step03. Check the available interfaces on the server
# ip addrifconfig -a (e.g. I want to use eth0 & eth1)

step04. Shutdown interface
# ifdown eth0 && ifdown && eth1

step05. Configure a channel bonding interface
** eth0 **
vi /etc/sysconfig/network-scripts/ifcfg-eth0
——————————————————————
NAME=bond0-slave0
DEVICE=eth0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
NM_CONTROLLED=no
——————————————————————

** eth1 **
vi /etc/sysconfig/network-scripts/ifcfg-eth1
——————————————————————
NAME=bond0-slave1
DEVICE=eth1
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
NM_CONTROLLED=no
——————————————————————

** bond0 **
vi /etc/sysconfig/network-scripts/ifcfg-bond0
——————————————————————
NAME=bond0
DEVICE=bond0
BONDING_MASTER=yes
TYPE=Bond
IPADDR=xx.xx.xx.xx
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
BONDING_OPTS="mode=active-backup miimon=100″
NM_CONTROLLED=no
——————————————————————

step06. create bond.conf
# vi /etc/modprobe.d/bond.conf
——————————————————————
alias bond0 bonding
——————————————————————

step07. Restart Network service
# service network restart

step08. up interface
# ifup eth0 && ifup eth1
# ifup bond0

step09.
# cat /proc/net/bonding/bond0

 

 

 

Reference :

  1. Red Hat Enterprise Linux 6 > Deployment Guide > 11.2.4. Channel Bonding Interfaces

[HDS] Compute Blade 500 ‘LPAR’ install RHEL6.7

*Pre-check*
1.what is ur CB500 blade mode ? e.g. CB 520H B3
2.what is ur wnat to install RHEL version ? e.g. RHEL 6.7 x86_64
3.use Physical or LPAR ?

*Pre-require*
CB500_520Hx3_Driver_Utility_for_RHEL6_v0670-01.iso // 後面 v0{xx}即代表該符合RHEL版本,若是符合RHEL 6.9會顯示 v0690-01.iso
CB500_hfc_drivers_cd_0429.iso ( need extract dd.iso )

*Notes*
1. CB 520X B1/B2 and CB 520H B3 can boot only on EFI.
2. CB 520H B3 @ CB500 chassis 需符合FW
> MM : 至少 A023
> LPAR Manager  至少 02-05

*Tips*
IP address of management module : 192.168.0.1 ; https://192.168.0.1
Factory default account / password : administrator / password
following LPAR configuration is recommended :
|-CPU : 2 or more
|-MEM: 2GB or Large
|-Disk: 40GB or Large capacity
|-NIC: 1 or more

*Installation RHEL 6.7*

step01.
extract CB500_hfc_drivers_cd_0429.iso (Fibre Channel driver) 裡頭 hfc_media\linux\x86_64\rhel6\cd_media放置各版本6.x hfc dd.iso ; 因我目標是RHEL6.7所以拷貝 2.6.32-573.el6裡頭dd.iso匯出
hfc-0429-dd.jpg

step02.
vKVM mount media ‘RHEL6.7 x86_64.iso’

step03.
一開始安裝畫面選擇第二項 “Install system with basic video driver" then press ‘Tab’ key

step04.
add ‘ dd blacklist=isci ‘ ,then press ‘b‘ boot in

step05.
The message, Do you have a driver disk? click  “Yes" ; 此時將原RHEL6.7 ISO unmount ,change 2.6.32-573.el6-dd.iso

step06.
choice media /sr0 , then click ‘OK’

step07.
The message “Do you wish to load any more driver disks ?" > clock “No" ;載入HBA driver後系統會自動umount dd.iso ,所以再手動掛入RHEL 6.7 ISO

step08.
HDD custom use LVM 或 traditional extended partition 都OK

step09.
自訂安裝項目什麼都可以裝,唯獨有二個千萬別裝 (PS: CB 520H B3環境)
~ System Management > System Management > Optional packages >
freeipmi-bmc-watchdog-x.x.x-x.xx.xx
~ Base System > Base > tboot-x.xxx.el6.x86_64.rpm

step10.
Finsih install , reboot

step11.
Boot menu , Press E key ; Delete “intel_iommu=on" and “amd_iommu=on" from the boot option,and press Enter.

step12.
enter OS , config boot menu
> vi /boot/efi/EFI/redhat/grub.conf
" intel_iommu=on" // delete
" amd_iommu=on" // delete
" nmi_watchdog=0 pci=noaer " add
" terminal –timeout=10 serial console " // add
" quiet rhgb " // delete from the kernel line
" nmi_watchdog=0 mce=0 pci=noaer no_timer_check console=ttyS1,115200 " // add the ending of the Kernel line
" vga=792 " // add ,LPAR Manager version 至少 01-60
" kernel /tboot.gz logging=vga,serial,memory " // comment out
Change the first “module" to “kernel" in the line starting with “module /initramfs"
Disable TCP checksum offload function
> ethtool -k eth{x} // 顯示目前網卡各功能狀態
> ethtool -K eth{x} rx off tx off

Do not use NetworkManager service
> service NetworkManager stop
> chkconfig NetworkManager off
> chkconfig | grep NetworkManager // 再次確認

Customizing /etc/sysctl.conf

== Validate the magic SysRq key to collect information when a problem
occurs. Edit or add the following line. ==
kernel.sysrq = 1

== Add a setting to induce kernel panic when NMI occurs, with which you can
quickly detect a failure in hardware and drivers ==
kernel.unknown_nmi_panic = 0
kernel.panic_on_unrecovered_nmi = 1
kernel.panic_on_io_nmi = 1

==  Add or edit the following line to set the console log level to 3. By changing
the level, you can avoid the console overload, which can result in
significant deterioration of applications or in Linux hang-up ==
kernel.printk = 3 4 1 7

Updating Drivers
# modinfo driver name

//etc/inittab /


 

Reference:

1. Red Hat Enterprise Linux Release Dates

2. Hitachi Compute Blade 500 Series OS Installation Guide for Red Hat Enterprise Linux

[Linux] RHEL6 install Hitachi multipath ‘HDLM’

step01. 準備好 HDLM Linux License *.plk ; 可以查看確認該檔文字內容有無 for Linux ,若沒有可不是隨便將for Windows 改為 for Linux就可以用唷!

step02. 更名License KEY改為或複製成hdlm_license
# mv “HDS VSP GXXX SNXXXXXX DXXX XXXXXXXXXXXX".plk /var/tmp/hdlm_license

step03.  放入 HDLM CD-ROM

step04. 掛載HDLM光碟
# mount -t iso9660 /dev/cdrom /media
Or
# mount /dev/cdrom /media

step05. check HDLM version
# /media/HDLM_Linux/installhdlm -v

step06. 安裝HDLM
# /media/HDLM_Linux/installhdlm
—————————————————–
KAPL09210-I installhdlm will now start.
KAPL09093-I HDLM 8.5.1-00 will be installed. Is this OK ? [y/n]: y
Preparing packages for installation…
KAPL09076-I The permanent license was installed.
HDLM-8.5.1.0.808-4
KAPL09043-I The installation of HDLM-8.5.1.0.808-4 completed successfully.
KAPL09211-I installhdlm completed successfully.
—————————————————–

step07. 檢查HDLM已安裝
# rpm -qa | grep -i hdlm

step08. 詳看HDLM資訊
# rpm -qi HDLM

step09. 若未重開機啟動
# /opt/DynamicLinkManager/bin/dlmstart
# /etc/init.d/DLMManager start

step10. 加入HDLM環境變數 > /opt/DynamicLinkManager/bin
[BourneAgain shell ]
# PATH=$PATH:/opt/DynamicLinkManager/bin ; export PATH

[C shell]
# set path= ( $path /opt/DynamicLinkManager/bin )

step11. 若未重啟系統請立即重啟一次
# shutdown -r now
Or
# init 6

step12. 查看dlnkmgr運作狀態及設定,版本,Load Balance模式,自動容錯切換狀態(aft),硬碟
# /opt/DynamicLinkManager/bin/dlnkmgr view -sys
我大多會注意三項資訊及狀態 > { Load Balance , Path Health Checking , Auto Failback )

HDLM-view-sys.png# /opt/DynamicLinkManager/bin/dlnkmgr view -lu
# /opt/DynamicLinkManager/bin/dlnkmgr view -path
# /opt/DynamicLinkManager/bin/dlnkmgr view -drv

Done.

–Maintenance–

**啟用Load Balance及變更模式為Round-Robin**
# /opt/DynamicLinkManager/bin/dlnkmgr set -lb on -lbtype rr
(模式如下)
rr       >for the Round Robin algorithm
exrr   >for the Extended Round Robin algorithm
lio      >for the Least I/Os algorithm
exlio  >for the Extended Least I/Os algorithm
lbk     >for the Least Blocks. algorithm
exlbk >for the Extended Least Blocks algorithm

**啟用及變更Path Health Checking及間隔時間**
# /opt/DynamicLinkManager/bin/dlnkmgr set -pchk on -intvl 10

**啟用Automatic Failback及間隔時間**
# /opt/DynamicLinkManager/bin/dlnkmgr set -afb on -intvl 10 (預設是關閉)

**查詢HDLM指令用法**
# /opt/DynamicLinkManager/bin/dlnkmgr help view


Reference :

1. Eddynurh’s Weblog – HDLM Installation

2. 馬克思 Linux學習筆記 – HDLM install on RHEL5.2

3. (原廠) Hitachi Command Suite – Dynamic Link Manager(for Linux®) User Guide

4. 杨红1989 – LINUX 安装HDS HDML报错