3

linuxbrew让你在home目录下安装应用

 3 years ago
source link: https://www.lujun9972.win/blog/2018/11/27/linuxbrew%E8%AE%A9%E4%BD%A0%E5%9C%A8home%E7%9B%AE%E5%BD%95%E4%B8%8B%E5%AE%89%E8%A3%85%E5%BA%94%E7%94%A8/index.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

linuxbrew让你在home目录下安装应用

普通用户想安装应用往往比较麻烦,他们没有写入 /etc/,/bin/,/sbin/ 等重要目录的权限,只能在configure时通过 --prefix=$HOME 来将应用安装在HOME目录下。

linuxbrew是著名MacOS包管理器homebrew的linux版,它可以让你很方便地安装应用到HOME目录下。

安装linuxbrew

  1. 安装linuxbrew

    sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
    
  2. 设置环境变量

    echo 'export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin/:$PATH"' >>~/.bashrc
    echo 'export MANPATH="/home/linuxbrew/.linuxbrew/share/man:$MANPATH"' >>~/.bashrc
    echo 'export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:$INFOPATH"' >>~/.bashrc
    
  3. 应用新设置的环境变量

    source ~/.bashrc
    

使用linuxbrew

运行 brew --help 就能列出帮助信息:

Example usage:
  brew search [TEXT|/REGEX/]
  brew info [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]

Troubleshooting:
  brew config
  brew doctor
  brew install --verbose --debug FORMULA

Contributing:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]

Further help:
  brew commands
  brew help [COMMAND]
  man brew
  https://docs.brew.sh

比较常用的操作如下所示

brew search nano
==> Formulae
nano                           nanomsg                        nanomsgxx                      nanopb-generator
brew install flac123
==> Installing dependencies for flac123: patchelf, m4, autoconf, automake, libogg, flac, libtool, pkg-config, libao and popt
==> Installing flac123 dependency: patchelf
==> Downloading https://linuxbrew.bintray.com/bottles/patchelf-0.9_1.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring patchelf-0.9_1.x86_64_linux.bottle.tar.gz
🍺  /home/lujun9972/.linuxbrew/Cellar/patchelf/0.9_1: 6 files, 1.2MB
==> Installing flac123 dependency: m4
==> Downloading https://linuxbrew.bintray.com/bottles/m4-1.4.18.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring m4-1.4.18.x86_64_linux.bottle.tar.gz
🍺  /home/lujun9972/.linuxbrew/Cellar/m4/1.4.18: 13 files, 1.1MB
==> Installing flac123 dependency: autoconf
....

列出已安装的应用

brew list
autoconf  automake  flac  flac123  gpatch  libao  libogg  libtool  m4  ncurses	patchelf  pkg-config  popt  zlib
brew uninstall flac123
Uninstalling /home/lujun9972/.linuxbrew/Cellar/flac123/0.0.12... (8 files, 63.1KB)

升级linuxbrew

brew update
Already up-to-date.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK