views:

92

answers:

4

When I am in my dept's server, I cannot use commands such as "apt-get install nethack". I have to build the nethack from Binary files to get it working, at least so I have been told. I cannot understand the reason. Why do I need to build things from binaries? Why is the use of the commands, such as "apt-get", forbidden? Why do I not need Root access to build from binaries?

A: 

Because apt-get will install a program system wide.

A: 

The locations to which apt-get writes installed files (/bin, /usr/bin, ...) are restricted to root access. I imagine that when you build from source you're not executing the install step of the bulid. You're going to need to set a prefix for the installation such that the packages end up somewhere you can write. This thread talks a bit about setting prefixes for apt-get and you'll probably want to set your prefix to something like

~/software/

and then add the resulting bin directories to your PATH.

stimms
+3  A: 

apt-get is a system-level command that installs packages for all users.

If you download and compile, you are only creating local "copies" of the binaries, not system-wide. If you tried to complete the install process with make install this would most likely fail because you do not have sufficient privileges to install the program for all users' access (same reason you can't run apt-get install)

Andy
I am interested to know more about system-wide commands. Does it mean that programs cannot use system wide commands? Let's take another perspective, is it possible to build a program from source files to get access to system wide commands?
Masi
+1 for starting to compare local things and system wide things.
Masi
It's a matter of storage permissions. When you "install" a program, you are copying it to a location that's accessible by all users - most likely included in the default $PATH env. variable. Only privileged users can write to this location.
Andy
Installing system-wide commands vs. executing system-wide commands are two different things. Executing some commands requires 'root' or 'power user' privileges as well.
Andy
Do you mean with power user priveleges sudo user?
Masi
Yes, I'd says 'sodoers' are 'power' or 'privileged' users.
Andy
+2  A: 

When you compile a program from source, you can give it the '--prefix=~/'. This causes it to install relative to your own home directory (so binary programs typically end up in '~/bin', man pages in '~/man' etc). This poses no problems because you already have permission to write here.

Apt-get on the other hand installs the packages in the global filesystem ('/bin/', '/usr/bin/', etc), which can impact other users and so, quite rightly, require administrative access.

If you want to install some program you can use the command

apt-get source app-name

This will work even if you are not root since it only fetch the source code to the app-name and put it in the current directory, which is easier than having to track down the source and there is a better chance to get it work, since you download the version that should work on your system.

Alternatively you should bug your sysadmin to install the programs you need, since it is his job (and if you need them, chances are that the rest of your team does too).

tomjen
+1 great thanks for the command :)
Masi