白话C++编程

Script to compile and install ng

2018-11-13  本文已影响67人  小宁静致远

Script to compile and install nginx on CentOS 6.

  1. Coyy compileInstallNginx.bash to target CentOS box, and then run it as 'root'
#!/bin/bash

#. Compile and make/make install nginx
#. run as 'root'

currDir=$(dirname $(readlink -f "$0"))
source ${currDir}/../utils/commonFuncs.bash
redAlert "PWD: $currDir"

nginxTarball=nginx-1.12.2.tar.gz
untareddir=$(echo ${nginxTarball} | cut -d't' -f1 | sed 'sA\.$AA')
greenAlert "Untarged Dir: $currDir}/${untareddir}"

tar xvf ${currDir}/${nginxTarball}

cd ${currDir}/${untareddir}
redAlert "Now dir: "`pwd`
echo
redAlert "Conigure, make, make installing..."
redAlert "./configure && make -j4 && make install"
./configure && make -j3 && make install
echo
greenAlert `which nginx`
greenAlert "Done!"
  1. Prepare
    1). Copy or download nginx-1.12.2.tar.gz to target box under some dir.
    2). Copy compileInstallNginx.bash also in this dir.
    3). Copy pwd/../utils/commonFuncs.bash together.
    4). Run compileInstallNginx.bash as 'root'

  2. Tips:
    greenAlert and redAlert is the color echo function in commonFuncs.bash.

上一篇 下一篇

猜你喜欢

热点阅读