Find the answer to your Linux question:
Results 1 to 4 of 4
Hi again, Just a quick question on best practices on the Linux file system and my code. On Windows it is easy, write some code and chuck it in the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2010
    Posts
    25

    What is best practice for file locations?


    Hi again,

    Just a quick question on best practices on the Linux file system and my code.

    On Windows it is easy, write some code and chuck it in the program files folder, create a shortcut and bam thats my software deployed.

    What I have come to like about linux is that everything has its place and the structure makes sense, so I just wanted to check in and see if the file locations I am going to use are best to maintain a level of consistency with other installed applications throughout my system.

    Code:
    /usr/bin/<my main program>
    /usr/share/<gui files, pngs, bmps, etc>
    /usr/lib/<my shared libs>
    Cheers

  2. #2
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    Refer to the Linux Filesystem Hierarchy for the official word on where things go.

    In general, if you compile a piece of software for linux, it defaults to installing in /usr/local, with the option during configuration of changing the install location.

    Example of how you would run many configuration scripts to install in /usr instead of /usr/local
    Code:
    ./configure prefix=/usr
    My rule of thumb personally is, unless I'm building a package for the software, therefore allowing it to be tracked and uninstalled via the package manager, I will not install things to /usr, but use /usr/local instead.

    Some distros use /usr/local a little differently, for example, RHEL says
    In Red Hat Linux, the intended use for the /usr/local/ directory is slightly different from that specified by the FHS. The FHS says that /usr/local/ should be where software that is to remain safe from system software upgrades is stored. Since system upgrades from under Red Hat Linux performed safely with the rpm command and graphical Package Management Tool application, it is not necessary to protect files by putting them in /usr/local/. Instead, the /usr/local/ directory is used for software that is local to the machine.

    For instance, if the /usr/ directory is mounted as a read-only NFS share from a remote host, it is still possible to install a package or program under the /usr/local/ directory.

  3. #3
    Just Joined!
    Join Date
    Jul 2010
    Posts
    25
    Thanks for that, I'll give that link a read.

    My software will not come with a configure script as my target system will never change, so I will take my gcc compiled programs and libs and create a install script to move all the packages to the /usr/local folder.


    Thanks.

  4. #4
    RDU
    RDU is offline
    Just Joined!
    Join Date
    Aug 2010
    Posts
    89
    I would say :

    Distro provided core program would be in
    /bin /lib /sbin

    Distro provided program would be in :
    /usr/bin + /usr/lib

    The program you compile (with configure + make install) would be in
    /usr/local/bin /usr/local/lib ....

    The program you install (binary way (like windows program files folder)) should be in
    /opt/your-program-name

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •