brew
brew是一个类似于apt-get(ubuntu)和yum install(centos)的包管理工具。
安装:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
如果慢可以更换国内源:
#下载脚本
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
#替换国内源
BREW_REPO = “https://github.com/Homebrew/brew“.freeze
BREW_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git".freeze
#执行
chmod 777 brew_install
./brew_install
使用:
brew install xxx //安装
brew uninstall xxx /卸载
brew list //清单
brew update xxx //更新
一.安装nginx:
brew install nginx
开机启动:
mkdir -p ~/Library/LaunchAgentsln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
//启动:
brew services start nginx
//修改配置后重新加载生效
nginx -s reload
// 查看nginx所有的配置
nginx -T
// 停止nginx服务
brew services stop nginx
// 重启动nginx服务
brew services restart nginx
配置文件目录:/usr/local/etc/nginx/nginx.conf
二.安装PHP:
brew install php
查看现有的php版本:
brew search php
默认安装的是最新的8.1,如果想安装7.3的版本
brew install php@7.3
查看php.ini目录
php --ini
三.安装MySQL
brew install mysql
设置密码:
mysqladmin -u root password 'xxx'
4.安装Redis:
brew install redis
#Redis默认配置文件不允许以Deamon方式运行,因此需要先修改配置文件
vim /usr/local/etc/redis.conf
#将daemonize修改为yes,然后载入配置文件即可实现后台进程启动
redis-server /usr/local/etc/redis.conf
#加入开机启动
cp /usr/local/Cellar/redis/2.8.19/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
已有0条评论