160 likes | 254 Vues
Linux Initialization. Kernel assumes control after Linux loaded Executes first daemon process (init daemon) /etc/inittab: Configuration file for init daemon. init and its Scripts. init program Master control program Starts many other programs Runs scripts to initialize system services
E N D
Linux Initialization • Kernel assumes control after Linux loaded • Executes first daemon process (init daemon) • /etc/inittab: Configuration file for init daemon
init and its Scripts • init program • Master control program • Starts many other programs • Runs scripts to initialize system services • Controlled by /etc/inittab configuration file • Three main configuration files located in /etc/rc.d • rc.sysinit • rc • rc.local
Understanding Run Levels • Run level • Numbered mode of operation • Preconfigured set of services is activated • Defined in /etc/inittab file • Default run level 5 • init or telinit command • Change to different run level • Commonly done only to restart or halt system
Understanding rc Scripts • rc script • Located in /etc/rc.d directory • Started with parameter that includes run level • Starts appropriate system services based on selected run level • Each run level is associated with subdirectory • Located in /etc/rc.d directory
Understanding rc Scripts • Each file begins with K or S followed by two-digit number • Begin with K―stopped (killed) • Begin with S―started • Files symbolic links to scripts that stop and start services
Controlling Services • Many services listed in run-level directories relate to networking • Scripts allow user to change almost anything on Linux system without restarting computer
Managing Services • service command • Control service • Must know service name • Examples: • service “service” stop • service “service” start • service “service” restart • service “service” status
Managing Services • chkconfig command • Alter files in run-level directories • Modify services started or stopped each time system started • By default alters run levels 2 through 5 • Example: • chkconfig named on • chkconfig named off • chkconfig named –list
Managing Services Graphically • Service configuration utility • Main window lists services available on system • Determined by contents of /etc/rc.d/init.d • Active services • Shown with check mark next to them
Configuring System Services • Initialization scripts in /etc/rc.d/init.d • Typically use configuration information located in /etc/sysconfig directory and subdirectories • Files in /etc/sysconfig • Named for services • Each file contains name-value pairs • Define configuration options for service
Configuring System Services • Use system-config-network utility to configure • /etc/sysconfig/ network file • Files within /etc/sysconfig/network-scripts • system-config-securitylevel utility • Alters /etc/sysconfig/system-config-securitylevel file • Based on firewall selections • Service itself often has another set of configuration files in /etc directory
Runlevels • Runlevel: Defines number and type of daemons loaded into memory and executed • init daemon responsible for changing runlevels • Often called initstates • runlevel command: Displays current and most recent runlevel • init command: Change OS runlevel • telinit command: Alias to init command
ntsysv utility: Modifies file entries in /etc/rc.d/rc*.d directories Figure 9-10: Results of ntsysv―level 5 command