#経緯
CentOS stream 8でサービスを登録しようとしたらエラーが出た。
[root@local hoge]# systemctl enable hoge.service
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
instance name specified.
ユニットファイルは以下の通り。
/etc/systemd/system/hoge.service
[Unit]
Description=hogehoge
After=network.target
[Service]
WorkingDirectory=/home/hoge
ExecStart=/usr/bin/php /home/hoge/hogeServer.php
Restart=always
Type=simple
User=root
Group=root
[install]
WantedBy=multi-user.target
CentOS7.8では動いていたが、「installation configが無い」ってどういう意味かな?
#原因
ユニットファイルの説明を読んでたら意味が分かった。
誤[install]
正[Install]
[root@local hoge]# systemctl enable hoge.service
Created symlink /etc/systemd/system/multi-user.target.wants/hoge.service → /etc/systemd/system/hoge.service.
動いた。