Mac开发环境配置
这是我的第一篇文章,作为程序员,首先要做得第一件事情,就是配置好开发环境,因为我使用的是 Mac 开发环境,所以,这篇文章主要是基于 Mac 操作系统,记录开发环境搭建过程。
重装系统后设置
$ git clone https://github.com/chensoul/dotfiles.git
$ cd dotfiles
$ ./install.sh
安装插件
Idea 插件
- .ignore
- Atom Material Icons
- InlineProblems
- Laconic POM for Maven
- plantar-java-format
- Maven Helper
- Rainbow Brackets
Chrome 插件
- JsonVue
- 1Password
- Inoreader
安装其他软件
安装 MySQL
安装 MySQL:
# 搜索可以安装的版本
➜ brew search mysql
# 安装对应的版本
➜ brew install [email protected]
# 写入环境变量
echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
# 为了让编译器找到 [email protected] 还需要写入
echo 'export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"' >> ~/.zshrc
echo 'export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"' >> ~/.zshrc
# 为了让 pkg-config 找到 [email protected] 还需要写入
echo 'PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig"' >> ~/.zshrc
MySQL 服务相关:
# 查看 MySQL 服务状态
➜ brew services info [email protected]
➜ mysql.server status
# 启动 MySQL 服务
➜ brew services start [email protected]
➜ mysql.server start
# 重启 MySQL 服务
➜ brew services restart [email protected]
➜ mysql.server restart
# 停止 MySQL 服务
➜ brew services stop [email protected]
➜ mysql.server stop
接着初始化 MySQL 设置,主要配置一下 root 密码已经是否远程登录登,根据提示来操作就行了:
mysql_secure_installation
数据库外连,这是个可选操作 根据自己的实际情况自行决定是否开启(有被攻击的风险):
mysql > grant all on *.* to root@'%' identified by '你设置的密码' with grant option;
mysql > flush privileges;
安装 Redis
# 安装 redis
➜ brew install redis
# 查看 redis 服务状态
➜ brew services info redis
# 启动 redis 服务端
➜ brew services start redis
# 启动 redis 客户端
➜ redis-cli
# 编辑默认配置文件
➜ sudo vim /opt/homebrew/etc/redis.conf
系统备份
1、备份 maven 仓库:
zip -r m2.zip ~/.m2
2、备份代码空间
find ~/codes -type d -name "target" -exec rm -rf {} +
zip -r codes.zip ~/codes