systemd on Linux 1: Intro and Unit Files
The first video in the systemd series, covering the basics of Linux init and systemd, including how to create systemd unit files for services.
0:00 Introduction
0:51 What is init in Linux?
1:45 SysV init
2:40 systemd's Components and Responsibilities
3:22 systemd Unit Types
4:52 Unit file locations
6:24 How to write a simple unit file
8:02 systemctl daemon-reload
8:56 deep dive on nginx unit file
https://www.freedesktop.org/software/systemd/man/systemd.html
Project-based Linux course for beginners: https://www.udemy.com/course/hands-on-linux-self-hosted-wordpress-for-linux-beginners/?referralCode=19C0A7DEE2FD53C9C09D
Linode Referral Link (you get $100 credit when signing up): https://www.linode.com/tutorialinux
tutorialinux Merch: https://www.youtube.com/channel/UCvA_wgsX6eFAOXI8Rbg_WiQ/store
Free Linux Sysadmin Course Playlist: https://www.youtube.com/playlist?list=PLtK75qxsQaMLZSo7KL-PmiRarU7hrpnwK
Patreon: https://www.patreon.com/tutorialinux
Official Site & e-mail list: https://tutorialinux.com/
Twitter: https://twitter.com/tutorialinux
Facebook: https://www.facebook.com/tutorialinux
Podcast: http://kernelpanicpodcast.com
Video Summary & Chapters
No chapters for this video generated yet.
Video Transcript
What's going on everyone?
In this video, I'm gonna cover kind of the basics
that you need to know about SystemD,
both theoretically and practically,
like how you're going to be interacting with SystemD
when it is your system's init process.
Firstly, what is init?
I'm just very quickly gonna cover that.
We're gonna talk about how SystemD kind of works,
the main ideas that you need to know to work with SystemD.
We're gonna cover units.
We're going to cover system CTL, we're going to cover system D targets, and we're going
to cover kind of the relationships between different system D units, what you might think
of as services.
right now, and how systemd handles dependencies and execution order.
You're also going to get all the ingredients that you need to like make a service in systemd and
manage it. So long story short, init is a special process that is started by the kernel. It's a
special process because it's the first process that really gets started by the kernel during
boot. The process id or pid is one, and it's a process that not only is it responsible for kind
of booting the rest of the system and getting the system to a state where
things are working, people can log in, etc. But in addition to starting services
and getting the system there, it's also a long-running process that kind of has
some power over other processes. For example, when a process is orphaned
because its parent process dies, it is reparented under init. So it's kind of
the ultimate mommy on the system.
It takes care of orphans, it kills zombie processes.
It's kind of responsible for process stuff
that can go wrong during the normal operation of a system.
Init used to be a series of plain text scripts,
essentially in ETC or Etsy init.d.
That's what's known as sys5 style init,
or you might see it written as sysv style init.
That's kind of the older Unix way of doing it.
You have a bunch of plain text scripts that get run essentially in order the user can
kind of munge that order around.
But long story short, there were some drawbacks to that and SystemD has kind of replaced how
that works in Linux.
It is not a Unix init system.
It is at this point purely in Linux.
So really when you think of Systemd, you think it's in it, but it also kind of handles all system state and service stuff during boot and then during the time that that system is up and running.
What is Systemd? It's really a collection of programs and libraries. It's not even just one binary.
You have the systemctl commands for interacting with it. You have journalctl. You have a bunch of tooling around that.
In fact, it does so much more than it. It's sort of an agglomeration of process
management, network management through NetworkD, logins through LoginD, and
logs that your services then emit through JournalD, and those are no longer
plain text logs. They're binary files, which has some advantages and
some disadvantages. So it's a bunch of stuff, and that's what you have to know
about SystemD before you actually start using it. SystemD units. What is a
SystemD unit? Well a unit is really what you might have called a service before
on an older style of init. A unit is any entity managed by SystemD and
Video Summary & Chapters
No chapters for this video generated yet.
Video Transcript
Herkesin başına ne oluyor?
Bu videoda, ben bir tür temelleri kapsayacağım
SystemD Hakkında Bilmeniz Gerekenler,
Hem teorik hem de pratik olarak,
SystemD ile nasıl etkileşim kuracağınız gibi
sisteminizin init işlemidir.
Öncelikle init nedir?
Bunu çok çabuk kaplayacağım.
Sistemin nasıl çalıştığı hakkında konuşacağız,
SystemD ile çalışmak için bilmeniz gereken temel fikirler.
Birimleri kapsayacağız.
Sistem CTL'yi kapsayacağız, sistem D hedeflerini kapsayacağız ve gideceğiz
Farklı sistem D üniteleri arasındaki ilişkilerin türünü kapsamak için, ne düşünebilirsiniz
veya hizmetler olarak.
Şu anda, ve sistemd bağımlılıkları ve uygulama emri nasıl ele alır.
Ayrıca sistemd'de bir hizmet yapmak için sevdiğiniz tüm malzemeleri alacaksınız ve
bu kadar uzun hikaye kısa, init çekirdek tarafından başlatılan özel bir süreçtir.
özel bir süreç çünkü çekirdek tarafından gerçekten başlatılan ilk süreçtir.
başlatma. işlem id veya pid birdir ve sadece türden sorumlu olmayan bir süreçtir
Sistemin geri kalanını başlatmak ve sistemin bir durumuna getirmek için
işler çalışıyor, insanlar oturum açabilir vb. Ama hizmetleri başlatmak için ek olarak
ve orada sistem almak, aynı zamanda bu tür bir uzun süren bir süreçtir
Diğer süreçler üzerinde bazı güçler. Örneğin, bir süreç yetim olduğunda
çünkü ebeveyn süreci ölür, init altında yeniden düzenlenir.
Sistemin en son anahtarı.
Yetimlere bakıyor, zombi süreçlerini öldürüyor.
İşletme konularından sorumlu bir tür
Bu bir sistemin normal çalışması sırasında yanlış olabilir.
Init, basit metin yazıları bir dizi olarak kullanılmıştır,
Temel olarak ETC veya Etsy init.d.
Sys5 tarzı init olarak bilinen bu,
Ya da sysv tarzı init olarak yazılmış olduğunu görebilirsiniz.
Bunu yapmanın eski bir Unix yöntemidir.
Basit metin senaryoyu bir sürü var
Kullanıcı için önemli ölçüde çalıştırılabilir
Çevresinde böyle bir sipariş verebilirsin.
Ama uzun bir hikaye kısa, bu konuda bazı dezavantajlar vardı.
Ve SystemD bunun nasıl çalıştığını bir çeşit değiştiriyor.
Linux'ta, bu bir Unix init sistemi değildir.
Bu noktada sadece Linux'ta.
Gerçekten SystemD'yi düşünüyorsanız,
içinde olduğunu düşünün ama aynı zamanda tüm sistem durumunu ve hizmetleri bir tür ele alır
Boot sırasında ve daha sonra o sistem yükseldi ve çalıştığı zaman içinde.
Sistemd nedir? Gerçekten programlar ve kütüphaneler bir koleksiyonudur.
sadece bir ikili. sen ile etkileşim için systemctl komutları var, sen
journalctl var, etrafında bir sürü araç var. Aslında bunu yapar
çok daha fazlası bir süreç yönetimi bir tür agglomeration,
NetworkD aracılığıyla ağ yönetimi, LoginD aracılığıyla oturumlar ve
Hizmetleriniz daha sonra JournalD aracılığıyla yayınlanır ve bunlar artık basit metin değildir.
günlükleri, bazı avantajları ve bazıları olan ikili dosyalarıdır