オフラインでインストールされたシステムでサービス状態を無効にする方法

オフラインでインストールされたシステムでサービス状態を無効にする方法

サーバー上のファイルシステムがルートシェルにローカルにオフラインでインストールされています。次回サーバーを起動したときにpostfixが自動的に起動しないように、postfixステータスを無効にするにはどうすればよいですか?

ベストアンサー1

ファイルシステムのルートを にマウントすると仮定すると/mnt/serverdisk

cd /mnt/serverdisk
rm -v etc/systemd/system/multi-user.target.wants/postfix.service

これだけで十分です。

以下は、シンボリックリンクを削除しても何も中断されないことを示すCentOS 8のデモです。

[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core)
[root@localhost ~]#
[root@localhost ~]# systemctl get-default
multi-user.target
[root@localhost ~]#
[root@localhost ~]# runlevel
N 3
[root@localhost ~]# systemctl is-enabled postfix
enabled
[root@localhost ~]# rm -v /etc/systemd/system/multi-user.target.wants/postfix.service
rm: remove symbolic link '/etc/systemd/system/multi-user.target.wants/postfix.service'? y
removed '/etc/systemd/system/multi-user.target.wants/postfix.service'
[root@localhost ~]#
[root@localhost ~]# systemctl is-enabled postfix
disabled
[root@localhost ~]#
[root@localhost ~]# systemctl enable postfix
Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /usr/lib/systemd/system/postfix.service.
[root@localhost ~]#
[root@localhost ~]# systemctl is-enabled postfix
enabled
[root@localhost ~]#

おすすめ記事