Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

CODE on Vagrant CentOS

liluo edited this page Mar 17, 2014 · 1 revision

准备环境 vagrant CentOS-6.4-i386-v20130731.box

安装 mysql git

yum install update
yum install -y mysql mysql-server mysql-devel git python-devel memcached

安装 python2.7

wget  https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2  --no-check-certificate
tar xvf Python-2.7.5.tar.bz2
cd Python-2.7.5
./configure --prefix=/usr/local
make && make altinstall

easy_install 包

wget https://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz --no-check-certificate
tar xf distribute-0.6.49.tar.gz
cd distribute-0.6.49
python2.7 setup.py install  # 必须“python2.7”,否则将安装到默认的2.6环境内。

easy_install virtualenv
easy_install pip

安装 memcached libmemcached

pip install mime python-magic
wget  https://github.com/xtao/douban-patched/raw/master/libmemcached-douban-1.0.18.tar.gz --no-check-certificate
tar zxf libmemcached-douban-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure && make && sudo make install
ln -s /usr/local/lib/libmemcached.so.11 /usr/lib/libmemcached.so.11

部署 CODE

git clone https://github.com/douban/code.git
cd code
mysql -uroot -e 'create database valentine;'
mysql -uroot -D valentine < vilya/databases/schema.sql
virtualenv venv --python=python2.7
cd venv
source ./bin/activate venv

pip install cython
pip install -U setuptools
easy_install distribute==0.6.28
yum install bzip2-devel
cp /usr/lib/python2.6/lib-dynload/bz2.so /usr/local/lib/python2.7/.
pip install -e "git+https://github.com/qingfeng/misaka.git@2fbe52692e8f304eea9d8925fd2a857916ff0ea5#egg=misaka-1.0.3"
pip install -r requirements.txt

定制 config 运行

cp vilya/local_config.py.tmpl vilya/local_config.py
gunicorn -w 2 -b 127.0.0.1:8000 app:app
# DOMAIN 是指的是程序运行的域名,包含IP地址和端口,例如: http://127.0.0.1:8000/
Clone this wiki locally