The Homebrew package manager for Linux
将以下命令粘贴到命令行中运行:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
安装脚本可能会使用sudo将Linuxbrew安装到/home/linuxbrew/.linuxbrew
,也可能会安装到 ~/.linuxbrew
的主目录中。Linuxbrew在安装后不使用sudo。使用/home/linuxbrew/.linuxbrew
可以使用比安装在个人主目录中更多的二进制包(瓶子)。
按照“下一步”的说明将Linuxbrew添加到您的 PATH
和bash shell配置文件脚本中,可以在Debian/Ubuuntu上添加~/.profile
,也可以在CentOS/Fedora/RedHat上添加 ~/.bash_profile
。
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
source ~/.profile
现在,尝试安装程序包:
brew install hello
如果您使用的是较旧版本的Linux,安装第一个软件包也会安装最新版本的glibc和gcc。
brew shellenv
打印导出语句。在shell中运行它们,Homebrew的安装将包含在您的PATH、MANPATH和INFOPATH中。HOMEBREW_PREFIX、HOMEBREW_CELLAR和HOMEBREW_REPOSITORY也会被导出以保存这些变量的多个查询。
您也可以考虑使用eval$(brew shellenv)
在dotfiles中添加评估输出。
brew shellenv
export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew"
export HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar"
export HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew"
export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH"
export MANPATH="/home/linuxbrew/.linuxbrew/share/man:$MANPATH"
export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:$INFOPATH"
brew install xxx
安装xxx软件
brew uninstall xxx
卸载xxx软件
brew search xxx
搜索xxx软件
假如用linuxbrew
安装的Python
会替换系统默认的Python
。
如需还原则需要将~/.profile
文件中的eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
这一行屏蔽:
# linuxbrew
#eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
然后重启电脑.