Skip to content

Instantly share code, notes, and snippets.

@cauu
Last active August 29, 2015 14:13
Show Gist options
  • Save cauu/5ebcdd970c7afcbd69a2 to your computer and use it in GitHub Desktop.
Save cauu/5ebcdd970c7afcbd69a2 to your computer and use it in GitHub Desktop.
#!/bin/bash
#Program:
# This script is used for setting up centos6.5
# install Python 2.7.6,pip,virtualenv,django 1.6.9,
# MySQL client plus mezzanine framework
#History:
#2014/1/23 first edition. Cauu Martin First release
echo 'Installing Development tools...'
yum -y groupinstall "Development tools"
yum -y install libevent #gen'l reqs
yum -y install ant-devel zlib-devel #gen'l reqs
yum -y install bzip2-devel openssl-devel ncurses-devel #gen's reqs
yum -y install sqlite-devel sqlite-devel
yum -y install tk-devel gdbm-devel db4-devel libpcap-devel
yum -y install mysql-devel #req'd to use MySQL with python ('mysql-python' package)
yum -y install unixODBC-devel #req'd by python package 'pyodbc'
yum -y install python-devel #req'd by mezzanine
echo 'Installing Python-2.7.6...'
wget --no-check-certificate http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xvf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local
make && make altinstall
echo 'Installing setuptools'
wget -q http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
# Install virtualenv and virtualenvwrapper
# Once you make your first virtualenv, you'll have 'pip' in there.
echo 'Installing virtualenv and virtualenvwrapper...'
wget --no-check-certificate https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz#md5=07e09df0adfca0b2d487e39a4bf2270a
tar -xvzf virtualenv-1.9.1.tar.gz
cd virtualenv-1.9.1
# python virtualenv-1.9.1/setup.py install
python setup.py install
wget --no-check-certificate https://pypi.python.org/packages/source/v/virtualenvwrapper/virtualenvwrapper-4.0.tar.gz#md5=78df3b40735e959479d9de34e4b8ba15
tar -xvzf virtualenvwrapper-*
cd virtualenvwrapper-4.0
# python virtualenvwrapper-4.0/setup.py install
python setup.py install
cd $HOME
echo 'export WORKON_HOME=~/envs' >> .bashrc # Change this directory if you don't like it
source $HOME/.bashrc
mkdir -p $WORKON_HOME
echo '. /usr/bin/virtualenvwrapper.sh' >> .bashrc
source $HOME/.bashrc
# Done!
# Now you can do: `mkvirtualenv foo --python=python2.7
# And after this you can install mezzanine,django and uwsgi in vritualenv foo
# After this we can install git
yum -y install curl curl-devel
yum -y install perl perl-devel
yum -y install cpio expat-devel gettext-devel autoconf
yum -y install git
# That's it !
# After this, just needs to make a virtualenv and use pip to install django,mezzanine,MySQL-python
mkvirtualenv venv # You can change the name of virtualenv with your own name
pip install Django==1.6.9 -i http://pypi.douban.com/simple/ # Install Django from a chinese mirror
pip install Mezzanine -i http://pypi.douban.com/simple/ #Install Mezzanine
pip install MySQL-python -i http://pypi.douban.com/simple/ # Install MySQL-python, or you cannot use mysql in django project
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment