Difference between "make install" and "sudo make install"
Avoid making local installs into system directories. The system directories eg /usr
, are reserved for the package management system to use. By definition, if you are doing make install
that means you are making a local install, and if you need to do sudo make install
that means you don't have permission to wherever you are writing.
So, if you are getting permission errors with make install
, check and see whether you are trying to install into system directories, and install into /usr/local
or similar instead. /usr/local
is reserved for local installations. You may need to give yourself permission to write to /usr/local
, but this is usually easily done. On Debian this can be done by adding yourself to the staff
group. Better still, find or create a binary package, and install that instead. That way you can easily keep track of installed packages and obtain the other benefits of package management.
Note that the package management system conversely does not install into /usr/local
, per the FHS. See Section 9.1 of the Debian Policy Manual- File system hierarchy for an overview.
As has been answered above, sudo make install
lets you install the files in directories which are otherwise read-only to you as a user.
The problem I can foresee is that at a later date you may want to uninstall or upgrade the program. If you still have the source code directory tree then a make uninstall
will uninstall the program for you but if, as many other typical users, you had deleted the source code directory tree then you are out of luck. And since you have not installed the program using a package management system, you may also be unable to uninstall the program that way.
The best way to install such programs may be to install them in your home directory. Pass the option --prefix=/home/<user>/<some>/<directory>
to ./configure
. This will allow you to use make install
instead of sudo make install
since /home/<user>/<some>/<directory>
is writable by you. Also uninstallation is a snap -- rm -rf /home/<user>/<some>/<directory>
Here's a basic rundown of the commands is question:
- sudo- run a command as root
- make- run a script to build from source
Since sudo command runs the command you pass it as root, it means that the make command has super-user privileges. This means that if the makefile is malicious, or any of the scripts it may call is malicious, then it could compromise your system.
In short, if you don't trust the software, don't install it. If you trust the software, then running as root shouldn't hurt anything.
Note:
sudo make install
is the same as su; make install
in most cases.