A service (also called a daemon process) is software that runs on a computer, generally in the background. This is usually because it's something that the administrator isn't likely to interact with directly.
For instance, a network service runs at the application layer to provide some form of service over a network. It's expected that client computers will contact the service for access. A common example is the Apache web server. It runs on a system so that devices connected to the internet can view a specific set of files on a computer.
Red Hat Enterprise Linux (RHEL) provides an environment where these network services can run. RHEL also provides a utility named systemd to help you manage these services.
systemd has been the default service manager since RHEL 7. It's the first thing that gets started (PID 1), and it is responsible for starting the rest of the system. It activates server daemons, system resources, and various other processes. With systemd, you can start, stop, and check the status of the network services running on your server. You interact with systemd by using the systemctl command.
Start a service
To start a given service, use:
$ sudo systemctl start <service>
For example, to start the sshd service, type:
$ sudo systemctl start sshd.service
You can ignore .service and run the systemctl start sshd command.
[ Free cheat sheet: Get a list of Linux utilities and commands for managing servers and networks. ]
List services
You can list all loaded services on a server with:
$ sudo systemctl list-units --type=service
Stop a service
To stop a service, type:
$ sudo systemctl stop sshd
To find out whether a service is running, inactive, enabled, disabled, or has exited, use:
$ sudo systemctl status sshd
The systemctl command also has is-active and is-enabled options to see whether a service is active or enabled. For example, to check if a service is active or enabled, run:
$ systemctl is-active sshd
This command gives two possible outputs. The service is either active, which means it is running, or it's inactive, which means it is stopped or not running.
Enable a service
You can configure a service to start automatically with the system so that you don't have to start it manually after the server reboots or restarts.
To enable a service, which means the service starts automatically when the server boots, use:
$ sudo systemctl enable sshd
To both start and enable a service, add the --now option, like this:
$ sudo systemctl enable --now sshd
To check whether a service is enabled, enter:
$ sudo systemctl is-enabled sshd
When a service is enabled, it starts automatically at boot. When it's disabled, it doesn't start automatically at boot.
[ Free download: Advanced Linux commands cheat sheet. ]
Disable a service
To disable a service, so the service will not start automatically at boot time, run:
$ sudo systemctl disable sshd
Wrap up
Not everything uses systemctl by default. Some applications are intended to be started manually. Of course, you can always add your own systemd service files when you need a network service to start automatically.
Systemd is full of features, and the systemctl command gives you easy control over the services your computer runs.
저자 소개
I work as Unix/Linux Administrator with a passion for high availability systems and clusters. I am a student of performance and optimization of systems and DevOps. I have passion for anything IT related and most importantly automation, high availability, and security.
유사한 검색 결과
Behind the scenes of RHEL 10, part 3
Alliander modernises its electricity grid with Red Hat for long-term reliability in balance with rapid innovation
The Overlooked Operating System | Compiler: Stack/Unstuck
Linux, Shadowman, And Open Source Spirit | Compiler
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
가상화
온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래