Linux Service Management (i)

Source: Internet
Author: User

First of all, thank you for the lesson network, teacher.

I. INTRODUCTION AND classification
Second, RPM package service Management
Third, source package service Management
Iv. Summary of service Management


First, Introduction and classification:

1. Operating level of the system
Linux has 7 runlevel by default
0 Turn off the machine
1 single-user mode, can be imagined as Windows Safe mode, mainly used for system repair
2 Incomplete Command mode with no NFS service
3 full command-line mode, which is the standard character interface
4 system Retention
5 Graphics Mode
6 restart
viewing levels
RunLevel
View current level, usually 3, standard character interface;
Toggle Level
Init 5
Switch to Level 5, but because the server does not have a secure graphics mode, it does not start properly
In this RunLevel
will return 3 5;
3 is the previous level, and 5 is the current level.
Init 0 shutdown
Init 6 Restart
Not reliable, don't mind being used to shut down and restart;
Modify the default Level
Vim/etc/inittab
Modify the profile control system to enter the operating level directly after the boot
-id:3:initdefault

CENTOS6 before the system started most of the files in the Inittab file, centOS6 and CENTOS5 one of the major difference is that 6 of the contents of the inside of the other files, now only effective only one sentence:-id:3:initdefault, Used to control the default run level. 0 and 6 o'clock are not allowed to be set to the default level.

2. Classification of services
What is a Linux service?
Why do you want to do service management? Turn off unused services and use less resources. is an important optimization process.

Linux services because of different installation methods, the corresponding startup shutdown method is different, can be divided into RPM package installation Services and source package installation Services.
(This is recommended, but most of the information is not so, because RPM-installed services can be modified by modifying the configuration can be changed to the same source package installation location and startup shutdown mode.) )
The RPM package is also divided into separate services and based on XINETD services.

Xinted service is slower than standalone service, but other services do not account for memory except for XINETD service;
But now the XINETD service is basically eliminated;
Use Chkconfig--list to see the services are RPM services, the list is a separate service, based on xinted services will be identified;
If there is no identification, you need to install the xinted service itself------yum-y install xinetd;
The General Service is left with Rsyns, which is used for network backup services.

Management: Startup and self-booting
Chkconfig--list
If the 2345 above is started, the opportunity starts from start; This command looks at the self-booting of the service and does not know if the service is now started.

To view installed services and current status
RPM Package Installation Services;
Chkconfig--list View rpm service self-booting status, can not view the source package service,
Source Package Installation Services:
See where the service is installed, typically/usr/local

RPM Package and source package after installation of the difference is the installation location of the different
Since the location of the installation is different, the starting and starting mode is different;

3. Services and Ports
How do I know which services are running under the current system?
Ps-aux
View the process, but the system not only the service will take the process, the program will also account for the process
Netstat-tlunp
-T TCP port
-l lists the Network service being monitored (does not include the network service that is already connected);
-U UDP port
-P look at PID number and process name;
-N uses the port number to display the service instead of the service name
Viewing the port lists all services that have been started, and if the queue is not 0, the port is busy.
State, the TCP protocol is the listener because TCP takes three handshake, and UDP does not.

Port, an IP address can have 65,536 (0 ~ 65535) ports.
Application Layer--Transport layer--network layer--Physical layer
Transport Layer (TCP/UDP)
The port is the interface of the transport layer to the application-level transport service.
TCP has 65,536 ports, UDP also has 65,536, usually TCP ports are occupied and UDP is empty.

(such as Ftp/http port, not recommended modification, if the service is used to give users access, do not modify, but like 22 port, is the administrator remote connection, modified after more security.) )

Within 10000 of the port, is reserved by the system,
Vim/etc/services
The file contains all the ports for the service.

Chkconfig--list See self-priming
Netstat-tlun look at the starting

Linux Service Management (i)

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.