RSS구독하기:SUBSCRIBE TO RSS FEED
즐겨찾기추가:ADD FAVORITE
글쓰기:POST
관리자:ADMINISTRATOR

last modified by Imogen Flood-Murphy on 01/05/12 - 07:45

Issue

A Red Hat Enterprise Linux server which is not connected to the Internet, needs to be updated, and has no access to a RHN Satellite or Proxy server.

Resolution

There is a server which is offline and doesn't have any connection to the Internet.

Then we need station (or laptop / virtual machine), which has the same major Red Hat Enterprise Linux version as server and is connected to the Red Hat Network/Proxy/Satellite.

  • Copy the /var/lib/rpm to the station connected to the Internet (you can use USB/CD…)

    scp -r /var/lib/rpm root@station:/tmp/
    
  • Install the download only plugin for yum and createrepo on the machine which is connected to the Internet (Red Hat Network):

    yum install yum-downloadonly createrepo
    yum clean all
    
  • Backup the original rpm directory on the station and replace it with the rpm directory from the "offline" server:

    mv -v /var/lib/rpm /var/lib/rpm.orig
    mv -v /tmp/rpm /var/lib/
    
  • Download updates to /tmp/rpm_updates and return back the /var/lib/rpm

    mkdir -v /tmp/rpm_updates
    yum update --downloadonly --downloaddir /tmp/rpm_updates
    createrepo /tmp/rpm_updates
    rm -rvf /var/lib/rpm
    mv -v /var/lib/rpm.orig /var/lib/rpm
    
  • Transfer the downloaded rpms to the server and update:

    scp -r /tmp/rpm_updates root@server:/tmp/
    ssh root@server
    
    cat > /etc/yum.repos.d/rhel-offline-updates.repo << \EOF
    [rhel-offline-updates]
    name=Red Hat Enterprise Linux $releasever - $basearch - Offline Updates Repository
    baseurl=file:///tmp/rpm_updates
    enabled=1
    EOF
    
    yum upgrade
    

…and the server is updated.

These updates are the same as if "yum update" had been executed on a station that had a connection to the Internet.

Trackback
Reply
본딩을 일일히 구성하는게 귀찮아진 나머지 스크립트를 짜려다, 혹시나 해서 검색해보니 좋은 스크립트가 있어서 소개!
출처는 맨 아래 적어놓았으며, 약간의 수정을 했다^^




#!/bin/sh
# This script creates bonding interfaces on RHEL 5.
#
# The first and second parameters are used to specify the enslaved interfaces.
# The third parameter is used to describe the name of the bonding interface.
# The network configuration is collected from the first device.
# After running the script please verify the/etc/modprobe.conf file as well as
# all/etc/sysconfig/network-scripts/ifcfg* files!
#
# LICENSE INFORMATION
#
# This software is released under the BSD license:
#
# Copyright 2010 Reiner Rottmann reiner[at]rottmann.it. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list
# of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this
# list of conditions and the following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# 3. The name of the author may not be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Global variables

SCRIPTNAME=$(basename $0 .sh)

EXIT_SUCCESS=0
EXIT_FAILED=1
EXIT_ERROR=2
EXIT_BUG=10

VERSION="1.0.0"

# Base functions

# This function displays the basic usage
function usage {
echo "Usage: $SCRIPTNAME <first slave interface> <second slave interface> <bonding interface> <ipaddress> <netmask> <gateway>" >&2
echo "This script bonds two network interfaces on RHEL 5 with the static network config from the first slave interface." >&2
echo >&2
echo "e.g. # ./$SCRIPTNAME eth1 eth3 bond1 192.168.5.250 255.255.255.0 192.168.5.1" >&2
echo >&2
[[ $# -eq 1 ]] && exit $1 || exit $EXIT_FAILED
}

# This function checks that the command is run with the right parameters
function preflightcheck {

# This script needs to be run as root.
if [ $(id -u) -ne 0 ]; then
echo "You need to be root to run this script."
exit $EXIT_FAILED
fi

# Check if we have exactly 3 commandline parameters.

if [ $# -ne 6 ]; then
echo "Commandline parameter is missing. (only $# present)."
usage
exit $EXIT_FAILED
fi

# Check if the first input is correct.
if ! echo $1|grep -q "^eth[0-9]$"; then
echo "The first parameter needs to be an ethernet device (e.g. eth1)."
usage
exit $EXIT_FAILED
fi

# Check if the second input is correct.
if ! echo $2|grep -q "^eth[0-9]$"; then
echo "The second parameter needs to be an ethernet device (e.g. eth3)."
usage
exit $EXIT_FAILED
fi

# Check if the third input is correct.
if ! echo $3|grep -q "^bond[0-9]$"; then
echo "The third parameter needs to be a bonding device (e.g. bond3)."
usage
exit $EXIT_FAILED
fi
}

# The main function that creates the bonding devices.
function rh5mkbond {

# Load the bonding kernel module with active-backup mode and set mii link monitoring to 100 ms.
cp /etc/modprobe.conf /tmp/modprobe.conf.bonding
cat >> /tmp/modprobe.conf.bonding <<EOF
alias $3 bonding
EOF
cat /tmp/modprobe.conf.bonding|uniq > /etc/modprobe.conf


# Get interface details
#IP=$(/sbin/ifconfig $1|egrep -o "([0-9]{1,3}\.){3}[0-9]{1,3}"|sed -n "1p")
#NETMASK=$(/sbin/ifconfig $1|egrep -o "([0-9]{1,3}\.){3}[0-9]{1,3}"|sed -n "3p")
MACIF1=$(/sbin/ifconfig $1|egrep -o "([[:xdigit:]]{2}[:]){5}[[:xdigit:]]{2}")
MACIF2=$(/sbin/ifconfig $2|egrep -o "([[:xdigit:]]{2}[:]){5}[[:xdigit:]]{2}")


# Create the bond0 device file.
mv /etc/sysconfig/network-scripts/ifcfg-$3 /etc/sysconfig/network-scripts/ifcfg-$3.orig  2>/dev/null
cat >> /etc/sysconfig/network-scripts/ifcfg-$3 <<BOND
DEVICE=$3
BOOTPROTO=none
IPADDR=$4
NETMASK=$5
GATEWAY=$6
USERCTL=no
BONDING_OPTS="mode=0 miimon=100"
BOND


# Create the slave device files.
for i in $1 $2
do
mv  /etc/sysconfig/network-scripts/ifcfg-$i  /etc/sysconfig/network-scripts/ifcfg-$i.orig 2>/dev/null
cat >> /etc/sysconfig/network-scripts/ifcfg-$i <<IFS
DEVICE=$i
BOOTPROTO=none
HWADDR=$(/sbin/ifconfig $i|egrep -o "([[:xdigit:]]{2}[:]){5}[[:xdigit:]]{2}")
ONBOOT=yes
MASTER=$3
SLAVE=yes
USERCTL=no
IFS
done

}

# Call functions
preflightcheck $1 $2 $3 $4 $5 $6
rh5mkbond $1 $2 $3 $4 $5 $6

# End script

exit $EXIT_SUCCESS
Trackback
Reply

1. kdump?

kdump 는 커널 crash 가 일어났을 때 메모리 덤프를 해주는 역할로 구 버전의 diskdump netdump kexec kdump로 대체되었습니다. kdump에서는 raw device, disk partition, nfs, ssh 등을 지원합니다.

 

2. kexec / kdump

1) kexec 의 역할

 kexec는 새로운 커널이 BIOS를 통하지 않고 재부팅이 될 수 있게 해 줍니다. kexec는 부팅시에 메모리에(RAM)에 상주하게 되며 패닉(panic) 발생 시 현재 커널을 정지 시키고 새로운 커널(dump용 커널)을 동작시키는 역할을 합니다.

 

2) kdump의 역할

 /etc/kdump.conf 환경설정 파일을 가지고 있으며, 서버의 panic 상황을 지켜보는 역할을 합니다.

 

3. dump 생성 작동 단계

1) 시스템 패닉 발생.(System panics)

2) kdump 커널로 부팅

3) kdump initramfs 로딩 및 init 작동

4) /etc/kdump.conf에 덤프 타켓이 설정되어 있는지 확인( 5, 아니오 9)

5) /etc/kdump.conf설정에 따라 capture dump

6) capture가 정상적으로 완료 되었는지 확인 ( 12, 아니오 7)

7) /etc/kdump.conf 설정 중 default_action halt 일 경우 ( 14, 아니오 8)

8) /etc/kdump.conf 설정 중 default_action reboot 일 경우 ( 12, 아니오 9)

9) root filesystem을 마운트 한 뒤, pivot_root(change root file system), /sbin/init 진행

10) kdump 서비스 시작

11) capture core CP/proc/vmcore /var/crash/<host-addr>-<date>/vmcore로 진행

12) 재부팅

13) shell drop

14) 시스템 다운(정지)

 

kdump가 설정되면, 패닉 발생 시 덤프를 뜨기 위한 비상용 커널이 미리 메모리에 올라가 있다가, 패닉 발생시 해당 비상 커널로 제어권이 넘어가고(실제로는 특수한 형태의 재부팅이 이루어집니다) 물리메모리(Raw memory)를 읽어 저장하게 됩니다.

 

4. kdump 설정법

1) /etc/kdump.conf

#raw /dev/sda5

#ext3 /dev/sda3

#ext3 LABEL=/boot

#ext3 UUID=03138356-5e61-4ab3-b58e-27507ac41937

#net my.server.com:/export/tmp

#net user@my.server.com

#path /var/crash

#core_collector makedumpfile -c --message-level 1

#link_delay 60

#kdump_post /var/crash/scripts/kdump-post.sh

#extra_bins /usr/bin/lftp

#extra_modules gfs2

#options modulename options

#default shell

 

옵션 설명

1) raw device dump 받기

raw <devicename>

 

2) disk dump 받기

     ext3 <devicename>

     ext3 LABEL=라벨명

     ext3 UUID=f15759be-89d4-46c4-9e1d-1b67e5b5da82

 

생성 디렉토리를 변경

path /원하는 디렉토리명

 

3) NETWORK를 통한 dump file 생성

     NFS설정

net <nfs server>:</nfs/mount>

 

     SSH설정

net <user>@<ssh server>

설정 이 후, service kdump propagate 명령어로 ssh keys를 생성

 

4) dump 파일 생성 옵션

core_collector makedumpfile -c --message-level 1

 vmcore를 대용량의 메모리를 FULL DUMP로 생성하게 되면, 오래 걸리기 때문에 확인 쓸모 없는 페이지를 빼고, 압축을 하여 시간을 단축 시키는 것이 좋다. 옵션 확인 방법은 /sbin/makedumpfile --help로 확인이 가능하다

-c : 각 페이지를 압축하는 옵션

-d : 특정 분석이 불필요한 페이지를 빼는 옵션(X표 있는 것은 제외되는 page)

 

Dump

zero

cache

cache

user

free

Level

page

page

private

data

page

0






1

X





2


X




4


X

X



8




X


16





X

31

X

X

X

X

X

, FULL DUMP를 위해서는 –d 0 옵션을 주어야 하며, -d 31는 가장 적은 양의 덤프 옵션이다.

–c, 옵션과 –d 옵션 적용 시에는 vmcore 생성하는 시간이 늘어날 수 있으니, 재부팅 이 후 빨리 원복이 되어야 하는 시스템에서는 제외 하는 것이 좋다.

 

아무것도 설정 안 했을 시, 기본으로 적용 되는 옵션

path /var/crash

core_collector --message-level 7

 

5) 커널 파라미터 설정

/etc/grub.conf

# grub.conf generated by anaconda

#

#boot=/dev/hda

default=0

timeout=5

splashimage=(hd0,0)/boot/grub/splash.xpm.gz

hiddenmenu

title Red Hat Enterprise Linux Client (2.6.17-1.2519.4.21.el5)

        root (hd0,0)

        kernel /boot/vmlinuz-2.6.17-1.2519.4.21.el5 ro root=LABEL=/ rhgb quiet crashkernel=128M@16M

        initrd /boot/initrd-2.6.17-1.2519.4.21.el5.img

 

crashkernel=128M@16M에서 x86시리즈에서는 32bit 64bit든 기본은 128M@16M으로 설정을 한다. 여기에서 128M RAM에 상주하는 용량이다. 기본 권고는 상 위와 같으나 메모리 용량이 클 경우에는 좀 달리한다. 메모리 용량이 256GB이상이거나 TB급일 경우에는 crashkernel=128M@32M로 설정하라는 access.redhat.com 권고가 있으니, vmcore 생성이 정상적이지 않을 경우에는 참조하여 변경 하도록 한다.

 

참조:https://access.redhat.com/kb/docs/DOC-2164 , https://access.redhat.com/kb/docs/DOC-31705

 

5. Daemon 구동

1) kdump daemon 서비스 등록

# chkconfig kdump on (혹은 chkconfig --level 345 kdump on)

 

2) kdump daemon 구동

# service kdump start

 

3) kdump daemon 정지

# service kdump stop

 

4) kdump daemon 상태 확인

# service kdump status

 

6. kdump 테스트 방법

1) Alt+ SysRq + C

/etc/sysctl.conf 에서 kernel.sysrq = 1 로 설정 후 sysctl -p로 활성화 이 후 사용 가능

      키보드에서 Alt + sysRq + C 키를 동시에 눌러서 패닉 유발.

      echo c > /proc/sysrq-trigger 명령어를 통해서 패닉 유발

 

2) NMI_WATCHDOG

서버 HANG 상태로 인하여, keyboard interrupts가 먹혀들지 않아 " Alt+ SysRq + C"로 패닉 유발이 되지 않을 때 셋팅

      /etc/grub.confnmi_watchdog=1(혹은 2) 파라미터를 설정

      (vmware의 경우)nmi 시그널을 보냄

 

3) NMI(Non maskable interrupt) button

H/W에서 지원하는 nmi 버튼을 이용 하기 위한 셋팅

      /etc/sysctl.conf kernel.unknown_nmi_panic = 1을 설정 후 활성화

      /etc/grub.confnmi_watchdog=1(혹은 2) 파라미터를 설정

      nmi 버튼을 누름

 

 

Trackback
Reply
우주곰:지구곰이 아닙니다.
지구곰이 아닙니다.
Categories (190)
Information (5)
About uzoogom (5)
My Advanced Linux (73)
Learning Linux (96)
OperatingSystem (5)
Databases (4)
OpenSource (1)
Tips! (1)
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30