GNU/Linux >> Linux Esercitazione >  >> Linux

Come modificare un runlevel su un sistema Linux RHEL 7

Il modo convenzionale usato per cambiare il runlevel usando /etc/inittab è diventato obsoleto con Redhat Enterprise Linux versione 7. Di conseguenza, qualsiasi sistema Linux che utilizza systemd Il demone di gestione del sistema ora si basa su systemctl comando per cambiare il runlevel o per essere più precisi per cambiare la destinazione. Di conseguenza qualsiasi modifica di /etc/inittab il file non avrà effetto su RHEL 7. Il termine runlevel esiste ancora su RHEL 7 e controlliamo il runlevel corrente usando runlevel comando:

[root@rhel7 ~]# runlevel 
N 3



Tuttavia, per quanto riguarda RHEL 7, invece di runlevel parliamo di obiettivi. Ad esempio, per elencare tutti i target attualmente caricati, possiamo usare il seguente comando linux:

[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'.

Attualmente, il nostro sistema esegue il runlevel 3 che è multi-user.target . Successivamente, possiamo elencare tutti i target di runlevel disponibili utilizzando un comando seguente:

[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'.

L'amministratore di sistema può attivare una qualsiasi delle destinazioni di cui sopra. Ad esempio, attivando graphical.target passeremo effettivamente dal runlevel 3 al runlevel 5 della GUI. Per farlo utilizziamo ancora una volta systemctl comando:

[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'

Come mostrato nell'output sopra, systemctl comando ha cambiato la destinazione predefinita creando un collegamento simbolico in /etc/systemd/system/default.target rendendolo quindi una destinazione di avvio predefinita.


Linux
  1. Come modificare una locale di sistema su RHEL7 Linux

  2. Come modificare un runlevel su un sistema Linux RHEL 7

  3. Come impostare o modificare il nome host del sistema in Linux

  4. Come modificare il nome host in Linux

  5. Modifica il runlevel predefinito in CentOS 7 / RHEL 7

Come unire un sistema Linux a un dominio Active Directory

Come controllare e riparare un file system in RHEL Linux

Come modificare la shell predefinita nel sistema Linux

Come modificare il runlevel corrente in RHEL 8/CentOS 8

Come cambiare utente su Linux

Come modificare nome utente e nome host su sistema Linux