当前位置:网站首页>One click deployment lamp and LNMP architecture
One click deployment lamp and LNMP architecture
2022-07-26 08:03:00 【Unset poetic dream】
List of articles
One key deployment LAMP and LNMP framework
One 、 Installation package download
link :https://pan.baidu.com/s/1rfJl51YKMPlVMI1YIRZ0eg
Extraction code :gf99
Download the installation package and script to /opt Under the table of contents , Use source Execute the script
Two 、 Script details
install.tool.sh Script
echo "============================================="
echo "1) install LAMP framework web The server ."
echo "2) install LNMP framework web The server ."
read -p " Please enter your choice :" option
if [ $option -eq 1 ] ; then
source install.httpd.sh
cd /opt
source install.mysql.sh
cd /opt
source install.php.sh
cd /opt
source install.discuz.sh
else
source install.Nginx.sh
cd /opt
source install.mysql.sh
cd /opt
source install.php.sh
cd /opt
source install.discuz.sh
fi
clear
echo "============================================="
echo " Installation completed !"
install.httpd.sh Script
#!/bin/bash
# initialization
yum -y install gcc gcc-c++ make pcre-devel expat-devel perl pcre
# Unzip the installation package
cd /opt
tar -zxf /opt/apr-1.6.2.tar.gz
tar -zxf /opt/apr-util-1.6.0.tar.gz
tar -jxf /opt/httpd-2.4.29.tar.bz2
mkdir /opt/httpd-2.4.29/srclib/apr
mkdir /opt/httpd-2.4.29/srclib/apr-util
mv ./apr-1.6.2/* ./httpd-2.4.29/srclib/apr mv ./apr-util-1.6.0/* ./httpd-2.4.29/srclib/apr-util # Compilation and installation cd /opt/httpd-2.4.29 ./configure \ --prefix=/usr/local/httpd \ --enable-so \ --enable-rewrite \ --enable-charset-lite \ --enable-cgi make && make install # Optimize the configuration file path ln -s /usr/local/httpd/conf/httpd.conf /etc/ ln -s /usr/local/httpd/bin/* /usr/local/bin/ cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd sed -i '4a # chkconfig: 35 85 21' /etc/init.d/httpd sed -i '5a # description: Apache is a World Wide Web server' /etc/init.d/httpd chkconfig --add httpd clear echo "===========================================================" read -p " Please enter a website IP Address :" ip sed -i '52c Listen '${ip}':80' /etc/httpd.conf sed -i '197c ServerName '${ip}':80' /etc/httpd.conf sed -i '221c DocumentRoot "/usr/local/httpd/htdocs"' /etc/httpd.conf install.Nginx.sh Script
#!/bin/bash
# initialization
yum -y install pcre-devel zlib-devel gcc gcc-c++ make
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
# establish nginx user
useradd -M -s /sbin/nologin nginx
# decompression
tar zxvf /opt/nginx-1.12.2.tar.gz
# Compilation and installation
cd /opt/nginx-1.12.2
./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_stub_status_module
make && make install
# Optimize the path
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/
echo "[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target" >/lib/systemd/system/nginx.service
# Configure the listening address and domain name
clear
echo "==========================================================="
read -p " Please enter the listening port :" ip
read -p " Please enter the listening domain name " dname
sed -i 's/listen 80/listen '$ip':80/' /usr/local/nginx/conf/nginx.conf
sed -i 's/server_name localhost;/server_name '$dname';/' /usr/local/nginx/conf/nginx.conf
sed -i 's/nobody/nginx/' /usr/local/nginx/conf/nginx.conf
# To configure nginx Support php
chmod 754 /lib/systemd/system/nginx.service
sed -i -e '65,71s/#//' -e '69c \\tfastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;' /usr/local/nginx/conf/nginx.conf
sed -i '69a \\t#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' /usr/local/nginx/conf/nginx.conf
# Restart the service
systemctl start nginx.service
systemctl enable nginx.service
# verification php Test page
echo "<?php
phpinfo();
?>" >/usr/local/nginx/html/index.php
install.mysql.sh Script
#/bin/bash
# initialization
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
yum -y install ncurses ncurses-devel bison cmake
# Unpack the installation mysql
tar zxvf /opt/mysql-5.7.17.tar.gz -C /opt
tar zxvf /opt/boost_1_59_0.tar.gz -C /usr/local/
mv /usr/local/boost_1_59_0 /usr/local/boost
cd /opt/mysql-5.7.17
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_BOOST=/usr/local/boost \
-DWITH_SYSTEMD=1
cd /opt/mysql-5.7.17
make -j3
make install
# Create users and configure permissions
useradd -M -s /sbin/nologin mysql
chown -R mysql:mysql /usr/local/mysql/
# modify mysql The configuration file
echo '[client]
port = 3306
socket=/usr/local/mysql/mysql.sock
[mysqld]
user = mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port = 3306
character-set-server=utf8
pid-file = /usr/local/mysql/mysqld.pid
socket=/usr/local/mysql/mysql.sock
bind-address = 0.0.0.0
skip-name-resolve
max_connections=2048
default-storage-engine=INNODB
max_allowed_packet=16M
server-id = 1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES' > /etc/my.cnf
# change mysql The primary group of the installation directory and configuration files
chown -R mysql:mysql /usr/local/mysql/
chown mysql:mysql /etc/my.cnf
# Set the path environment variable
echo "export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib" >>/etc/profile
source /etc/profile
# Initialize database
cd /usr/local/mysql/bin/
./mysqld \
--initialize-insecure \
--user=mysql \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data
# add to mysqld system service
cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/
systemctl daemon-reload
systemctl start mysqld.service
systemctl enable mysqld
yum -y install expect
/usr/bin/expect <<-EOF
spawn mysqladmin -u root -p password 123456
expect "Enter password:"
send "\r"
expect eof
EOF
cd
install.php.sh Script
#/bin/bash
# initialization
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
yum -y install ncurses ncurses-devel bison cmake
# Unpack the installation mysql
tar zxvf /opt/mysql-5.7.17.tar.gz -C /opt
tar zxvf /opt/boost_1_59_0.tar.gz -C /usr/local/
mv /usr/local/boost_1_59_0 /usr/local/boost
cd /opt/mysql-5.7.17
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_BOOST=/usr/local/boost \
-DWITH_SYSTEMD=1
cd /opt/mysql-5.7.17
make -j3
make install
# Create users and configure permissions
useradd -M -s /sbin/nologin mysql
chown -R mysql:mysql /usr/local/mysql/
# modify mysql The configuration file
echo '[client]
port = 3306
socket=/usr/local/mysql/mysql.sock
[mysqld]
user = mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port = 3306
character-set-server=utf8
pid-file = /usr/local/mysql/mysqld.pid
socket=/usr/local/mysql/mysql.sock
bind-address = 0.0.0.0
skip-name-resolve
max_connections=2048
default-storage-engine=INNODB
max_allowed_packet=16M
server-id = 1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES' > /etc/my.cnf
# change mysql The primary group of the installation directory and configuration files
chown -R mysql:mysql /usr/local/mysql/
chown mysql:mysql /etc/my.cnf
# Set the path environment variable
echo "export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib" >>/etc/profile
source /etc/profile
# Initialize database
cd /usr/local/mysql/bin/
./mysqld \
--initialize-insecure \
--user=mysql \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data
# add to mysqld system service
cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/
systemctl daemon-reload
systemctl start mysqld.service
systemctl enable mysqld
yum -y install expect
/usr/bin/expect <<-EOF
spawn mysqladmin -u root -p password 123456
expect "Enter password:"
send "\r"
expect eof
EOF
cd
install.discuz.sh Script
#!/bin/bash
# Extract the file and copy it to the specified path
unzip Discuz_X3.4_SC_UTF8.zip -d /opt/discuz
cp -r /opt/discuz/dir_SC_UTF8/upload/ /usr/local/nginx/html/bbs/
# Create database users
yum -y install expect
/usr/bin/expect <<-EOF
spawn mysql -u root -p123456
expect "mysql>"
send "\r"
expect "mysql>"
send "CREATE DATABASE bbs;\r"
expect "mysql>"
send "GRANT all ON bbs.* TO 'bbsuser'@'%' IDENTIFIED BY 'admin123';\r"
expect "mysql>"
send "flush privileges;\r"
expect "mysql>"
send "quit\r"
EOF
# Adjust the permissions of forum Directory
bbs="/usr/local/nginx/html/bbs/"
chmod 777 ${
bbs}config/
chmod 777 ${
bbs}data/
chmod 777 ${
bbs}uc_client/
chmod 777 ${
bbs}uc_server/
chown -R nginx ${
bbs}/config/
chown -R nginx ${
bbs}/data/
chown -R nginx ${
bbs}/uc_client/
chown -R nginx ${
bbs}/uc_server/
3、 ... and 、 Wait for the installation to finish, and then the browser can access and verify
call install.tool.sh The script selects the architecture to be installed .

It is now accessible :192.168.10.10/index.php
At this time, you can enter the browser installation Forum :http://192.168.10.10/bbs/install/index.php
database server :localhost
Database name :bbs
Database user name :bbsuser
Database password :admin123
Administrator account :admin
Administrator password :admin123
Forum internal page :http://192.168.10.10/bbs/index.php
Forum background administrator page :http://192.168.10.10/bbs/admin.php
verification php Is the configuration successful?
192.168.10.10/index.php

Install and log in to the Forum
At this time, you can enter the browser installation Forum :http://192.168.10.10/bbs/install/index.php
database server :localhost
Database name :bbs
Database user name :bbsuser
Database password :admin123
Administrator account :admin
Administrator password :admin123
Forum internal page :http://192.168.10.10/bbs/index.php
Forum background administrator page :http://192.168.10.10/bbs/admin.php


边栏推荐
- Burp Suite-第五章 如何使用Burp Target
- Excel file parsing
- Stm8 official library file download
- The idea of stack simulating queue
- Summary of API method
- 99 multiplication table and inverted triangle 99 multiplication table
- Matlab-二/三维图上绘制黑点
- OVS underlying implementation principle
- Burp Suite-第九章 如何使用Burp Repeater
- JSP implicit object servlet object
猜你喜欢

Use of JMeter performance test to store response content to file listener

Idea settings set shortcut keys to convert English letters to case in strings

Spotty music data client_ ID account

If the thread crashes, why doesn't it cause the JVM to crash? What about the main thread?

Burp Suite-第九章 如何使用Burp Repeater

万字长文 | 深入理解 OpenFeign 的架构原理

JMeter性能测试之使用CSV文件参数化

shardingjdbc踩坑记录
![[xshell7 free download and installation]](/img/1f/7ac3e2c40c1b3ef2e7ce7403541972.png)
[xshell7 free download and installation]

Interview question set
随机推荐
Burp Suite-第七章 如何使用Burp Scanner
[xshell7 free download and installation]
If the thread crashes, why doesn't it cause the JVM to crash? What about the main thread?
Use js to count the number of occurrences of each string in the string array, and format it into an object array.
微服务feign调用时候,token丢失问题解决方案
Leetcode sword finger offer special (I) integer
Fang Wenshan, Jay Chou's best partner, will officially announce "Hualiu yuancosmos" on July 25
What are the differences between FileInputStream and bufferedinputstream?
数组的介绍--Array
Implementation class under map interface
Read and write of zip file
音视频学习(十)——ps流
2022.7.22DAY612
Strtus2历史漏洞复现
Dynamic performance view overview
Exam summary on June 30, 2022
PHP environment deployment
Software engineering -- dental clinic -- demand acquisition
The difference between LinkedList and ArrayList
Leetcode 206. reverse chain list (2022.07.25)