What is the difference between /opt and /usr/local?

Patches

According to the Filesystem Hierarchy Standard, /opt is for "the installation of add-on application software packages". /usr/local is "for use by the system administrator when installing software locally". These use cases seem pretty similar. Software not included with distributions usually is configured by default to install in either /usr/local or /opt with no particular rhyme or reason as to which they chose.

Is there some difference I'm missing, or do both do the same thing, but exist for historical reasons?

jlliagre

While both are designed to contain files not belonging to the operating system, /opt and /usr/local are not intended to contain the same set of files.

/usr/local is a place to install files built by the administrator, typically by using the make command (e.g., ./configure; make; make install). The idea is to avoid clashes with files that are part of the operating system, which would either be overwritten or overwrite the local ones otherwise (e.g., /usr/bin/foo is part of the OS while /usr/local/bin/foo is a local alternative).

All files under /usr are shareable between OS instances, although this is rarely done with Linux. This is a part where the FHS is slightly self-contradictory, as /usr is defined to be read-only, but /usr/local/bin needs to be read-write for local installation of software to succeed. The SVR4 file system standard, which was the FHS' main source of inspiration, is recommending to avoid /usr/local and use /opt/local instead to overcome this issue.

/usr/local is a legacy from the original BSD. At that time, the source code of /usr/bin OS commands were in /usr/src/bin and /usr/src/usr.bin, while the source of locally developed commands was in /usr/local/src, and their binaries in /usr/local/bin. There was no notion of packaging (outside tarballs).

另一方面,/opt是一个目录,用于安装未捆绑的软件包(即,软件包不是操作系统发行版的一部分,但由独立的源提供),每个目录都位于其自己的子目录中。它们已经由独立的第三方软件发行商提供了完整的软件包。/usr/local不同,这些包遵循目录约定(或至少应遵循)。例如,someapp将安装在中/opt/someapp,使用命令之一/opt/someapp/bin/foo,将其配置文件安装在中/etc/opt/someapp/foo.conf,并将日志文件安装在中/var/opt/someapp/logs/foo.access

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

What is the difference between (a+b)* and (a*b*)*?

what is the difference between SAS ARRAY and SAS IF-THEN

What is the difference between Runtime Exception in java and Runtime Error in java?

What is the difference between these two SQL Server connection strings

What's the difference between `make:console` and `make:command`?

What is the difference between PWA and Angular 2/4 application?

dh_usrlocal:...不是目录

dh_usrlocal实际做什么

What is the difference between running a .bat from cmd line vs. double click?

What is the difference between parametric polymorphism with upper-bound and subtype polymorphism in these methods?

What is the difference between component 'mat-table' and the directive '<table mat-table>'?

Difference between mail and mailx?

Difference between nohup, disown and &

Difference between @Inject and @ValueMapValue annotations

A difference between Unicode and ASCII operators

What is the difference between `java -Dspring.profiles.active -jar xxx.jar` and `java -jar xxx.jar --spring.profiles.active`

Difference between authorization and sale transactions method in paypal

Difference between ! vs !! vs * in /etc/shadow

Difference between composer update and composer global update

Is there a difference between an I/O port and a physical port?

Two sided PDFs, what's the difference?

指向/ opt的符号链接

写入/ opt / folder

“无法打开” / opt文件

/ opt目录的默认权限?

在/ opt中拒绝访问

what is the distinction between /media, /mnt and /run/mount?

Is there a quality difference between YouTube videos on Chrome vs. Firefox?

Difference between window.location.href and top.location.href