[coucou项目]|[coucou项目] mac初始化开发环境配置

环境介绍

cat/etc/issue

Ubuntu 16.04.3 LTS \n \l
python -V

3.5.2
安装brew
refer:https://treehouse.github.io/installation-guides/mac/homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew 修改为清华源
refer: https://lug.ustc.edu.cn/wiki/mirrors/help/brew.git
替换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

brew install vagrant
brew cask install vagrant

安装 virtualbox
由于国内网速太慢。可以选择迅雷下载。
但是,仍然很慢。
安装vagrant box
mac 直接下载安装软件即可。
地址
https://mirrors.tuna.tsinghua.edu.cn/virtualbox/

选择最后那个dmg文件即可。
start vagrant
mkdir coucou cd coucouvagrant init ubuntu/trusty64 vim Vagrantfile

然后把下面的内容给替换掉
config.vm.box = "download/path.box"
config.vm.network "forwarded_port", guest: 80, host: 80
config.vm.synced_folder "/Users/xy/Data/", "/home/ubuntu/workspace"
config.vm.provider "virtualbox" do |v|
v.memory = 8192
end
vagrant up vagrant ssh

ubuntu 环境配置
create user 'dbu'@'localhost' identified by 'dddd'; grant all privileges on *.* to dbu@'localhost' identified by 'dddd'; flush privileges; show grants for 'dbu';

mysql -udbu -p coucou

python环境配置
sudo apt-get install -y unzip sudo apt-get install libmysqlclient-dev sudo apt-get install -y python-pip pip install --upgrade pip sudo pip install virtualenvwrapper echo "export WORKON_HOME=$HOME/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc source ~/.bashrc mkvirtualenv coucou -p python3 mkvirtualenv py2sudo pip install MySQL-python sudo apt-get install python-pip python-dev libmysqlclient-dev pip install mysqlclient

下载项目

Vim编辑器配置 refer
运行
curl -Lo ~/.vimrc https://j.mp/re-vim

然后进入vim 运行
:PlugInstall

碰到的问题 git 无法clone
git clone失败的原因找到了,remote_url默认的端口应该是10080,而不是22。
解决方式:~/.ssh 新建名为config文件
添加一下内容
Host gitlab
Hostname 54.95.90.120
Port 10080
【[coucou项目]|[coucou项目] mac初始化开发环境配置】然后 git clone git@gitlab:RD/coucou_web_backend.git

    推荐阅读