Linux目录
我正在为我的程序编写安装脚本,该程序应该在 Linux/Unix 操作系统上运行。以下文件的默认目录是什么:
- 可执行文件(程序)。应通过从命令行键入程序名称来执行程序。
- 共享库。
- 第三方共享库(该程序不是开源的,所以我需要重新分发第三方库)。
- 所有用户的只读程序配置文件。
- 配置数据可供所有用户读/写访问。
I am writing installation script for my program, which is supposed to run on Linux/Unix OS. What is the default directory for the following files:
- Executable files (programs). Program should be executed by typing its name from the command line.
- Shared libraries.
- Third-party shared libraries (the program is not open source, so I need to redistribute third-party libraries).
- Read-only program configuration files for all users.
- Configuration data available for read/write access for all users.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
该列表因 Linux 文件系统而异。
1)
/bin
,/usr/bin
,/usr/local/bin
2/3)
/lib
,/usr/lib
,/usr/local/lib
3./usr/share/lib
4)
/etc
是配置数据的只读位置。5)
/usr/local/etc
或者通常在/home
目录下的点目录名下,如果配置文件允许bin目录位于下/home/user_id/bin
其中“user_id”是相关的登录 ID。以用户“jdoe”为例,他的配置可以写入/home/jdoe/.configs
或~/.configs
不要依赖于此,在大多数情况下,LSB 文件系统规定至少应有:
/bin
、/etc
、/usr
、/lib
、/home
对于例如,
/usr
可以位于不同的分区,同样对于/home
编辑: 感谢 dtrosset 指出了我的错误......
The listing varies depending on the Linux filesystem.
1)
/bin
,/usr/bin
,/usr/local/bin
2/3)
/lib
,/usr/lib
,/usr/local/lib
3./usr/share/lib
4)
/etc
is a read-only spot for configuration data.5)
/usr/local/etc
or usually in the/home
directory under the dot directory name, if the profile allows the bin directory to be located under the/home/user_id/bin
where 'user_id' is the relevant login id.. for an example for user 'jdoe', his configuration could be written to/home/jdoe/.configs
or~/.configs
Do not rely on this, for the most part the LSB filesystem dictates that there shall be at minimum:
/bin
,/etc
,/usr
,/lib
,/home
For instance, the
/usr
could be on a different partition, likewise the same for/home
Edit: Thanks to dtrosset for pointing out my blooper....
$PREFIX/bin
$PREFIX/lib
$PREFIX/lib
/etc
$HOME/.config
其中
$HOME
是运行应用程序的用户的主目录,在运行时确定。$PREFIX
取决于分发方法:$PREFIX
应该是可配置的,但默认为/usr/local
;$PREFIX
通常应为/usr/local
(但/opt
也很常见);$PREFIX
应为/usr
。文档和其他独立于体系结构的文件应该放在
$PREFIX/share/doc
中;实例之间共享的程序生成的文件应该放在/var/run
(例如锁定文件、pidfiles 和套接字)或/var/lib
(例如共享二进制数据库)中。$PREFIX/bin
$PREFIX/lib
$PREFIX/lib
/etc
$HOME/.config
Where
$HOME
is the home directory of the user running the application, determined at runtime.$PREFIX
depends on the method of distribution:$PREFIX
should be configurable but default to/usr/local
;$PREFIX
should usually be/usr/local
(but/opt
is also common);$PREFIX
should be/usr
.Documentation and other architecture-independent files should go in
$PREFIX/share/doc
; program-generated files shared between instances should go in/var/run
(things like lockfiles, pidfiles and sockets) or/var/lib
(things like shared binary databases).查看文件系统层次结构标准。
Check out the Filesystem Hierarchy Standard.
可执行文件(二进制):
共享:
其他:
我不确定编写安装脚本是否明智,如果您不知道 *nix 操作系统的文件结构。除此之外,*nix 的每个发行版在数据存储位置方面都略有不同。
我建议你读一下这个:
http://www.comptechdoc.org/os/linux/commands/linux_crfilest。 html
^.^
Executable (Binary):
Shared:
Other:
I'm not sure it would be wise to be writing an install script if you don't know the file structure of a *nix OS. Besides which, each distribution of *nix is sligthly different when it comes to where the data is stored.
I suggest you read this:
http://www.comptechdoc.org/os/linux/commands/linux_crfilest.html
^.^
最简单的方法是为您的应用程序创建一个
.rpm
,然后使用例如alien
来创建一个.deb
。最后我做了一个 deb,真的非常非常简单。如果您想启用它,该打包还使您能够进行某种自动更新,并且无需考虑太多卸载过程。The easiest way is to make an
.rpm
of your application and then use for examplealien
to make an.deb
out of it. Last I made a deb, it was really, really simple. The packaging also enables you to have a sorts-of auto-update if you want to enable it and you will not need to think a lot about uninstallation procedures.