MAC環境裝機

一、ohmyz.sh

1.官網下載安裝iterm2
2.安裝ohmyz.sh
curl 安裝

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

或者wget 安裝

sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

3.將zsh設置爲默認shell
3.1檢查是否是默認
若下面命令輸出/bin/zsh則zsh是默認/若是brew安裝則輸出/usr/local/bin/zsh

echo $SHELL

3.2設爲默認

chsh -s /bin/zsh

若路徑是/usr/local/bin/zsh則下面路徑改爲對應的
若不知道路徑which zsh
3.3自動補全插件
下載該插件到.oh-my-zsh的插件目錄

cd ~/.oh-my-zsh/plugins
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

open ~/.zshrc
找到plugins=(git)這一行,如果沒有添加。更改爲如下
plugins=(git zsh-autosuggestions)
4.idea使用zsh
在這裏插入圖片描述

二、go

官網https://golang.google.cn/dl/
一鍵安裝

which go
/usr/local/go/bin/go

http://medeming.com/
http://idea.medeming.com/jets/

三、java

1.官網
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
sudo vi /etc/profile
修改環境變量

四、Git安裝

1.檢查git是否安裝
輸入git會提示安裝x-code

git

2.安裝git
3.配置用戶
git config --list 查看用戶信息
git config --global user.name xxx

五、Redis

1.官網下載
https://redis.io/download
2.把解壓文件copy到/usr/local/
3.進入文件

$ sudo make test 
$ sudo make install 

若sudo make test有報錯就再執行一遍sudo make test就ok了
啓動redis

redis-server

六、Ngrok安裝

1.官網下載
https://ngrok.com/download
在這裏插入圖片描述
2.解壓
3…/ngrok http localhost:8080
其他人訪問https://2220a1ce.ngrok.io便會自動映射到本地的http://localhost:8080
在這裏插入圖片描述

七、lrzsz 遠程文件上傳下載

1.安裝iTerm2
第一條有官網下載地址
2.brew安裝
先安裝brew,再用brew安裝lrzsz

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install lrzsz

3.配置lrzsz
(1)在cd /usr/local/bin創建兩個文件

cd /usr/local/bin
vim iterm2-recv-zmodem.sh
vim iterm2-send-zmodem.sh

iterm2-recv-zmodem.sh內容如下

#!/bin/bash
# Author: Matt Mastracci ([email protected])
# AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
# licensed under cc-wiki with attribution required
# Remainder of script public domain

osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; then
   FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
else
   FILE=`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
fi

if [[ $FILE = "" ]]; then
   echo Cancelled.
   # Send ZModem cancel
   echo -e \\x18\\x18\\x18\\x18\\x18
   sleep 1
   echo
   echo \# Cancelled transfer
else
   cd "$FILE"
   /usr/local/bin/rz -E -e -b
   sleep 1
   echo
   echo
   echo \# Sent \-\> $FILE
fi

iterm2-send-zmodem.sh內容

#!/bin/bash
# Author: Matt Mastracci ([email protected])
# AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
# licensed under cc-wiki with attribution required
# Remainder of script public domain

osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; then
    FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
else
    FILE=`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
fi
if [[ $FILE = "" ]]; then
    echo Cancelled.
    # Send ZModem cancel
    echo -e \\x18\\x18\\x18\\x18\\x18
    sleep 1
    echo
    echo \# Cancelled transfer
else
    /usr/local/bin/sz "$FILE" -e -b
    sleep 1
    echo
    echo \# Received $FILE
fi

(2)給剛剛的配置文件授權

chmod +777 iterm2-*

(3)配置iterm2
點擊 iTerm2 的設置界面 Perference-> Profiles -> Default -> Advanced -> Triggers 的 Edit
新加兩條

Regular expression: rz waiting to receive.\*\*B0100
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-send-zmodem.sh
 
Regular expression: \*\*B00000000000000
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-recv-zmodem.sh

4.使用
rz 上傳功能
在bash中,也就是iTerm2終端輸入rz 就會彈出文件選擇框,選擇文件 choose 就開始上傳,會上傳到當前目錄
sz 下載功能
sz fileName(你要下載的文件的名字) 回車
會彈出窗體 我們選擇要保存的地方即可

八、 常用指令備註

ssh遠程登錄跳板機
ssh -p[端口] zora.xiao@[ip]
open ~/.zshrc
https://blog.csdn.net/u011886447/article/details/73268407

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章