Centos7 Flask环境搭建

===========================
centos7.3安装mysql

前期工作

cd /home
mkdir liuxiawei
cd liuxiawei
mkdir server
mkdir tools
cd tools

1.检测是否已经安装mysql服务

rpm -qa | grep mysql

2.下载mysql包

wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
  1. 安装 mysql57-community-release-el7-8.noarch.rpm:
rpm -ivh mysql57-community-release-el7-8.noarch.rpm

4.下载安装mysql

yum install mysql-server

5.启动mysql服务

service mysqld start

6.查看随机密码

grep "password" /var/log/mysqld.log

2019-05-14T02:17:16.818716Z 1 [Note] A temporary password is generated for root@localhost: Eal>tvRy(8?n

7.进入mysql命令模式修改密码

mysql -uroot -"Eal>tvRy(8?n"

8.使用随机密码连接mysql

/usr/bin/mysql -u root -p
Eal>tvRy(8?n

9.修改密码

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('XXX');

如果出现这个错误:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
那是因为密码设置得太简单了

10.停止服务

service mysqld stop

11.设置mysql远程连接

mysql -u root -p                           
mysql>use mysql;
mysql>select 'host' from user where user='root';
mysql>update user set host = '%' where user ='root';
mysql>flush privileges;

==============================
centos7.3安装python3.8

前期准备

cd /home/tools

1.下载python官方tgz包并FTP到tools下

https://www.python.org/downloads/release/python-380/

2.YUM安装编译Python所需要的开发包

yum -y install gcc zlib* libffi-devel

3.解压tar包

tar -xvf Python-3.8.0.tgz
cd Python-3.8.0
./configure --prefix=/usr/local/bin/python3
make
make install
  1. //查看系统默认Python的版本号
python -V   
rm -rf /usr/bin/python
ln -s /usr/local/bin/python3/bin/python3 /usr/bin/python
python -V
yum update
vi /usr/bin/yum 

把#!/usr/bin/python
改成#!/usr/bin/python2.7

vi /usr/libexec/urlgrabber-ext-down

把#!/usr/bin/python
改成#!/usr/bin/python2.7

15.这里不要选择更新,否则python版本会变回2

yum update

16.pip3加入环境变量

#vim ~/.bash_profile
#.bash_profile
#Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
#User specific environment and startup programs
PATH=$PATH:$HOME/bin:/usr/local/python3/bin
export PATH

source ~/.bash_profile(环境变量生效)

============================
运行app.py

cd 项目名

vim start.sh(创建执行脚本,&切记)
sudo nohup python app.py &
chmod 777 start.sh
./start.sh
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值