何处以及如何在Linux中存储程序信息 [英] Where and How to store program information in Linux

查看:102
本文介绍了何处以及如何在Linux中存储程序信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Linux的新手,我只是搞乱了它,但现在我想让我的Java程序在Linux上运行...

I'm new to Linux and I've only ever messed around with it but now I want to allow my Java program to run on Linux...

我在互联网上快速浏览了一下,我找到了目录列表及其说明。 / usr / lib 似乎是我存储程序信息的最佳位置,但我刚刚查看了我的VirtualBox VM,看来我不能写在那里,即使有root权限。所以,如果有人能指出我的方向非常好。

I've had a quick look around on the internet, and I've found a list of directories and their discriptions. /usr/lib seems to be the best place for me to store program information, but I've just looked in there on my VirtualBox VM and it appears that I can't write there, even with root permissions. So if anyone can point me in the right direction that would be brilliant.

我也注意到Linux拥有它自己的软件中心,我担心关于这一切,我可能会采用错误的方式,所以可能会对Linux上的编程进行某种介绍会有所帮助,如果有人愿意提供一个!

I have also noticed that Linux has it's own "Software Center", and I'm afraid that I may be going to wrong way about all this, so may be some sort of introduction to programming on Linux would help if anybody would be kind enough to provide one!

谢谢提前

PS我的虚拟机是一个Ubuntu发行版

PS My Virtual Machine is an Ubuntu distribution

推荐答案

不仅Linux的文件系统结构,而且任何与POSIX兼容的系统(包括BSD,Solaris,甚至在较小程度上甚至是Mac OS X)都标准化为 FHS 。特别是对于Ubuntu,请查看针对Java的Debian策略和ubuntu-java团队的打包指南

The file system structure of not only Linux, but any POSIX-compatible system (including BSD, Solaris, and to a lesser degree even Mac OS X) are standardized in the FHS. Specifically for Ubuntu, have a look at the Debian policy for Java and the packaging guide of the ubuntu-java team.

如果您的程序以交互方式运行,它应该在 $ HOME / .your-program-name <中存储信息(如数据库和设置) / strong>(或 $ HOME / .config / your-program-name )。如果您的程序是系统服务,它应该将其信息存储在 / var / lib 中。您还可以将默认配置安装到 / etc / your-program-name

If your program is run interactively, it should store information(like databases and settings) in $HOME/.your-program-name (or $HOME/.config/your-program-name). If your program is a system service, it should store its information in /var/lib. You can also install a default configuration into /etc/your-program-name.

二进制文件是一个整体不同的交易,其位置的前缀应该是可配置的。要充分利用软件中心及其依赖/更新机制,请打包您的软件。这些二进制文件(以及随附的库)将进入 / usr / 树(如果打包), / usr / local / 如果手动安装。无论前缀如何,二进制文件都进入 bin (即 / usr / bin ),库进入 lib32 / lib64 ,以及分享中的其他数据。

The binaries are a whole different deal, and a prefix to their location should be configurable. To get the full advantage of the Software Center and its dependency/update mechanisms, package your software. These binaries(and the libraries that go with them) will go into to /usr/ tree if packaged, and /usr/local/ if manually installed. No matter the prefix, binaries go into bin (i.e. /usr/bin), libraries into lib32/lib64, and other data into share.

如果您不想打包程序并且不想遵循FHS强加的结构(但您确实应该这样做),另一种方法是将代码和其他对象放入的/ opt /你的程序名。请注意,您的程序生成和操作的(可变)数据仍应进入 $ HOME / .your-program-name (交互式)或 / var / lib / your-program-name (service)。

If you don't want to package your program and don't want to follow the structure imposed by FHS (but you really should do that), the alternative is putting code and other objects into /opt/your-program-name. Note that the (mutable) data your program generates and operates on should still go into $HOME/.your-program-name(interactive) or /var/lib/your-program-name(service).

这篇关于何处以及如何在Linux中存储程序信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆