Systemd: Difference between revisions
| (40 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
== Kernel settings == | == Kernel settings == | ||
First of all you need a recent kernel version >= | First of all you need a recent kernel version >=4.2 and some [[Kernel#systemd|kernel options]] set. | ||
== Installation == | == Installation == | ||
| Line 11: | Line 11: | ||
*/* build_options: jobs=5 -recommended_tests | */* build_options: jobs=5 -recommended_tests | ||
*/* systemd | */* systemd | ||
sys-apps/systemd | sys-apps/systemd seccomp | ||
</pre> | </pre> | ||
}} | }} | ||
| Line 21: | Line 21: | ||
{{Root|cave resolve world -cx}} | {{Root|cave resolve world -cx}} | ||
== | == Network == | ||
You can find out what the network device will be named by running: | |||
{{Root|udevadm test-builtin net_id /sys/class/net/<ifname> 2> /dev/null}} | |||
{{ | {{Code|network device name| | ||
<pre> | <pre> | ||
ID_NET_NAME_MAC=enx005056a84955 | |||
ID_NET_NAME_PATH=enp11s0 | |||
</pre> | </pre> | ||
}} | }} | ||
{{File|/etc/ | === systemd-networkd === | ||
This configuration will default to DHCP as long as the 10-static.network doesn't match. | |||
{{File|/etc/systemd/network/10-static.network| | |||
<pre> | <pre> | ||
[Match] | |||
Name=eno1 | |||
[Network] | |||
Address=192.168.0.88/24 | |||
Gateway=192.168.0.1 | |||
DNS=192.168.0.1 | |||
</pre> | </pre> | ||
}} | }} | ||
{{File|/etc/ | {{File|/etc/systemd/network/20-dhcp.network| | ||
<pre> | <pre> | ||
[Match] | |||
Name=en* | |||
[Network] | |||
DHCP=yes | |||
Domains=domain.local | |||
[DHCP] | |||
UseDomains=yes | |||
</pre> | </pre> | ||
}} | }} | ||
{{File|/etc/ | {{Root|systemctl enable systemd-networkd.socket}} | ||
== Network Name Resolution manager == | |||
=== systemd-resolved === | |||
{{File|/etc/systemd/resolved.conf.d/resolved.conf| | |||
<pre> | <pre> | ||
[Resolve] | |||
DNS=192.168.0.1 | |||
</pre> | </pre> | ||
}} | }} | ||
{{Root|rm /etc/resolv.conf}} | |||
{{Root|cd /etc}} | |||
{{Root|ln -s /run/systemd/resolve/resolv.conf resolv.conf}} | |||
{{Root|systemctl enable systemd-resolved.service}} | |||
== Network Time Synchronization (NTP) == | |||
=== systemd-timesyncd === | |||
{{ | {{File|/etc/systemd/timesyncd.conf.d/timesyncd.conf| | ||
<pre> | |||
[Time] | |||
NTP=192.168.0.1 | |||
</pre> | |||
}} | |||
{{Root| | {{Root|systemctl enable systemd-timesyncd.service}} | ||
{{Root|systemctl | {{Root|systemctl start systemd-timesyncd.service}} | ||
== Enable tty login == | |||
{{Root|systemctl enable getty@tty1.service}} | |||
== Enable sshd connectivity == | == Enable sshd connectivity == | ||
| Line 75: | Line 109: | ||
== Manually starting and stopping services == | == Configuration == | ||
=== Hostname === | |||
Edits /etc/hostname and /etc/machine-info. | |||
{{Root|hostnamectl set-hostname desiredhostname}} | |||
=== Timezone === | |||
Sets the /etc/localtime symlink. | |||
{{Root|timedatectl set-timezone Europe/Berlin}} | |||
Ensure the system RTC is in UTC, this might require setting Windows to UTC via a registry key when dual-booting. | |||
{{Root|timedatectl set-local-rtc 0}} | |||
=== Keyboard Layout === | |||
Edits /etc/vconsole.conf. | |||
{{Root|localectl set-keymap de}} | |||
=== Localization === | |||
Edits /etc/locale.conf. | |||
{{Root|<nowiki>localectl set-locale LANG="en_US.UTF-8"</nowiki>}} | |||
The systemd localectl commands sets the system locale, if you want to set your user locale use /etc/env.d/02locale. | |||
== Misc == | |||
=== Manually starting and stopping services === | |||
You'll find an overview of all installed services and sockets in /lib/systemd/system. | You'll find an overview of all installed services and sockets in /lib/systemd/system. | ||
| Line 84: | Line 151: | ||
{{Root|systemctl}} prints a status report of your systemd setup. | {{Root|systemctl}} prints a status report of your systemd setup. | ||
== Enable additional/optional services == | === Enable additional/optional services === | ||
systemd-journal-gatewayd (accessible via port 19531): | systemd-journal-gatewayd (accessible via port 19531): | ||
{{Root|systemctl enable systemd-journal-gatewayd. | {{Root|systemctl enable systemd-journal-gatewayd.socket}} | ||
cronie: | |||
{{Root|systemctl enable | {{Root|systemctl enable cronie.service}} | ||
ntp: | ntp: | ||
{{Root| | {{Root|timedatectl set-ntp 1}} | ||
MySQL: | MySQL: | ||
{{Root|systemctl enable mysql.service}} | {{Root|systemctl enable mysql.service}} | ||
Samba 4: | |||
{{Root|systemctl enable smbd.service}} | |||
{{Root|systemctl enable nmbd.service}} | |||
{{Root|systemctl enable winbindd.service}} | |||
SSSD: | |||
{{Root|systemctl enable sssd.service}} | |||
mdadm: | |||
{{Root|systemctl enable mdadm.service}} | |||
postfix: | |||
{{Root|systemctl enable postfix.service}} | |||
NFS (client): | |||
{{Root|systemctl enable rpcstatd.service}} | |||
NFS (server): | |||
{{Root|systemctl enable nfs-server.service}} | |||
Latest revision as of 09:51, 18 March 2020
Description
systemd is a system and session manager for Linux also including udev nowadays.
Kernel settings
First of all you need a recent kernel version >=4.2 and some kernel options set.
Installation
*/* build_options: jobs=5 -recommended_tests */* systemd sys-apps/systemd seccomp
Now we need to reinstall packages with the systemd option set.
Network
You can find out what the network device will be named by running:
| Code: network device name |
ID_NET_NAME_MAC=enx005056a84955 ID_NET_NAME_PATH=enp11s0 |
systemd-networkd
This configuration will default to DHCP as long as the 10-static.network doesn't match.
[Match] Name=eno1 [Network] Address=192.168.0.88/24 Gateway=192.168.0.1 DNS=192.168.0.1
[Match] Name=en* [Network] DHCP=yes Domains=domain.local [DHCP] UseDomains=yes
Network Name Resolution manager
systemd-resolved
[Resolve] DNS=192.168.0.1
Network Time Synchronization (NTP)
systemd-timesyncd
[Time] NTP=192.168.0.1
Enable tty login
Enable sshd connectivity
Configuration
Hostname
Edits /etc/hostname and /etc/machine-info.
Timezone
Sets the /etc/localtime symlink.
Ensure the system RTC is in UTC, this might require setting Windows to UTC via a registry key when dual-booting.
Keyboard Layout
Edits /etc/vconsole.conf.
Localization
Edits /etc/locale.conf.
The systemd localectl commands sets the system locale, if you want to set your user locale use /etc/env.d/02locale.
Misc
Manually starting and stopping services
You'll find an overview of all installed services and sockets in /lib/systemd/system.
prints a status report of your systemd setup.
Enable additional/optional services
systemd-journal-gatewayd (accessible via port 19531):
cronie:
ntp:
MySQL:
Samba 4:
SSSD:
mdadm:
postfix:
NFS (client):
NFS (server):