Go How to boot the CentOS Setup program

Source: Internet
Author: User

Under the CentOS system, there are two main ways to set up your own installed programs to boot.
1, the command to add the startup program to the/etc/rc.d/rc.local file, such as the following is the Setup boot httpd.

#!/bin/sh## This script is executed *after* all the other init scripts.# you can put your own initialization stuff in Here if you don ' t# want-to-do the full Sys V style init stuff. Touch/var/lock/subsys/local/usr/local/apache/bin/apachectl start

2. Add the written startup script to the directory/etc/rc.d/init.d/, then use the command chkconfig to set the boot up.

Chkconfig function Description: Check, set the various services of the system.

Syntax: chkconfig [--add][--del][--list][system service] or Chkconfig [--level < rank code >][system service][on/off/reset]

--add Adding services

--del Deleting a service

--list viewing the Start status of each service

For example, we set up self-booting MySQL:

1 #将mysql启动脚本放入所有脚本运行目录/etc/rc.d/init.d 2 cp/lamp/mysql-5.0.41/support-files/mysql.server/etc/rc.d/init.d/mysqld 3  4 #改变权限 5 chown root.root/etc/rc.d/init.d/mysqld 6  7 #所有用户都可以执行, only root can modify the 8 chmod 755/etc/rc.d/init.d/mysql D 9 #将mysqld put into the Linux boot management system one by one chkconfig--add mysqld12 #查看全部服务在各运行级状态14 chkconfig--list mysqld15 #只要运行级别3启动, others off Closed Chkconfig--levels 245 mysqld off

For example: We write the httpd script and put it into the/etc/rc.d/init.d/directory, using

Chkconfig--add httpdchkconfig httpd on

The command is set to boot.

3. Add the command of the startup program to the/etc/rc.d/rc.sysinit file

Script/etc/rc.d/rc.sysinit, complete system service program startup, such as system environment variable setting, setting system clock, loading font, checking loading file system, generating system boot information log file, etc.

For example, we set up a self-booting Apache:

echo "/usr/local/apache2/bin/apachectl start" >>/etc/rc.d/rc.sysinit

Go How to boot the CentOS Setup program

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.