当前位置:   article > 正文

Linuxbrew安装及使用介绍_linux安装brew

linux安装brew

Linuxbrew安装

The Homebrew package manager for Linux

安装linuxbrew

将以下命令粘贴到命令行中运行:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
  • 1

安装脚本可能会使用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
  • 1
  • 2
  • 3
  • 4
  • 5

现在,尝试安装程序包:

brew install hello
  • 1

如果您使用的是较旧版本的Linux,安装第一个软件包也会安装最新版本的glibc和gcc。

linuxbrew必装包

  • git
  • wget
  • vim

brew常用命令

  • brew shellenv
    打印导出语句。在shell中运行它们,Homebrew的安装将包含在您的PATH、MANPATH和INFOPATH中。HOMEBREW_PREFIX、HOMEBREW_CELLAR和HOMEBREW_REPOSITORY也会被导出以保存这些变量的多个查询。
    您也可以考虑使用eval$(brew shellenv)在dotfiles中添加评估输出。

    brew shellenv
    
    • 1
    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"
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
  • brew install xxx
    安装xxx软件

  • brew uninstall xxx
    卸载xxx软件

  • brew search xxx
    搜索xxx软件

linuxbrew注意事项

假如用linuxbrew安装的Python会替换系统默认的Python
如需还原则需要将~/.profile文件中的eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)这一行屏蔽:

# linuxbrew
#eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
  • 1
  • 2

然后重启电脑.


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/414585
推荐阅读
相关标签
  

闽ICP备14008679号