-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision.sh
59 lines (46 loc) · 1.7 KB
/
provision.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
echo 'Start!'
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
cd /vagrant
sudo apt-get update
sudo apt-get install tree
# 安装配置mysql8
if ! [ -e /vagrant/mysql-apt-config_0.8.15-1_all.deb ]; then
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
fi
sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb
sudo DEBIAN_FRONTEND=noninteractivate apt-get install -y mysql-server
sudo apt-get install -y libmysqlclient-dev
if [ ! -f "/usr/bin/pip" ]; then
sudo apt-get install -y python3-pip
sudo apt-get install -y python-setuptools
sudo ln -s /usr/bin/pip3 /usr/bin/pip
else
echo "pip3 已安装"
fi
# 升级pip,目前存在问题,read timed out,看脸,有时候可以,但大多时候不行
# python -m pip install --upgrade pip
# 换源完美解决
# 安装pip所需依赖
pip install --upgrade setuptools -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install --ignore-installed wrapt -i https://pypi.tuna.tsinghua.edu.cn/simple
# 安装pip最新版
pip install -U pip -i https://pypi.tuna.tsinghua.edu.cn/simple
# 根据 requirements.txt 里的记录安装 pip package,确保所有版本之间的兼容性
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
# 设置 mysql 的 root 账户的密码为 yourpassword
# 创建名为twitter的数据库
sudo mysql -u root << EOF
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
flush privileges;
show databases;
CREATE DATABASE IF NOT EXISTS twitter;
EOF
# fi
# 如果想直接进入/vagrant路径下
# 请输入vagrant ssh命令进入
# 手动输入
# 输入ls -a
# 输入 vi .bashrc
# 在最下面,添加cd /vagrant
echo 'All Done!'