开发环境搭建——HomeBrew安装Nginx、Mysql、php(Mac篇)
2018年10月03日11:00:54 XXM
1.首先我们需要安装一个Xcode
xcode-select --install
2.安装HomeBrew Xcode安装完成后,我们开始安装brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3.安装Nginx
brew install nginx
安装完成后启动nginx
sudo nginx
开机自启动nginx:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/nginx/1.13.12/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
4.安装PHP
brew install php72 --whitout-apache --with-imap --with-tidy --with-debug --with-pgsql --with-mysql --with-fpm
安装完成重新打开终端
php -v 查看是否为7.2.0以上版本
开机自启动
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/php/7.2.5/homebrew.mxcl.php.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php.plist
5.安装mysql
brew install mysql
安装好之后,mysql 的 root 用户默认是空密码,首先设置密码:
mysql_secure_installation
设置完成后 测试连接
mysql -u root -p 如果可以正常访问mysql即为安装成功
开机启动mysql
mkdir -p ~/Library/LaunchAgents/
cp /usr/local/Cellar/mysql/5.7.22/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
这个人暂时没有 freestyle