Last active
March 25, 2016 05:49
-
-
Save koolii/25ec2b9ce432d22b6de0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PYVER=3.4.3 | |
DL_MECAB=/var/tmp | |
PROJECT=project | |
PROJECT_PATH=/var/work | |
PIP_PACKAGE=require_modules | |
set -e | |
log() { | |
echo "########################################################" | |
echo "[INFO] $1" | |
echo "########################################################" | |
} | |
log "start install" | |
# install needs package | |
sudo yum update | |
sudo rpm -ivh http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm | |
sudo yum -y install gcc bzip2 bzip2-devel openssl openssl-devel readline readline-devel tar libffi-devel python-devel mecab mecab-devel mecab-ipadic git xz patch | |
log 'download pyenv via Github' | |
rm -rf ~/.pyenv | |
git clone git://github.com/yyuu/pyenv.git ~/.pyenv | |
mkdir -p ~/.pyenv/versions ~/.pyenv/shims | |
appendDefaultShell() { | |
{ | |
echo 'export PYENV_ROOT="${HOME}/.pyenv"' | |
echo 'if [ -d "${PYENV_ROOT}" ]; then' | |
echo ' export PATH=${PYENV_ROOT}/bin:$PATH' | |
echo ' eval "$(pyenv init -)"' | |
echo 'fi' | |
} >> ~/.bashrc | |
} | |
appendDefaultShell | |
source ~/.bashrc | |
log "install python ver $PYVER" | |
pyenv install $PYVER | |
python --version | |
pyenv local $PYVER | |
log "download mecab" | |
cd $DL_MECAB | |
wget https://mecab.googlecode.com/files/mecab-0.996.tar.gz | |
log "thaw tar of mecab" | |
tar zxfv mecab-0.996.tar.gz | |
cd mecab-0.996 | |
log "compile mecab" | |
./configure --with-charaset=utf8 | |
make | |
sudo make install | |
log "install dictionary" | |
cd $DL_MECAB | |
git clone --depth 1 git@github.com:neologd/mecab-ipadic-neologd.git | |
cd mecab-ipadic-neologd | |
# need to pass | |
# warn for disk memory | |
./bin/install-mecab-ipadic-neologd -n -y | |
log "finish install pyenv, python, mecab" | |
log "build" | |
[ -d $PROJECT_PATH ] || sudo mkdir $PROJECT_PATH | |
# git clone repository $PROJECT_PATH | |
cd $PROJECT_PATH | |
cd $PROJECT | |
pyenv local $PYVER | |
log "install package via pip" | |
pip install -r $PIP_PACKAGE | |
pip list | |
log "finished!!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment