3

I often find build instructions like this:

./configure
make
make install

while in reality I need to type

sudo make install

Why is this not mentioned in the installation instructions? Or is it supposed to be such common knowledge that it isn't worth mentioning? Or are you assumed to be logged in as root?

1
  • They may also show '$' or '#' before the commands to convey access level. Commented Jun 26, 2015 at 17:20

5 Answers 5

8

They give you the correct commands, it is up to you as a user to ensure you have the correct privileges.

1
  • 2
    A lot of build instructions are very generic, they can build on many different platforms, some of which don't even have sudo. Sudo also isn't really a command related to the build, just a security measure. Commented Nov 22, 2009 at 0:58
9

"sudo" may not be required if, for example, you have already run "su" and your session is running in elevated permissions. That negates the need to run sudo. Generally the use of sudo is preferred, but it is not strictly the only way to reach the same goal.

4
  • 4
    sudo also isn't always available/installed.
    – innaM
    Commented Nov 20, 2009 at 21:27
  • You should add that as an additional answer, @Manni, since comments don't earn rep. :)
    – JMD
    Commented Nov 20, 2009 at 21:31
  • You might also set --prefix to be $HOME/bin
    – Jeremy L
    Commented Nov 20, 2009 at 22:12
  • 3
    @nerdling: don't do that. set --prefix to $HOME. by default the bindirectory is $prefix/bin. you could set --bindir to $HOME/bin directly, but that won't change the installation directory for files destined for $prefix/share, $prefix/lib, $prefix/man, $prefix/sbin, etc. Commented Nov 20, 2009 at 23:29
6

You may not actually need root permissions to install a given software package, or you may not have access to root privileges via sudo or su or other methods.

One of the ./configure script's common options is --prefix, which changes the base installation directory from whatever the default is. So on a system where I have no root privs at all, I can still install this software to my own home directory:

./configure --prefix=$HOME
make
make install

The ./configure script has lots of other options, some common to all, some dependent on the particular package you're compiling. Use ./configure --help to see them all.

1
  • 2
    This answer, plus: it's not standard to make you use sudo for all your admin work. It's only some distributions (typically recent ones such as Ubuntu) that take this approach.
    – bobince
    Commented Nov 21, 2009 at 3:18
4

sudo is only available in certain distributions. In others, you must use su to switch to the root user, the run the command. They are NOT assuming you are already logged in as root, since you should never just be running things as root. They are assuming that you know enough about your system to know how to run something as root. It is quite common to need to run installations as root, so do be used to how to do it on your system.

3

Perhaps your instructors looked like this. I've seen the following many times:

$ ./configure
$ make
# make install

Notice the hash/pound sign. On almost every Linux distro I've used, this sign indicates you're in a root shell.

You must log in to answer this question.

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