Script to compile and install ng
2018-11-13 本文已影响67人
小宁静致远
Script to compile and install nginx on CentOS 6.
- 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!"
-
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). Copypwd
/../utils/commonFuncs.bash together.
4). Run compileInstallNginx.bash as 'root' -
Tips:
greenAlert and redAlert is the color echo function in commonFuncs.bash.