1. 程式人生 > >mac 環境的brew及其他軟體的安裝

mac 環境的brew及其他軟體的安裝

brew相當於linux下的yum,能非常方便得管理各種軟體包,這裡整理一下brew安裝及其他軟體的安裝。

brew的安裝:

1.開啟命令列工具

2.安裝brew   命令為:ruby -e "$(curl --insecure -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3.如網路不行,出現錯誤,就先解除安裝之前的安裝  命令為:ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

4.再次重複2步驟 

5.安裝成功 ,輸入brew -v命令,如果有版本顯示則說明安裝成功,如果提示-bash: brew: command not found mac  則需要執行

sudo vim .bash_profile

並加入配置export PATH=/usr/local/bin:$PATH,最後source .bash_profile使配置修改生效,這樣就安裝完了brew。

6.如果覺得官方太慢,可以切換國內映象,使用的比較多的就是中科大的源

(1)替換預設源 
第一步:替換brew.git

cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
第二步:替換homebrew-core.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
cd 
brew update
(2)替換Homebrew Bottles源

對於bash使用者:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

 

 

brew下的mysql安裝:

1.$ brew install mysql

2.開啟或關閉mysql命令   mysql.service start(stop)

3.配置mysql資訊($ mysql_secure_installation)

Press y|Y for Yes, any other key for No: N   // 這個選yes的話密碼長度就必須要設定為8位以上
New password:             // 設定密碼
Re-enter new password:     // 再一次確認密碼
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y    // 移除不用密碼的那個賬戶
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n  //不接受root遠端登入賬號
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y  //刪除text資料庫

4.mysql8 navicat 連線 mysql 出現Client does not support authentication protocol requested by server解決方法:

USE mysql; 
alter user ‘root’@’localhost’ identified with mysql_native_password by ‘root’; 
FLUSH PRIVILEGES;

5.之後開啟或關閉命令可以用:

# 啟動 mysql, 並設定為開機啟動
brew services start mysql
# 關閉 mysql
brew services stop mysql
# 重啟 mysql
brew services restart mysql

 

 

brew安裝redis

1.$ brew install redis

2.$ redis-server  啟動redis服務

 

brewa安裝zookeeper

1.$ brew install zookeeper

2$ zkServer start stop 開啟或關閉服務  zkServer status  檢視狀態