Failed to start mongod.service: Unit mongod.service not found

前端 未结 25 1562
误落风尘
误落风尘 2020-12-07 14:43

I follow all the steps mention in MongoDB installation documents for Ubuntu 16.04.

Steps 1:

sudo apt-key adv --keyserv         


        
25条回答
  •  醉酒成梦
    2020-12-07 15:17

    In some cases for some security reasons the unit would be marked as masked. This state is much stronger than being disabled in which you cannot even start the service manually.

    to check this, run the following command:

        systemctl list-unit-files | grep mongod
    

    if you find out something like this:

        mongod.service                         masked
    

    then you can unmask the unit by:

        sudo systemctl unmask mongod
    

    then you may want to start the service:

        sudo systemctl start mongod
    

    and to enable auto-start during system boot:

        sudo systemctl enable mongod
    

    However if mongodb did not start again or was not masked at all, you have the option to reinstall it this way:

        sudo apt-get --purge mongo*
        sudo apt-get install mongodb-org
    

    thanks to @jehanzeb-malik

提交回复
热议问题