Kyle's Blog Talk is cheap. Show me the code.

CentOS 搭建Flask(py3) + Mysql + uwsgi + nginx环境

2018-06-06

1) svn co 报错:
svn: E210007: Unable to connect to a repository at URL 'svn://git.oschina.net/xxx'
svn: E210007: Cannot negotiate authentication mechanism

原因是缺少组件,运行sudo yum install cyrus-sasl cyrus-sasl-plain cyrus-sasl-ldap
问题解决

2) 安装mysql
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
systemctl start  mysqld.service
systemctl status mysqld.service
chkconfig mysqld on
grep "password" /var/log/mysqld.log
mysql -uroot -pPASSWORD
set global validate_password_policy=0;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';
yum -y remove mysql57-community-release-el7-10.noarch

3) mysql启动失败,需要设置swap内存
free -h
# 创建1G空间
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024
sudo mkswap /swapfile
sudo swapon /swapfile
# 这样swap内存就创建成功了,但是重启后会失效
# 永久保存
sudo vi /etc/fstab
# 文件末尾加入这行内容,保存退出
/swapfile   swap    swap    sw  0   0

4)设置mysql编码为utf8mb4
打开/etc/my.cnf,添加
[mysqld]
character_set_server = utf8mb4

[mysql]
default_character_set = utf8mb4

[client]
default_character_set = utf8mb4

5) 安装python3.6.5
编译环境的安装:yum install zlib-devel bzip2-devel openssl-devel ncurese-devel(要先安装这个不然python安装不完整,会没有pip3)
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz 
tar -xf Python-3.6.5.tgz 
cd Python-3.6.5
设置安装目录:./configure --prefix=/usr/bin/python-3.6.5
新建安装的文件夹:sudo mkdir /usr/bin/python-3.6.5
编译命令 :
make(等待..)
安装命令:sudo make install
设置软连接
sudo ln -s /usr/bin/python-3.6.5/bin/python3.6 /usr/bin/python3
# 创建虚拟python3环境
python3 -m venv project-name
cd project-name
source bin/activate

Similar Posts

Comments