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

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