Linux boot-up software (includes Xampp method)

Source: Internet
Author: User
Tags stop script

Linux setup Apache and MySQL:

LiNux open startup program is generally placed in the/etc/rc.d/init.d/inside,/etc/init.d/is its soft connection .

MySQL Set as Linux service

Cp/usr/local/mysql5/share/mysql/mysql.server/etc/init.d/mysqld
Chkconfig--add mysqld
Chkconfig--level 2345 mysqld on
Chown Mysql:mysql-r/usr/local/mysql5/
Service mysqld Start

Apache as Linux service

Cp/usr/local/apache2/bin/apachectl/etc/init.d/httpd
Vi/etc/init.d/httpd

Add the following two lines after #!/bin/sh
#chkconfig: 345 85 15
#description: Start and stops the Apache HTTP Server.

And then
chmod +x/etc/rc.d/init.d/httpd
Chkconfig--add httpd
You can then use the Setup command to enter the service settings, set to boot

The second method:
In/etc/rc.d/rc.local, add the command to start Apache, for example:/usr/local/httpd/bin/apachectl start
----------------------------------
Chkconfig command [url=] collection [/url]
Function Description: Check, set the system of various services.
Syntax: chkconfig [--add][--del][--list][system service] or
Chkconfig [--level< Class Code >][system service][on/off/reset]

Note: This is a program developed by the Redhat company in accordance with the GPL rules, which can query what system services the operating system performs in each execution level (RunLevel), including various daemon.
The Linux OS divides the operating environment into the following 7 levels:

0: Boot (please do not switch to this level)
1: Text interface for single user mode
2: Multi-person user mode text interface, does not have the network File system (NFS) function
3: Multi-person user mode text interface, with Network File system (NFS) function
4: Some distributions of Linux use this level to enter the X Windows system
5: Some distributions of Linux use this level to enter the X Windows system
6: Restart
Parameter:--add new system service specified
--del Delete the specified system service
--LEVEL specifies in which execution level the system service is to be turned on or off
--list List all system services and rank codes currently available from the CHKCONFIG directive
On/off/reset on/off/reset the system service at the specified execution registration
The Chkconfig command is primarily used to update (start or stop) and query run-level information for system services. Keep in mind that Chkconfig does not immediately automatically disable or activate a service, it simply changes the symbolic connection.
Grammar:
Chkconfig--list [Name]
Chkconfig--add Name
Chkconfig--del Name
Chkconfig [--level levels] name <on|off|reset>
Chkconfig [--level levels] Name
Chkconfig displays usage when no parameters are run. If the service name is added, check that the service is started at the current run level. If yes, returns TRUE, otherwise false is returned. If On,off or reset is specified after the service name, CHKCONFI will change the startup information for the specified service. On and off refers to the service being started and stopped, and reset refers to the boot information of the reset service, regardless of what is specified by the problematic initialization script. On and off switches, the system is only valid for run-level 3,4,5 by default, but reset can be valid for all run levels.
The--level option allows you to specify the run level you want to view, not necessarily the current run level.
It is necessary to note that for each run level, there can be only one startup script or stop script. When you switch the run level, Init does not restart the service that is already started, nor does it stop the service that has stopped.
Chkconfig--list: Displays the running status information (on or off) of all run-level system services. If name is specified, only the state of the specified service at a different run level is displayed.
Chkconfig--add Name: Add a new service. Chkconfig ensure that each run level has a start (S) or Kill (K) entry. If one is missing, it is automatically created from the default init script.
Chkconfig--del Name: Deletes the service and removes the associated symbolic connection from the/ETC/RC[0-6].D.
Chkconfig [--level levels] name <on|off|reset>: Sets whether a service is started, stopped, or reset at the specified run level. For example, to stop the NFS service at the 3,4,5 run level, the command is as follows:
Chkconfig--level 345 NFS Off
Run-level files:
Each service managed by Chkconfig needs to add two or more lines of comments to the script under the corresponding INIT.D. The first line tells Chkconfig the run level of the default startup and the priority of start and stop. If a service does not start at any run level by default, use-instead of run-level. The second line describes the service and can be used
Cross-line comments.
For example, Random.init contains three rows:
# chkconfig:2345 20 80
# description:saves and restores system entropy pool for
# higher quality random number generation.
Add a description of the operational level concept of the Linux system:
Linux has a variety of operating levels, the common is multi-user 2,3,4,5, many people know that 5 is the level of running X-windows, and 0 is shutdown. Changes to the run level can be toggled with the init command. For example, if you want to maintain the system into a single-user state, you can use INIT1 to switch. During the switching process of Linux running level, the system will automatically find files corresponding to the/etc/rc[0-6].d of K and S under the directory of Run level, and execute these scripts in the following numerical order. The maintenance of these scripts is a tedious thing, Linux provides the chkconfig command to update and query system services at different run levels.
Example:

1. View the status of each service in various levels of execution:
$chkconfig--list

2. List the startup status of the system service VSFTPD at each execution level:
$chkconfig--list vsftpd

3. At execution level 3, 5 o'clock, turn off the VSFTPD system service:
$chkconfig--level vsftpd off

4. When performing level 2,3,5, turn on the VSFTPD system service:
$chkconfig--level 235 vsftpd on

5. Close some services that you do not need
If you do not have a printer:
Chkconfig--level 235 Cups off
If you do not have a LAN:
Chkconfig--level 235 SMB off
If you do not require a remote user to log on:
Chkconfig--level 235 sshd off
If you do not need a scheduled task:
Chkconfig--level 235 Crond off
If you do not need to add new hardware:
Chkconfig--level 235 Kudzu off

Transferred from: http://www.cnblogs.com/superjt/archive/2012/11/17/2774722.html

For XAMPP:

Method One:

1. Create the lampp.sh file under/ETC/INIT.D and add the following:
#!/bin/sh
/opt/lampp/lampp start

2. chmod 755/etc/init.d/lampp.sh

3. Edit/etc/init. d/rc.local in the last line plus:
sh/etc/init.d/lampp.sh

Or
exec/etc/init.d/lampp.sh (Note: This method even if not logged in after boot, XAMPP will still start)

4. Restart Ubuntu

Method Two:

sudo  ln  -s  /opt/lampp/lampp   /etc/init .d /lampp sudo  update-rc.d -f lampp defaultsThe same method is used to set the boot start with XMPP openfire.

Linux boot-up software (includes Xampp method)

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.