티스토리 뷰
파워 넣고 OS가 켜지기 까지 어떤 프로세스가 발생하는지 알 수 있다.
SYSTEMD OVERVIEW
introduction
# systemd 파일은 PID가 1번이다. PID가 0번인 파일은 kernel 이다.
[root@station16 ~]# ps -ef | grep systemd
root 1 0 0 09:54 ? 00:00:02 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
root 524 1 0 09:54 ? 00:00:00 /usr/lib/systemd/systemd-journald
# 여러 파일을 확인해보았다. crond :스케쥴 파일, libvirtd : kvm에 필요한 파일. 이 두 파일의 부모 프로세스는 systemd 이다. 작은 예들만 보았지만, 즉 모든 프로세스가 시작하기위해선 부모프로세스(데몬) systemd가 필요하다.
[root@station16 ~]# ps -ef |grep crond
root 1061 1 0 09:54 ? 00:00:00 /usr/sbin/crond -n
root 3172 2163 0 10:23 pts/0 00:00:00 grep --color=auto crond
[root@station16 ~]# ps -ef | grep libvirtd
root 1042 1 0 09:54 ? 00:00:00 /usr/sbin/libvirtd
root 3199 2163 0 10:24 pts/0 00:00:00 grep --color=auto libvirtd
# System Boot Method Overview / 시스템 부트 메서드에는 3가지가 있다. 시대 순이다.
# Runlevel-driven - AT&T System V init
# Event-driven - Upstart
# Dependency-driven - Systemd
# 아래는 제일 먼저 사용된 sysV의 run level에 관한 내용이다. 현재도 쓰인다.
# run level(실행 수준) #runlevel 또는 # who -r 로 run level을 확인할 수있다. 아래는 런레벨 수준 정보이다.
# 0 : 시스템 정지상태. {s, S, Single} : init's single-user mode (장애처리를 위한 안전모드, 네트워크 안됨)
# 1 : run level 준비단계인 싱글유저모드 2: full multi-user, without networking
# 3 : Full multi-user mode with textmode login 4: Custom or local system
# 5 : Full multi-user mode with graphical X11 login 6: reboot
# sysV init booting 순서
/* power on -> POST(power on self test, 메모리 안 꽂았을 때 비프음 내는 등의 역할) -> BIOS (부팅장치 결정, bootrom에 존재) -> MBR(boot disk에 존재) -> grub2 호출 -> kernel 과 ramdisk를 메모리에 로드 실습환경의 리눅스인 경우 /boot/vmlinuz-3.10 를 메모리에 올린다. 이 수행은 boot(kernel) loader가 수행한다. -> init 실행 */
# init이 포함하고 있는 내용들
# 1) /etc/inittab : default runrevel을 설정
# 2) /etc/rc.d/rc.sysinit : 시스템 초기화 작업 실행
# 3) /etc/rc.d/rc : /etc/rc#.d/S... or /K ... #은 run level의 수준이 들어간다. 수준이 5라면 /etc/rc5.d/S. 의 스크립트 들이 수행된다
# 4) /etc/rc.local 사용자가 부팅시 임의의 서비스를 등록할 수있다. default runlevel까지 스크립트가 수행된 후에 사용자 임의로 자동으로 수행할 스크립트들을 등록. 서버에서 시간 정보 들고와 업데이트 하는 서비스 ntp가 예로 있다.
# target은 runlevel 개념의 대체로 사용되기도 한다. target은 systemd에서부터 사용됨
# 0 : poweroff.target, 1 : rescue.target, 2,3,4 : multi-user.target, 5: graphical.target
# 6 : reboot.target, 아래는 systemctl 명령으를 통해 현재 target 정보를 확인해보았다.
[root@station16 ~]# systemctl get-default
graphical.target
# systemd system은 어떻게 다른가?
# systemd의 pid가 1이다. systemd는 sysV에서 일렬로 세운 프로세스 부팅 메서드에서 부팅 메서드를 병렬처리로 바꾼 것이다. 그러나 어느정도의 디펜던시가 필요하므로 , 수행 시킬 순서를 정의하는 변수 Requires Wants After 등이 필요하다.
[root@station16 ~]# ls -l /etc/systemd/system/default.target
lrwxrwxrwx. 1 root root 36 Jul 15 04:12 /etc/systemd/system/default.target -> /lib/systemd/system/graphical.target
[root@station16 multi-user.target.wants]# cat /lib/systemd/system/graphical.target
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Graphical Interface
Documentation=man:systemd.special(7)
Requires=multi-user.target //수행 되기 위해 필요한것들
Wants=display-manager.service // 그 이후에 수행 되어야할 것
Conflicts=rescue.service rescue.target
After=multi-user.target rescue.service rescue.target display-manager.service
AllowIsolate=yes // 수행 되기 이전에 수행 된 것들
[root@station16 ~]# ls -l /lib/systemd/system/graphical.target.wants
total 0
lrwxrwxrwx. 1 root root 39 Jul 15 03:58 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service
# systemd targets은 sysV runlevel concept를 대체되어 사용된다.
# 파일의 이름 끝이 .target으로 끝난다. unit_name.wants/ 디렉토리를 이용한다.
# 현재 타겟변경하기
[root@station16 ~]# systemctl isolate multiuser.target // 이것은 이전 버전의 "init #" 명령어와 같다.
# 디폴트 타겟 변경하기 (디폴트 런레벨 수준)
[root@station16 ~]# systemctl get-default
graphical.target
[root@station16 ~]# system set-default multi-user.target
# systemd 이용하는법 /언제 사용하는지는 잘 모르겠으나, 부팅시에 서비스 결정할 때 사용하는 또는 시스템 온일 때 사용 또는 정지
# systemctl start "unit_name.service" { stop, restart }
# systemctl status "unit_name.service" 상태확인
# systemctl disabled "unit_name.service" 부팅하는 타겟파일에서 심볼릭 링크를 지우기 {enable}
# systemctl mask "unit ..." 링크를 /dev/null 로 한다. 사용자들의 사용을 제한하기위함
# systemctl unmask "unit..." mask 해제하기
# system에 있는 service들을 확해보았다. state는 enabled, static, disabled가 있다. enable, disable은 부팅시에 사용할지를 말하고, static은 부팅후 사용자에 의해 쓰이는 서비스를 뜻한다고한다
[root@station16 ~]# systemctl list-unit-files -t service
UNIT FILE STATE
abrt-ccpp.service enabled
abrt-oops.service enabled
abrt-pstoreoops.service disabled
abrt-vmcore.service enabled
abrt-xorg.service enabled
abrtd.service enabled
accounts-daemon.service enabled
acpid.service enabled
arp-ethers.service disabled
atd.service enabled
auditd.service enabled
auth-rpcgss-module.service static
autofs.service disabled
'IoT 과정' 카테고리의 다른 글
SOFTWARE MAINTENANCE (0) | 2017.07.18 |
---|---|
GRUB 관련 (0) | 2017.07.18 |
커널 옵션 적응하기, 드라이버 편집하기 등 task (0) | 2017.07.17 |
LINUX KERNEL & DEVICES (0) | 2017.07.17 |
Enterprise Linux System - Adnministration 시작 (0) | 2017.07.17 |
- Total
- Today
- Yesterday
- 시뮬레이션
- 가상 면접 사례로 배우는 대규모 시스템 설계 기초
- 엄청난 인내심과 시뮬레이션을 위한 아레나 툴
- 아레나 시뮬레이션
- 자바스크립트
- 대규모 시스템 설계 기초
- grafana cloud
- 명제논리
- flutter
- Discrete Mathematics
- 항해99
- 데이터 중심 애플리케이션 설계
- Grafana
- 아레나
- 그라파나
- 로젠
- paul wilton
- 백준
- beginning javascript
- Simulation
- 자바스크립트 예제
- rosen
- Propositional and Predicate Logic
- 최단경로 알고리즘
- javascript
- Arena
- arena simulation
- 이산 수학
- 아레나시뮬레이션
- 이산수학
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |