Created
July 6, 2018 04:49
-
-
Save philographer/e069729de9eb01b3a95c02f3feb55438 to your computer and use it in GitHub Desktop.
centos7-searchenv
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/bash | |
set -e # If Error then exit | |
# Result Print | |
cat << EOF | |
=========================================================== | |
=========================================================== | |
=================== Installation Started ================== | |
=========================================================== | |
=========================================================== | |
EOF | |
NAVER_PATH=/home1/irteam/naver | |
SEARCH_SUPPORT_PATH=$NAVER_PATH/search-support # /home1/irteam/naver/search-support | |
SEARCH_ENV_PATH=$NAVER_PATH/search-env # /home1/irteam/naver/search-env | |
PACKAGE_PATH=$SEARCH_ENV_PATH/package # /home1/irteam/naver/search-env/package | |
INSTALL_TMP_PATH=$NAVER_PATH/tmp # /home1/irteam/naver/tmp | |
APACHE_INSTALL_TMP_PATH=$INSTALL_TMP_PATH/install_apache # /home1/irteam/naver/tmp/install_apache | |
APAHCE_PATH=$PACKAGE_PATH/apache2 # /home1/irteam/naver/search-env/package/apache2 | |
# Prerequisite 1: Install Some Dependency (TSP는 이미 설치되어있음, Docker에 띄울때 사용) | |
yum install epel-release gcc gcc-c++ make wget openssl-devel expat-devel perl-devel sqlite-devel.x86_64 libsqlite3-dev libsqlite3x-devel.x86_64 -y | |
# Prerequisite 2: Make Directory With Parent | |
mkdir -p $PACKAGE_PATH | |
mkdir -p $SEARCH_SUPPORT_PATH | |
mkdir -p $INSTALL_TMP_PATH | |
# Download & Install PCRE | |
cd $NAVER_PATH | |
mkdir -p $APACHE_INSTALL_TMP_PATH | |
cd $APACHE_INSTALL_TMP_PATH | |
wget https://ftp.pcre.org/pub/pcre/pcre-8.42.tar.gz | |
tar zxvf pcre-8.42.tar.gz | |
cd pcre-8.42 | |
./configure --prefix=$PACKAGE_PATH/pcre | |
make && make install | |
#Download Apache Httpd, APR, APR-Util | |
cd $APACHE_INSTALL_TMP_PATH | |
curl -O -L http://mirror.navercorp.com/apache/httpd/httpd-2.4.33.tar.gz | |
tar xvf httpd-2.4.33.tar.gz | |
curl -O -L http://mirror.navercorp.com/apache/apr/apr-1.6.3.tar.gz | |
tar zxvf apr-1.6.3.tar.gz | |
mv apr-1.6.3 httpd-2.4.33/srclib/apr | |
curl -O -L http://mirror.navercorp.com/apache/apr/apr-util-1.6.1.tar.gz | |
tar zxvf apr-util-1.6.1.tar.gz | |
mv apr-util-1.6.1 httpd-2.4.33/srclib/apr-util | |
# Install Apache | |
cd httpd-2.4.33 | |
./configure --prefix=$APAHCE_PATH \ | |
--enable-rewrite --enable-mods-shared=all --enable-proxy \ | |
--enable-so --enable-ssl --with-ssl=/usr/bin/openssl \ | |
--with-mpm=prefork --with-included-apr \ | |
--with-pcre=$PACKAGE_PATH/pcre | |
make | |
make install | |
# Run Apache WebServer | |
$APAHCE_PATH/bin/apachectl start | |
# Install Python 3.6.5 | |
cd $INSTALL_TMP_PATH | |
wget https://github.com/python/cpython/archive/v3.6.5.tar.gz # https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz | |
tar -zxvf v3.6.5.tar.gz # tar -zxvf Python-3.6.5.tgz | |
cd Python-3.6.5 | |
./configure --prefix=$PACKAGE_PATH/python-3.6.5 --enable-shared | |
make && make install | |
# Set Env Variable for Python | |
echo "export LD_LIBRARY_PATH=${PACKAGE_PATH}/python-3.6.5/lib" >> ~/.bash_profile | |
echo "export PATH=$PATH:${PACKAGE_PATH}/python-3.6.5/bin" >> ~/.bash_profile | |
source ~/.bash_profile | |
# pip install | |
cd $PACKAGE_PATH/python-3.6.5/bin | |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py | |
python3 get-pip.py | |
# Install django | |
pip install django | |
mkdir -p $SEARCH_SUPPORT_PATH/toy | |
cd $SEARCH_SUPPORT_PATH/toy | |
django-admin startproject myproject | |
# Install virtualenv & set-up | |
cd myproject | |
pip install virtualenv | |
virtualenv myprojectenv | |
source ./myprojectenv/bin/activate | |
python manage.py collectstatic | |
python manage.py migrate | |
# Install django in venv | |
pip install django | |
deactivate | |
# Install mod_wsgi | |
cd $INSTALL_TMP_PATH | |
wget https://github.com/GrahamDumpleton/mod_wsgi/archive/4.5.22.tar.gz | |
tar -zxvf 4.5.22.tar.gz | |
cd mod_wsgi-4.5.22 | |
./configure --with-apxs=$PACKAGE_PATH/apache2/bin/apxs --with-python=$PACKAGE_PATH/python-3.6.5/bin/python3 | |
make && make install | |
# Install Node | |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash | |
source ~/.bash_profile | |
nvm install v9.11.1 | |
node -v | |
npm -v | |
# Install Angular Cli | |
npm install -g @angular/cli | |
ng -v | |
# Install MongoDB | |
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.6.4.tgz | |
tar -zxvf mongodb-linux-x86_64-rhel70-3.6.4.tgz | |
mv mongodb-linux-x86_64-rhel70-3.6.4 mongodb | |
mv mongodb $SEARCH_SUPPORT_PATH/toy | |
## Config for mongo | |
cd $SEARCH_SUPPORT_PATH/toy/mongodb | |
mkdir -p {config,data/db,log,pid} | |
cat > config/mongod.conf << EOF | |
systemLog: | |
destination: file | |
path: "/home1/irteam/naver/search-support/toy/mongodb/log/mongod.log" | |
logAppend: true | |
storage: | |
dbPath: "/home1/irteam/naver/search-support/toy/mongodb/data/db" | |
journal: | |
enabled: true | |
processManagement: | |
pidFilePath: "/home1/irteam/naver/search-support/toy/mongodb/pid/mongod.pid" | |
fork: true | |
net: | |
bindIp: 127.0.0.1 | |
port: 5555 | |
EOF | |
# Run Mongo | |
cd /home1/irteam/naver/search-support/toy/mongodb/bin | |
./mongod --config /home1/irteam/naver/search-support/toy/mongodb/config/mongod.conf | |
# Result Print | |
cat << EOF | |
=========================================================== | |
=========================================================== | |
Plz type below | |
$ source ~/.bashrc | |
$ source ~/.bash_profile | |
Install Successfully Completed! Close Bash And Re-Enter plz | |
=========================================================== | |
=========================================================== | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment