Cara konvensional yang digunakan untuk mengubah runlevel menggunakan /etc/inittab
telah menjadi usang dengan Redhat Enterprise Linux versi 7. Akibatnya semua sistem Linux menggunakan systemd
daemon manajemen sistem sekarang bergantung pada systemctl
perintah untuk mengubah runlevel atau lebih tepatnya mengubah target. Akibatnya, setiap pengeditan /etc/inittab
file tidak akan berpengaruh pada RHEL 7. Istilah runlevel
masih ada di RHEL 7 dan kami memeriksa runlevel saat ini menggunakan runlevel
perintah:
[root@rhel7 ~]# runlevel N 3
Namun, dalam hal RHEL 7 kami bukannya runlevel berbicara tentang target. Misalnya untuk membuat daftar semua target yang sedang dimuat, kita dapat menggunakan perintah linux berikut:
[root@rhel7 ~]# systemctl list-units -t target UNIT LOAD ACTIVE SUB DESCRIPTION basic.target loaded active active Basic System cryptsetup.target loaded active active Encrypted Volumes getty.target loaded active active Login Prompts local-fs-pre.target loaded active active Local File Systems (Pre) local-fs.target loaded active active Local File Systems multi-user.target loaded active active Multi-User System network.target loaded active active Network paths.target loaded active active Paths remote-fs.target loaded active active Remote File Systems slices.target loaded active active Slices sockets.target loaded active active Sockets swap.target loaded active active Swap sysinit.target loaded active active System Initialization timers.target loaded active active Timers LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. 14 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'.
Saat ini, sistem kami menjalankan runlevel 3 yaitu multi-user.target
. Selanjutnya, kita dapat membuat daftar semua target runlevel yang tersedia menggunakan perintah di bawah ini:
[root@rhel7 ~]# systemctl list-units -t target -a UNIT LOAD ACTIVE SUB DESCRIPTION basic.target loaded active active Basic System cryptsetup.target loaded active active Encrypted Volumes emergency.target loaded inactive dead Emergency Mode final.target loaded inactive dead Final Step getty.target loaded active active Login Prompts graphical.target loaded inactive dead Graphical Interface local-fs-pre.target loaded active active Local File Systems (Pre) local-fs.target loaded active active Local File Systems multi-user.target loaded active active Multi-User System network-online.target loaded inactive dead Network is Online network.target loaded active active Network nss-lookup.target loaded inactive dead Host and Network Name Lookups nss-user-lookup.target loaded inactive dead User and Group Name Lookups paths.target loaded active active Paths remote-fs-pre.target loaded inactive dead Remote File Systems (Pre) remote-fs.target loaded active active Remote File Systems rescue.target loaded inactive dead Rescue Mode shutdown.target loaded inactive dead Shutdown slices.target loaded active active Slices sockets.target loaded active active Sockets swap.target loaded active active Swap sysinit.target loaded active active System Initialization syslog.target not-found inactive dead syslog.target time-sync.target loaded inactive dead System Time Synchronized timers.target loaded active active Timers umount.target loaded inactive dead Unmount All Filesystems LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. 26 loaded units listed. To show all installed unit files use 'systemctl list-unit-files'.
Administrator sistem dapat mengaktifkan salah satu target di atas. Misalnya mengaktifkan graphical.target
kita akan secara efektif mengubah dari runlevel 3 ke GUI runlevel 5. Untuk melakukan itu kita sekali lagi menggunakan systemctl
perintah:
[root@rhel7 ~]# systemctl enable graphical.target --force rm '/etc/systemd/system/default.target' ln -s '/usr/lib/systemd/system/graphical.target' '/etc/systemd/system/default.target'
Seperti yang ditunjukkan pada output di atas systemctl
perintah mengubah target default dengan membuat tautan simbolis menjadi /etc/systemd/system/default.target
menjadikannya sebagai target boot default.