This question already has an answer here:

I know this is rather subject to opinion but what are some good choices where on the file system to locate the source code of a build that the server builds (let's say it's a build/integration server)? E.g. there is /usr/src but I think that is rather a conventional location for shell-related stuff (correct me if wrong). How about /usr/local/src?

E.g. right now I check out foo (one of our apps we integrate) source code in /var/lib/foo but I think that may be a misleading reference. Of course it doesn't matter for execution purposes but I am trying to get in line with the convetions.

marked as duplicate by amphibient, schily, slm Jun 28 '18 at 3:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • oh I think this is answered by unix.stackexchange.com/a/10816/23944. Admin should decide whether to delete this question unless it makes sense to keep it – amphibient Jun 27 '18 at 15:10
  • 2
    Unfortunately the accepted answer there is slightly wrong (don’t use /usr/local/src for builds). – Stephen Kitt Jun 27 '18 at 15:12

What is the "/usr/local/src" folder meant for? addresses /usr/src and /usr/local/src. The FHS says those directories should only be used for reference purposes.

For a build system I would use a temporary directory under /tmp, or the home directory of the (system) user which runs the builds, or a dedicated directory under /srv (e.g. /srv/workspace for Jenkins’ workspaces).

I wouldn’t use /var/lib/foo, that’s intended to store foo’s variable state, not its source code.

  • I kind of don't like either of those two locations – amphibient Jun 27 '18 at 15:38
  • 1
    @amphibient /srv might be better, see my update. What don’t you like about /tmp or a home directory? – Stephen Kitt Jun 27 '18 at 15:43
  • I don't like that those dirs have a general (usually human caused but also often caused by apps) tendency to collect a lot of trash, such as log files and miscellaneous other junk – amphibient Jun 27 '18 at 15:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.