Start Ubuntu & enable auto start & chkconfig
Abstract: in many cases, we need to enable certain services to run automatically at startup, such as Apache and MySQL. Or, at other times, we need to set the value of certain environment variables and modify runlevel when starting the system. At this time, we need to understand the starting process of the system.
1. Start Ubuntu:
In general Linux, the boot process is as follows:
Boot> loader> kernel> init>Inittab> RCs. conf> RC. conf> rc2.d> RC. Local
For centos systems, the INIT process reads/etc/inittab (the file content is as follows: ID: 5: initdefault :) and determines the runlevel to be started. The system initialization is determined by/etc/init/RC. conf is complete. Initialization of non-runlevel is performed by/etc/init/RC. conf, and then the specific script file/etc/rc. d/RC2. Note that RC2 is a directory. the following file actually points to/etc/init. d. RC. Local will be executed after initialization. Therefore, for users, if we want our modifications to take effect for all startup levels, we need to change RC. Local. If we need to change the default runlvel, we need to change the inittab.
The Startup Process of Ubuntu is similar to that of centos, but it is different in runlevel processing. Centos is determined by the text configuration file, and Ubuntu is determined by/var/run/utmp. This file will be constantly rewritten by reboot and other programs, it stores the last runlevel. run the runlevel command to view the current runlevel.
After initialization, you can log on and execute a specific script file to complete environment variable initialization.
2. Enable Auto Start Service & Environment Variable Initialization
Like automatic start on Windows, you need to set the automatic start options for some services. Common Linux system services are as follows (partial ):
NetworkManager |
To automatically connect to Network Services |
|
X |
No. |
Acpid |
Advanced Configuration and power management interfaces |
■ |
○ |
Turn on, advanced power management |
Anacron |
A service that runs tasks automatically |
■ |
X |
More advanced than crond. |
Apmd |
Advanced Power Management (support for old hardware) |
■ |
X |
No. Choose either apmdacpid or apmdacpid. |
ATD |
A job scheduling system similar to Cron |
■ |
X |
Use Cron |
Auditd |
Kernel audit daemon |
■ |
X |
No, seliux. |
Autofs |
Optical Drive nfssmb automatic loading/unloading |
■ |
△ |
Enable as needed |
2.1 automatic start upon startup:
Traditionally, you can use shell commands in RC. Local to open or close certain services. This method is effective for all rulevels.
2.2 set environment variables:
Theoretically, we can process it in RC. Local. More traditionally, we usually set it in files such as/etc/profile, or in nologinfile.
3. chkconfig
In the newer Ubuntu system, chkconfig is no longer used.
Start Ubuntu & enable auto start & chkconfig