以前的用實驗室的服務器,由於某些緣由,使用的用戶沒有root權限。linux的非root用戶不少軟件沒法安裝,很是的不方便。個人方法是使用brew來代替系統的包管理工具。brew是最早用在mac上的包管理工具,能夠將全部的包託管在user本地的環境內。下面的文檔中運行的時候記得將用戶名改爲本身的。python
下載官方anaconda python安裝包(minicondo也行),將conda加入~/.bashrc的系統變量中(在安裝中會提示你運行 conda init,點yes就會直接複製到~/.bashrc中了)。這一步的目的是去安裝curl, curl是下載安裝brew必備的工具,此時curl會安裝在/home/username/anaconda3/bin中linux
conda install curl --use-local
建議這裏裝完再裝一個vim,方便文本編輯git
使用curl命令下載安裝brew,中間有一些錯誤不用管他,結束後輸入brew有返回就說明安裝成功github
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
以後將一下brew加入~/.bashrc中shell
export HOMEBREW_PREFIX="/home/username/.linuxbrew"; export HOMEBREW_CELLAR="/home/username/.linuxbrew/Cellar"; export HOMEBREW_REPOSITORY="/home/username/.linuxbrew/Homebrew"; export PATH="/home/username/.linuxbrew/bin:/home/username/.linuxbrew/sbin:$PATH"; export MANPATH="/home/username/.linuxbrew/share/man:$MANPATH"; export INFOPATH="/home/username/.linuxbrew/share/info:$INFOPATH";
此時保證brew已是一個能夠在終端被調用, 接下來是關鍵的一步vim
在/home/username/.linuxbrew/Homebrew/Library/Homebrew/brew.sh#L200上進行加上一行bash
if [[ -n "$HOMEBREW_FORCE_BREWED_CURL" && -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]] && "$HOMEBREW_PREFIX/opt/curl/bin/curl" --version >/dev/null then HOMEBREW_CURL="$HOMEBREW_PREFIX/opt/curl/bin/curl" elif [[ -n "$HOMEBREW_DEVELOPER" && -x "$HOMEBREW_CURL_PATH" ]] then HOMEBREW_CURL="$HOMEBREW_CURL_PATH" else HOMEBREW_CURL="curl" fi HOMEBREW_CURL="/home/username/anaconda/bin/curl" # 加上這一行!
而後輸入 brew install curl服務器
裝完以後brew.sh會自動抹去本身以前的修改 : ),而後brew就正式能用了curl
好比 brew install tmux, brew install htop,只有brew有的包均可以裝(參考包列表https://formulae.brew.sh/formula/)工具
若是brew裏面沒有某個包,須要本身編譯的話,通常的linux軟件包都是make編譯的,通常修改下configure而後再make && make install 就行了,以下三行命令:
./configure --prefix=/home/username/.local make make install # 若是要卸載 運行 make uninstall
最後分享下個人~/.bashrc
,其中 ~/.local/bin
和 ~/.local/lib
加到PATH裏面是爲了本身編譯安裝用的。
export PATH=~/.local/bin:$PATH export C_INCLUDE_PATH=$C_INCLUDE_PATH:~/.local/include export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:~/.local/include export LD_LIBRARY_PATH=~/.local/lib:$LD_LIBRARY_PATH # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! __conda_setup="$('/home/username/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" if [ $? -eq 0 ]; then eval "$__conda_setup" else if [ -f "/home/username/anaconda3/etc/profile.d/conda.sh" ]; then . "/home/username/anaconda3/etc/profile.d/conda.sh" else export PATH="/home/username/anaconda3/bin:$PATH" fi fi unset __conda_setup # <<< conda initialize <<< export HOMEBREW_PREFIX="/home/username/.linuxbrew"; export HOMEBREW_CELLAR="/home/username/.linuxbrew/Cellar"; export HOMEBREW_REPOSITORY="/home/username/.linuxbrew/Homebrew"; export PATH="/home/username/.linuxbrew/bin:/home/username/.linuxbrew/sbin:$PATH"; export MANPATH="/home/username/.linuxbrew/share/man:$MANPATH"; export INFOPATH="/home/username/.linuxbrew/share/info:$INFOPATH";