Δημοσιεύτηκε: 18 Ιουν 2011, 11:31
Στο φάκελο αυτό μπαίνουν τα executables των προγραμματων/πακέτων που εγκαθιστά το σύστημα.
Παρόμοιοι φακέλοι είναι οσοι βρισκονται στο $PATH:
Δεν είναι θέμα ασφάλειας, αλλά ευκολίας. Πες πως έχεις ένα πρόγραμμα "surl".
Το ubuntu εγκαθιστά το executable προγραμμα surl ως /usr/bin/surl.
Εσύ βρίσκεις μια καινούργια έκδοση και θέλεις να δοκιμάσεις να την εγκαταστήσεις χρησιμοποιώντας το source code.
Θα εγκαταστήσεις την καινούργια έκδοση στο φάκελο /usr/local/bin/surl.
Σύμφωνα με το $PATH, αν εκτελέσεις "surl" το πρόγραμμα που θα εκτελεστεί είναι το /usr/local/bin/surl και όχι το /usr/bin/surl:
Έτσι α) έχεις και τις δύο εκδόσεις β) δεν παίζεις με τα αρχεία του συστήματος γ) δεν επηρεάζεις το σύστημα πακέτων και δ) είναι πιο εύκολο να αφαιρέσεις αρχεία που βρίσκονται στο /usr/local/.
Σύγκριση με το /opt: http://www.linuxjournal.com/magazine/po ... s-usrlocal
Χρήση στο redhat: http://docs.redhat.com/docs/en-US/Red_H ... m-fhs.html
Παρόμοιοι φακέλοι είναι οσοι βρισκονται στο $PATH:
- Κώδικας: Επιλογή όλων
IFS=":"; for i in $PATH; do echo $i; done
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
Δεν είναι θέμα ασφάλειας, αλλά ευκολίας. Πες πως έχεις ένα πρόγραμμα "surl".
Το ubuntu εγκαθιστά το executable προγραμμα surl ως /usr/bin/surl.
Εσύ βρίσκεις μια καινούργια έκδοση και θέλεις να δοκιμάσεις να την εγκαταστήσεις χρησιμοποιώντας το source code.
Θα εγκαταστήσεις την καινούργια έκδοση στο φάκελο /usr/local/bin/surl.
Σύμφωνα με το $PATH, αν εκτελέσεις "surl" το πρόγραμμα που θα εκτελεστεί είναι το /usr/local/bin/surl και όχι το /usr/bin/surl:
- Κώδικας: Επιλογή όλων
$ which -a surl
/usr/local/bin/surl
/usr/bin/surl
Έτσι α) έχεις και τις δύο εκδόσεις β) δεν παίζεις με τα αρχεία του συστήματος γ) δεν επηρεάζεις το σύστημα πακέτων και δ) είναι πιο εύκολο να αφαιρέσεις αρχεία που βρίσκονται στο /usr/local/.
Σύγκριση με το /opt: http://www.linuxjournal.com/magazine/po ... s-usrlocal
Χρήση στο redhat: http://docs.redhat.com/docs/en-US/Red_H ... m-fhs.html
- Κώδικας: Επιλογή όλων
6.2.1.13. The /usr/ Directory
The /usr/ directory is for files that can be shared across multiple machines. The /usr/ directory is often on its own partition and is mounted read-only. At a minimum, /usr/ should contain the following subdirectories:
/usr/bin, used for binaries
/usr/etc, used for system-wide configuration files
/usr/games
/usr/include, used for C header files
/usr/kerberos, used for Kerberos-related binaries and files
/usr/lib, used for object files and libraries that are not designed to be directly utilized by shell scripts or users
/usr/libexec, contains small helper programs called by other programs
/usr/sbin, stores system administration binaries that do not belong to /sbin/
/usr/share, stores files that are not architecture-specific
/usr/src, stores source code
/usr/tmp -> /var/tmp
The /usr/ directory should also contain a /local/ subdirectory. As per the FHS, this subdirectory is used by the system administrator when installing software locally, and should be safe from being overwritten during system updates. The /usr/local directory has a structure similar to /usr/, and contains the following subdirectories:
/usr/local/bin
/usr/local/etc
/usr/local/games
/usr/local/include
/usr/local/lib
/usr/local/libexec
/usr/local/sbin
/usr/local/share
/usr/local/src
Red Hat Enterprise Linux's usage of /usr/local/ differs slightly from the FHS. The FHS states that /usr/local/ should be used to store software that should remain safe from system software upgrades. Since the RPM Package Manager can perform software upgrades safely, it is not necessary to protect files by storing them in /usr/local/.
Instead, Red Hat Enterprise Linux uses /usr/local/ for software 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.