安装下载为 .tar 文件的程序

1 linux software-installation linux-mint

我是运行 Mint 17.3 的新 Linux 用户。我想安装我作为 .tar 文件下载的程序。我提取了 .tar 的内容。现在我看到文件夹:

programname/lib
programname/bin
programname/include
Run Code Online (Sandbox Code Playgroud)

这些文件夹中有文件,但看起来不像安装文件。我不知道从哪里开始安装这个程序。任何帮助都会很棒。

iga*_*gal 5

简答

看起来您的下载包含一组预编译文件。为了“安装”它们,您只需将每个文件复制或移动到适当的位置。

在这种情况下,您可能只想将 的每个子目录中的所有文件复制smartcash-1.0.0到 的相应子目录中/usr/local,例如:

cp -i smartcash-1.0.0/bin/* /usr/local/bin
cp -i smartcash-1.0.0/include/* /usr/local/include
cp -i smartcash-1.0.0/lib/* /usr/local/lib
Run Code Online (Sandbox Code Playgroud)

就是这样。一旦你这样做了,你应该能够运行四个新命令:

smartcash-cli
smartcash-qt
smartcash-tx
smartcashd
Run Code Online (Sandbox Code Playgroud)

长答案

这是我试图弄清楚您正在处理的内容所做的工作。首先,我下载了 TAR 存档:

wget 'https://smartcash.cc/wp-content/uploads/2017/11/smartcash-1.0.0-x86_64-linux-gnu.tar.gz'
Run Code Online (Sandbox Code Playgroud)

然后我解压了存档:

tar xzf smartcash-1.0.0-x86_64-linux-gnu.tar.gz
Run Code Online (Sandbox Code Playgroud)

然后我查看了结果目录:

tree smartcash-1.0.0
Run Code Online (Sandbox Code Playgroud)

这是来自的输出tree

smartcash-1.0.0
|-- bin
|   |-- smartcash-cli
|   |-- smartcash-qt
|   |-- smartcash-tx
|   `-- smartcashd
|-- include
|   `-- bitcoinconsensus.h
`-- lib
    |-- libbitcoinconsensus.so -> libbitcoinconsensus.so.0.0.0
    |-- libbitcoinconsensus.so.0 -> libbitcoinconsensus.so.0.0.0
    `-- libbitcoinconsensus.so.0.0.0
Run Code Online (Sandbox Code Playgroud)

看起来我们有一些预编译的可执行程序(在 'bin/' 子目录中)、一些共享库(在lib/子目录中)和一个头文件(在include子目录中)。

通常,您可能希望将可执行文件放入路径中的目录中。要查看 PATH 中的目录,您可以运行以下命令:

(IFS=:; for path in ${PATH[@]}; do echo "${path}"; done)
Run Code Online (Sandbox Code Playgroud)

输出可能如下所示:

/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
Run Code Online (Sandbox Code Playgroud)

放置这些的典型位置是/usr/local/bin. 您可以使用如下命令:

cp -i smartcash-1.0.0/bin/* /usr/local/bin
Run Code Online (Sandbox Code Playgroud)

共享库文件应位于共享库搜索路径中的目录中。要查看您的共享库搜索路径是什么,您应该检查/etc/ld.so.conf配置文件。这是我的:

include /etc/ld.so.conf.d/*.conf
Run Code Online (Sandbox Code Playgroud)

所以它包括/etc/ld.so.conf.d目录中的配置文件。检查该目录的内容(即cat /etc/ld.so.conf.d/*)会显示以下目录列表:

/usr/lib/x86_64-linux-gnu/libfakeroot
/usr/local/lib
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
Run Code Online (Sandbox Code Playgroud)

所以我会把文件放在/usr/local/lib目录中,例如:

cp -i smartcash-1.0.0/lib/* /usr/local/lib
Run Code Online (Sandbox Code Playgroud)

有关将共享库放在哪里的进一步讨论,您可能需要参考以下帖子:

最后,/usr/local/include为了一致性起见,您可能希望将头文件放入其中,例如:

cp -i smartcash-1.0.0/include/* /usr/local/include
Run Code Online (Sandbox Code Playgroud)