Proper way to build from sources

I am logged in as a regular user. Should I use:

./configure && make && make install

or

sudo ./configure && sudo make && sudo make install

or

./configure && make && sudo make install

when installing packages.

And could someone explain the differences.

I want all users to be able to use it.


Your 3rd version is correct, ./configure && make && sudo make install. Make and configure can be done as a normal user since you aren't trying to write files in a system directory, make install will often try to copy the binaries to /usr/bin or /bin which requires root access to write.


You need the last version:

./configure && make && sudo make install

Configure and make can happen in your local folder but you'll need root permissions to install. That command accomplishes it.

Make sure the application you're installing isn't in the package manager already. It's typically much easier to use the pre-compiled software for your system than trying to find all the dependencies to compile something.


You should use the least privileges that work. That's usually:

./configure && make && sudo make install

Option number 3:

./configure

make

sudo make install