Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Script sharing for CentOS to install LNMP with one click

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "CentOS one-click installation of LNMP script sharing", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn "CentOS one-click installation of LNMP script sharing" bar!

Share a script you wrote to install LNMP with one click.

CentOS6 installation effect:

#! / bin/bash# Author: Zhangbin# Website: http://qicheng0211.blog.51cto.com/# Description: CentOS6/7 install lnmp (based on yum) PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport PATHerr_echo () {echo-e "\ e [31m [Error]\ 033 [0m $@" exit 1} info_echo () { Echo-e "\ e [32m [Info]\ 033 [0m $@" sleep 1} # check if the root user if [$EUID-ne 0] Then err_echo "please run this script as root user." fi# check operating system version if egrep "CentOS release 6" / etc/redhat-release > / dev/null 2 > & 1; then OS=CentOS6elif egrep "CentOS Linux release 7" / etc/redhat-release > / dev/null 2 > & 1 Then OS=CentOS7else err_echo "This script is used for CentOS 6.x or 7.x only." fi# checks the network ping-c 1 mirrors.163.com & > / dev/null [$?! = 0] & & err_echo "Network does not work." which wget & > / dev/null | | yum install wget-y # CentOS6 installs yum's axel plug-in so that yum supports multithreaded download: if ["$OS" = "CentOS6"] Then wget https://mirrors.tuna.tsinghua.edu.cn/repoforge/redhat/el6/en/x86_64/rpmforge/RPMS/axel-2.4-1.el6.rf.x86_64.rpm rpm-ivh axel-2.4-1.el6.rf.x86_64.rpm axelget_conf_start=$ (grep-n 'axelget.conf start_line' "$0" | grep-v grep | awk-F:' {print $1}') axelget_conf_end=$ (grep -n 'axelget.conf end_line' "$0" | grep-v grep | awk-F:' {print $1}') ((axelget_conf_start++)) ((axelget_conf_end--)) sed-n "${axelget_conf_start} ${axelget_conf_end} p "" $0 "> / etc/yum/pluginconf.d/axelget.conf axelget_py_start=$ (grep-n 'axelget.py start_line'" $0 "| grep-v grep | awk-F:' {print $1}') axelget_py_end=$ (grep-n 'axelget.py end_line'" $0 "| grep-v grep | awk-F:' {print $1}') ((axelget_py_start++)) ((axelget_py_end--)) sed-n "${axelget_py_start} ${axelget_py_end} p "" $0 "> / usr/lib/yum-plugins/axelget.pyfi# installation 163yum Source: if [" $OS "= =" CentOS6 "] Then wget http://mirrors.163.com/.help/CentOS6-Base-163.repo-O CentOS-Base.repoelse wget http://mirrors.163.com/.help/CentOS7-Base-163.repo-O CentOS-Base.repoficp-p / etc/yum.repos.d/CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repo.bakmv-f CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repoyum clean allyum makecache# install epel Yum source: yum-y install epel-releasesed-I's / ^ mirrorlist = https/mirrorlist=http/' / etc/yum.repos.d/epel.repo# CentOS7 install yum's axel plug-in Rely on epel source if ["$OS" = = "CentOS7"] The yum source of then yum- y install yum-axelget sed-I'/ ^ maxconn=/c\ maxconn=10' / etc/yum/pluginconf.d/axelget.conffi# nginx: cat > / etc/yum.repos.d/nginx.repo / etc/nginx/nginx.conf / etc/my.cnf

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report