美文网首页CentOS
CentOS 解决bash: service: command

CentOS 解决bash: service: command

作者: Rinaloving | 来源:发表于2022-03-27 23:03 被阅读0次

运行 service mysqld restart 报错

[root@f325c82add38 local]# service mysqld restart
bash: service: command not found

执行以下命令

yum list | grep initscripts

[root@f325c82add38 local]# yum list | grep initscripts
initscripts.x86_64                        9.49.53-1.el7_9.1              updates

yum install initscripts -y

[root@f325c82add38 local]# yum install initscripts -y

安装过程

Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: mirrors.bupt.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.bupt.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package initscripts.x86_64 0:9.49.53-1.el7_9.1 will be installed
--> Processing Dependency: sysvinit-tools >= 2.87-5 for package: initscripts-9.49.53-1.el7_9.1.x86_64
--> Processing Dependency: iproute for package: initscripts-9.49.53-1.el7_9.1.x86_64
--> Running transaction check
---> Package iproute.x86_64 0:4.11.0-30.el7 will be installed
--> Processing Dependency: libmnl.so.0(LIBMNL_1.0)(64bit) for package: iproute-4.11.0-30.el7.x86_64
--> Processing Dependency: libxtables.so.10()(64bit) for package: iproute-4.11.0-30.el7.x86_64
--> Processing Dependency: libmnl.so.0()(64bit) for package: iproute-4.11.0-30.el7.x86_64
---> Package sysvinit-tools.x86_64 0:2.88-14.dsf.el7 will be installed
--> Running transaction check
---> Package iptables.x86_64 0:1.4.21-35.el7 will be installed
--> Processing Dependency: libnfnetlink.so.0()(64bit) for package: iptables-1.4.21-35.el7.x86_64
--> Processing Dependency: libnetfilter_conntrack.so.3()(64bit) for package: iptables-1.4.21-35.el7.x86_64
---> Package libmnl.x86_64 0:1.0.3-7.el7 will be installed
--> Running transaction check
---> Package libnetfilter_conntrack.x86_64 0:1.0.6-1.el7_3 will be installed
---> Package libnfnetlink.x86_64 0:1.0.1-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================================== Package                                                         Arch                                            Version                                                    Repository                                        Size
===================================================================================================================================================================================================================================Installing:
 initscripts                                                     x86_64                                          9.49.53-1.el7_9.1                                          updates                                          440 k
Installing for dependencies:
 iproute                                                         x86_64                                          4.11.0-30.el7                                              base                                             805 k
 iptables                                                        x86_64                                          1.4.21-35.el7                                              base                                             432 k
 libmnl                                                          x86_64                                          1.0.3-7.el7                                                base                                              23 k
 libnetfilter_conntrack                                          x86_64                                          1.0.6-1.el7_3                                              base                                              55 k
 libnfnetlink                                                    x86_64                                          1.0.1-4.el7                                                base                                              26 k
 sysvinit-tools                                                  x86_64                                          2.88-14.dsf.el7                                            base                                              63 k

Transaction Summary
===================================================================================================================================================================================================================================Install  1 Package (+6 Dependent packages)

Total download size: 1.8 M
Installed size: 5.1 M
Downloading packages:
(1/7): libnetfilter_conntrack-1.0.6-1.el7_3.x86_64.rpm                                                                                                                                                      |  55 kB  00:00:00     
(2/7): libmnl-1.0.3-7.el7.x86_64.rpm                                                                                                                                                                        |  23 kB  00:00:00     
(3/7): libnfnetlink-1.0.1-4.el7.x86_64.rpm                                                                                                                                                                  |  26 kB  00:00:00     
(4/7): initscripts-9.49.53-1.el7_9.1.x86_64.rpm                                                                                                                                                             | 440 kB  00:00:00     
(5/7): sysvinit-tools-2.88-14.dsf.el7.x86_64.rpm                                                                                                                                                            |  63 kB  00:00:00     
(6/7): iproute-4.11.0-30.el7.x86_64.rpm                                                                                                                                                                     | 805 kB  00:00:01     
(7/7): iptables-1.4.21-35.el7.x86_64.rpm                                                                                                                                                                    | 432 kB  00:00:01     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Total                                                                                                                                                                                              905 kB/s | 1.8 MB  00:00:02     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libmnl-1.0.3-7.el7.x86_64                                                                                                                                                                                       1/7 
  Installing : libnfnetlink-1.0.1-4.el7.x86_64                                                                                                                                                                                 2/7 
  Installing : libnetfilter_conntrack-1.0.6-1.el7_3.x86_64                                                                                                                                                                     3/7 
  Installing : iptables-1.4.21-35.el7.x86_64                                                                                                                                                                                   4/7 
  Installing : iproute-4.11.0-30.el7.x86_64                                                                                                                                                                                    5/7 
  Installing : sysvinit-tools-2.88-14.dsf.el7.x86_64                                                                                                                                                                           6/7 
  Installing : initscripts-9.49.53-1.el7_9.1.x86_64                                                                                                                                                                            7/7 
  Verifying  : libnfnetlink-1.0.1-4.el7.x86_64                                                                                                                                                                                 1/7 
  Verifying  : initscripts-9.49.53-1.el7_9.1.x86_64                                                                                                                                                                            2/7 
  Verifying  : libmnl-1.0.3-7.el7.x86_64                                                                                                                                                                                       3/7 
  Verifying  : libnetfilter_conntrack-1.0.6-1.el7_3.x86_64                                                                                                                                                                     4/7 
  Verifying  : iproute-4.11.0-30.el7.x86_64                                                                                                                                                                                    5/7 
  Verifying  : sysvinit-tools-2.88-14.dsf.el7.x86_64                                                                                                                                                                           6/7 
  Verifying  : iptables-1.4.21-35.el7.x86_64                                                                                                                                                                                   7/7 

Installed:
  initscripts.x86_64 0:9.49.53-1.el7_9.1                                                                                                                                                                                           

Dependency Installed:
  iproute.x86_64 0:4.11.0-30.el7   iptables.x86_64 0:1.4.21-35.el7   libmnl.x86_64 0:1.0.3-7.el7   libnetfilter_conntrack.x86_64 0:1.0.6-1.el7_3   libnfnetlink.x86_64 0:1.0.1-4.el7   sysvinit-tools.x86_64 0:2.88-14.dsf.el7  

再次运行 service 即可

Complete!

相关文章

网友评论

    本文标题:CentOS 解决bash: service: command

    本文链接:https://www.haomeiwen.com/subject/fbjujrtx.html