我尝试在 CentOS 7 上安装 brew 并收到以下错误:
[jalal@goku ~]$ git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew
Cloning into '/home/grad3/jalal/.linuxbrew/Homebrew'...
remote: Enumerating objects: 418, done.
remote: Counting objects: 100% (418/418), done.
remote: Compressing objects: 100% (231/231), done.
remote: Total 178024 (delta 237), reused 341 (delta 176), pack-reused 177606
Receiving objects: 100% (178024/178024), 46.71 MiB | 22.72 MiB/s, done.
Resolving deltas: 100% (132086/132086), done.
Checking out files: 100% (2559/2559), done.
[jalal@goku ~]$ mkdir ~/.linuxbrew/bin
mkdir: cannot create directory ‘/home/grad3/jalal/.linuxbrew/bin’: File exists
[jalal@goku ~]$ ln -s ~/.linuxbrew/Homebrew/bin/brew ~/.linuxbrew/bin
ln: failed to create symbolic link ‘/home/grad3/jalal/.linuxbrew/bin/brew’: File exists
[jalal@goku ~]$ eval $(~/.linuxbrew/bin/brew shellenv)
Error: Unknown command: shellenv
有没有在 CentOS 7 中安装 brew 的其他方法或者我如何解决这个问题?
我按照这里的说明进行操作https://docs.brew.sh/Homebrew-on-Linux
$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.9.2009 (Core)
Release: 7.9.2009
Codename: Core
答案1
我不知道 Homebrew 可以在 Linux 上运行。但显然它可以!
似乎这些是官方说明您的参考资料表明,在执行步骤之前,您需要安装一些先决条件。只需运行这两个命令,您就应该可以了:
sudo yum groupinstall 'Development Tools'
sudo yum install curl file git
然后运行以下命令:
git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew
mkdir ~/.linuxbrew/bin
ln -s ~/.linuxbrew/Homebrew/bin/brew ~/.linuxbrew/bin
eval $(~/.linuxbrew/bin/brew shellenv)
也就是说,如果您已遵循这些说明但仍然有问题,我建议您删除~/.linuxbrew/bin
如下内容:
rm -rf ~/.linuxbrew/
然后按照步骤重新安装。我建议这样做的原因是查看命令输出末尾的错误消息链:
[jalal@goku ~]$ mkdir ~/.linuxbrew/bin
mkdir: cannot create directory ‘/home/grad3/jalal/.linuxbrew/bin’: File exists
[jalal@goku ~]$ ln -s ~/.linuxbrew/Homebrew/bin/brew ~/.linuxbrew/bin
ln: failed to create symbolic link ‘/home/grad3/jalal/.linuxbrew/bin/brew’: File exists
[jalal@goku ~]$ eval $(~/.linuxbrew/bin/brew shellenv)
Error: Unknown command: shellenv
我猜是你的安装失败了mkdir: cannot create directory ‘/home/grad3/jalal/.linuxbrew/bin’: File exists
,因此命令无法正常运行。只需放弃~/.linuxbrew/
并重新安装,它就可以正常工作。
请记住,为您的用户安装这样的东西 - 在下面~/.linuxbrew/
- 很容易删除和重新安装,所以这始终是一个安全的选择。