Home  >  Article  >  Backend Development  >  Some deployment commands for Centos Python production environment

Some deployment commands for Centos Python production environment

不言
不言Original
2018-05-07 14:16:412042browse

This article mainly introduces some deployment commands for the Centos Python production environment. It is very good and has reference value. Friends who need it can refer to it

Just notes

Get one After clean centos, initialize the Python environment, just some commands and problem records

Can be made into a script for automatic initialization, of course, it is better to use docker

##Basic environment

1. Create user

sudo adduser newuser
sudo passwd newuser
# 设置授权不需要输入密码
sudo /usr/sbin/visudo
newuser  ALL=NOPASSWD: ALL

2. EPEL(Fedora Extra Packages for Enterprise Linux repository )

Reference Document

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6*.rpm

3. Add ius Source

Package address

wget http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-13.ius.centos6.noarch.rpm
sudo rpm -Uvh ius-release-1.0-13.ius.centos6.noarch.rpm

4. Install python2.7/python3/pip

sudo yum install python27
sudo yum install python27-devel
then
curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | sudo /usr/bin/python2.7 -
# pip
curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | sudo /usr/bin/python2.7 -
extra: install python3
sudo yum install python34u python34u-devel

5. virtualenv

sudo pip install virtualenv

6. gen ssh key

ssh-keygen -t rsa
add ~/.ssh/id_rsa.pub to git or github

Some services

1. install git

##sudo yum install git

2. mysql

sudo yum install mysql
sudo yum install mysql-devel* -y
sudo yum install mysql-server
sudo /sbin/service mysqld start

3. redis

sudo yum install redis

##4. rabbitmq

sudo yum install rabbitmq-server

Problem

[Errno 14] Peer cert cannot be verified or peer cert invalidadd "sslverify=false" in /etc/yum.conf

pip error: ImportError: cannot import name HTTPSHandler

##yum install openssl openssl-devel -y

see in sof
MySQL-python

_mysql.c:2642: error: initializer element is not constant

_mysql.c:2642: error: (near initialization for '_mysql_ResultObject_memberlist[0].offset')

_mysql.c: In function '_mysql_ConnectionObject_getattr':

_mysql.c:2666: error: '_mysql_ConnectionObject' has no member named 'open'
error: command 'gcc' failed with exit status 1

---------------------------------- -------
Command "/data/home/alarm/env/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-HgXAQT/MySQL-python/setup. py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install - -record /tmp/pip-kx2cSu-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-HgXAQT/MySQL-python

Processing:

yum install mysql-devel

Related recommendations:

Instance of using ip proxy pool to randomly generate IP in python3 requests

The above is the detailed content of Some deployment commands for Centos Python production environment. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn