当前位置:网站首页>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


边栏推荐
- Brief description of hystrix configuration
- Enterprise private network construction and operation and maintenance
- BGP选路原则
- Yaml language-01 (data type, array, object)
- Why don't you tell me what long polling is?
- R language foundation
- Burp Suite-第六章 如何使用Burp Spider
- 为啥谷歌的内部工具不适合你?
- 【uniapp】多种支付方式封装
- 线程崩了,为什么不会导致 JVM 崩溃呢?如果是主线程呢?
猜你喜欢

Database foundation

Web side 3D visualization engine hoops communicator reads 10g super large model test | digital twin Technology

Unity metaverse (II), mixamo & animator hybrid tree and animation fusion

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

QT listview add controls and pictures

Web page basic label

Master slave database deployment

99 multiplication table and inverted triangle 99 multiplication table

利用js实现统计字符串数组中各字符串出现的次数,并将其格式化为对象数组。

Stack simulation queue
随机推荐
Brief introduction to XML
The bigger the project is, the bigger it is. This is how I split it
【 fastjson1.2.24反序列化漏洞原理代码分析】
Summary of API method
99 multiplication table and inverted triangle 99 multiplication table
What are the differences between FileInputStream and bufferedinputstream?
JMeter性能测试之使用CSV文件参数化
[fastjson1.2.24 deserialization vulnerability principle code analysis]
Command line execution and test report generation of JMeter performance test
【uniapp】多种支付方式封装
Meta universe infrastructure: analysis of the advantages of Web 3.0 chain33
How WPS sets page headers page by page
JSP implicit object -- scope
Basic introduction of JDBC
Rack server expansion memory
Hystrix配置简单说明
The difference between equals() and = =
2022-07-08 group 5 Gu Xiangquan's learning notes day01
Spotty music data client_ ID account
Introduction to C language (8)