Why do some packages use 'make install' while other use 'sudo make install'
Solution 1
Usually I try to run it without sudo
anyway - sometimes it works. Sometimes package creators think sudo
is required, they use it due to their preference, or otherwise choose to install things in non-user areas of the system. Sometimes this is necessary, but many times it isn't.
The other common reason I see for the use of sudo
is in blog posts by 3rd parties that explain how to install software, and rather than go the extra mile and explain to you how to install it without sudo
privileges, they tell you to use sudo
because the person writing the post simply uses sudo
for everything, which isn't really a good idea.
Theoretically, the only reason a package should require sudo
is if it needs (or decides) to install itself into/otherwise modify areas of the system that can only be modified via administrator access.
Generally speaking, fewer and fewer packages are still doing this, as the need for users to install some software without sudo
access is growing.
Solution 2
It depends if you're installing it for you or for all users. (Mostly. Some things like kernel modules will require root access regardless of who will use the end features.)
Most programs that provide a ./configure
script also accept a --prefix=~/bin
or --prefix=~/Local/
so that you can install it into your home directory. Not all programs provide a ./configure
, but most provide some mechanism in the Makefile
that allows you to configure the installation destination.
So: are your libraries / programs for you or for all users on your system?
Related videos on Youtube
alexbooots
Updated on September 18, 2022Comments
-
alexbooots almost 2 years
I recently installed LAME encoder on my server to convert wav to mp3 and that worked with
./configure; make; make install
.I then tried to install OGG encoder and that requires './configure, make, sudo make install' - which I cannot do, since I don't have a VPS (and I'd rather not pay $15 a month for a VPN just to install a codec).
I'm new to all this, and I understand sudo gives you permissions - but I have been trying to find out why exactly some
make install
s require sudo access and others don't. I haven't yet found the answer.-
Admin over 12 yearsYou should be able to change the Makefile (or some template that the Makefile is generated from) or pass command-line options to something (probably
./configure
) in order to make it install in a different directory (presumably one you don't needsudo
to access).
-
-
Admin over 12 yearsMost packages should have configuration options somewhere so that you can install them in other locations. Using them might require a bit more effort, but if you can't
sudo
that's what you're stuck with. -
Admin over 12 yearsThey are just for me to use.. and, brill!.. I used ./configure --exec-prefix=/home/username/folder --prefix=/home/username/folder and it seems to have went through ok without sudo (which it didnt when using only ./configure) for libogg, libvorbis, have some trouble with libtheora and vorbis-tools but not sure what thats about yet. I should be able to get it though. Thanks!
-
sarnold over 12 yearsYou may need to then use a command line option like
--theora-path=/home/username/folder
when compiling further programs -- be sure to read theREADME
or similar files to learn which variables may need to be changed.