Spack - 自动化安装管理器

54 篇文章 25 订阅
23 篇文章 1 订阅
Spack是一个自动化包管理器,适用于Linux和MacOS,简化了安装、管理和更新工具如Python、GCC等的过程。它能自动处理依赖关系,自动生成modulefile,并通过哈希码确保安装的唯一性。在示例中,安装Python3.9.0仅需几条命令,大大提高了效率。
摘要由CSDN通过智能技术生成

Spack - 自动化安装管理器

我们有什么问题?

在日常支持中,我们可能需要安装Python、GCC等工具。通常步骤是

  • 找到官网,下载需要的包
  • 传到目的服务器
  • 解压
  • ./configure && make && make install

一圈下来,耗时不少。

Spack是什么?

它是一个自动化包管理器,支持管理Linux、MacOS上的包。

Spack能做什么?

Spack能使得上述步骤自动化,并自动生成modulefile(Environment Modules或Lmod的,都可以生成)——无论是对于广泛使用的开源包,还是有知识产权保护的有限范围分发包,还是处于研发阶段的内部包,它都能轻松搞定。

举例

本文以安装开源包Python为例,来感受一下自动安装的魅力,

先看已有的Python版本

[thesre@localhost ~]$ module avail python
-------------------------------------------- /app/spack-0.16.2/share/spack/modules/linux-centos7-sandybridge --------------------------------------------
python-3.8.6-gcc-9.4.0-x7ebx7b  
[thesre@localhost ~]$

安装Python 3.9.0

[thesre@localhost ~]$ spack -k install python@3.9.0
==> Warning: You asked for --insecure. Will NOT check SSL certificates.
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/libiconv-1.16-qp6xhw7243p2s3jrfygxcor3f723zy4y
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/libbsd-0.10.0-ot7ls7bw4butgierpa4cmjluqvsjoaji
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/pkgconf-1.7.3-vdqtrqwkkhqy3g4i5jjj3t3siptzpgxm
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/xz-5.2.5-ds3jrbkvzlrnklirwgnagoj67ngbx6gb
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/zlib-1.2.11-wrpx7fqamc562dxcn3qwyl5dzfswl5qh
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/libffi-3.3-s7scryukxbekp7u3hlq5czx5fyz2cyzi
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/libuuid-1.0.3-rssfovgso7ojag5ybguj4qpoptzyliab
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/berkeley-db-18.1.40-gfcdrmlydcd4smrmzkziudw6zedihsmv
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/diffutils-3.7-qhfscuxrwvf5y3y3jywz5fiqqgvy6wvj
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/tar-1.32-n6b45i35ks4is5u5taaqd6mzfw44fzlk
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/expat-2.2.10-cal2lrbnkmhqomqhpw4buidkwd256fvu
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/ncurses-6.2-idwc6kcoigxcy43iau4bmlvkocu4olg5
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/libxml2-2.9.10-miqastwta7pzpo4nvqt2bwnkyohwute7
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/bzip2-1.0.8-bt2hrgk32n4zue4w53q4ev7ylidvyv6e
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/readline-8.0-cf4ys6umtgnbq42uxy55ar6yrko2cae5
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/gettext-0.21-cnwqlvg22ivf2a6cygxcphkmx4l5m36p
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/sqlite-3.33.0-wbvmbd6rjewg6fqpciwa72slwpbinhac
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/gdbm-1.18.1-brzlhvhm5mppt7aml2yqz5tlztqrolne
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/perl-5.32.0-gg2xi5suigorukjnv3irvkgv6ebsb2st
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/openssl-1.1.1h-7p3yykxrgamue5lapcnfeh5zhkhohipr
==> Installing python-3.9.0-wz6q56w5ytjm5mh2us44r2df5ntcwvfl
==> No binary for python-3.9.0-wz6q56w5ytjm5mh2us44r2df5ntcwvfl found: installing from source
==> Using cached archive: /app/spack-0.16.2/var/spack/cache/_source-cache/archive/df/df796b2dc8ef085edae2597a41c1c0a63625ebd92487adaef2fed22b567873e8.tgz
==> python: Executing phase: 'autoreconf'
==> python: Executing phase: 'configure'
==> python: Executing phase: 'build'
==> python: Executing phase: 'install'
[+] /app/spack-0.16.2/opt/spack/linux-centos7-sandybridge/gcc-9.4.0/python-3.9.0-wz6q56w5ytjm5mh2us44r2df5ntcwvfl
[thesre@localhost ~]$ 

可以看到多了一个版本,是刚刚安装的Python 3.9.0,其modulename为python-3.9.0-gcc-9.4.0-wz6q56w

[thesre@localhost ~]$ module avail python
-------------------------------------------- /app/spack-0.16.2/share/spack/modules/linux-centos7-sandybridge --------------------------------------------
python-3.8.6-gcc-9.4.0-x7ebx7b  python-3.9.0-gcc-9.4.0-wz6q56w  

Spack简介

101资料:https://spack-tutorial.readthedocs.io/en/latest/#tutorial-spack-101

spack能为

  • OS版本
  • 架构
  • 包版本
  • 不同编译器
  • 包本身的不同编译选项

的组合自动生成依赖DAG(单向无环图),并为安装的每一个包名自动打上哈希码,以确保不会冲突。
以上面例子为例,安装Python 3.9.0,并装上了其n个依赖包(全都已经安装好了的)。假如将上述组合中的任何一个更改,都会生成一个新的DAG。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

王万林 Ben

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值