Operations 5 min read

How to Quickly Set Up a Python Development Environment on CentOS

This step‑by‑step guide shows how to create a user, enable passwordless sudo, add EPEL and IUS repositories, install Python 2.7, Python 3, pip, virtualenv, generate SSH keys, and set up common services like Git, MySQL, Redis, and RabbitMQ on a clean CentOS system, with troubleshooting tips for common errors.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
How to Quickly Set Up a Python Development Environment on CentOS
After obtaining a clean CentOS system, this guide records the commands and issues for initializing a Python environment; it can be scripted or containerized with Docker.

1. Create a New User

sudo adduser newuser
sudo passwd newuser

Configure Passwordless Sudo

sudo /usr/sbin/visudo
newuser    ALL=NOPASSWD: ALL

2. Enable EPEL Repository

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 Repository

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 Python 2.7, Python 3, and pip

sudo yum install python27
sudo yum install python27-devel

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 -
sudo yum install python34u python34u-devel

5. Install virtualenv

sudo pip install virtualenv

6. Generate SSH Key

ssh-keygen -t rsa

# Add ~/.ssh/id_rsa.pub to Git or GitHub

Additional Services

Install Git

sudo yum install git

Install MySQL

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

Install Redis

sudo yum install redis

Install RabbitMQ

sudo yum install rabbitmq-server

Troubleshooting

When encountering [Errno 14] Peer cert cannot be verified or peer cert invalid, add sslverify=false to /etc/yum.conf. For pip errors like ImportError: cannot import name HTTPSHandler, install OpenSSL development packages: yum install openssl openssl-devel -y MySQL‑python compilation may fail with gcc errors; ensure the MySQL development headers are installed:

yum install mysql-devel
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PythonDevOpsLinuxCentOSEnvironment setup
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.