有一台 RHEL 7.9 服务器。似乎安装了networkmanger包但没有添加服务。有没有办法可以手动添加服务?
# yum install NetworkManager
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
local | 2.8 kB 00:00:00
Package 1:NetworkManager-1.18.8-1.el7.x86_64 already installed and latest version
Nothing to do
# systemctl start networkmanager
Failed to start networkmanager.service: Unit not found.
# cat /etc/*release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.9 (Maipo)"
...
答案1
尝试:
systemctl daemon-reload
systemctl status NetworkManager
# start if it is there
systemctl start NetworkManager
如果它不起作用检查单元文件:
systemctl list-unit-files | grep -i network
如果不存在,请检查
/usr/lib/systemd/system/
/etc/systemd/system
任何 .service 文件的目录。
如果您需要创建 .service 文件,这里有一个模板:
[Unit]
Description=<description about this service>
[Service]
User=<user e.g. root>
WorkingDirectory=<directory_of_script e.g. /root>
ExecStart=<script which needs to be executed>
Restart=always
[Install]
WantedBy=multi-user.target