Linuxbrew安装及使用介绍

Posted prince_zxill

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linuxbrew安装及使用介绍相关的知识,希望对你有一定的参考价值。

Linuxbrew安装及使用介绍

Linuxbrew安装

The Homebrew package manager for Linux

安装linuxbrew

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

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。

linuxbrew必装包

  • git
  • wget
  • vim

brew常用命令

  • 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注意事项

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

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

然后重启电脑.


Ubuntu安装及卸载brew

网站:http://linuxbrew.sh/

一、安装:

不能在root下运行

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

- Add Linuxbrew to your PATH

    PATH="/home/ubuntu/.linuxbrew/bin:$PATH"

- We recommend that you install GCC by running:

    brew install gcc

- Run `brew help` to get started

- Further documentation: 

    https://docs.brew.sh

Warning: /home/ubuntu/.linuxbrew/bin is not in your PATH.

设置路径:

$PATH="/home/ubuntu/.linuxbrew/bin:$PATH"

二、卸载:

$/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" 

The following possible Homebrew files were not deleted:

/home/ubuntu/.linuxbrew/share/

/home/ubuntu/.linuxbrew/etc/

/home/ubuntu/.linuxbrew/lib/

/home/ubuntu/.linuxbrew/var/

You may wish to remove them yourself.

需要手动删除文件夹:

$rm -r -f /home/ubuntu/.linuxbrew

 

以上是关于Linuxbrew安装及使用介绍的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu安装及卸载brew

markdown 如果你已经在Mac OS X或Linuxbrew上通过Homebrew安装了Node,那么如何修复npm的说明

ubuntu 安装home-brew.

Goreplay开源工具的介绍,安装及使用 (Linux)

26.linux磁盘使用及文件管理系统介绍

26.linux磁盘使用及文件管理系统介绍