GHC 无需 Root 即可安装
所以我想设置一台用于 Haskell 开发的 Linux 机器,但有一个巨大的警告——这台机器上没有 root 权限。当然,我们最终可以让管理员为我们安装 GHC。然而,从长远来看,当我们想要升级等时,我们需要麻烦他们。所以最好在用户空间中完成所有事情。这也意味着我们还需要在用户空间中安装我们链接到的 c 库等,以使一切尽可能顺利。
所以,问题是,从头到尾,我该如何进行 GHC 的纯用户态安装?该机器将有 gcc 和常用的工具链。如果有必要,我们可以从典型的 ghc 安装开始,但最好不要这样做。
此外,任何有关管理此类环境的提示都将受到赞赏,特别是涉及如何使用多个开发人员/帐户管理此类设置。
So I'd like to set up a linux machine for Haskell development with one huge caveat -- no root privs on this machine. We could of course get the admins to install GHC for us, eventually. However, in the long-term then we need to hassle them when we want to upgrade, etc. So much better to do everything in userland. Which also means that we'll want to install c libs we link to in userland as well, etc. to keep everything as hassle-free as possible.
So, the question is, how, soup-to-nuts, would I go about doing a purely userland install of GHC? The machine will have gcc, and the usual toolchain. If necessary, we can start with a typical ghc install to get the ball rolling, but it would be nice not to.
Additionally, any tips on managing an environment like this would be appreciated, especially involving how such a setup can be manageable with multiple devs/accounts.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我也做了这个。我创建了一个目录
~/usr
并将--prefix=$HOME/usr
传递给所有配置脚本。使用 Haskell 平台使这个过程更加顺利。I did this too. I created a directory
~/usr
and passed--prefix=$HOME/usr
to all configure scripts. Using the Haskell Platform makes this process even smoother.显然,您需要一个所有相关用户至少具有读取权限的目录。比如说 /home/foo,带有子目录 bin、lib、share、.cabal。然后
./configure --prefix=/home/foo
并制作 && make install,并确保 /home/foo/* 在每个人的 PATH、LIBRARY_PATH 等中位于 /usr/* 之前。您可能应该从在那里安装 gcc 和 c-libs 开始,当所有 C 都安装完毕后,安装 ghc。You obviously need a directory that all pertinent users have at least read permission on. Say /home/foo, with subdirectories bin, lib, share, .cabal. Then
./configure --prefix=/home/foo
and make && make install, and make sure that /home/foo/* is before /usr/* in everybody's PATH, LIBRARY_PATH etc. You should probably start with installing gcc and c-libs there, and when everything C is installed, install ghc.我设法通过堆栈安装 ghc 按照这些说明。它就像一种魔咒一样起作用。我唯一需要做的额外事情是安装GMP 库并将其添加到
LD_LIBRARY_PATH.
I managed to install ghc through stack by following these instructions. It worked like a charm; the only additional thing I had to do was to install the GMP library and to add it to the
LD_LIBRARY_PATH
.如果您想使用堆栈安装
ghc
或ghci
,请按照 本官方手册:tar.gz
文件(curl
/wget
/甚至scp
都可以将本地文件上传到远程服务器)tar xvzf 并进入文件夹 test if
./stack
runproperly到
~/.bashrc
每次启动终端时,执行
source ~/.bashrc
code>ghci
它将安装
ghci
自动并启动它。If you want to use stack to install
ghc
orghci
, follow this offical manual:tar.gz
file from the release link (curl
/wget
/evenscp
can upload your local file to a remote server)tar xvzf
and enter the folder test if./stack
run properlyto
~/.bashrc
Every time you start the terminal, do
source ~/.bashrc
ghci
locallyIt will install
ghci
automatically and launch it.