美文网首页白话C++编程
Script to compile and install ng

Script to compile and install ng

作者: 小宁静致远 | 来源:发表于2018-11-13 18:31 被阅读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.

相关文章

网友评论

  • 童_刚:小宁这篇文章真的是考验我啊,文章是小宁的笔记,主要记录了在CentOS中安装Nginx的全过程。
    我还专门上网查了一下,Nginx一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器。
    文章里面的操作步骤很详细,并用黑色背景模拟了命令行的感觉,很好奇小宁是如何做到这样排版的?
    有个小小瑕疵,文中Copy错写成Coyy了。另外:不知道小宁的编程课程现在进展的怎么样了?
    童_刚:@小宁静致远 谢谢小宁指点迷津,学习了markdown的小tip。支持你继续更新星球,也支持你继续更新课程。张三九说的一句话特别好:教是最好的学。大家一起共勉^_^
    小宁静致远:谢谢,刚刚. 我这个对你是小意思了.
    倒是你是我学习的目标呀,在区块链的知识海洋中遨游和飞奔, 不管是理论,还是实践和赚币,赚钱!
    同时,在生活中你也是我的榜样, 最近我的一个同事儿,也向我聊起了半马和全马,我特别佩服像你们这样,可以参加半马全马的人,非常好的处理好了生活,工作,学习和锻炼,赚钱的关系.

    笔记中的排版,只是用了 markdown的排版, 使用了```bash 代码 ```这个语法,相信你也已经早就掌握了.

    我的课程现在断更了大概2个月了, 最近我在想着将我的星球做为平时记录的一个地方, 今天的作业内容就是其中一个部分: 这是我在写自动化脚本的时候写的安装nginx的一个bash脚本, 用于避免今后重复的工作...

    感谢你的提醒,我一会儿就修改成正确的copy.
    再次感谢你这么细心的阅读,谢谢.
    祝愿你事业,生活,赚钱都蒸蒸日上! :smile:

本文标题:Script to compile and install ng

本文链接:https://www.haomeiwen.com/subject/cftlfqtx.html