본문 바로가기

리눅스

[리눅스] CentOS 7 런레벨(runlevel) 변경

728x90

CentOS 7 런레벨(runlevel) 변경

1. RunLevel config 파일

(CentOS 7 부터 systemctl 명령을 통해 RunLevel를 변경하도록 안내)

vim /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target

2. 현재 시스템 RunLevel 확인

systemctl get-default
$ systemctl get-default
graphical.target

3. Runlevel 3로 변경(Change default to runlevel 3)

systemctl set-default multi-user.target
$ systemctl set-default multi-user.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.

4. 현재 시스템 RunLevel 확인

systemctl get-default
$ systemctl get-default
multi-user.target

5. 현재 세션에서 런레벨 변경하기

systemctl isolate multi-user.target
728x90