Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the process of installing nginx with shell script source code

Shulou Source: shulou.com Published: 2022-06-02 21:43:45 10月01日 Update

This article mainly explains "what is the process of installing nginx in the source code of shell script". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the process of installing nginx with shell script source code"?

SHELL concept

What is SHELL? SHELL is the bridge between Linux kernel and users.

SHELL is also a command interpreter. Users can enter commands to SHELL,SHELL and pass them to the Linux kernel. After kernel processing, the kernel is returned to SHELL,SHELL and the returned results are returned to the user terminal

SHELL is shell, middleware, there are many kinds of shell, bash, csh, ksh, zsh and so on.

What does SHELL have to do with SHELL programming? SHELL is a bridge between the command interpreter, the user and the operating system, while SHELL programming is based on the SHELL interpreter to achieve specific functions or requirements.

Interpretation between SHELL commands, SHELL scripts, SHELL programming, and SHELL?

SHELL programming purpose

The purpose of SHELL programming is to turn repetitive work into automation, which can be understood as batch processing

The main purpose of SHELL is to reduce frequent manual operations, improve the efficiency of operation and maintenance, and ensure the stable and efficient operation of the website.

For example, if you need source code to compile the LNMP WEB architecture, what if all 20 of them need to compile?

How to turn on Shell programming

Any programming language is derived from Hello,world

SHELL programming is actually writing SHELL commands to a script file.

SHELL programming specification, the first line of the script must be #! At the beginning, followed by the type of SHELL, such as / bin/bash,/bin/sh, etc.

The following script looks at the process of installing nginx in the source code of the shell script.

[root@localhost ~] # vim nginx.sh [root@localhost ~] # cat nginx.sh #! / bin/bashversion=nginx-1.20.1.tar.gzname=nginx-1.20.1install_dir=/usr/locallog=/var/log/nginx# solves dependencies yum-y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel wget gd-devel gcc gcc-c++yum-y groups mark install 'Development Tools'# create user id nginx & > / dev/nullif [$?-ne 0] Then useradd-s / sbin/nologin nginx fi# create log storage directory if [!-d $log] Download then mkdir-p / var/log/nginx chown-R nginx.nginx / var/log/nginx fi# nginxcd / usr/src/wget http://nginx.org/download/$version# extract tar xf $version mv $name nginxcd nginx/ & &. / configure\-- prefix=$install_dir/nginx\-- user=nginx\-- group=nginx\-- with-debug\-- with-http_ssl_module\-- with-http_realip_module\-- with-http_image_filter _ module\-- with-http_gunzip_module\-- with-http_gzip_static_module\-- with-http_stub_status_module\-- http-log-path=$log/access.log\-- error-log-path=$log/error.logmake & & make install# configure environment variable echo "export PATH=$install_dir/nginx/sbin:\ $PATH" > / etc/profile.d/nginx.shsource / etc/profile.d/nginx.sh# create service file cat > / usr/lib/systemd/system/nginx.service

Tags: Version software package script programming command source code user process being interpreting content kernel file directory interpreter configuration between variables shell Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Information Redmi Shulou Tech Info MySQL