3

I'm new to this. I'm trying to install apache2 on an Ubuntu 15.04 server. Running as root.

But when giving the command:

$ sudo apt-get install apache2
-bash: sudo: command not found

Can anyone point me in the right direction? Thanks in advance.

EDIT:

root@dev:~# whoami
root

root@dev:~# apt-cache policy sudo
N: Unable to locate package sudo

root@dev:~# apt-get install sudo
Reading package lists... Done
Building dependency tree... Done
E: Unable to locate package sudo

root@dev:~# apt-cache policy sudo
N: Unable to locate package sudo

root@dev:~# sudo apt-get install apache2
-bash: sudo: command not found

root@dev:~# apt-get install apache2
Reading package lists... Done
Building dependency tree... Done
E: Unable to locate package apache2

EDIT:

Ran; apt-get update and then tried again. Worked!

12
  • Does su work instead of sudo?
    – Raphael
    Nov 8, 2015 at 15:38
  • 1
    Are you running as root? Please edit your question and add the output of whoami and apt-cache policy sudo.
    – muru
    Nov 8, 2015 at 15:43
  • 1
    which sudo shows anything? If not please add results from more /etc/lsb-release
    – Rinzwind
    Nov 8, 2015 at 15:46
  • 1
    @Rinzwind - I have a question. OP says that he is running as root right? So, he can use apt-get install sudo to install it, can't he?
    – Raphael
    Nov 8, 2015 at 15:54
  • @muru Yes, whoami outputs root. The other returns; N: Unable to locate package sudo. So I guess it isn't installed yet. Going to look into that now. As I said, I'm new to this.
    – Hees1989
    Nov 8, 2015 at 15:54

2 Answers 2

2

As you are root you shouldn't need sudo to run the command. Try running the commands without sudo as in apt-get install apache2 for example.

Source: experience

0

Maybe it isn't installed? Open your package manager and install the sudo package.

taken from another question on unix & Linux.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .