source
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
install.log
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright {yyyy} {name of copyright owner}
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
This script is written using the shell, in order to quickly deploy `LEMP`/`LAMP`/`LNMP`/`LNMPA`/`LTMP`(Linux, Nginx/Tengine/OpenResty, MySQL in a production environment/MariaDB/Percona, PHP, JAVA), applicable to RHEL 7, 8, 9(including CentOS,RedHat,AlmaLinux,Rocky), Debian 9, 10, 11, 12, Ubuntu 16, 18, 20, 22 and Fedora 27+ of 64.
|
||||||
|
|
||||||
|
Script properties:
|
||||||
|
- Continually updated, Provide Shell Interaction and Autoinstall
|
||||||
|
- Source compiler installation, most stable source is the latest version, and download from the official site
|
||||||
|
- Some security optimization
|
||||||
|
- Providing a plurality of database versions (MySQL-8.0, MySQL-5.7, MySQL-5.6, MySQL-5.5, MariaDB-10.11, MariaDB-10.5, MariaDB-10.4, MariaDB-5.5, Percona-8.0, Percona-5.7, Percona-5.6, Percona-5.5, PostgreSQL, MongoDB)
|
||||||
|
- Providing multiple PHP versions (PHP-8.3, PHP-8.2, PHP-8.1, PHP-8.0, PHP-7.4, PHP-7.3, PHP-7.2, PHP-7.1, PHP-7.0, PHP-5.6, PHP-5.5, PHP-5.4, PHP-5.3)
|
||||||
|
- Provide Nginx, Tengine, OpenResty, Caddy, Apache and ngx_lua_waf
|
||||||
|
- Providing a plurality of Tomcat version (Tomcat-10, Tomcat-9, Tomcat-8, Tomcat-7)
|
||||||
|
- Providing a plurality of JDK version (OpenJDK-8, OpenJDK-11, OpenJDK-17)
|
||||||
|
- According to their needs to install PHP Cache Accelerator provides ZendOPcache, xcache, apcu, eAccelerator. And php extensions,include ZendGuardLoader,ionCube,SourceGuardian,imagick,gmagick,fileinfo,imap,ldap,calendar,phalcon,yaf,yar,redis,memcached,memcache,mongodb,swoole,xdebug
|
||||||
|
- Installation Nodejs, Pureftpd, phpMyAdmin according to their needs
|
||||||
|
- Install memcached, redis according to their needs
|
||||||
|
- Jemalloc optimize MySQL, Nginx
|
||||||
|
- Providing add a virtual host script, include Let's Encrypt SSL certificate
|
||||||
|
- Provide Nginx/Tengine/OpenResty/Apache/Tomcat, MySQL/MariaDB/Percona, PHP, Redis, Memcached, phpMyAdmin upgrade script
|
||||||
|
- Provide local,remote(rsync between servers),Aliyun OSS,Qcloud COS,UPYUN,QINIU,Amazon S3,Google Drive and Dropbox backup script
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Install the dependencies for your distro, download the source and run the installation script.
|
||||||
|
|
||||||
|
#### CentOS/Redhat
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yum -y install wget screen
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Debian/Ubuntu
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apt-get -y install wget screen
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Download Source and Install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wget http://mirrors.oneinstack.com/oneinstack-full.tar.gz
|
||||||
|
tar xzf oneinstack-full.tar.gz
|
||||||
|
cd oneinstack
|
||||||
|
```
|
||||||
|
|
||||||
|
If you disconnect during installation, you can execute the command `screen -r oneinstack` to reconnect to the install window
|
||||||
|
```bash
|
||||||
|
screen -S oneinstack
|
||||||
|
```
|
||||||
|
|
||||||
|
If you need to modify the directory (installation, data storage, Nginx logs), modify `options.conf` file before running install.sh
|
||||||
|
```bash
|
||||||
|
./install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to install another PHP version
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/oneinstack/install.sh --mphp_ver 54
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to add Extensions
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/oneinstack/addons.sh
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to add a virtual host
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/oneinstack/vhost.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to delete a virtual host
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/oneinstack/vhost.sh --del
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to add FTP virtual user
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/oneinstack/pureftpd_vhost.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to backup
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/oneinstack/backup_setup.sh // Backup parameters
|
||||||
|
~/oneinstack/backup.sh // Perform the backup immediately
|
||||||
|
crontab -l // Can be added to scheduled tasks, such as automatic backups every day 1:00
|
||||||
|
0 1 * * * cd ~/oneinstack/backup.sh > /dev/null 2>&1 &
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to manage service
|
||||||
|
|
||||||
|
Nginx/Tengine/OpenResty:
|
||||||
|
```bash
|
||||||
|
systemctl {start|stop|status|restart|reload} nginx
|
||||||
|
```
|
||||||
|
MySQL/MariaDB/Percona:
|
||||||
|
```bash
|
||||||
|
systemctl {start|stop|restart|reload|status} mysqld
|
||||||
|
```
|
||||||
|
PostgreSQL:
|
||||||
|
```bash
|
||||||
|
systemctl {start|stop|restart|status} postgresql
|
||||||
|
```
|
||||||
|
MongoDB:
|
||||||
|
```bash
|
||||||
|
systemctl {start|stop|status|restart|reload} mongod
|
||||||
|
```
|
||||||
|
PHP:
|
||||||
|
```bash
|
||||||
|
systemctl {start|stop|restart|reload|status} php-fpm
|
||||||
|
```
|
||||||
|
Apache:
|
||||||
|
```bash
|
||||||
|
systemctl {start|restart|stop} httpd
|
||||||
|
```
|
||||||
|
Tomcat:
|
||||||
|
```bash
|
||||||
|
systemctl {start|stop|status|restart} tomcat
|
||||||
|
```
|
||||||
|
Pure-FTPd:
|
||||||
|
```bash
|
||||||
|
systemctl {start|stop|restart|status} pureftpd
|
||||||
|
```
|
||||||
|
Redis:
|
||||||
|
```bash
|
||||||
|
systemctl {start|stop|status|restart|reload} redis-server
|
||||||
|
```
|
||||||
|
Memcached:
|
||||||
|
```bash
|
||||||
|
systemctl {start|stop|status|restart|reload} memcached
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to upgrade
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/oneinstack/upgrade.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to uninstall
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/oneinstack/uninstall.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
For feedback, questions, and to follow the progress of the project: <br />
|
||||||
|
[Telegram Group](https://t.me/oneinstack)<br />
|
||||||
|
[OneinStack](https://oneinstack.com)<br />
|
||||||
@@ -0,0 +1,185 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
|
||||||
|
clear
|
||||||
|
printf "
|
||||||
|
#######################################################################
|
||||||
|
# OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+ #
|
||||||
|
# Install/Uninstall Extensions #
|
||||||
|
# For more information please visit https://oneinstack.com #
|
||||||
|
#######################################################################
|
||||||
|
"
|
||||||
|
# Check if user is root
|
||||||
|
# shellcheck disable=SC2046
|
||||||
|
[ $(id -u) != '0' ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
|
||||||
|
|
||||||
|
oneinstack_dir=$(dirname "`readlink -f $0`")
|
||||||
|
# shellcheck disable=SC2164
|
||||||
|
pushd ${oneinstack_dir} > /dev/null
|
||||||
|
|
||||||
|
. ./versions.txt
|
||||||
|
. ./options.conf
|
||||||
|
. ./include/color.sh
|
||||||
|
. ./include/check_os.sh
|
||||||
|
. ./include/download.sh
|
||||||
|
. ./include/get_char.sh
|
||||||
|
|
||||||
|
. ./include/composer.sh
|
||||||
|
|
||||||
|
. ./include/fail2ban.sh
|
||||||
|
|
||||||
|
. ./include/ngx_lua_waf.sh
|
||||||
|
|
||||||
|
# get the out ip country
|
||||||
|
OUTIP_STATE=$(./include/ois.${ARCH} ip_state)
|
||||||
|
|
||||||
|
# shellcheck disable=SC2154
|
||||||
|
Show_Help() {
|
||||||
|
echo
|
||||||
|
echo "Usage: $0 command ...
|
||||||
|
--help, -h Show this help message
|
||||||
|
--install, -i Install
|
||||||
|
--uninstall, -u Uninstall
|
||||||
|
--composer Composer
|
||||||
|
--fail2ban Fail2ban
|
||||||
|
--ngx_lua_waf Ngx_lua_waf
|
||||||
|
"
|
||||||
|
}
|
||||||
|
|
||||||
|
ARG_NUM=$#
|
||||||
|
TEMP=`getopt -o hiu --long help,install,uninstall,composer,fail2ban,ngx_lua_waf -- "$@" 2>/dev/null`
|
||||||
|
[ $? != 0 ] && echo "${CWARNING}ERROR: unknown argument! ${CEND}" && Show_Help && exit 1
|
||||||
|
eval set -- "${TEMP}"
|
||||||
|
while :; do
|
||||||
|
[ -z "$1" ] && break;
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
Show_Help; exit 0
|
||||||
|
;;
|
||||||
|
-i|--install)
|
||||||
|
install_flag=y; shift 1
|
||||||
|
;;
|
||||||
|
-u|--uninstall)
|
||||||
|
uninstall_flag=y; shift 1
|
||||||
|
;;
|
||||||
|
--composer)
|
||||||
|
composer_flag=y; shift 1
|
||||||
|
;;
|
||||||
|
--fail2ban)
|
||||||
|
fail2ban_flag=y; shift 1
|
||||||
|
;;
|
||||||
|
--ngx_lua_waf)
|
||||||
|
ngx_lua_waf_flag=y; shift 1
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "${CWARNING}ERROR: unknown argument! ${CEND}" && Show_Help && exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
ACTION_FUN() {
|
||||||
|
while :; do
|
||||||
|
echo
|
||||||
|
echo "Please select an action:"
|
||||||
|
echo -e "\t${CMSG}1${CEND}. install"
|
||||||
|
echo -e "\t${CMSG}2${CEND}. uninstall"
|
||||||
|
read -e -p "Please input a number:(Default 1 press Enter) " ACTION
|
||||||
|
ACTION=${ACTION:-1}
|
||||||
|
if [[ ! "${ACTION}" =~ ^[1,2]$ ]]; then
|
||||||
|
echo "${CWARNING}input error! Please only input number 1~2${CEND}"
|
||||||
|
else
|
||||||
|
[ "${ACTION}" == '1' ] && install_flag=y
|
||||||
|
[ "${ACTION}" == '2' ] && uninstall_flag=y
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu() {
|
||||||
|
while :;do
|
||||||
|
printf "
|
||||||
|
What Are You Doing?
|
||||||
|
\t${CMSG}1${CEND}. Install/Uninstall PHP Composer
|
||||||
|
\t${CMSG}2${CEND}. Install/Uninstall fail2ban
|
||||||
|
\t${CMSG}3${CEND}. Install/Uninstall ngx_lua_waf
|
||||||
|
\t${CMSG}q${CEND}. Exit
|
||||||
|
"
|
||||||
|
read -e -p "Please input the correct option: " Number
|
||||||
|
if [[ ! "${Number}" =~ ^[1-3,q]$ ]]; then
|
||||||
|
echo "${CFAILURE}input error! Please only input 1~3 and q${CEND}"
|
||||||
|
else
|
||||||
|
case "${Number}" in
|
||||||
|
1)
|
||||||
|
ACTION_FUN
|
||||||
|
if [ "${install_flag}" = 'y' ]; then
|
||||||
|
Install_composer
|
||||||
|
elif [ "${uninstall_flag}" = 'y' ]; then
|
||||||
|
Uninstall_composer
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
ACTION_FUN
|
||||||
|
if [ "${install_flag}" = 'y' ]; then
|
||||||
|
Install_fail2ban
|
||||||
|
elif [ "${uninstall_flag}" = 'y' ]; then
|
||||||
|
Uninstall_fail2ban
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
ACTION_FUN
|
||||||
|
if [ "${install_flag}" = 'y' ]; then
|
||||||
|
# shellcheck disable=SC2154
|
||||||
|
[ -e "${nginx_install_dir}/sbin/nginx" ] && Nginx_lua_waf
|
||||||
|
# shellcheck disable=SC2154
|
||||||
|
[ -e "${tengine_install_dir}/sbin/nginx" ] && Tengine_lua_waf
|
||||||
|
enable_lua_waf
|
||||||
|
elif [ "${uninstall_flag}" = 'y' ]; then
|
||||||
|
disable_lua_waf
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
q)
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ ${ARG_NUM} == 0 ]; then
|
||||||
|
Menu
|
||||||
|
else
|
||||||
|
if [ "${composer_flag}" == 'y' ]; then
|
||||||
|
if [ "${install_flag}" = 'y' ]; then
|
||||||
|
Install_composer
|
||||||
|
elif [ "${uninstall_flag}" = 'y' ]; then
|
||||||
|
Uninstall_composer
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "${fail2ban_flag}" == 'y' ]; then
|
||||||
|
if [ "${install_flag}" = 'y' ]; then
|
||||||
|
Install_fail2ban
|
||||||
|
elif [ "${uninstall_flag}" = 'y' ]; then
|
||||||
|
Uninstall_fail2ban
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "${ngx_lua_waf_flag}" == 'y' ]; then
|
||||||
|
if [ "${install_flag}" = 'y' ]; then
|
||||||
|
[ -e "${nginx_install_dir}/sbin/nginx" ] && Nginx_lua_waf
|
||||||
|
[ -e "${tengine_install_dir}/sbin/nginx" ] && Tengine_lua_waf
|
||||||
|
enable_lua_waf
|
||||||
|
elif [ "${uninstall_flag}" = 'y' ]; then
|
||||||
|
disable_lua_waf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
@@ -0,0 +1,297 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
|
||||||
|
|
||||||
|
# Check if user is root
|
||||||
|
[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
|
||||||
|
|
||||||
|
oneinstack_dir=$(dirname "`readlink -f $0`")
|
||||||
|
pushd ${oneinstack_dir}/tools > /dev/null
|
||||||
|
. ../options.conf
|
||||||
|
[ ! -e "${backup_dir}" ] && mkdir -p ${backup_dir}
|
||||||
|
|
||||||
|
DB_Local_BK() {
|
||||||
|
for D in `echo ${db_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
./db_bk.sh ${D}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
DB_Remote_BK() {
|
||||||
|
for D in `echo ${db_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
./db_bk.sh ${D}
|
||||||
|
DB_GREP="DB_${D}_`date +%Y%m%d`"
|
||||||
|
DB_FILE=`ls -lrt ${backup_dir} | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
|
||||||
|
echo "file:::${backup_dir}/${DB_FILE} ${backup_dir} push" >> config_backup.txt
|
||||||
|
echo "com:::[ -e "${backup_dir}/${DB_FILE}" ] && rm -rf ${backup_dir}/DB_${D}_$(date +%Y%m%d --date="${expired_days} days ago")_*.tgz" >> config_backup.txt
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
DB_OSS_BK() {
|
||||||
|
for D in `echo ${db_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
./db_bk.sh ${D}
|
||||||
|
DB_GREP="DB_${D}_`date +%Y%m%d`"
|
||||||
|
DB_FILE=`ls -lrt ${backup_dir} | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
|
||||||
|
ossutil cp -f ${backup_dir}/${DB_FILE} oss://${oss_bucket}/`date +%F`/${DB_FILE}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
ossutil rm -rf oss://${oss_bucket}/`date +%F --date="${expired_days} days ago"`/
|
||||||
|
[ -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -f ${backup_dir}/${DB_FILE}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
DB_COS_BK() {
|
||||||
|
for D in `echo ${db_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
./db_bk.sh ${D}
|
||||||
|
DB_GREP="DB_${D}_`date +%Y%m%d`"
|
||||||
|
DB_FILE=`ls -lrt ${backup_dir} | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
|
||||||
|
coscli sync ${backup_dir}/${DB_FILE} cos://${cos_bucket}/`date +%F`/${DB_FILE}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
coscli rm -rf cos://${cos_bucket}/`date +%F --date="${expired_days} days ago"` > /dev/null 2>&1
|
||||||
|
[ -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -f ${backup_dir}/${DB_FILE}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
DB_UPYUN_BK() {
|
||||||
|
for D in `echo ${db_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
./db_bk.sh ${D}
|
||||||
|
DB_GREP="DB_${D}_`date +%Y%m%d`"
|
||||||
|
DB_FILE=`ls -lrt ${backup_dir} | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
|
||||||
|
upx put ${backup_dir}/${DB_FILE} /`date +%F`/${DB_FILE}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
upx rm -a `date +%F --date="${expired_days} days ago"` > /dev/null 2>&1
|
||||||
|
[ -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -f ${backup_dir}/${DB_FILE}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
DB_QINIU_BK() {
|
||||||
|
for D in `echo ${db_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
./db_bk.sh ${D}
|
||||||
|
DB_GREP="DB_${D}_`date +%Y%m%d`"
|
||||||
|
DB_FILE=`ls -lrt ${backup_dir} | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
|
||||||
|
qshell rput ${qiniu_bucket} /`date +%F`/${DB_FILE} ${backup_dir}/${DB_FILE}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
qshell listbucket ${qiniu_bucket} /`date +%F --date="${expired_days} days ago"` /tmp/qiniu.txt > /dev/null 2>&1
|
||||||
|
qshell batchdelete -force ${qiniu_bucket} /tmp/qiniu.txt > /dev/null 2>&1
|
||||||
|
[ -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -f ${backup_dir}/${DB_FILE}
|
||||||
|
rm -f /tmp/qiniu.txt
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
DB_S3_BK() {
|
||||||
|
for D in `echo ${db_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
./db_bk.sh ${D}
|
||||||
|
DB_GREP="DB_${D}_`date +%Y%m%d`"
|
||||||
|
DB_FILE=`ls -lrt ${backup_dir} | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
|
||||||
|
aws s3 sync ${backup_dir}/${DB_FILE} s3://${s3_bucket}/`date +%F`/${DB_FILE}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
aws s3 rm -r s3://${s3_bucket}/`date +%F --date="${expired_days} days ago"` > /dev/null 2>&1
|
||||||
|
[ -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -f ${backup_dir}/${DB_FILE}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
DB_DROPBOX_BK() {
|
||||||
|
for D in `echo ${db_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
./db_bk.sh ${D}
|
||||||
|
DB_GREP="DB_${D}_`date +%Y%m%d`"
|
||||||
|
DB_FILE=`ls -lrt ${backup_dir} | grep ${DB_GREP} | tail -1 | awk '{print $NF}'`
|
||||||
|
dbxcli put ${backup_dir}/${DB_FILE} `date +%F`/${DB_FILE}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
dbxcli rm -f `date +%F --date="${expired_days} days ago"` > /dev/null 2>&1
|
||||||
|
[ -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -f ${backup_dir}/${DB_FILE}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
WEB_LOCAL_BK() {
|
||||||
|
for W in `echo ${website_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
./website_bk.sh $W
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
WEB_Remote_BK() {
|
||||||
|
for W in `echo ${website_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
if [ `du -sm "${wwwroot_dir}/${WebSite}" | awk '{print $1}'` -lt 2048 ]; then
|
||||||
|
./website_bk.sh $W
|
||||||
|
Web_GREP="Web_${W}_`date +%Y%m%d`"
|
||||||
|
Web_FILE=`ls -lrt ${backup_dir} | grep ${Web_GREP} | tail -1 | awk '{print $NF}'`
|
||||||
|
echo "file:::${backup_dir}/${Web_FILE} ${backup_dir} push" >> config_backup.txt
|
||||||
|
echo "com:::[ -e "${backup_dir}/${Web_FILE}" ] && rm -rf ${backup_dir}/Web_${W}_$(date +%Y%m%d --date="${expired_days} days ago")_*.tgz" >> config_backup.txt
|
||||||
|
else
|
||||||
|
echo "file:::${wwwroot_dir}/$W ${backup_dir} push" >> config_backup.txt
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
WEB_OSS_BK() {
|
||||||
|
for W in `echo $website_name | tr ',' ' '`
|
||||||
|
do
|
||||||
|
[ ! -e "${wwwroot_dir}/${WebSite}" ] && { echo "[${wwwroot_dir}/${WebSite}] not exist"; break; }
|
||||||
|
PUSH_FILE="${backup_dir}/Web_${W}_$(date +%Y%m%d_%H).tgz"
|
||||||
|
if [ ! -e "${PUSH_FILE}" ]; then
|
||||||
|
pushd ${wwwroot_dir} > /dev/null
|
||||||
|
tar czf ${PUSH_FILE} ./$W
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
ossutil cp -f ${PUSH_FILE} oss://${oss_bucket}/`date +%F`/${PUSH_FILE##*/}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
ossutil rm -rf oss://${oss_bucket}/`date +%F --date="${expired_days} days ago"`/
|
||||||
|
[ -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -f ${PUSH_FILE}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
WEB_COS_BK() {
|
||||||
|
for W in `echo ${website_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
[ ! -e "${wwwroot_dir}/${WebSite}" ] && { echo "[${wwwroot_dir}/${WebSite}] not exist"; break; }
|
||||||
|
PUSH_FILE="${backup_dir}/Web_${W}_$(date +%Y%m%d_%H).tgz"
|
||||||
|
if [ ! -e "${PUSH_FILE}" ]; then
|
||||||
|
pushd ${wwwroot_dir} > /dev/null
|
||||||
|
tar czf ${PUSH_FILE} ./$W
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
coscli sync ${PUSH_FILE} cos://${cos_bucket}/`date +%F`/${PUSH_FILE##*/}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
coscli rm -rf cos://${cos_bucket}/`date +%F --date="${expired_days} days ago"` > /dev/null 2>&1
|
||||||
|
[ -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -f ${PUSH_FILE}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
WEB_UPYUN_BK() {
|
||||||
|
for W in `echo ${website_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
[ ! -e "${wwwroot_dir}/${WebSite}" ] && { echo "[${wwwroot_dir}/${WebSite}] not exist"; break; }
|
||||||
|
[ ! -e "${backup_dir}" ] && mkdir -p ${backup_dir}
|
||||||
|
PUSH_FILE="${backup_dir}/Web_${W}_$(date +%Y%m%d_%H).tgz"
|
||||||
|
if [ ! -e "${PUSH_FILE}" ]; then
|
||||||
|
pushd ${wwwroot_dir} > /dev/null
|
||||||
|
tar czf ${PUSH_FILE} ./$W
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
upx put ${PUSH_FILE} /`date +%F`/${PUSH_FILE##*/}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
upx rm -a `date +%F --date="${expired_days} days ago"` > /dev/null 2>&1
|
||||||
|
[ -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -f ${PUSH_FILE}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
WEB_QINIU_BK() {
|
||||||
|
for W in `echo ${website_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
[ ! -e "${wwwroot_dir}/${WebSite}" ] && { echo "[${wwwroot_dir}/${WebSite}] not exist"; break; }
|
||||||
|
[ ! -e "${backup_dir}" ] && mkdir -p ${backup_dir}
|
||||||
|
PUSH_FILE="${backup_dir}/Web_${W}_$(date +%Y%m%d_%H).tgz"
|
||||||
|
if [ ! -e "${PUSH_FILE}" ]; then
|
||||||
|
pushd ${wwwroot_dir} > /dev/null
|
||||||
|
tar czf ${PUSH_FILE} ./$W
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
qshell rput ${qiniu_bucket} /`date +%F`/${PUSH_FILE##*/} ${PUSH_FILE}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
qshell listbucket ${qiniu_bucket} /`date +%F --date="${expired_days} days ago"` /tmp/qiniu.txt > /dev/null 2>&1
|
||||||
|
qshell batchdelete -force ${qiniu_bucket} /tmp/qiniu.txt > /dev/null 2>&1
|
||||||
|
[ -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -f ${PUSH_FILE}
|
||||||
|
rm -f /tmp/qiniu.txt
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
WEB_S3_BK() {
|
||||||
|
for W in `echo ${website_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
[ ! -e "${wwwroot_dir}/${WebSite}" ] && { echo "[${wwwroot_dir}/${WebSite}] not exist"; break; }
|
||||||
|
[ ! -e "${backup_dir}" ] && mkdir -p ${backup_dir}
|
||||||
|
PUSH_FILE="${backup_dir}/Web_${W}_$(date +%Y%m%d_%H).tgz"
|
||||||
|
if [ ! -e "${PUSH_FILE}" ]; then
|
||||||
|
pushd ${wwwroot_dir} > /dev/null
|
||||||
|
tar czf ${PUSH_FILE} ./$W
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
aws s3 sync ${PUSH_FILE} s3://${s3_bucket}/`date +%F`/${PUSH_FILE##*/}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
aws s3 rm -r s3://${s3_bucket}/`date +%F --date="${expired_days} days ago"` > /dev/null 2>&1
|
||||||
|
[ -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -f ${PUSH_FILE}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
WEB_DROPBOX_BK() {
|
||||||
|
for W in `echo ${website_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
[ ! -e "${wwwroot_dir}/${WebSite}" ] && { echo "[${wwwroot_dir}/${WebSite}] not exist"; break; }
|
||||||
|
[ ! -e "${backup_dir}" ] && mkdir -p ${backup_dir}
|
||||||
|
PUSH_FILE="${backup_dir}/Web_${W}_$(date +%Y%m%d_%H).tgz"
|
||||||
|
if [ ! -e "${PUSH_FILE}" ]; then
|
||||||
|
pushd ${wwwroot_dir} > /dev/null
|
||||||
|
tar czf ${PUSH_FILE} ./$W
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
dbxcli put ${PUSH_FILE} `date +%F`/${PUSH_FILE##*/}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
dbxcli rm -f `date +%F --date="${expired_days} days ago"` > /dev/null 2>&1
|
||||||
|
[ -z "`echo ${backup_destination} | grep -ow 'local'`" ] && rm -f ${PUSH_FILE}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
for DEST in `echo ${backup_destination} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
if [ "${DEST}" == 'local' ]; then
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow db`" ] && DB_Local_BK
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow web`" ] && WEB_LOCAL_BK
|
||||||
|
fi
|
||||||
|
if [ "${DEST}" == 'remote' ]; then
|
||||||
|
echo "com:::[ ! -e "${backup_dir}" ] && mkdir -p ${backup_dir}" > config_backup.txt
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow db`" ] && DB_Remote_BK
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow web`" ] && WEB_Remote_BK
|
||||||
|
./mabs.sh -c config_backup.txt -T -1 | tee -a mabs.log
|
||||||
|
fi
|
||||||
|
if [ "${DEST}" == 'oss' ]; then
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow db`" ] && DB_OSS_BK
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow web`" ] && WEB_OSS_BK
|
||||||
|
fi
|
||||||
|
if [ "${DEST}" == 'cos' ]; then
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow db`" ] && DB_COS_BK
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow web`" ] && WEB_COS_BK
|
||||||
|
fi
|
||||||
|
if [ "${DEST}" == 'upyun' ]; then
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow db`" ] && DB_UPYUN_BK
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow web`" ] && WEB_UPYUN_BK
|
||||||
|
fi
|
||||||
|
if [ "${DEST}" == 'qiniu' ]; then
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow db`" ] && DB_QINIU_BK
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow web`" ] && WEB_QINIU_BK
|
||||||
|
fi
|
||||||
|
if [ "${DEST}" == 's3' ]; then
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow db`" ] && DB_S3_BK
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow web`" ] && WEB_S3_BK
|
||||||
|
fi
|
||||||
|
if [ "${DEST}" == 'dropbox' ]; then
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow db`" ] && DB_DROPBOX_BK
|
||||||
|
[ -n "`echo ${backup_content} | grep -ow web`" ] && WEB_DROPBOX_BK
|
||||||
|
fi
|
||||||
|
done
|
||||||
+563
@@ -0,0 +1,563 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
|
||||||
|
clear
|
||||||
|
printf "
|
||||||
|
#######################################################################
|
||||||
|
# OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+ #
|
||||||
|
# Setup the backup parameters #
|
||||||
|
# For more information please visit https://oneinstack.com #
|
||||||
|
#######################################################################
|
||||||
|
"
|
||||||
|
# Check if user is root
|
||||||
|
[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
|
||||||
|
|
||||||
|
oneinstack_dir=$(dirname "`readlink -f $0`")
|
||||||
|
pushd ${oneinstack_dir} > /dev/null
|
||||||
|
. ./options.conf
|
||||||
|
. ./versions.txt
|
||||||
|
. ./include/color.sh
|
||||||
|
. ./include/check_os.sh
|
||||||
|
. ./include/check_dir.sh
|
||||||
|
. ./include/download.sh
|
||||||
|
|
||||||
|
while :; do echo
|
||||||
|
echo 'Please select your backup destination:'
|
||||||
|
echo -e "\t${CMSG}1${CEND}. Localhost"
|
||||||
|
echo -e "\t${CMSG}2${CEND}. Remote host"
|
||||||
|
echo -e "\t${CMSG}3${CEND}. Aliyun OSS"
|
||||||
|
echo -e "\t${CMSG}4${CEND}. Qcloud COS"
|
||||||
|
echo -e "\t${CMSG}5${CEND}. UPYUN"
|
||||||
|
echo -e "\t${CMSG}6${CEND}. QINIU"
|
||||||
|
echo -e "\t${CMSG}7${CEND}. Amazon S3"
|
||||||
|
echo -e "\t${CMSG}8${CEND}. Dropbox"
|
||||||
|
read -e -p "Please input numbers:(Default 1 press Enter) " desc_bk
|
||||||
|
desc_bk=${desc_bk:-'1'}
|
||||||
|
array_desc=(${desc_bk})
|
||||||
|
array_all=(1 2 3 4 5 6 7 8)
|
||||||
|
for v in ${array_desc[@]}
|
||||||
|
do
|
||||||
|
[ -z "`echo ${array_all[@]} | grep -w ${v}`" ] && desc_flag=1
|
||||||
|
done
|
||||||
|
if [ "${desc_flag}" == '1' ]; then
|
||||||
|
unset desc_flag
|
||||||
|
echo; echo "${CWARNING}input error! Please only input number 1 3 4 and so on${CEND}"; echo
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
sed -i 's@^backup_destination=.*@backup_destination=@' ./options.conf
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
[ -n "`echo ${desc_bk} | grep -w 1`" ] && sed -i 's@^backup_destination=.*@backup_destination=local@' ./options.conf
|
||||||
|
[ -n "`echo ${desc_bk} | grep -w 2`" ] && sed -i 's@^backup_destination=.*@&,remote@' ./options.conf
|
||||||
|
[ -n "`echo ${desc_bk} | grep -w 3`" ] && sed -i 's@^backup_destination=.*@&,oss@' ./options.conf
|
||||||
|
[ -n "`echo ${desc_bk} | grep -w 4`" ] && sed -i 's@^backup_destination=.*@&,cos@' ./options.conf
|
||||||
|
[ -n "`echo ${desc_bk} | grep -w 5`" ] && sed -i 's@^backup_destination=.*@&,upyun@' ./options.conf
|
||||||
|
[ -n "`echo ${desc_bk} | grep -w 6`" ] && sed -i 's@^backup_destination=.*@&,qiniu@' ./options.conf
|
||||||
|
[ -n "`echo ${desc_bk} | grep -w 7`" ] && sed -i 's@^backup_destination=.*@&,s3@' ./options.conf
|
||||||
|
[ -n "`echo ${desc_bk} | grep -w 8`" ] && sed -i 's@^backup_destination=.*@&,dropbox@' ./options.conf
|
||||||
|
sed -i 's@^backup_destination=,@backup_destination=@' ./options.conf
|
||||||
|
|
||||||
|
while :; do echo
|
||||||
|
echo 'Please select your backup content:'
|
||||||
|
echo -e "\t${CMSG}1${CEND}. Only Database"
|
||||||
|
echo -e "\t${CMSG}2${CEND}. Only Website"
|
||||||
|
echo -e "\t${CMSG}3${CEND}. Database and Website"
|
||||||
|
read -e -p "Please input a number:(Default 1 press Enter) " content_bk
|
||||||
|
content_bk=${content_bk:-1}
|
||||||
|
if [[ ! ${content_bk} =~ ^[1-3]$ ]]; then
|
||||||
|
echo "${CWARNING}input error! Please only input number 1~3${CEND}"
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
[ "${content_bk}" == '1' ] && sed -i 's@^backup_content=.*@backup_content=db@' ./options.conf
|
||||||
|
[ "${content_bk}" == '2' ] && sed -i 's@^backup_content=.*@backup_content=web@' ./options.conf
|
||||||
|
[ "${content_bk}" == '3' ] && sed -i 's@^backup_content=.*@backup_content=db,web@' ./options.conf
|
||||||
|
|
||||||
|
if [ -n "`echo ${desc_bk} | grep -Ew '1|2'`" ]; then
|
||||||
|
while :; do echo
|
||||||
|
echo "Please enter the directory for save the backup file: "
|
||||||
|
read -e -p "(Default directory: ${backup_dir}): " new_backup_dir
|
||||||
|
new_backup_dir=${new_backup_dir:-${backup_dir}}
|
||||||
|
if [ -z "`echo ${new_backup_dir}| grep '^/'`" ]; then
|
||||||
|
echo "${CWARNING}input error! ${CEND}"
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
sed -i "s@^backup_dir=.*@backup_dir=${new_backup_dir}@" ./options.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
while :; do echo
|
||||||
|
echo "Please enter a valid backup number of days: "
|
||||||
|
read -e -p "(Default days: 5): " expired_days
|
||||||
|
expired_days=${expired_days:-5}
|
||||||
|
[ -n "`echo ${expired_days} | sed -n "/^[0-9]\+$/p"`" ] && break || echo "${CWARNING}input error! Please only enter numbers! ${CEND}"
|
||||||
|
done
|
||||||
|
sed -i "s@^expired_days=.*@expired_days=${expired_days}@" ./options.conf
|
||||||
|
|
||||||
|
if [ "${content_bk}" != '2' ]; then
|
||||||
|
databases=`${db_install_dir}/bin/mysql -uroot -p$dbrootpwd -e "show databases\G" | grep Database | awk '{print $2}' | grep -Evw "(performance_schema|information_schema|mysql|sys)"`
|
||||||
|
while :; do echo
|
||||||
|
echo "Please enter one or more name for database, separate multiple database names with commas: "
|
||||||
|
read -e -p "(Default database: `echo $databases | tr ' ' ','`) " db_name
|
||||||
|
db_name=`echo ${db_name} | tr -d ' '`
|
||||||
|
[ -z "${db_name}" ] && db_name="`echo $databases | tr ' ' ','`"
|
||||||
|
D_tmp=0
|
||||||
|
for D in `echo ${db_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
[ -z "`echo $databases | grep -w $D`" ] && { echo "${CWARNING}$D was not exist! ${CEND}" ; D_tmp=1; }
|
||||||
|
done
|
||||||
|
[ "$D_tmp" != '1' ] && break
|
||||||
|
done
|
||||||
|
sed -i "s@^db_name=.*@db_name=${db_name}@" ./options.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${content_bk}" != '1' ]; then
|
||||||
|
websites=`ls ${wwwroot_dir}`
|
||||||
|
while :; do echo
|
||||||
|
echo "Please enter one or more name for website, separate multiple website names with commas: "
|
||||||
|
read -e -p "(Default website: `echo $websites | tr ' ' ','`) " website_name
|
||||||
|
website_name=`echo ${website_name} | tr -d ' '`
|
||||||
|
[ -z "${website_name}" ] && website_name="`echo $websites | tr ' ' ','`"
|
||||||
|
W_tmp=0
|
||||||
|
for W in `echo ${website_name} | tr ',' ' '`
|
||||||
|
do
|
||||||
|
[ ! -e "${wwwroot_dir}/$W" ] && { echo "${CWARNING}${wwwroot_dir}/$W not exist! ${CEND}" ; W_tmp=1; }
|
||||||
|
done
|
||||||
|
[ "$W_tmp" != '1' ] && break
|
||||||
|
done
|
||||||
|
sed -i "s@^website_name=.*@website_name=${website_name}@" ./options.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "You have to backup the content:"
|
||||||
|
[ "${content_bk}" != '2' ] && echo "Database: ${CMSG}${db_name}${CEND}"
|
||||||
|
[ "${content_bk}" != '1' ] && echo "Website: ${CMSG}${website_name}${CEND}"
|
||||||
|
|
||||||
|
if [ -n "`echo ${desc_bk} | grep -w 2`" ]; then
|
||||||
|
> tools/iplist.txt
|
||||||
|
while :; do echo
|
||||||
|
read -e -p "Please enter the remote host address: " remote_address
|
||||||
|
[ -z "${remote_address}" -o "${remote_address}" == '127.0.0.1' ] && continue
|
||||||
|
echo
|
||||||
|
read -e -p "Please enter the remote host port(Default: 22) : " remote_port
|
||||||
|
remote_port=${remote_port:-22}
|
||||||
|
echo
|
||||||
|
read -e -p "Please enter the remote host user(Default: root) : " remote_user
|
||||||
|
remote_user=${remote_user:-root}
|
||||||
|
echo
|
||||||
|
read -e -p "Please enter the remote host password: " remote_password
|
||||||
|
IPcode=$(echo "ibase=16;$(echo "${remote_address}" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n')
|
||||||
|
Portcode=$(echo "ibase=16;$(echo "${remote_port}" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n')
|
||||||
|
PWcode=$(echo "ibase=16;$(echo "$remote_password" | xxd -ps -u)"|bc|tr -d '\\'|tr -d '\n')
|
||||||
|
[ -e "~/.ssh/known_hosts" ] && grep ${remote_address} ~/.ssh/known_hosts | sed -i "/${remote_address}/d" ~/.ssh/known_hosts
|
||||||
|
./tools/mssh.exp ${IPcode}P ${remote_user} ${PWcode}P ${Portcode}P true 10
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
[ -z "`grep ${remote_address} tools/iplist.txt`" ] && echo "${remote_address} ${remote_port} ${remote_user} $remote_password" >> tools/iplist.txt || echo "${CWARNING}${remote_address} has been added! ${CEND}"
|
||||||
|
while :; do
|
||||||
|
read -e -p "Do you want to add more host ? [y/n]: " morehost_flag
|
||||||
|
if [[ ! ${morehost_flag} =~ ^[y,n]$ ]]; then
|
||||||
|
echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[ "${morehost_flag}" == 'n' ] && break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "`echo ${desc_bk} | grep -w 3`" ]; then
|
||||||
|
if [ ! -e "/usr/local/bin/ossutil" ]; then
|
||||||
|
if [ "${armplatform}" == 'y' ]; then
|
||||||
|
wget -qc https://gosspublic.alicdn.com/ossutil/1.7.16/ossutilarm64 -O /usr/local/bin/ossutil
|
||||||
|
else
|
||||||
|
wget -qc https://gosspublic.alicdn.com/ossutil/1.7.16/ossutil64 -O /usr/local/bin/ossutil
|
||||||
|
fi
|
||||||
|
chmod +x /usr/local/bin/ossutil
|
||||||
|
fi
|
||||||
|
while :; do echo
|
||||||
|
echo 'Please select your backup aliyun datacenter:'
|
||||||
|
echo -e "\t ${CMSG}1${CEND}. cn-hangzhou-华东1 (杭州) ${CMSG}2${CEND}. cn-shanghai-华东2 (上海)"
|
||||||
|
echo -e "\t ${CMSG}3${CEND}. cn-nanjing-华东5 (南京) ${CMSG}4${CEND}. cn-fuzhou-华东6 (福州)"
|
||||||
|
echo -e "\t ${CMSG}5${CEND}. cn-qingdao-华北1 (青岛) ${CMSG}6${CEND}. cn-beijing-华北2 (北京)"
|
||||||
|
echo -e "\t ${CMSG}7${CEND}. cn-zhangjiakou-华北3 (张家口) ${CMSG}8${CEND}. cn-huhehaote-华北5 (呼和浩特)"
|
||||||
|
echo -e "\t ${CMSG}9${CEND}. cn-wulanchabu-华北6 (乌兰察布) ${CMSG}10${CEND}. cn-shenzhen-华南1 (深圳)"
|
||||||
|
echo -e "\t${CMSG}11${CEND}. cn-heyuan-华南2 (河源) ${CMSG}12${CEND}. cn-guangzhou-华南3 (广州)"
|
||||||
|
echo -e "\t${CMSG}13${CEND}. cn-chengdu-西南1 (成都) ${CMSG}14${CEND}. cn-hongkong-香港"
|
||||||
|
echo -e "\t${CMSG}15${CEND}. us-west-1-美国 (硅谷) ${CMSG}16${CEND}. us-east-1-美国 (弗吉尼亚)"
|
||||||
|
echo -e "\t${CMSG}17${CEND}. ap-northeast-1-日本 (东京) ${CMSG}18${CEND}. ap-northeast-2-韩国 (首尔)"
|
||||||
|
echo -e "\t${CMSG}19${CEND}. ap-southeast-1-新加坡 ${CMSG}20${CEND}. ap-southeast-2-澳大利亚 (悉尼)"
|
||||||
|
echo -e "\t${CMSG}21${CEND}. ap-southeast-3-马来西亚 (吉隆坡) ${CMSG}22${CEND}. ap-southeast-5-印度尼西亚 (雅加达)"
|
||||||
|
echo -e "\t${CMSG}23${CEND}. ap-southeast-6-菲律宾 (马尼拉) ${CMSG}24${CEND}. ap-southeast-7-泰国 (曼谷)"
|
||||||
|
echo -e "\t${CMSG}25${CEND}. ap-south-1-印度 (孟买) ${CMSG}26${CEND}. eu-central-1-德国 (法兰克福)"
|
||||||
|
echo -e "\t${CMSG}27${CEND}. eu-west-1-英国 (伦敦) ${CMSG}28${CEND}. me-east-1-阿联酋 (迪拜)"
|
||||||
|
read -e -p "Please input a number:(Default 1 press Enter) " Location
|
||||||
|
Location=${Location:-1}
|
||||||
|
if [[ "${Location}" =~ ^[1-9]$|^1[0-9]$|^2[0-8]$ ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${CWARNING}input error! Please only input number 1~28${CEND}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[ "${Location}" == '1' ] && Host=oss-cn-hangzhou-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '2' ] && Host=oss-cn-shanghai-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '3' ] && Host=oss-cn-nanjing-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '4' ] && Host=oss-cn-fuzhou-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '5' ] && Host=oss-cn-qingdao-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '6' ] && Host=oss-cn-beijing-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '7' ] && Host=oss-cn-zhangjiakou-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '8' ] && Host=oss-cn-huhehaote-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '9' ] && Host=oss-cn-wulanchabu-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '10' ] && Host=oss-cn-shenzhen-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '11' ] && Host=oss-cn-heyuan-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '12' ] && Host=oss-cn-guangzhou-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '13' ] && Host=oss-cn-chengdu-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '14' ] && Host=oss-cn-hongkong-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '15' ] && Host=oss-us-west-1-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '16' ] && Host=oss-us-east-1-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '17' ] && Host=oss-ap-northeast-1-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '18' ] && Host=oss-ap-northeast-2-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '19' ] && Host=oss-ap-southeast-1-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '20' ] && Host=oss-ap-southeast-2-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '21' ] && Host=oss-ap-southeast-3-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '22' ] && Host=oss-ap-southeast-5-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '23' ] && Host=oss-ap-southeast-6-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '24' ] && Host=oss-ap-southeast-7-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '25' ] && Host=oss-ap-south-1-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '26' ] && Host=oss-eu-central-1-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '27' ] && Host=oss-eu-west-1-internal.aliyuncs.com
|
||||||
|
[ "${Location}" == '28' ] && Host=oss-me-east-1-internal.aliyuncs.com
|
||||||
|
[ "$(./include/ois.${ARCH} conn_port --host ${Host} --port 80)" == "false" ] && Host=`echo ${Host} | sed 's@-internal@@g'`
|
||||||
|
[ -e "/root/.ossutilconfig" ] && rm -f /root/.ossutilconfig
|
||||||
|
while :; do echo
|
||||||
|
read -e -p "Please enter the aliyun oss Access Key ID: " KeyID
|
||||||
|
[ -z "${KeyID}" ] && continue
|
||||||
|
echo
|
||||||
|
read -e -p "Please enter the aliyun oss Access Key Secret: " KeySecret
|
||||||
|
[ -z "${KeySecret}" ] && continue
|
||||||
|
ossutil ls -e ${Host} -i ${KeyID} -k ${KeySecret} > /dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
ossutil config -e ${Host} -i ${KeyID} -k ${KeySecret} > /dev/null 2>&1
|
||||||
|
while :; do echo
|
||||||
|
read -e -p "Please enter the aliyun oss bucket: " OSS_BUCKET
|
||||||
|
ossutil mb oss://${OSS_BUCKET} > /dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "${CMSG}Bucket oss://${OSS_BUCKET}/ created${CEND}"
|
||||||
|
sed -i "s@^oss_bucket=.*@oss_bucket=${OSS_BUCKET}@" ./options.conf
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${CWARNING}[${OSS_BUCKET}] already exists, You need to use the OSS Console to create a bucket for storing.${CEND}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "`echo ${desc_bk} | grep -w 4`" ]; then
|
||||||
|
if [ ! -e "/usr/local/bin/coscli" ]; then
|
||||||
|
wget -qc https://cosbrowser.cloud.tencent.com/software/coscli/coscli-linux -O /usr/local/bin/coscli
|
||||||
|
chmod +x /usr/local/bin/coscli
|
||||||
|
fi
|
||||||
|
|
||||||
|
while :; do echo
|
||||||
|
echo 'Please select your backup qcloud datacenter:'
|
||||||
|
echo -e "\t ${CMSG} 1${CEND}. ap-beijing-北京 ${CMSG}2${CEND}. ap-nanjing-南京"
|
||||||
|
echo -e "\t ${CMSG} 3${CEND}. ap-shanghai-上海 ${CMSG}4${CEND}. ap-guangzhou-广州"
|
||||||
|
echo -e "\t ${CMSG} 5${CEND}. ap-chengdu-成都 ${CMSG}6${CEND}. ap-chongqing-重庆"
|
||||||
|
echo -e "\t ${CMSG} 7${CEND}. ap-shenzhen-fsi-深圳金融 ${CMSG}8${CEND}. ap-shanghai-fsi-上海金融"
|
||||||
|
echo -e "\t ${CMSG} 9${CEND}. ap-beijing-fsi-北京金融 ${CMSG}10${CEND}. ap-hongkong-香港"
|
||||||
|
echo -e "\t ${CMSG}11${CEND}. ap-singapore-新加坡 ${CMSG}12${CEND}. ap-mumbai-孟买"
|
||||||
|
echo -e "\t ${CMSG}13${CEND}. ap-jakarta-雅加达 ${CMSG}14${CEND}. ap-seoul-首尔"
|
||||||
|
echo -e "\t ${CMSG}15${CEND}. ap-bangkok-曼谷 ${CMSG}16${CEND}. ap-tokyo-东京"
|
||||||
|
echo -e "\t ${CMSG}17${CEND}. na-siliconvalley-硅谷 ${CMSG}18${CEND}. na-ashburn-弗吉尼亚"
|
||||||
|
echo -e "\t ${CMSG}19${CEND}. na-toronto-多伦多 ${CMSG}20${CEND}. sa-saopaulo-圣保罗"
|
||||||
|
echo -e "\t ${CMSG}21${CEND}. eu-frankfurt-法兰克福"
|
||||||
|
read -e -p "Please input a number:(Default 1 press Enter) " Location
|
||||||
|
Location=${Location:-1}
|
||||||
|
if [[ "${Location}" =~ ^[1-9]$|^1[0-9]$|^2[0-1]$ ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${CWARNING}input error! Please only input number 1~21${CEND}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[ "${Location}" == '1' ] && REGION='ap-beijing'
|
||||||
|
[ "${Location}" == '2' ] && REGION='ap-nanjing'
|
||||||
|
[ "${Location}" == '3' ] && REGION='ap-shanghai'
|
||||||
|
[ "${Location}" == '4' ] && REGION='ap-guangzhou'
|
||||||
|
[ "${Location}" == '5' ] && REGION='ap-chengdu'
|
||||||
|
[ "${Location}" == '6' ] && REGION='ap-chongqing'
|
||||||
|
[ "${Location}" == '7' ] && REGION='ap-shenzhen-fsi'
|
||||||
|
[ "${Location}" == '8' ] && REGION='ap-shanghai-fsi'
|
||||||
|
[ "${Location}" == '9' ] && REGION='ap-beijing-fsi'
|
||||||
|
[ "${Location}" == '10' ] && REGION='ap-hongkong'
|
||||||
|
[ "${Location}" == '11' ] && REGION='ap-singapore'
|
||||||
|
[ "${Location}" == '12' ] && REGION='ap-mumbai'
|
||||||
|
[ "${Location}" == '13' ] && REGION='ap-jakarta'
|
||||||
|
[ "${Location}" == '14' ] && REGION='ap-seoul'
|
||||||
|
[ "${Location}" == '15' ] && REGION='ap-bangkok'
|
||||||
|
[ "${Location}" == '16' ] && REGION='ap-tokyo'
|
||||||
|
[ "${Location}" == '17' ] && REGION='na-siliconvalley'
|
||||||
|
[ "${Location}" == '18' ] && REGION='na-ashburn'
|
||||||
|
[ "${Location}" == '19' ] && REGION='na-toronto'
|
||||||
|
[ "${Location}" == '20' ] && REGION='sa-saopaulo'
|
||||||
|
[ "${Location}" == '21' ] && REGION='eu-frankfurt'
|
||||||
|
while :; do echo
|
||||||
|
read -e -p "Please enter the Qcloud COS SECRET_ID: " SECRET_ID
|
||||||
|
[ -z "${SECRET_ID}" ] && continue
|
||||||
|
echo
|
||||||
|
read -e -p "Please enter the Qcloud COS SECRET_KEY: " SECRET_KEY
|
||||||
|
[ -z "${SECRET_KEY}" ] && continue
|
||||||
|
echo
|
||||||
|
read -e -p "Please enter the Qcloud COS BUCKET: " COS_BUCKET
|
||||||
|
[ -z "${COS_BUCKET}" ] && continue
|
||||||
|
cat > ~/.cos.yaml << EOF
|
||||||
|
cos:
|
||||||
|
base:
|
||||||
|
secretid: ${SECRET_ID}
|
||||||
|
secretkey: ${SECRET_KEY}
|
||||||
|
protocol: https
|
||||||
|
buckets:
|
||||||
|
- name: ${COS_BUCKET}
|
||||||
|
endpoint: cos.${REGION}.myqcloud.com
|
||||||
|
EOF
|
||||||
|
coscli ls cos://${COS_BUCKET} > /dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "${CMSG}SECRET_ID/SECRET_KEY/REGION/BUCKET OK${CEND}"
|
||||||
|
sed -i "s@^cos_bucket=.*@cos_bucket=${COS_BUCKET}@" ./options.conf
|
||||||
|
echo
|
||||||
|
break
|
||||||
|
else
|
||||||
|
coscli mb cos://${COS_BUCKET} -e cos.${REGION}.myqcloud.com > /dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "${CMSG}Bucket ${COS_BUCKET} created${CEND}"
|
||||||
|
sed -i "s@^cos_bucket=.*@cos_bucket=${COS_BUCKET}@" ./options.conf
|
||||||
|
echo
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${CWARNING}input error! SECRET_ID/SECRET_KEY/REGION/BUCKET invalid${CEND}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "`echo ${desc_bk} | grep -w 5`" ]; then
|
||||||
|
if [ ! -e "/usr/local/bin/upx" ]; then
|
||||||
|
if [ "${armplatform}" == 'y' ]; then
|
||||||
|
wget -qc http://collection.b0.upaiyun.com/softwares/upx/upx_0.4.3_linux_arm64.tar.gz -O /tmp/upx_0.4.3_linux_arm64.tar.gz
|
||||||
|
tar xzf /tmp/upx_0.4.3_linux_arm64.tar.gz -C /tmp/
|
||||||
|
else
|
||||||
|
wget -qc http://collection.b0.upaiyun.com/softwares/upx/upx_0.4.3_linux_x86_64.tar.gz -O /tmp/upx_0.4.3_linux_x86_64.tar.gz
|
||||||
|
tar xzf /tmp/upx_0.4.3_linux_x86_64.tar.gz -C /tmp/
|
||||||
|
fi
|
||||||
|
/bin/mv /tmp/upx /usr/local/bin/upx
|
||||||
|
chmod +x /usr/local/bin/upx
|
||||||
|
rm -f /tmp/{upx_*,LICENSE,README.md}
|
||||||
|
fi
|
||||||
|
while :; do echo
|
||||||
|
read -e -p "Please enter the upyun ServiceName: " ServiceName
|
||||||
|
[ -z "${ServiceName}" ] && continue
|
||||||
|
echo
|
||||||
|
read -e -p "Please enter the upyun Operator: " Operator
|
||||||
|
[ -z "${Operator}" ] && continue
|
||||||
|
echo
|
||||||
|
read -e -p "Please enter the upyun Password: " Password
|
||||||
|
[ -z "${Password}" ] && continue
|
||||||
|
echo
|
||||||
|
upx login ${ServiceName} ${Operator} ${Password} > /dev/null 2>&1
|
||||||
|
if [ $? = 0 ]; then
|
||||||
|
echo "${CMSG}ServiceName/Operator/Password OK${CEND}"
|
||||||
|
echo
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${CWARNING}input error! ServiceName/Operator/Password invalid${CEND}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "`echo ${desc_bk} | grep -w 6`" ]; then
|
||||||
|
if [ ! -e "/usr/local/bin/qshell" ]; then
|
||||||
|
if [ "${armplatform}" == 'y' ]; then
|
||||||
|
wget -qc https://devtools.qiniu.com/qshell-v2.12.0-linux-arm64.tar.gz -O /tmp/qshell-v2.12.0-linux-arm64.tar.gz
|
||||||
|
tar xzf /tmp/qshell-v2.12.0-linux-arm64.tar.gz -C /usr/local/bin/
|
||||||
|
else
|
||||||
|
wget -qc https://devtools.qiniu.com/qshell-v2.12.0-linux-amd64.tar.gz -O /tmp/qshell-v2.12.0-linux-amd64.tar.gz
|
||||||
|
tar xzf /tmp/qshell-v2.12.0-linux-amd64.tar.gz -C /usr/local/bin/
|
||||||
|
fi
|
||||||
|
chmod +x /usr/local/bin/qshell
|
||||||
|
rm -f /tmp/qshell*
|
||||||
|
fi
|
||||||
|
while :; do echo
|
||||||
|
echo 'Please select your backup qiniu datacenter:'
|
||||||
|
echo -e "\t ${CMSG} 1${CEND}. 华东 ${CMSG}2${CEND}. 华北"
|
||||||
|
echo -e "\t ${CMSG} 3${CEND}. 华南 ${CMSG}4${CEND}. 北美"
|
||||||
|
echo -e "\t ${CMSG} 5${CEND}. 东南亚 ${CMSG}6${CEND}. 华东-浙江2"
|
||||||
|
read -e -p "Please input a number:(Default 1 press Enter) " Location
|
||||||
|
Location=${Location:-1}
|
||||||
|
if [[ "${Location}" =~ ^[1-6]$ ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${CWARNING}input error! Please only input number 1~6${CEND}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[ "${Location}" == '1' ] && zone='z0'
|
||||||
|
[ "${Location}" == '2' ] && zone='z1'
|
||||||
|
[ "${Location}" == '3' ] && zone='z2'
|
||||||
|
[ "${Location}" == '4' ] && zone='na0'
|
||||||
|
[ "${Location}" == '5' ] && zone='as0'
|
||||||
|
[ "${Location}" == '6' ] && zone='cn-east-2'
|
||||||
|
while :; do echo
|
||||||
|
read -e -p "Please enter the qiniu AccessKey: " AccessKey
|
||||||
|
[ -z "${AccessKey}" ] && continue
|
||||||
|
echo
|
||||||
|
read -e -p "Please enter the qiniu SecretKey: " SecretKey
|
||||||
|
[ -z "${SecretKey}" ] && continue
|
||||||
|
echo
|
||||||
|
read -e -p "Please enter the qiniu bucket: " QINIU_BUCKET
|
||||||
|
[ -z "${QINIU_BUCKET}" ] && continue
|
||||||
|
echo
|
||||||
|
qshell account ${AccessKey} ${SecretKey} backup
|
||||||
|
if qshell buckets | grep -w ${QINIU_BUCKET} > /dev/null 2>&1; then
|
||||||
|
sed -i "s@^qiniu_bucket=.*@qiniu_bucket=${QINIU_BUCKET}@" ./options.conf
|
||||||
|
echo "${CMSG}AccessKey/SecretKey/Bucket OK${CEND}"
|
||||||
|
echo
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${CWARNING}input error! AccessKey/SecretKey/Bucket invalid${CEND}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "`echo ${desc_bk} | grep -w 7`" ]; then
|
||||||
|
if [ ! -e "/usr/local/bin/aws" ] && [ ! -e "/usr/bin/aws" ]; then
|
||||||
|
wget -qc https://awscli.amazonaws.com/awscli-exe-linux-$(arch).zip -O /tmp/awscliv2.zip
|
||||||
|
unzip /tmp/awscliv2.zip -d /tmp/
|
||||||
|
/tmp/aws/install
|
||||||
|
rm -rf /tmp/{awscliv2.zip,aws}
|
||||||
|
fi
|
||||||
|
while :; do echo
|
||||||
|
echo 'Please select your backup amazon datacenter:'
|
||||||
|
echo -e "\t ${CMSG} 1${CEND}. us-east-2 ${CMSG} 2${CEND}. us-east-1"
|
||||||
|
echo -e "\t ${CMSG} 3${CEND}. us-west-1 ${CMSG} 4${CEND}. us-west-2"
|
||||||
|
echo -e "\t ${CMSG} 5${CEND}. af-south-1 ${CMSG} 6${CEND}. ap-east-1"
|
||||||
|
echo -e "\t ${CMSG} 7${CEND}. ap-south-2 ${CMSG} 8${CEND}. ap-southeast-3"
|
||||||
|
echo -e "\t ${CMSG} 9${CEND}. ap-southeast-4 ${CMSG}10${CEND}. ap-south-1"
|
||||||
|
echo -e "\t ${CMSG}11${CEND}. ap-northeast-3 ${CMSG}12${CEND}. ap-northeast-2"
|
||||||
|
echo -e "\t ${CMSG}13${CEND}. ap-southeast-1 ${CMSG}14${CEND}. ap-southeast-2"
|
||||||
|
echo -e "\t ${CMSG}15${CEND}. ap-northeast-1 ${CMSG}16${CEND}. ca-central-1"
|
||||||
|
echo -e "\t ${CMSG}17${CEND}. eu-central-1 ${CMSG}18${CEND}. eu-west-1"
|
||||||
|
echo -e "\t ${CMSG}19${CEND}. eu-west-2 ${CMSG}20${CEND}. eu-south-1"
|
||||||
|
echo -e "\t ${CMSG}21${CEND}. eu-west-3 ${CMSG}22${CEND}. eu-south-2"
|
||||||
|
echo -e "\t ${CMSG}23${CEND}. eu-north-1 ${CMSG}24${CEND}. eu-central-2"
|
||||||
|
echo -e "\t ${CMSG}25${CEND}. me-south-1 ${CMSG}26${CEND}. me-central-1"
|
||||||
|
echo -e "\t ${CMSG}27${CEND}. sa-east-1 ${CMSG}28${CEND}. us-gov-east-1"
|
||||||
|
echo -e "\t ${CMSG}29${CEND}. us-gov-west-1 ${CMSG}30${CEND}. cn-north-1"
|
||||||
|
echo -e "\t ${CMSG}31${CEND}. cn-northwest-1"
|
||||||
|
read -e -p "Please input a number:(Default 1 press Enter) " Location
|
||||||
|
Location=${Location:-1}
|
||||||
|
if [[ "${Location}" =~ ^[1-9]$|^[1-2][0-9]$|^3[0-1]$ ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${CWARNING}input error! Please only input number 1~31${CEND}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[ "${Location}" == '1' ] && REGION='us-east-2'
|
||||||
|
[ "${Location}" == '2' ] && REGION='us-east-1'
|
||||||
|
[ "${Location}" == '3' ] && REGION='us-west-1'
|
||||||
|
[ "${Location}" == '4' ] && REGION='us-west-2'
|
||||||
|
[ "${Location}" == '5' ] && REGION='af-south-1'
|
||||||
|
[ "${Location}" == '6' ] && REGION='ap-east-1'
|
||||||
|
[ "${Location}" == '7' ] && REGION='ap-south-2'
|
||||||
|
[ "${Location}" == '8' ] && REGION='ap-southeast-3'
|
||||||
|
[ "${Location}" == '9' ] && REGION='ap-southeast-4'
|
||||||
|
[ "${Location}" == '10' ] && REGION='ap-south-1'
|
||||||
|
[ "${Location}" == '11' ] && REGION='ap-northeast-3'
|
||||||
|
[ "${Location}" == '12' ] && REGION='ap-northeast-2'
|
||||||
|
[ "${Location}" == '13' ] && REGION='ap-southeast-1'
|
||||||
|
[ "${Location}" == '14' ] && REGION='ap-southeast-2'
|
||||||
|
[ "${Location}" == '15' ] && REGION='ap-northeast-1'
|
||||||
|
[ "${Location}" == '16' ] && REGION='ca-central-1'
|
||||||
|
[ "${Location}" == '17' ] && REGION='eu-central-1'
|
||||||
|
[ "${Location}" == '18' ] && REGION='eu-west-1'
|
||||||
|
[ "${Location}" == '19' ] && REGION='eu-west-2'
|
||||||
|
[ "${Location}" == '20' ] && REGION='eu-south-1'
|
||||||
|
[ "${Location}" == '21' ] && REGION='eu-west-3'
|
||||||
|
[ "${Location}" == '22' ] && REGION='eu-south-2'
|
||||||
|
[ "${Location}" == '23' ] && REGION='eu-north-1'
|
||||||
|
[ "${Location}" == '24' ] && REGION='eu-central-2'
|
||||||
|
[ "${Location}" == '25' ] && REGION='me-south-1'
|
||||||
|
[ "${Location}" == '26' ] && REGION='me-central-1'
|
||||||
|
[ "${Location}" == '27' ] && REGION='sa-east-1'
|
||||||
|
[ "${Location}" == '28' ] && REGION='us-gov-east-1'
|
||||||
|
[ "${Location}" == '29' ] && REGION='us-gov-west-1'
|
||||||
|
[ "${Location}" == '30' ] && REGION='cn-north-1'
|
||||||
|
[ "${Location}" == '31' ] && REGION='cn-northwest-1'
|
||||||
|
while :; do echo
|
||||||
|
read -e -p "Please enter the AWS Access Key: " ACCESS_KEY
|
||||||
|
[ -z "${ACCESS_KEY}" ] && continue
|
||||||
|
echo
|
||||||
|
read -e -p "Please enter the AWS Access Key: " SECRET_KEY
|
||||||
|
[ -z "${SECRET_KEY}" ] && continue
|
||||||
|
aws configure set aws_access_key_id ${ACCESS_KEY}
|
||||||
|
aws configure set aws_secret_access_key ${SECRET_KEY}
|
||||||
|
aws configure set region ${REGION}
|
||||||
|
aws sts get-caller-identity > /dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "${CMSG}ACCESS_KEY/SECRET_KEY OK${CEND}"
|
||||||
|
while :; do echo
|
||||||
|
read -e -p "Please enter the Amazon S3 bucket: " S3_BUCKET
|
||||||
|
[ -z "${S3_BUCKET}" ] && continue
|
||||||
|
aws s3 ls s3://${S3_BUCKET} > /dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "${CMSG}Bucket s3://${S3_BUCKET}/ existed${CEND}"
|
||||||
|
sed -i "s@^s3_bucket=.*@s3_bucket=${S3_BUCKET}@" ./options.conf
|
||||||
|
break
|
||||||
|
else
|
||||||
|
aws s3 mb s3://${S3_BUCKET} > /dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "${CMSG}Bucket s3://${S3_BUCKET}/ created${CEND}"
|
||||||
|
sed -i "s@^s3_bucket=.*@s3_bucket=${S3_BUCKET}@" ./options.conf
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${CWARNING}The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.${CEND}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${CWARNING}input error! ACCESS_KEY/SECRET_KEY invalid${CEND}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "`echo ${desc_bk} | grep -w 8`" ]; then
|
||||||
|
if [ ! -e "/usr/local/bin/dbxcli" ]; then
|
||||||
|
if [ "${armplatform}" == 'y' ]; then
|
||||||
|
wget -qc ${mirror_link}/oneinstack/src/dbxcli-linux-arm -O /usr/local/bin/dbxcli
|
||||||
|
else
|
||||||
|
wget -qc ${mirror_link}/oneinstack/src/dbxcli-linux-amd64 -O /usr/local/bin/dbxcli
|
||||||
|
fi
|
||||||
|
chmod +x /usr/local/bin/dbxcli
|
||||||
|
fi
|
||||||
|
while :; do echo
|
||||||
|
if dbxcli account; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# The Caddyfile is an easy way to configure your Caddy web server.
|
||||||
|
#
|
||||||
|
# Unless the file starts with a global options block, the first
|
||||||
|
# uncommented line is always the address of your site.
|
||||||
|
#
|
||||||
|
# To use your own domain name (with automatic HTTPS), first make
|
||||||
|
# sure your domain's A/AAAA DNS records are properly pointed to
|
||||||
|
# this machine's public IP, then replace ":80" below with your
|
||||||
|
# domain name.
|
||||||
|
|
||||||
|
:80 {
|
||||||
|
# Set this path to your site's directory.
|
||||||
|
root * /data/wwwroot/default
|
||||||
|
|
||||||
|
# Enable the static file server.
|
||||||
|
file_server
|
||||||
|
|
||||||
|
# Another common task is to set up a reverse proxy:
|
||||||
|
# reverse_proxy localhost:8080
|
||||||
|
|
||||||
|
# Or serve a PHP site through php-fpm:
|
||||||
|
# php_fastcgi localhost:9000
|
||||||
|
}
|
||||||
|
|
||||||
|
# Refer to the Caddy docs for more information:
|
||||||
|
# https://caddyserver.com/docs/caddyfile
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
set_real_ip_from 103.21.244.0/22;
|
||||||
|
set_real_ip_from 103.22.200.0/22;
|
||||||
|
set_real_ip_from 103.31.4.0/22;
|
||||||
|
set_real_ip_from 104.16.0.0/12;
|
||||||
|
set_real_ip_from 108.162.192.0/18;
|
||||||
|
set_real_ip_from 131.0.72.0/22;
|
||||||
|
set_real_ip_from 141.101.64.0/18;
|
||||||
|
set_real_ip_from 162.158.0.0/15;
|
||||||
|
set_real_ip_from 172.64.0.0/13;
|
||||||
|
set_real_ip_from 173.245.48.0/20;
|
||||||
|
set_real_ip_from 188.114.96.0/20;
|
||||||
|
set_real_ip_from 190.93.240.0/20;
|
||||||
|
set_real_ip_from 197.234.240.0/22;
|
||||||
|
set_real_ip_from 198.41.128.0/17;
|
||||||
|
set_real_ip_from 2400:cb00::/32;
|
||||||
|
set_real_ip_from 2606:4700::/32;
|
||||||
|
set_real_ip_from 2803:f800::/32;
|
||||||
|
set_real_ip_from 2405:b500::/32;
|
||||||
|
set_real_ip_from 2405:8100::/32;
|
||||||
|
set_real_ip_from 2c0f:f248::/32;
|
||||||
|
set_real_ip_from 2a06:98c0::/29;
|
||||||
|
|
||||||
|
# use any of the following two
|
||||||
|
real_ip_header CF-Connecting-IP;
|
||||||
|
#real_ip_header X-Forwarded-For;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?/$request_uri;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
|
||||||
|
rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
|
||||||
|
rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
|
||||||
|
rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
|
||||||
|
rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
|
||||||
|
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
|
||||||
|
rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
|
||||||
|
rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
|
||||||
|
rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
|
||||||
|
#if (!-e $request_filename) {
|
||||||
|
# return 404;
|
||||||
|
#}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
if (!-e $request_filename) {
|
||||||
|
rewrite ^/update.php(.*)$ /update.php?q=$1 last;
|
||||||
|
rewrite ^/(.*)$ /index.php?q=$1 last;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
if (!-e $request_filename) {
|
||||||
|
rewrite "^/index\.html" /index.php last;
|
||||||
|
rewrite "^/category$" /index.php last;
|
||||||
|
rewrite "^/feed-c([0-9]+)\.xml$" /feed.php?cat=$1 last;
|
||||||
|
rewrite "^/feed-b([0-9]+)\.xml$" /feed.php?brand=$1 last;
|
||||||
|
rewrite "^/feed\.xml$" /feed.php last;
|
||||||
|
rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last;
|
||||||
|
rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 last;
|
||||||
|
rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last;
|
||||||
|
rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3 last;
|
||||||
|
rewrite "^/category-([0-9]+)-b([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2 last;
|
||||||
|
rewrite "^/category-([0-9]+)(.*)\.html$" /category.php?id=$1 last;
|
||||||
|
rewrite "^/goods-([0-9]+)(.*)\.html" /goods.php?id=$1 last;
|
||||||
|
rewrite "^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last;
|
||||||
|
rewrite "^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$" /article_cat.php?id=$1&page=$2 last;
|
||||||
|
rewrite "^/article_cat-([0-9]+)(.*)\.html$" /article_cat.php?id=$1 last;
|
||||||
|
rewrite "^/article-([0-9]+)(.*)\.html$" /article.php?id=$1 last;
|
||||||
|
rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html" /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last;
|
||||||
|
rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2&page=$3 last;
|
||||||
|
rewrite "^/brand-([0-9]+)-c([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2 last;
|
||||||
|
rewrite "^/brand-([0-9]+)(.*)\.html" /brand.php?id=$1 last;
|
||||||
|
rewrite "^/tag-(.*)\.html" /search.php?keywords=$1 last;
|
||||||
|
rewrite "^/snatch-([0-9]+)\.html$" /snatch.php?id=$1 last;
|
||||||
|
rewrite "^/group_buy-([0-9]+)\.html$" /group_buy.php?act=view&id=$1 last;
|
||||||
|
rewrite "^/auction-([0-9]+)\.html$" /auction.php?act=view&id=$1 last;
|
||||||
|
rewrite "^/exchange-id([0-9]+)(.*)\.html$" /exchange.php?id=$1&act=view last;
|
||||||
|
rewrite "^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 last;
|
||||||
|
rewrite "^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last;
|
||||||
|
rewrite "^/exchange-([0-9]+)-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2 last;
|
||||||
|
rewrite "^/exchange-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1 last;
|
||||||
|
}
|
||||||
@@ -0,0 +1,321 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<meta name="description" content="OneinStack - A PHP/JAVA Deployment Tool. In order to quickly deploy lnmp,lamp,lnmpa,ltmp,lnmh,MySQL,PostgreSQL,MongoDB,oneinstack.com">
|
||||||
|
<meta name="author" content="yeho">
|
||||||
|
<title>Welcome to use OneinStack</title>
|
||||||
|
<link href="https://static.oneinstack.com/assets/ois.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<nav class="navbar navbar-dark fixed-top bg-dark flex-md-nowrap p-0 shadow">
|
||||||
|
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="">OneinStack</a>
|
||||||
|
|
||||||
|
<form class="w-100" action="https://lempstack.com/qa/" method="GET" target="_blank">
|
||||||
|
<input class="form-control form-control-dark w-100" type="text" placeholder="What do you want to know?" aria-label="What do you want to know?" name="qs">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<ul class="navbar-nav px-3">
|
||||||
|
<li class="nav-item text-nowrap">
|
||||||
|
<a class="nav-link" href="https://lempstack.com" target="_blank">OneinStack</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
|
||||||
|
<div class="sidebar-sticky">
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="###home" id="home_link">
|
||||||
|
<span data-feather="home"></span>
|
||||||
|
Control center <span class="sr-only">(current)</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<!--<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###step" id="step_link">
|
||||||
|
<span data-feather="file"></span>
|
||||||
|
</a>
|
||||||
|
</li>-->
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###vhost" id="vhost_link">
|
||||||
|
<span data-feather="layers"></span>
|
||||||
|
Virtual host
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###db" id="db_link">
|
||||||
|
<span data-feather="shopping-cart"></span>
|
||||||
|
Database
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###ftp" id="ftp_link">
|
||||||
|
<span data-feather="users"></span>
|
||||||
|
FTP
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###tools" id="tools_link">
|
||||||
|
<span data-feather="briefcase"></span>
|
||||||
|
Tools
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###manage" id="manage_link">
|
||||||
|
<span data-feather="bar-chart-2"></span>
|
||||||
|
Manage service
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###backup" id="backup_link">
|
||||||
|
<span data-feather="disc"></span>
|
||||||
|
Backup
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###upgrade" id="upgrade_link">
|
||||||
|
<span data-feather="trending-up"></span>
|
||||||
|
Upgrade & Uninstall
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###port" id="port_link">
|
||||||
|
<span data-feather="cloud"></span>
|
||||||
|
Security group
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###donation" id="donation_link">
|
||||||
|
<span data-feather="heart"></span>
|
||||||
|
Donation
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
|
||||||
|
<span>OneinStack</span>
|
||||||
|
<a class="d-flex align-items-center text-muted" href="https://lempstack.com/" target="_blank">
|
||||||
|
<span data-feather="chevron-down"></span>
|
||||||
|
</a>
|
||||||
|
</h6>
|
||||||
|
<ul class="nav flex-column mb-2">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="https://lempstack.com/" target="_blank">
|
||||||
|
<span data-feather="home"></span>
|
||||||
|
OneinStack Home
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="https://lempstack.com/install/" target="_blank">
|
||||||
|
<span data-feather="help-circle"></span>
|
||||||
|
Install & Docs
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="https://lempstack.com/faq/" target="_blank">
|
||||||
|
<span data-feather="link"></span>
|
||||||
|
FAQ
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="https://lempstack.com/changelog/" target="_blank">
|
||||||
|
<span data-feather="link"></span>
|
||||||
|
ChangeLog
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
||||||
|
<h1 class="h2" id="home">Control center</h1>
|
||||||
|
<div class="btn-toolbar mb-2 mb-md-0">
|
||||||
|
<div class="btn-group mr-2">
|
||||||
|
<a class="btn btn-sm btn-outline-primary btn_prober" href="xprober.php" target="_blank"><span data-feather="compass"></span> prober</a>
|
||||||
|
<a class="btn btn-sm btn-outline-info btn_phpinfo" href="phpinfo.php" target="_blank"><span data-feather="info"></span> phpinfo</a>
|
||||||
|
<a class="btn btn-sm btn-outline-secondary btn_op" href="ocp.php" target="_blank"><span data-feather="cpu"></span> Opcache</a>
|
||||||
|
</div>
|
||||||
|
<a class="btn btn-sm btn-outline-warning mr-2 btn_pma" href="phpMyAdmin/" target="_blank">
|
||||||
|
<span data-feather="database"></span> phpMyAdmin
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<section class="section" id="home_section">
|
||||||
|
<h2>Congratulations, OneinStack installed successfully!</h2>
|
||||||
|
<h3><a href="https://oneinstack.com" target="_blank" class="links">OneinStack </a><a href="https://linuxeye.com/" target="_blank">Linux</a>+Nginx/Tengine+MySQL/MariaDB/Percona</br>+PHP+Pureftpd+phpMyAdmin+redis+memcached+jemalloc.</h3>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="tools_section">
|
||||||
|
<h2 class="mt-5" id="tools">Tools</h2>
|
||||||
|
<a class="btn btn-primary btn_prober" href="xprober.php" target="_blank" role="button">prober</a>
|
||||||
|
<a class="btn btn-info btn_phpinfo" href="phpinfo.php" target="_blank" role="button">phpinfo</a>
|
||||||
|
<a class="btn btn-success btn_pma" href="phpMyAdmin/" target="_blank" role="button">phpMyAdmin</a>
|
||||||
|
<a class="btn btn-secondary btn_op" href="ocp.php" target="_blank" role="button">Opcache</a>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="step_section">
|
||||||
|
<h2 class="mt-5" id="step">Steps</h2>
|
||||||
|
<div class="card-deck mb-3 text-center">
|
||||||
|
<div class="card mb-4 box-shadow">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4 class="my-0 font-weight-normal">Dns analysis</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<h1 class="card-title pricing-card-title">Domain<small class="text-muted"> control</small></h1>
|
||||||
|
<ul class="list-unstyled mt-3 mb-4">
|
||||||
|
<li>Cloudflare</li>
|
||||||
|
<li>Alibabacloud</li>
|
||||||
|
<li>DNSPOD</li>
|
||||||
|
</ul>
|
||||||
|
<a href="https://www.alibabacloud.com/help/faq-detail/35854.htm" target="_blank" type="role" class="btn btn-lg btn-block btn-primary">BROWSE DOCS</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card mb-4 box-shadow">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4 class="my-0 font-weight-normal">Add virtual host</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<h1 class="card-title pricing-card-title">Create<small class="text-muted"> website</small></h1>
|
||||||
|
<ul class="list-unstyled mt-3 mb-4">
|
||||||
|
<li>Add virtual host: ./vhost.sh</li>
|
||||||
|
<li>Del virtual host: ./vhost.sh --del</li>
|
||||||
|
<li>Manage FTP account: ./pureftpd_vhost.sh</li>
|
||||||
|
</ul>
|
||||||
|
<a href="https://lempstack.com/install/" target="_blank" type="role" class="btn btn-lg btn-block btn-primary">BROWSE DOCS</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card mb-4 box-shadow">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4 class="my-0 font-weight-normal">Deploy website</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<h1 class="card-title pricing-card-title">Online<small class="text-muted"> running</small></h1>
|
||||||
|
<ul class="list-unstyled mt-3 mb-4">
|
||||||
|
<li><a href="phpMyAdmin/" target="_blank">phpMyAdmin</a></li>
|
||||||
|
<li>Manage FTP account: ./pureftpd_vhost.sh</li>
|
||||||
|
<li>Backup: ./backup_setup.sh</li>
|
||||||
|
</ul>
|
||||||
|
<a href="https://lempstack.com/install/" target="_blank" type="role" class="btn btn-lg btn-block btn-primary">BROWSE DOCS</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="vhost_section">
|
||||||
|
<h2 class="mt-5" id="vhost">How to add a virtual host?</h2>
|
||||||
|
<div class="alert alert-primary" role="alert">
|
||||||
|
<code>./vhost.sh</code>
|
||||||
|
</div>
|
||||||
|
<img class="img-fluid" src="https://static.oneinstack.com/images/vhost.png" alt="《Interactive install》">
|
||||||
|
<h2 class="mt-5">How to delete a virtual host?</h2>
|
||||||
|
<div class="alert alert-primary" role="alert">
|
||||||
|
<code>./vhost.sh --del</code>
|
||||||
|
</div>
|
||||||
|
<img class="img-fluid" src="https://static.oneinstack.com/images/vhost_del.png" alt="《Interactive install》">
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="ftp_section">
|
||||||
|
<h2 class="mt-5">FTP Client</h2>
|
||||||
|
<h3>FileZilla: <a href="https://filezilla-project.org/download.php" target="_blank" class="links">Download address</a></h3>
|
||||||
|
<h2 class="mt-5" id="ftp">How to add FTP virtual user?</h2>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>./pureftpd_vhost.sh</code></pre></div>
|
||||||
|
<img class="img-fluid" src="https://static.oneinstack.com/images/pureftpd.png" alt="《Interactive install》">
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="db_section">
|
||||||
|
<h2 class="mt-5" id="db">Database</h2>
|
||||||
|
<div class="list-group">
|
||||||
|
<a href="phpMyAdmin" target="_blank" class="list-group-item list-group-item-action active">
|
||||||
|
phpMyAdmin
|
||||||
|
</a>
|
||||||
|
<a href="https://lempstack.com/question/display-default-mysql-root-password/" target="_blank" class="list-group-item list-group-item-action">Display default MySQL root password</a>
|
||||||
|
<a href="https://lempstack.com/question/how-to-setup-a-remote-mysql-connection/" target="_blank" class="list-group-item list-group-item-action">How to setup a remote MySQL connection?</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="backup_section">
|
||||||
|
<h2 class="mt-5" id="backup">How to backup?</h2>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>./backup_setup.sh # Set backup options</code></div>
|
||||||
|
<img class="img-fluid" src="https://static.oneinstack.com/images/backup_setup.png" alt="《Interactive install》">
|
||||||
|
<div class="alert alert-primary" role="alert"><pre><code>./backup.sh # Start backup, You can add cron jobs
|
||||||
|
# crontab -l # Examples
|
||||||
|
0 1 * * * ~/oneinstack/backup.sh > /dev/null 2>&1 &</code></pre></div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="manage_section">
|
||||||
|
<h2 class="mt-5" id="manage">How to manage service?</h2>
|
||||||
|
<p class="mt-4">Nginx/Tengine/OpenResty:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|status|restart|reload} nginx</code></div>
|
||||||
|
<p class="mt-4">MySQL/MariaDB/Percona:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|restart|reload|status} mysqld</code></div>
|
||||||
|
<p class="mt-4">PostgreSQL:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|restart|status} postgresql</code></div>
|
||||||
|
<p class="mt-4">MongoDB:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|status|restart|reload} mongod</code></div>
|
||||||
|
<p class="mt-4">PHP:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|restart|reload|status} php-fpm</code></div>
|
||||||
|
<p class="mt-4">Apache:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|restart|stop} httpd</code></div>
|
||||||
|
<p class="mt-4">Tomcat:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|status|restart} tomcat</code></div>
|
||||||
|
<p class="mt-4">Pure-Ftpd:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|restart|status} pureftpd</code></div>
|
||||||
|
<p class="mt-4">Redis:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|status|restart|reload} redis-server</code></div>
|
||||||
|
<p class="mt-4">Memcached:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|status|restart|reload} memcached</code></div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="upgrade_section">
|
||||||
|
<h2 class="mt-5" id="upgrade">How to upgrade?</h2>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>./upgrade.sh</code></div>
|
||||||
|
<img class="img-fluid" src="https://static.oneinstack.com/images/upgrade.png" alt="">
|
||||||
|
<h2 class="mt-5">How to uninstall?</h2>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>./uninstall.sh</code></div>
|
||||||
|
<img class="img-fluid" src="https://static.oneinstack.com/images/uninstall.png" alt="">
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="port_section">
|
||||||
|
<div class="card text-white bg-danger" style="width: 20rem;">
|
||||||
|
<div class="card-header">
|
||||||
|
You must specify port numbers (for TCP):
|
||||||
|
</div>
|
||||||
|
<ul class="list-group list-group-flush">
|
||||||
|
<li class="list-group-item text-danger">ssh: 22</li>
|
||||||
|
<li class="list-group-item text-danger">http: 80</li>
|
||||||
|
<li class="list-group-item text-danger">https: 443</li>
|
||||||
|
<li class="list-group-item text-danger">ftp: 21, 20000~30000</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="list-group mt-5" style="width: 18rem;">
|
||||||
|
<a class="list-group-item list-group-item-action active">
|
||||||
|
Security Groups for Your VPC
|
||||||
|
</a>
|
||||||
|
<a href="https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html" target="_blank" class="list-group-item list-group-item-action">AWS Security groups</a>
|
||||||
|
<a href="https://docs.microsoft.com/en-us/azure/virtual-network/security-overview" target="_blank" class="list-group-item list-group-item-action">Azure Security groups</a>
|
||||||
|
<a href="https://www.alibabacloud.com/help/doc-detail/58746.htm" target="_blank" class="list-group-item list-group-item-action">Alibabacloud Security group</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<div align="center" class="mt-5"><iframe src="https://static.oneinstack.com/ad_buttom.html" width="475" frameborder="0" scrolling="no"></iframe></div>
|
||||||
|
<div>
|
||||||
|
<p>
|
||||||
|
<a href="https://oneinstack.com" target="_blank">OneinStack</a> by <a href="https://linuxeye.com/" target="_blank">LinuxEye</a>
|
||||||
|
Telegram Group: <a target="_blank" class="links" href="https://t.me/oneinstack">t.me/oneinstack</a>
|
||||||
|
</p>
|
||||||
|
<p align="right"><a href="#">Top</a></p>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="https://static.oneinstack.com/assets/ois20190114.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,322 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<meta name="description" content="OneinStack是一键PHP/JAVA安装脚本工具,包含lnmp,lamp,lnmpa,ltmp,lnmh,MySQL,PostgreSQL,MongoDB等,官网oneinstack.com">
|
||||||
|
<meta name="author" content="yeho">
|
||||||
|
<title>欢迎您使用OneinStack</title>
|
||||||
|
<link href="https://static.oneinstack.com/assets/ois.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<nav class="navbar navbar-dark fixed-top bg-dark flex-md-nowrap p-0 shadow">
|
||||||
|
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="">OneinStack</a>
|
||||||
|
|
||||||
|
<form class="w-100" action="https://oneinstack.com/qa/" method="GET" target="_blank">
|
||||||
|
<input class="form-control form-control-dark w-100" type="text" placeholder="搜索OneinStack官网问答" aria-label="搜索OneinStack官网问答" name="qs">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<ul class="navbar-nav px-3">
|
||||||
|
<li class="nav-item text-nowrap">
|
||||||
|
<a class="nav-link" href="https://oneinstack.com" target="_blank">OneinStack官网</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
|
||||||
|
<div class="sidebar-sticky">
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="###home" id="home_link">
|
||||||
|
<span data-feather="home"></span>
|
||||||
|
控制中心 <span class="sr-only">(current)</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<!--<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###step" id="step_link">
|
||||||
|
<span data-feather="file"></span>
|
||||||
|
</a>
|
||||||
|
</li>-->
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###vhost" id="vhost_link">
|
||||||
|
<span data-feather="layers"></span>
|
||||||
|
虚拟主机管理
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###db" id="db_link">
|
||||||
|
<span data-feather="shopping-cart"></span>
|
||||||
|
数据库管理
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###ftp" id="ftp_link">
|
||||||
|
<span data-feather="users"></span>
|
||||||
|
FTP管理
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###tools" id="tools_link">
|
||||||
|
<span data-feather="briefcase"></span>
|
||||||
|
运维工具
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###manage" id="manage_link">
|
||||||
|
<span data-feather="bar-chart-2"></span>
|
||||||
|
管理服务
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###backup" id="backup_link">
|
||||||
|
<span data-feather="disc"></span>
|
||||||
|
备份
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###upgrade" id="upgrade_link">
|
||||||
|
<span data-feather="trending-up"></span>
|
||||||
|
升级 & 卸载
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###port" id="port_link">
|
||||||
|
<span data-feather="cloud"></span>
|
||||||
|
端口开放教程
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="###donation" id="donation_link">
|
||||||
|
<span data-feather="heart"></span>
|
||||||
|
捐赠
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
|
||||||
|
<span>OneinStack官网</span>
|
||||||
|
<a class="d-flex align-items-center text-muted" href="https://oneinstack.com/" target="_blank">
|
||||||
|
<span data-feather="chevron-down"></span>
|
||||||
|
</a>
|
||||||
|
</h6>
|
||||||
|
<ul class="nav flex-column mb-2">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="https://oneinstack.com/" target="_blank">
|
||||||
|
<span data-feather="home"></span>
|
||||||
|
OneinStack首页
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="https://oneinstack.com/install/" target="_blank">
|
||||||
|
<span data-feather="help-circle"></span>
|
||||||
|
安装、使用方法
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="https://oneinstack.com/faq/" target="_blank">
|
||||||
|
<span data-feather="link"></span>
|
||||||
|
FAQ
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="https://oneinstack.com/changelog/" target="_blank">
|
||||||
|
<span data-feather="link"></span>
|
||||||
|
更新日志
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
||||||
|
<h1 class="h2" id="home">控制中心</h1>
|
||||||
|
<div class="btn-toolbar mb-2 mb-md-0">
|
||||||
|
<div class="btn-group mr-2">
|
||||||
|
<a class="btn btn-sm btn-outline-primary btn_prober" href="xprober.php" target="_blank"><span data-feather="compass"></span> 探针</a>
|
||||||
|
<a class="btn btn-sm btn-outline-info btn_phpinfo" href="phpinfo.php" target="_blank"><span data-feather="info"></span> phpinfo</a>
|
||||||
|
<a class="btn btn-sm btn-outline-secondary btn_op" href="ocp.php" target="_blank"><span data-feather="cpu"></span> Opcache</a>
|
||||||
|
</div>
|
||||||
|
<a class="btn btn-sm btn-outline-warning mr-2 btn_pma" href="phpMyAdmin/" target="_blank">
|
||||||
|
<span data-feather="database"></span> phpMyAdmin
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<section class="section" id="home_section">
|
||||||
|
<h2>Congratulations, OneinStack installed successfully!</h2>
|
||||||
|
<h3><a href="https://oneinstack.com" target="_blank" class="links">OneinStack </a><a href="https://linuxeye.com/" target="_blank">Linux</a>+Nginx/Tengine+MySQL/MariaDB/Percona</br>+PHP+Pureftpd+phpMyAdmin+redis+memcached+jemalloc.</h3>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="tools_section">
|
||||||
|
<h2 class="mt-5" id="tools">主机工具</h2>
|
||||||
|
<a class="btn btn-primary btn_prober" href="xprober.php" target="_blank" role="button">探针</a>
|
||||||
|
<a class="btn btn-info btn_phpinfo" href="phpinfo.php" target="_blank" role="button">phpinfo</a>
|
||||||
|
<a class="btn btn-success btn_pma" href="phpMyAdmin/" target="_blank" role="button">phpMyAdmin</a>
|
||||||
|
<a class="btn btn-secondary btn_op" href="ocp.php" target="_blank" role="button">Opcache</a>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="step_section">
|
||||||
|
<h2 class="mt-5" id="step">基本使用步骤</h2>
|
||||||
|
<div class="card-deck mb-3 text-center">
|
||||||
|
<div class="card mb-4 box-shadow">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4 class="my-0 font-weight-normal">域名解析</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<h1 class="card-title pricing-card-title">域名<small class="text-muted">控制</small></h1>
|
||||||
|
<ul class="list-unstyled mt-3 mb-4">
|
||||||
|
<li>阿里云(万网)</li>
|
||||||
|
<li>DNSPOD</li>
|
||||||
|
<li>Cloudflare</li>
|
||||||
|
</ul>
|
||||||
|
<a href="https://help.aliyun.com/document_detail/29716.html" target="_blank" type="role" class="btn btn-lg btn-block btn-primary">详细教程</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card mb-4 box-shadow">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4 class="my-0 font-weight-normal">新建虚拟主机</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<h1 class="card-title pricing-card-title">建立<small class="text-muted">网站</small></h1>
|
||||||
|
<ul class="list-unstyled mt-3 mb-4">
|
||||||
|
<li>新建虚拟主机 ./vhost.sh</li>
|
||||||
|
<li>删除虚拟主机 ./vhost.sh --del</li>
|
||||||
|
<li>管理FTP账号 ./pureftpd_vhost.sh</li>
|
||||||
|
</ul>
|
||||||
|
<a href="https://oneinstack.com/install/" target="_blank" type="role" class="btn btn-lg btn-block btn-primary">详细教程</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card mb-4 box-shadow">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4 class="my-0 font-weight-normal">部署网站</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<h1 class="card-title pricing-card-title">上线<small class="text-muted">运行</small></h1>
|
||||||
|
<ul class="list-unstyled mt-3 mb-4">
|
||||||
|
<li><a href="phpMyAdmin/" target="_blank">phpMyAdmin</a></li>
|
||||||
|
<li>管理FTP账号 ./pureftpd_vhost.sh</li>
|
||||||
|
<li>备份 ./backup_setup.sh</li>
|
||||||
|
</ul>
|
||||||
|
<a href="https://oneinstack.com/install/" target="_blank" type="role" class="btn btn-lg btn-block btn-primary">详细教程</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="vhost_section">
|
||||||
|
<h2 class="mt-5" id="vhost">如何添加虚拟主机?</h2>
|
||||||
|
<div class="alert alert-primary" role="alert">
|
||||||
|
<code>./vhost.sh</code>
|
||||||
|
</div>
|
||||||
|
<img class="img-fluid" src="https://static.oneinstack.com/images/vhost.png" alt="《交互安装》">
|
||||||
|
<h2 class="mt-5">如何删除虚拟主机?</h2>
|
||||||
|
<div class="alert alert-primary" role="alert">
|
||||||
|
<code>./vhost.sh --del</code>
|
||||||
|
</div>
|
||||||
|
<img class="img-fluid" src="https://static.oneinstack.com/images/vhost_del.png" alt="《交互安装》">
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="ftp_section">
|
||||||
|
<h2 class="mt-5">FTP客户端推荐</h2>
|
||||||
|
<h3>FileZilla: <a href="https://filezilla-project.org/download.php" target="_blank" class="links">下载地址</a></h3>
|
||||||
|
<h2 class="mt-5" id="ftp">如何管理FTP账号?</h2>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>./pureftpd_vhost.sh</code></pre></div>
|
||||||
|
<img class="img-fluid" src="https://static.oneinstack.com/images/pureftpd.png" alt="《交互安装》">
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="db_section">
|
||||||
|
<h2 class="mt-5" id="db">数据库</h2>
|
||||||
|
<div class="list-group">
|
||||||
|
<a href="phpMyAdmin" target="_blank" class="list-group-item list-group-item-action active">
|
||||||
|
phpMyAdmin
|
||||||
|
</a>
|
||||||
|
<a href="https://oneinstack.com/question/17347/" target="_blank" class="list-group-item list-group-item-action">如何获取MySQL root密码?</a>
|
||||||
|
<a href="https://oneinstack.com/question/oneinstack-how-to-configure-mysql-remote-connection/" target="_blank" class="list-group-item list-group-item-action">如何配置MySQL远程连接?</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="backup_section">
|
||||||
|
<h2 class="mt-5" id="backup">如何备份?</h2>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>./backup_setup.sh # Set backup options</code></div>
|
||||||
|
<img class="img-fluid" src="https://static.oneinstack.com/images/backup_setup.png" alt="《交互安装》">
|
||||||
|
<div class="alert alert-primary" role="alert"><pre><code>./backup.sh # Start backup, You can add cron jobs
|
||||||
|
# crontab -l # Examples
|
||||||
|
0 1 * * * ~/oneinstack/backup.sh > /dev/null 2>&1 &</code></pre></div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="manage_section">
|
||||||
|
<h2 class="mt-5" id="manage">如何管理服务?</h2>
|
||||||
|
<p class="mt-4">Nginx/Tengine/OpenResty:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|status|restart|reload} nginx</code></div>
|
||||||
|
<p class="mt-4">MySQL/MariaDB/Percona:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|restart|reload|status} mysqld</code></div>
|
||||||
|
<p class="mt-4">PostgreSQL:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|restart|status} postgresql</code></div>
|
||||||
|
<p class="mt-4">MongoDB:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|status|restart|reload} mongod</code></div>
|
||||||
|
<p class="mt-4">PHP:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|restart|reload|status} php-fpm</code></div>
|
||||||
|
<p class="mt-4">Apache:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|restart|stop} httpd</code></div>
|
||||||
|
<p class="mt-4">Tomcat:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|status|restart} tomcat</code></div>
|
||||||
|
<p class="mt-4">Pure-Ftpd:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|restart|status} pureftpd</code></div>
|
||||||
|
<p class="mt-4">Redis:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|status|restart|reload} redis-server</code></div>
|
||||||
|
<p class="mt-4">Memcached:</p>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>systemctl {start|stop|status|restart|reload} memcached</code></div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="upgrade_section">
|
||||||
|
<h2 class="mt-5" id="upgrade">如何更新版本?</h2>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>./upgrade.sh</code></div>
|
||||||
|
<img class="img-fluid" src="https://static.oneinstack.com/images/upgrade.png" alt="">
|
||||||
|
<h2 class="mt-5">如何卸载?</h2>
|
||||||
|
<div class="alert alert-primary" role="alert"><code>./uninstall.sh</code></div>
|
||||||
|
<img class="img-fluid" src="https://static.oneinstack.com/images/uninstall.png" alt="">
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section" id="port_section">
|
||||||
|
<!--<h2 class="mt-5" id="port">云主机安全组端口开放教程<span class="badge badge-secondary">Version 1.0.0</span></h2>-->
|
||||||
|
<div class="card text-white bg-danger" style="width: 18rem;">
|
||||||
|
<div class="card-header">
|
||||||
|
云主机安全组必须打开如下端口:
|
||||||
|
</div>
|
||||||
|
<ul class="list-group list-group-flush">
|
||||||
|
<li class="list-group-item text-danger">ssh: 22</li>
|
||||||
|
<li class="list-group-item text-danger">http: 80</li>
|
||||||
|
<li class="list-group-item text-danger">https: 443</li>
|
||||||
|
<li class="list-group-item text-danger">ftp: 21, 20000~30000</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="list-group mt-5" style="width: 18rem;">
|
||||||
|
<a class="list-group-item list-group-item-action active">
|
||||||
|
云主机安全组端口开放教程
|
||||||
|
</a>
|
||||||
|
<a href="https://oneinstack.com/docs/securitygroup/#11" target="_blank" class="list-group-item list-group-item-action">阿里云安全组端口</a>
|
||||||
|
<a href="https://oneinstack.com/docs/securitygroup/#12" target="_blank" class="list-group-item list-group-item-action">腾讯云安全组端口</a>
|
||||||
|
<a href="https://oneinstack.com/docs/securitygroup/#13" target="_blank" class="list-group-item list-group-item-action">华为云安全组端口</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<div align="center" class="mt-5"><iframe src="https://static.oneinstack.com/ad_buttom.html" width="475" frameborder="0" scrolling="no"></iframe></div>
|
||||||
|
<div>
|
||||||
|
<p>
|
||||||
|
<a href="https://oneinstack.com" target="_blank">OneinStack</a> by <a href="https://linuxeye.com/" target="_blank">LinuxEye</a>
|
||||||
|
QQ群: 262601796(新) 558540514(付费千人群)</a>
|
||||||
|
</p>
|
||||||
|
<p align="right"><a href="#">回顶部</a></p>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="https://static.oneinstack.com/assets/ois20190114.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$args;
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name oneinstack.com;
|
||||||
|
set $MAGE_ROOT /data/wwwroot/default;
|
||||||
|
root $MAGE_ROOT/pub;
|
||||||
|
index index.php;
|
||||||
|
autoindex off;
|
||||||
|
charset UTF-8;
|
||||||
|
error_page 404 403 /errors/404.php;
|
||||||
|
#add_header "X-UA-Compatible" "IE=Edge";
|
||||||
|
|
||||||
|
# PHP entry point for setup application
|
||||||
|
location ~* ^/setup($|/) {
|
||||||
|
root $MAGE_ROOT;
|
||||||
|
location ~ ^/setup/index.php {
|
||||||
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
|
fastcgi_pass unix:/dev/shm/php-cgi.sock;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/setup/(?!pub/). {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/setup/pub/ {
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# PHP entry point for update application
|
||||||
|
location ~* ^/update($|/) {
|
||||||
|
root $MAGE_ROOT;
|
||||||
|
location ~ ^/update/index.php {
|
||||||
|
fastcgi_split_path_info ^(/update/index.php)(/.+)$;
|
||||||
|
fastcgi_pass unix:/dev/shm/php-cgi.sock;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Deny everything but index.php
|
||||||
|
location ~ ^/update/(?!pub/). {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/update/pub/ {
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /pub/ {
|
||||||
|
location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
alias $MAGE_ROOT/pub/;
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
}
|
||||||
|
|
||||||
|
location /static/ {
|
||||||
|
# Uncomment the following line in production mode
|
||||||
|
# expires max;
|
||||||
|
# Remove signature of the static files that is used to overcome the browser cache
|
||||||
|
location ~ ^/static/version {
|
||||||
|
rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
expires +1y;
|
||||||
|
if (!-f $request_filename) {
|
||||||
|
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
|
||||||
|
add_header Cache-Control "no-store";
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
expires off;
|
||||||
|
if (!-f $request_filename) {
|
||||||
|
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!-f $request_filename) {
|
||||||
|
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
|
||||||
|
}
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
}
|
||||||
|
|
||||||
|
location /media/ {
|
||||||
|
try_files $uri $uri/ /get.php?$args;
|
||||||
|
location ~ ^/media/theme_customization/.*\.xml {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
expires +1y;
|
||||||
|
try_files $uri $uri/ /get.php?$args;
|
||||||
|
}
|
||||||
|
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
|
||||||
|
add_header Cache-Control "no-store";
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
expires off;
|
||||||
|
try_files $uri $uri/ /get.php?$args;
|
||||||
|
}
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
}
|
||||||
|
|
||||||
|
location /media/customer/ {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /media/downloadable/ {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /media/import/ {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
# PHP entry point for main application
|
||||||
|
location ~ (index|get|static|report|404|503)\.php$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
fastcgi_pass unix:/dev/shm/php-cgi.sock;
|
||||||
|
fastcgi_buffers 1024 4k;
|
||||||
|
|
||||||
|
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
|
||||||
|
fastcgi_param PHP_VALUE "memory_limit=768M \n max_execution_time=600";
|
||||||
|
fastcgi_read_timeout 600s;
|
||||||
|
fastcgi_connect_timeout 600s;
|
||||||
|
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_disable "msie6";
|
||||||
|
gzip_comp_level 6;
|
||||||
|
gzip_min_length 1100;
|
||||||
|
gzip_buffers 16 8k;
|
||||||
|
gzip_proxied any;
|
||||||
|
gzip_types
|
||||||
|
text/plain
|
||||||
|
text/css
|
||||||
|
text/js
|
||||||
|
text/xml
|
||||||
|
text/javascript
|
||||||
|
application/javascript
|
||||||
|
application/x-javascript
|
||||||
|
application/json
|
||||||
|
application/xml
|
||||||
|
application/xml+rss
|
||||||
|
image/svg+xml;
|
||||||
|
gzip_vary on;
|
||||||
|
|
||||||
|
# Banned locations (only reached if the earlier PHP entry point regexes don't match)
|
||||||
|
location ~* (\.php$|\.htaccess$|\.git) {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
#(可选)添加如下header主要为了安全
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Robots-Tag none;
|
||||||
|
add_header X-Download-Options noopen;
|
||||||
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
|
||||||
|
#(可选)为了支持user_webfinger app
|
||||||
|
rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
|
||||||
|
rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
|
||||||
|
|
||||||
|
#这儿是为了支持日历和联系人,建议加上
|
||||||
|
location = /.well-known/carddav {
|
||||||
|
return 301 $scheme://$host/remote.php/dav;
|
||||||
|
}
|
||||||
|
location = /.well-known/caldav {
|
||||||
|
return 301 $scheme://$host/remote.php/dav;
|
||||||
|
}
|
||||||
|
|
||||||
|
#设置上传文件的最大大小(还和php里的那个设置有关)
|
||||||
|
client_max_body_size 512M;
|
||||||
|
fastcgi_buffers 64 4K;
|
||||||
|
|
||||||
|
#最主要的,将所有请求转发到index.php上
|
||||||
|
location / {
|
||||||
|
rewrite ^ /index.php$uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
#安全设置,禁止访问部分敏感内容
|
||||||
|
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
#这部分吧,默认就有,不过有所不同,所以我合并了下,替换原来的就行
|
||||||
|
location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||||
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
|
fastcgi_param modHeadersAvailable true;
|
||||||
|
fastcgi_param front_controller_active true;
|
||||||
|
fastcgi_pass unix:/dev/shm/php-cgi.sock;
|
||||||
|
fastcgi_intercept_errors on;
|
||||||
|
fastcgi_request_buffering off;
|
||||||
|
include fastcgi.conf;
|
||||||
|
}
|
||||||
|
|
||||||
|
#安全设置,禁止访问部分敏感内容
|
||||||
|
location ~ ^/(?:updater|ocs-provider)(?:$|/) {
|
||||||
|
try_files $uri/ =404;
|
||||||
|
index index.php;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.(?:css|js|woff|svg|gif)$ {
|
||||||
|
try_files $uri /index.php$uri$is_args$args;
|
||||||
|
add_header Cache-Control "public, max-age=15778463";
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Robots-Tag none;
|
||||||
|
add_header X-Download-Options noopen;
|
||||||
|
add_header X-Permitted-Cross-Domain-Policies none;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
||||||
|
try_files $uri /index.php$uri$is_args$args;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /robots.txt {
|
||||||
|
allow all;
|
||||||
|
log_not_found off;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_comp_level 4;
|
||||||
|
gzip_min_length 256;
|
||||||
|
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
|
||||||
|
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
user www www;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
error_log /data/wwwlogs/error_nginx.log crit;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
worker_rlimit_nofile 51200;
|
||||||
|
|
||||||
|
events {
|
||||||
|
use epoll;
|
||||||
|
worker_connections 51200;
|
||||||
|
multi_accept on;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
server_names_hash_bucket_size 128;
|
||||||
|
client_header_buffer_size 32k;
|
||||||
|
large_client_header_buffers 4 32k;
|
||||||
|
client_max_body_size 1024m;
|
||||||
|
client_body_buffer_size 10m;
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
keepalive_timeout 120;
|
||||||
|
server_tokens off;
|
||||||
|
tcp_nodelay on;
|
||||||
|
|
||||||
|
fastcgi_connect_timeout 300;
|
||||||
|
fastcgi_send_timeout 300;
|
||||||
|
fastcgi_read_timeout 300;
|
||||||
|
fastcgi_buffer_size 64k;
|
||||||
|
fastcgi_buffers 4 64k;
|
||||||
|
fastcgi_busy_buffers_size 128k;
|
||||||
|
fastcgi_temp_file_write_size 128k;
|
||||||
|
fastcgi_intercept_errors on;
|
||||||
|
|
||||||
|
#Gzip Compression
|
||||||
|
gzip on;
|
||||||
|
gzip_buffers 16 8k;
|
||||||
|
gzip_comp_level 6;
|
||||||
|
gzip_http_version 1.1;
|
||||||
|
gzip_min_length 256;
|
||||||
|
gzip_proxied any;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_types
|
||||||
|
text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
|
||||||
|
text/javascript application/javascript application/x-javascript
|
||||||
|
text/x-json application/json application/x-web-app-manifest+json
|
||||||
|
text/css text/plain text/x-component
|
||||||
|
font/opentype application/x-font-ttf application/vnd.ms-fontobject
|
||||||
|
image/x-icon;
|
||||||
|
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
|
||||||
|
|
||||||
|
##Brotli Compression
|
||||||
|
#brotli on;
|
||||||
|
#brotli_comp_level 6;
|
||||||
|
#brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
|
||||||
|
|
||||||
|
##If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
|
||||||
|
#open_file_cache max=1000 inactive=20s;
|
||||||
|
#open_file_cache_valid 30s;
|
||||||
|
#open_file_cache_min_uses 2;
|
||||||
|
#open_file_cache_errors on;
|
||||||
|
|
||||||
|
log_format json escape=json '{"@timestamp":"$time_iso8601",'
|
||||||
|
'"server_addr":"$server_addr",'
|
||||||
|
'"remote_addr":"$remote_addr",'
|
||||||
|
'"scheme":"$scheme",'
|
||||||
|
'"request_method":"$request_method",'
|
||||||
|
'"request_uri": "$request_uri",'
|
||||||
|
'"request_length": "$request_length",'
|
||||||
|
'"uri": "$uri", '
|
||||||
|
'"request_time":$request_time,'
|
||||||
|
'"body_bytes_sent":$body_bytes_sent,'
|
||||||
|
'"bytes_sent":$bytes_sent,'
|
||||||
|
'"status":"$status",'
|
||||||
|
'"upstream_time":"$upstream_response_time",'
|
||||||
|
'"upstream_host":"$upstream_addr",'
|
||||||
|
'"upstream_status":"$upstream_status",'
|
||||||
|
'"host":"$host",'
|
||||||
|
'"http_referer":"$http_referer",'
|
||||||
|
'"http_user_agent":"$http_user_agent"'
|
||||||
|
'}';
|
||||||
|
|
||||||
|
######################## default ############################
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
access_log /data/wwwlogs/access_nginx.log combined;
|
||||||
|
root /data/wwwroot/default;
|
||||||
|
index index.html index.htm index.php;
|
||||||
|
#error_page 404 /404.html;
|
||||||
|
#error_page 502 /502.html;
|
||||||
|
location /nginx_status {
|
||||||
|
stub_status on;
|
||||||
|
access_log off;
|
||||||
|
allow 127.0.0.1;
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
location ~ [^/]\.php(/|$) {
|
||||||
|
#fastcgi_pass remote_php_ip:9000;
|
||||||
|
fastcgi_pass unix:/dev/shm/php-cgi.sock;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi.conf;
|
||||||
|
}
|
||||||
|
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
|
||||||
|
expires 30d;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
location ~ .*\.(js|css)?$ {
|
||||||
|
expires 7d;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
location ~ ^/(\.user.ini|\.ht|\.git|\.svn|\.project|LICENSE|README.md) {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
location /.well-known {
|
||||||
|
allow all;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
########################## vhost #############################
|
||||||
|
include vhost/*.conf;
|
||||||
|
}
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
user www www;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
error_log /data/wwwlogs/error_nginx.log crit;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
worker_rlimit_nofile 51200;
|
||||||
|
|
||||||
|
events {
|
||||||
|
use epoll;
|
||||||
|
worker_connections 51200;
|
||||||
|
multi_accept on;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
server_names_hash_bucket_size 128;
|
||||||
|
client_header_buffer_size 32k;
|
||||||
|
large_client_header_buffers 4 32k;
|
||||||
|
client_max_body_size 1024m;
|
||||||
|
client_body_buffer_size 10m;
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
keepalive_timeout 120;
|
||||||
|
server_tokens off;
|
||||||
|
tcp_nodelay on;
|
||||||
|
|
||||||
|
fastcgi_connect_timeout 300;
|
||||||
|
fastcgi_send_timeout 300;
|
||||||
|
fastcgi_read_timeout 300;
|
||||||
|
fastcgi_buffer_size 64k;
|
||||||
|
fastcgi_buffers 4 64k;
|
||||||
|
fastcgi_busy_buffers_size 128k;
|
||||||
|
fastcgi_temp_file_write_size 128k;
|
||||||
|
fastcgi_intercept_errors on;
|
||||||
|
|
||||||
|
#Gzip Compression
|
||||||
|
gzip on;
|
||||||
|
gzip_buffers 16 8k;
|
||||||
|
gzip_comp_level 6;
|
||||||
|
gzip_http_version 1.1;
|
||||||
|
gzip_min_length 256;
|
||||||
|
gzip_proxied any;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_types
|
||||||
|
text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
|
||||||
|
text/javascript application/javascript application/x-javascript
|
||||||
|
text/x-json application/json application/x-web-app-manifest+json
|
||||||
|
text/css text/plain text/x-component
|
||||||
|
font/opentype application/x-font-ttf application/vnd.ms-fontobject
|
||||||
|
image/x-icon;
|
||||||
|
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
|
||||||
|
|
||||||
|
##Brotli Compression
|
||||||
|
#brotli on;
|
||||||
|
#brotli_comp_level 6;
|
||||||
|
#brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
|
||||||
|
|
||||||
|
##If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
|
||||||
|
#open_file_cache max=1000 inactive=20s;
|
||||||
|
#open_file_cache_valid 30s;
|
||||||
|
#open_file_cache_min_uses 2;
|
||||||
|
#open_file_cache_errors on;
|
||||||
|
|
||||||
|
log_format json escape=json '{"@timestamp":"$time_iso8601",'
|
||||||
|
'"server_addr":"$server_addr",'
|
||||||
|
'"remote_addr":"$remote_addr",'
|
||||||
|
'"scheme":"$scheme",'
|
||||||
|
'"request_method":"$request_method",'
|
||||||
|
'"request_uri": "$request_uri",'
|
||||||
|
'"request_length": "$request_length",'
|
||||||
|
'"uri": "$uri", '
|
||||||
|
'"request_time":$request_time,'
|
||||||
|
'"body_bytes_sent":$body_bytes_sent,'
|
||||||
|
'"bytes_sent":$bytes_sent,'
|
||||||
|
'"status":"$status",'
|
||||||
|
'"upstream_time":"$upstream_response_time",'
|
||||||
|
'"upstream_host":"$upstream_addr",'
|
||||||
|
'"upstream_status":"$upstream_status",'
|
||||||
|
'"host":"$host",'
|
||||||
|
'"http_referer":"$http_referer",'
|
||||||
|
'"http_user_agent":"$http_user_agent"'
|
||||||
|
'}';
|
||||||
|
|
||||||
|
######################## default ############################
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
access_log /data/wwwlogs/access_nginx.log combined;
|
||||||
|
root /data/wwwroot/default;
|
||||||
|
index index.html index.htm index.php;
|
||||||
|
#error_page 404 /404.html;
|
||||||
|
#error_page 502 /502.html;
|
||||||
|
location /nginx_status {
|
||||||
|
stub_status on;
|
||||||
|
access_log off;
|
||||||
|
allow 127.0.0.1;
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
location / {
|
||||||
|
try_files $uri @apache;
|
||||||
|
}
|
||||||
|
location @apache {
|
||||||
|
proxy_pass http://127.0.0.1:88;
|
||||||
|
include proxy.conf;
|
||||||
|
}
|
||||||
|
location ~ [^/]\.php(/|$) {
|
||||||
|
proxy_pass http://127.0.0.1:88;
|
||||||
|
include proxy.conf;
|
||||||
|
}
|
||||||
|
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
|
||||||
|
expires 30d;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
location ~ .*\.(js|css)?$ {
|
||||||
|
expires 7d;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
location ~ ^/(\.user.ini|\.ht|\.git|\.svn|\.project|LICENSE|README.md) {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
location /.well-known {
|
||||||
|
allow all;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
########################## vhost #############################
|
||||||
|
include vhost/*.conf;
|
||||||
|
}
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
user www www;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
error_log /data/wwwlogs/error_nginx.log crit;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
worker_rlimit_nofile 51200;
|
||||||
|
|
||||||
|
events {
|
||||||
|
use epoll;
|
||||||
|
worker_connections 51200;
|
||||||
|
multi_accept on;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
server_names_hash_bucket_size 128;
|
||||||
|
client_header_buffer_size 32k;
|
||||||
|
large_client_header_buffers 4 32k;
|
||||||
|
client_max_body_size 1024m;
|
||||||
|
client_body_buffer_size 10m;
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
keepalive_timeout 120;
|
||||||
|
server_tokens off;
|
||||||
|
tcp_nodelay on;
|
||||||
|
|
||||||
|
fastcgi_connect_timeout 300;
|
||||||
|
fastcgi_send_timeout 300;
|
||||||
|
fastcgi_read_timeout 300;
|
||||||
|
fastcgi_buffer_size 64k;
|
||||||
|
fastcgi_buffers 4 64k;
|
||||||
|
fastcgi_busy_buffers_size 128k;
|
||||||
|
fastcgi_temp_file_write_size 128k;
|
||||||
|
fastcgi_intercept_errors on;
|
||||||
|
|
||||||
|
#Gzip Compression
|
||||||
|
gzip on;
|
||||||
|
gzip_buffers 16 8k;
|
||||||
|
gzip_comp_level 6;
|
||||||
|
gzip_http_version 1.1;
|
||||||
|
gzip_min_length 256;
|
||||||
|
gzip_proxied any;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_types
|
||||||
|
text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
|
||||||
|
text/javascript application/javascript application/x-javascript
|
||||||
|
text/x-json application/json application/x-web-app-manifest+json
|
||||||
|
text/css text/plain text/x-component
|
||||||
|
font/opentype application/x-font-ttf application/vnd.ms-fontobject
|
||||||
|
image/x-icon;
|
||||||
|
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
|
||||||
|
|
||||||
|
##Brotli Compression
|
||||||
|
#brotli on;
|
||||||
|
#brotli_comp_level 6;
|
||||||
|
#brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
|
||||||
|
|
||||||
|
##If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
|
||||||
|
#open_file_cache max=1000 inactive=20s;
|
||||||
|
#open_file_cache_valid 30s;
|
||||||
|
#open_file_cache_min_uses 2;
|
||||||
|
#open_file_cache_errors on;
|
||||||
|
|
||||||
|
log_format json escape=json '{"@timestamp":"$time_iso8601",'
|
||||||
|
'"server_addr":"$server_addr",'
|
||||||
|
'"remote_addr":"$remote_addr",'
|
||||||
|
'"scheme":"$scheme",'
|
||||||
|
'"request_method":"$request_method",'
|
||||||
|
'"request_uri": "$request_uri",'
|
||||||
|
'"request_length": "$request_length",'
|
||||||
|
'"uri": "$uri", '
|
||||||
|
'"request_time":$request_time,'
|
||||||
|
'"body_bytes_sent":$body_bytes_sent,'
|
||||||
|
'"bytes_sent":$bytes_sent,'
|
||||||
|
'"status":"$status",'
|
||||||
|
'"upstream_time":"$upstream_response_time",'
|
||||||
|
'"upstream_host":"$upstream_addr",'
|
||||||
|
'"upstream_status":"$upstream_status",'
|
||||||
|
'"host":"$host",'
|
||||||
|
'"http_referer":"$http_referer",'
|
||||||
|
'"http_user_agent":"$http_user_agent"'
|
||||||
|
'}';
|
||||||
|
|
||||||
|
######################## default ############################
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
access_log /data/wwwlogs/access_nginx.log combined;
|
||||||
|
root /data/wwwroot/default;
|
||||||
|
index index.html index.htm index.jsp;
|
||||||
|
#error_page 404 /404.html;
|
||||||
|
#error_page 502 /502.html;
|
||||||
|
location /nginx_status {
|
||||||
|
stub_status on;
|
||||||
|
access_log off;
|
||||||
|
allow 127.0.0.1;
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
|
||||||
|
expires 30d;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
location ~ .*\.(js|css)?$ {
|
||||||
|
expires 7d;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
location ~ {
|
||||||
|
proxy_pass http://127.0.0.1:8080;
|
||||||
|
include proxy.conf;
|
||||||
|
}
|
||||||
|
location ~ ^/(\.user.ini|\.ht|\.git|\.svn|\.project|LICENSE|README.md) {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
location /.well-known {
|
||||||
|
allow all;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
########################## vhost #############################
|
||||||
|
include vhost/*.conf;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
location = /sitemap.xml {
|
||||||
|
rewrite ^(.*)$ /index.php?route=feed/google_sitemap break;
|
||||||
|
}
|
||||||
|
location = /googlebase.xml {
|
||||||
|
rewrite ^(.*)$ /index.php?route=feed/google_base break;
|
||||||
|
}
|
||||||
|
location / {
|
||||||
|
# This try_files directive is used to enable SEO-friendly URLs for OpenCart
|
||||||
|
try_files $uri $uri/ @opencart;
|
||||||
|
}
|
||||||
|
location @opencart {
|
||||||
|
rewrite ^/(.+)$ /index.php?_route_=$1 last;
|
||||||
|
}
|
||||||
@@ -0,0 +1,444 @@
|
|||||||
|
|
||||||
|
############################################################
|
||||||
|
# #
|
||||||
|
# Configuration file for pure-ftpd wrappers #
|
||||||
|
# #
|
||||||
|
############################################################
|
||||||
|
|
||||||
|
# If you want to run Pure-FTPd with this configuration
|
||||||
|
# instead of command-line options, please run the
|
||||||
|
# following command :
|
||||||
|
#
|
||||||
|
# /usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf
|
||||||
|
#
|
||||||
|
# Please don't forget to have a look at documentation at
|
||||||
|
# http://www.pureftpd.org/documentation.shtml for a complete list of
|
||||||
|
# options.
|
||||||
|
|
||||||
|
# Cage in every user in his home directory
|
||||||
|
|
||||||
|
ChrootEveryone yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# If the previous option is set to "no", members of the following group
|
||||||
|
# won't be caged. Others will be. If you don't want chroot()ing anyone,
|
||||||
|
# just comment out ChrootEveryone and TrustedGID.
|
||||||
|
|
||||||
|
# TrustedGID 100
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Turn on compatibility hacks for broken clients
|
||||||
|
|
||||||
|
BrokenClientsCompatibility no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Maximum number of simultaneous users
|
||||||
|
|
||||||
|
MaxClientsNumber 5000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Fork in background
|
||||||
|
|
||||||
|
Daemonize yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Maximum number of sim clients with the same IP address
|
||||||
|
|
||||||
|
MaxClientsPerIP 500
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# If you want to log all client commands, set this to "yes".
|
||||||
|
# This directive can be duplicated to also log server responses.
|
||||||
|
|
||||||
|
VerboseLog no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# List dot-files even when the client doesn't send "-a".
|
||||||
|
|
||||||
|
DisplayDotFiles yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Don't allow authenticated users - have a public anonymous FTP only.
|
||||||
|
|
||||||
|
AnonymousOnly no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Disallow anonymous connections. Only allow authenticated users.
|
||||||
|
|
||||||
|
NoAnonymous yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Syslog facility (auth, authpriv, daemon, ftp, security, user, local*)
|
||||||
|
# The default facility is "ftp". "none" disables logging.
|
||||||
|
|
||||||
|
SyslogFacility ftp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Display fortune cookies
|
||||||
|
|
||||||
|
# FortunesFile /usr/share/fortune/zippy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Don't resolve host names in log files. Logs are less verbose, but
|
||||||
|
# it uses less bandwidth. Set this to "yes" on very busy servers or
|
||||||
|
# if you don't have a working DNS.
|
||||||
|
|
||||||
|
DontResolve yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Maximum idle time in minutes (default = 15 minutes)
|
||||||
|
|
||||||
|
MaxIdleTime 15
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# LDAP configuration file (see README.LDAP)
|
||||||
|
|
||||||
|
# LDAPConfigFile /etc/pureftpd-ldap.conf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# MySQL configuration file (see README.MySQL)
|
||||||
|
|
||||||
|
# MySQLConfigFile /usr/local/pureftpd/etc/pureftpd-mysql.conf
|
||||||
|
|
||||||
|
|
||||||
|
# Postgres configuration file (see README.PGSQL)
|
||||||
|
|
||||||
|
# PGSQLConfigFile /etc/pureftpd-pgsql.conf
|
||||||
|
|
||||||
|
|
||||||
|
# PureDB user database (see README.Virtual-Users)
|
||||||
|
|
||||||
|
PureDB /usr/local/pureftpd/etc/pureftpd.pdb
|
||||||
|
|
||||||
|
|
||||||
|
# Path to pure-authd socket (see README.Authentication-Modules)
|
||||||
|
|
||||||
|
# ExtAuth /var/run/ftpd.sock
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# If you want to enable PAM authentication, uncomment the following line
|
||||||
|
|
||||||
|
# PAMAuthentication yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# If you want simple Unix (/etc/passwd) authentication, uncomment this
|
||||||
|
|
||||||
|
UnixAuthentication yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Please note that LDAPConfigFile, MySQLConfigFile, PAMAuthentication and
|
||||||
|
# UnixAuthentication can be used only once, but they can be combined
|
||||||
|
# together. For instance, if you use MySQLConfigFile, then UnixAuthentication,
|
||||||
|
# the SQL server will be asked. If the SQL authentication fails because the
|
||||||
|
# user wasn't found, another try # will be done with /etc/passwd and
|
||||||
|
# /etc/shadow. If the SQL authentication fails because the password was wrong,
|
||||||
|
# the authentication chain stops here. Authentication methods are chained in
|
||||||
|
# the order they are given.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 'ls' recursion limits. The first argument is the maximum number of
|
||||||
|
# files to be displayed. The second one is the max subdirectories depth
|
||||||
|
|
||||||
|
LimitRecursion 2000 8
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Are anonymous users allowed to create new directories ?
|
||||||
|
|
||||||
|
AnonymousCanCreateDirs no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# If the system is more loaded than the following value,
|
||||||
|
# anonymous users aren't allowed to download.
|
||||||
|
|
||||||
|
MaxLoad 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Port range for passive connections replies. - for firewalling.
|
||||||
|
|
||||||
|
PassivePortRange 20000 30000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Force an IP address in PASV/EPSV/SPSV replies. - for NAT.
|
||||||
|
# Symbolic host names are also accepted for gateways with dynamic IP
|
||||||
|
# addresses.
|
||||||
|
|
||||||
|
# ForcePassiveIP 192.168.0.1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Upload/download ratio for anonymous users.
|
||||||
|
|
||||||
|
# AnonymousRatio 1 10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Upload/download ratio for all users.
|
||||||
|
# This directive superscedes the previous one.
|
||||||
|
|
||||||
|
# UserRatio 1 10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Disallow downloading of files owned by "ftp", ie.
|
||||||
|
# files that were uploaded but not validated by a local admin.
|
||||||
|
|
||||||
|
AntiWarez yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# IP address/port to listen to (default=all IP and port 21).
|
||||||
|
|
||||||
|
# Bind 127.0.0.1,21
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Maximum bandwidth for anonymous users in KB/s
|
||||||
|
|
||||||
|
# AnonymousBandwidth 8
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Maximum bandwidth for *all* users (including anonymous) in KB/s
|
||||||
|
# Use AnonymousBandwidth *or* UserBandwidth, both makes no sense.
|
||||||
|
|
||||||
|
# UserBandwidth 8
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# File creation mask. <umask for files>:<umask for dirs> .
|
||||||
|
# 177:077 if you feel paranoid.
|
||||||
|
|
||||||
|
Umask 133:022
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Minimum UID for an authenticated user to log in.
|
||||||
|
|
||||||
|
MinUID 100
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Allow FXP transfers for authenticated users.
|
||||||
|
|
||||||
|
AllowUserFXP no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Allow anonymous FXP for anonymous and non-anonymous users.
|
||||||
|
|
||||||
|
AllowAnonymousFXP no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Users can't delete/write files beginning with a dot ('.')
|
||||||
|
# even if they own them. If TrustedGID is enabled, this group
|
||||||
|
# will have access to dot-files, though.
|
||||||
|
|
||||||
|
ProhibitDotFilesWrite no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Prohibit *reading* of files beginning with a dot (.history, .ssh...)
|
||||||
|
|
||||||
|
ProhibitDotFilesRead no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Never overwrite files. When a file whoose name already exist is uploaded,
|
||||||
|
# it get automatically renamed to file.1, file.2, file.3, ...
|
||||||
|
|
||||||
|
AutoRename no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Disallow anonymous users to upload new files (no = upload is allowed)
|
||||||
|
|
||||||
|
AnonymousCantUpload no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Only connections to this specific IP address are allowed to be
|
||||||
|
# non-anonymous. You can use this directive to open several public IPs for
|
||||||
|
# anonymous FTP, and keep a private firewalled IP for remote administration.
|
||||||
|
# You can also only allow a non-routable local IP (like 10.x.x.x) to
|
||||||
|
# authenticate, and keep a public anon-only FTP server on another IP.
|
||||||
|
|
||||||
|
#TrustedIP 10.1.1.1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# If you want to add the PID to every logged line, uncomment the following
|
||||||
|
# line.
|
||||||
|
|
||||||
|
#LogPID yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Create an additional log file with transfers logged in a Apache-like format :
|
||||||
|
# fw.c9x.org - jedi [13/Dec/1975:19:36:39] "GET /ftp/linux.tar.bz2" 200 21809338
|
||||||
|
# This log file can then be processed by www traffic analyzers.
|
||||||
|
|
||||||
|
# AltLog clf:/var/log/pureftpd.log
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Create an additional log file with transfers logged in a format optimized
|
||||||
|
# for statistic reports.
|
||||||
|
|
||||||
|
# AltLog stats:/var/log/pureftpd.log
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Create an additional log file with transfers logged in the standard W3C
|
||||||
|
# format (compatible with most commercial log analyzers)
|
||||||
|
|
||||||
|
# AltLog w3c:/var/log/pureftpd.log
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Disallow the CHMOD command. Users can't change perms of their files.
|
||||||
|
|
||||||
|
#NoChmod yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Allow users to resume and upload files, but *NOT* to delete them.
|
||||||
|
|
||||||
|
#KeepAllFiles yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Automatically create home directories if they are missing
|
||||||
|
|
||||||
|
CreateHomeDir no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Enable virtual quotas. The first number is the max number of files.
|
||||||
|
# The second number is the max size of megabytes.
|
||||||
|
# So 1000:10 limits every user to 1000 files and 10 Mb.
|
||||||
|
|
||||||
|
#Quota 1000:10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# If your pure-ftpd has been compiled with standalone support, you can change
|
||||||
|
# the location of the pid file. The default is /var/run/pure-ftpd.pid
|
||||||
|
|
||||||
|
#PIDFile /var/run/pure-ftpd.pid
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# If your pure-ftpd has been compiled with pure-uploadscript support,
|
||||||
|
# this will make pure-ftpd write info about new uploads to
|
||||||
|
# /var/run/pure-ftpd.upload.pipe so pure-uploadscript can read it and
|
||||||
|
# spawn a script to handle the upload.
|
||||||
|
|
||||||
|
#CallUploadScript yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# This option is useful with servers where anonymous upload is
|
||||||
|
# allowed. As /var/ftp is in /var, it save some space and protect
|
||||||
|
# the log files. When the partition is more that X percent full,
|
||||||
|
# new uploads are disallowed.
|
||||||
|
|
||||||
|
MaxDiskUsage 99
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Set to 'yes' if you don't want your users to rename files.
|
||||||
|
|
||||||
|
#NoRename yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Be 'customer proof' : workaround against common customer mistakes like
|
||||||
|
# 'chmod 0 public_html', that are valid, but that could cause ignorant
|
||||||
|
# customers to lock their files, and then keep your technical support busy
|
||||||
|
# with silly issues. If you're sure all your users have some basic Unix
|
||||||
|
# knowledge, this feature is useless. If you're a hosting service, enable it.
|
||||||
|
|
||||||
|
CustomerProof yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Per-user concurrency limits. It will only work if the FTP server has
|
||||||
|
# been compiled with --with-peruserlimits (and this is the case on
|
||||||
|
# most binary distributions) .
|
||||||
|
# The format is : <max sessions per user>:<max anonymous sessions>
|
||||||
|
# For instance, 3:20 means that the same authenticated user can have 3 active
|
||||||
|
# sessions max. And there are 20 anonymous sessions max.
|
||||||
|
|
||||||
|
# PerUserLimits 3:20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# When a file is uploaded and there is already a previous version of the file
|
||||||
|
# with the same name, the old file will neither get removed nor truncated.
|
||||||
|
# Upload will take place in a temporary file and once the upload is complete,
|
||||||
|
# the switch to the new version will be atomic. For instance, when a large PHP
|
||||||
|
# script is being uploaded, the web server will still serve the old version and
|
||||||
|
# immediatly switch to the new one as soon as the full file will have been
|
||||||
|
# transfered. This option is incompatible with virtual quotas.
|
||||||
|
|
||||||
|
# NoTruncate yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# This option can accept three values :
|
||||||
|
# 0 : disable SSL/TLS encryption layer (default).
|
||||||
|
# 1 : accept both traditional and encrypted sessions.
|
||||||
|
# 2 : refuse connections that don't use SSL/TLS security mechanisms,
|
||||||
|
# including anonymous sessions.
|
||||||
|
# Do _not_ uncomment this blindly. Be sure that :
|
||||||
|
# 1) Your server has been compiled with SSL/TLS support (--with-tls),
|
||||||
|
# 2) A valid certificate is in place,
|
||||||
|
# 3) Only compatible clients will log in.
|
||||||
|
|
||||||
|
# TLS 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Listen only to IPv4 addresses in standalone mode (ie. disable IPv6)
|
||||||
|
# By default, both IPv4 and IPv6 are enabled.
|
||||||
|
|
||||||
|
# IPV4Only yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Listen only to IPv6 addresses in standalone mode (ie. disable IPv4)
|
||||||
|
# By default, both IPv4 and IPv6 are enabled.
|
||||||
|
|
||||||
|
# IPV6Only yes
|
||||||
|
|
||||||
|
# UTF-8 support for file names (RFC 2640)
|
||||||
|
# Define charset of the server filesystem and optionnally the default charset
|
||||||
|
# for remote clients if they don't use UTF-8.
|
||||||
|
# Works only if pure-ftpd has been compiled with --with-rfc2640
|
||||||
|
|
||||||
|
# FileSystemCharset big5
|
||||||
|
# ClientCharset big5
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE server-xml [
|
||||||
|
<!ENTITY vhost-localhost SYSTEM "file:///usr/local/tomcat/conf/vhost/localhost.xml">
|
||||||
|
]>
|
||||||
|
<Server port="8006" shutdown="SHUTDOWN">
|
||||||
|
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
|
||||||
|
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
|
||||||
|
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
|
||||||
|
<Listener className="org.apache.catalina.core.AprLifecycleListener"/>
|
||||||
|
<!--
|
||||||
|
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="8081" rmiServerPortPlatform="8082" />
|
||||||
|
-->
|
||||||
|
<GlobalNamingResources>
|
||||||
|
<Resource name="UserDatabase" auth="Container"
|
||||||
|
type="org.apache.catalina.UserDatabase"
|
||||||
|
description="User database that can be updated and saved"
|
||||||
|
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
|
||||||
|
pathname="conf/tomcat-users.xml" />
|
||||||
|
</GlobalNamingResources>
|
||||||
|
|
||||||
|
<Service name="Catalina">
|
||||||
|
<Connector port="8080"
|
||||||
|
protocol="org.apache.coyote.http11.Http11AprProtocol"
|
||||||
|
connectionTimeout="20000"
|
||||||
|
redirectPort="8443"
|
||||||
|
maxThreads="1000"
|
||||||
|
minSpareThreads="20"
|
||||||
|
acceptCount="1000"
|
||||||
|
maxHttpHeaderSize="65536"
|
||||||
|
disableUploadTimeout="true"
|
||||||
|
useBodyEncodingForURI="true"
|
||||||
|
enableLookups="false"
|
||||||
|
URIEncoding="UTF-8" />
|
||||||
|
<Engine name="Catalina" defaultHost="localhost">
|
||||||
|
<Realm className="org.apache.catalina.realm.LockOutRealm">
|
||||||
|
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
|
||||||
|
resourceName="UserDatabase"/>
|
||||||
|
</Realm>
|
||||||
|
&vhost-localhost;
|
||||||
|
</Engine>
|
||||||
|
</Service>
|
||||||
|
</Server>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
location / {
|
||||||
|
if (!-e $request_filename) {
|
||||||
|
rewrite ^(.*)$ /index.php?s=$1 last;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
location / {
|
||||||
|
if (!-e $request_filename) {
|
||||||
|
rewrite ^(.*)$ /index.php$1 last;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
location ~ /announcements/?(.*)$ {
|
||||||
|
rewrite ^/(.*)$ /index.php?rp=/announcements/$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /download/?(.*)$ {
|
||||||
|
rewrite ^/(.*)$ /index.php?rp=/download$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /knowledgebase/?(.*)$ {
|
||||||
|
rewrite ^/(.*)$ /index.php?rp=/knowledgebase/$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /store/ssl-certificates/?(.*)$ {
|
||||||
|
rewrite ^/(.*)$ /index.php?rp=/store/ssl-certificates/$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /store/sitelock/?(.*)$ {
|
||||||
|
rewrite ^/(.*)$ /index.php?rp=/store/sitelock/$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /store/website-builder/?(.*)$ {
|
||||||
|
rewrite ^/(.*)$ /index.php?rp=/store/website-builder/$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /store/order/?(.*)$ {
|
||||||
|
rewrite ^/(.*)$ /index.php?rp=/store/order/$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /cart/domain/renew/?(.*)$ {
|
||||||
|
rewrite ^/(.*)$ /index.php?rp=/cart/domain/renew$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /account/paymentmethods/?(.*)$ {
|
||||||
|
rewrite ^/(.*)$ /index.php?rp=/account/paymentmethods$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /admin/(addons|apps|domains|help\/license|services|setup|utilities\/system\/php-compat)(.*) {
|
||||||
|
rewrite ^/(.*)$ /admin/index.php?rp=/admin/$1$2 last;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$args;
|
||||||
|
}
|
||||||
|
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
|
||||||
|
location ~* ^/wp-content/uploads/.*\.php$ {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
location / {
|
||||||
|
if (-f $request_filename/index.html){
|
||||||
|
rewrite (.*) $1/index.html break;
|
||||||
|
}
|
||||||
|
if (-f $request_filename/index.php){
|
||||||
|
rewrite (.*) $1/index.php;
|
||||||
|
}
|
||||||
|
if (!-f $request_filename){
|
||||||
|
rewrite (.*) /index.php;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_GraphicsMagick() {
|
||||||
|
if [ -d "${gmagick_install_dir}" ]; then
|
||||||
|
echo "${CWARNING}GraphicsMagick already installed! ${CEND}"
|
||||||
|
else
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
tar xzf GraphicsMagick-${graphicsmagick_ver}.tar.gz
|
||||||
|
pushd GraphicsMagick-${graphicsmagick_ver} > /dev/null
|
||||||
|
./configure --prefix=${gmagick_install_dir} --enable-shared --enable-static --enable-symbol-prefix
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf GraphicsMagick-${graphicsmagick_ver}
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_GraphicsMagick() {
|
||||||
|
if [ -d "${gmagick_install_dir}" ]; then
|
||||||
|
rm -rf ${gmagick_install_dir}
|
||||||
|
echo; echo "${CMSG}GraphicsMagick uninstall completed${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Install_pecl_gmagick() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
|
||||||
|
if [ "`${php_install_dir}/bin/php-config --version | awk -F. '{print $1}'`" == '5' ]; then
|
||||||
|
tar xzf gmagick-${gmagick_oldver}.tgz
|
||||||
|
pushd gmagick-${gmagick_oldver} > /dev/null
|
||||||
|
else
|
||||||
|
tar xzf gmagick-${gmagick_ver}.tgz
|
||||||
|
pushd gmagick-${gmagick_ver} > /dev/null
|
||||||
|
fi
|
||||||
|
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config --with-gmagick=${gmagick_install_dir}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/gmagick.so" ]; then
|
||||||
|
echo 'extension=gmagick.so' > ${php_install_dir}/etc/php.d/03-gmagick.ini
|
||||||
|
echo "${CSUCCESS}PHP gmagick module installed successfully! ${CEND}"
|
||||||
|
rm -rf gmagick-${gmagick_ver} gmagick-${gmagick_oldver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP gmagick module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_gmagick() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/03-gmagick.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/03-gmagick.ini
|
||||||
|
echo; echo "${CMSG}PHP gmagick module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP gmagick module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_ImageMagick() {
|
||||||
|
if [ -d "${imagick_install_dir}" ]; then
|
||||||
|
echo "${CWARNING}ImageMagick already installed! ${CEND}"
|
||||||
|
else
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
tar xzf ImageMagick-${imagemagick_ver}.tar.gz
|
||||||
|
#if [ "${PM}" == 'yum' ]; then
|
||||||
|
# yum -y install libwebp-devel
|
||||||
|
#elif [ "${PM}" == 'apt-get' ]; then
|
||||||
|
# yum -y install libwebp-dev
|
||||||
|
#fi
|
||||||
|
pushd ImageMagick-${imagemagick_ver} > /dev/null
|
||||||
|
./configure --prefix=${imagick_install_dir} --enable-shared --enable-static
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf ImageMagick-${imagemagick_ver}
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_ImageMagick() {
|
||||||
|
if [ -d "${imagick_install_dir}" ]; then
|
||||||
|
rm -rf ${imagick_install_dir}
|
||||||
|
echo; echo "${CMSG}ImageMagick uninstall completed${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Install_pecl_imagick() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
PHP_main_ver=${PHP_detail_ver%.*}
|
||||||
|
phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
|
||||||
|
if [[ "${PHP_main_ver}" =~ ^5.3$ ]]; then
|
||||||
|
tar xzf imagick-${imagick_oldver}.tgz
|
||||||
|
pushd imagick-${imagick_oldver} > /dev/null
|
||||||
|
else
|
||||||
|
tar xzf imagick-${imagick_ver}.tgz
|
||||||
|
pushd imagick-${imagick_ver} > /dev/null
|
||||||
|
fi
|
||||||
|
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config --with-imagick=${imagick_install_dir}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/imagick.so" ]; then
|
||||||
|
echo 'extension=imagick.so' > ${php_install_dir}/etc/php.d/03-imagick.ini
|
||||||
|
echo "${CSUCCESS}PHP imagick module installed successfully! ${CEND}"
|
||||||
|
rm -rf imagick-${imagick_ver} imagick-${imagick_oldver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP imagick module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_imagick() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/03-imagick.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/03-imagick.ini
|
||||||
|
echo; echo "${CMSG}PHP imagick module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP imagick module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_ZendGuardLoader() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
PHP_main_ver=${PHP_detail_ver%.*}
|
||||||
|
phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
|
||||||
|
[ ! -d "${phpExtensionDir}" ] && mkdir -p ${phpExtensionDir}
|
||||||
|
if [ -n "`echo $phpExtensionDir | grep 'non-zts'`" ] && [ "${armplatform}" != 'y' ]; then
|
||||||
|
case "${PHP_main_ver}" in
|
||||||
|
5.6)
|
||||||
|
tar xzf zend-loader-php5.6-linux-x86_64.tar.gz
|
||||||
|
/bin/mv zend-loader-php5.6-linux-x86_64/ZendGuardLoader.so ${phpExtensionDir}
|
||||||
|
rm -rf zend-loader-php5.6-linux-x86_64
|
||||||
|
;;
|
||||||
|
5.5)
|
||||||
|
tar xzf zend-loader-php5.5-linux-x86_64.tar.gz
|
||||||
|
/bin/mv zend-loader-php5.5-linux-x86_64/ZendGuardLoader.so ${phpExtensionDir}
|
||||||
|
rm -rf zend-loader-php5.5-linux-x86_64
|
||||||
|
;;
|
||||||
|
5.4)
|
||||||
|
tar xzf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz
|
||||||
|
/bin/mv ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so ${phpExtensionDir}
|
||||||
|
rm -rf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64
|
||||||
|
;;
|
||||||
|
5.3)
|
||||||
|
tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
|
||||||
|
/bin/mv ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so ${phpExtensionDir}
|
||||||
|
rm -rf ZendGuardLoader-php-5.3-linux-glibc23-x86_64
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "${CWARNING}Your php ${PHP_detail_ver} does not support ZendGuardLoader! ${CEND}";
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -f "${phpExtensionDir}/ZendGuardLoader.so" ]; then
|
||||||
|
chmod 644 ${phpExtensionDir}/ZendGuardLoader.so
|
||||||
|
cat > ${php_install_dir}/etc/php.d/01-ZendGuardLoader.ini<< EOF
|
||||||
|
[Zend Guard Loader]
|
||||||
|
zend_extension=${phpExtensionDir}/ZendGuardLoader.so
|
||||||
|
zend_loader.enable=1
|
||||||
|
zend_loader.disable_licensing=0
|
||||||
|
zend_loader.obfuscation_level_support=3
|
||||||
|
EOF
|
||||||
|
echo "${CSUCCESS}PHP ZendGuardLoader module installed successfully! ${CEND}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error! Your Apache's prefork or PHP already enable thread safety or platform ${TARGET_ARCH} does not support ZendGuardLoader! "
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_ZendGuardLoader() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/01-ZendGuardLoader.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/01-ZendGuardLoader.ini
|
||||||
|
echo; echo "${CMSG}PHP ZendGuardLoader module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP ZendGuardLoader module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,190 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_Apache() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
tar xzf pcre-${pcre_ver}.tar.gz
|
||||||
|
pushd pcre-${pcre_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
tar xzf httpd-${apache_ver}.tar.gz
|
||||||
|
|
||||||
|
# install apr
|
||||||
|
if [ ! -e "${apr_install_dir}/bin/apr-1-config" ]; then
|
||||||
|
tar xzf apr-${apr_ver}.tar.gz
|
||||||
|
pushd apr-${apr_ver} > /dev/null
|
||||||
|
./configure --prefix=${apr_install_dir}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf apr-${apr_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# install apr-util
|
||||||
|
if [ ! -e "${apr_install_dir}/bin/apu-1-config" ]; then
|
||||||
|
tar xzf apr-util-${apr_util_ver}.tar.gz
|
||||||
|
pushd apr-util-${apr_util_ver} > /dev/null
|
||||||
|
./configure --prefix=${apr_install_dir} --with-apr=${apr_install_dir}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf apr-util-${apr_util_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# install nghttp2
|
||||||
|
if [ ! -e "/usr/local/lib/libnghttp2.so" ]; then
|
||||||
|
tar xzf nghttp2-${nghttp2_ver}.tar.gz
|
||||||
|
pushd nghttp2-${nghttp2_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
[ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
|
||||||
|
ldconfig
|
||||||
|
rm -rf nghttp2-${nghttp2_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd httpd-${apache_ver} > /dev/null
|
||||||
|
LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} --enable-mpms-shared=all --with-pcre --with-apr=${apr_install_dir} --with-apr-util=${apr_install_dir} --enable-headers --enable-mime-magic --enable-deflate --enable-proxy --enable-so --enable-dav --enable-rewrite --enable-remoteip --enable-expires --enable-static-support --enable-suexec --enable-mods-shared=most --enable-nonportable-atomics=yes --enable-ssl --with-ssl --enable-http2 --with-nghttp2=/usr/local
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
unset LDFLAGS
|
||||||
|
if [ -e "${apache_install_dir}/bin/httpd" ]; then
|
||||||
|
echo "${CSUCCESS}Apache installed successfully! ${CEND}"
|
||||||
|
rm -rf httpd-${apache_ver} pcre-${pcre_ver}
|
||||||
|
else
|
||||||
|
rm -rf ${apache_install_dir}
|
||||||
|
echo "${CFAILURE}Apache install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${apache_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${apache_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${apache_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
/bin/cp ../init.d/httpd.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/apache@${apache_install_dir}@g" /lib/systemd/system/httpd.service
|
||||||
|
systemctl enable httpd
|
||||||
|
|
||||||
|
sed -i "s@^User daemon@User ${run_user}@" ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -i "s@^Group daemon@Group ${run_group}@" ${apache_install_dir}/conf/httpd.conf
|
||||||
|
if [[ ! ${nginx_option} =~ ^[1-3]$ ]] && [ ! -e "${web_install_dir}/sbin/nginx" ]; then
|
||||||
|
sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
TMP_PORT=80
|
||||||
|
elif [[ ${nginx_option} =~ ^[1-3]$ ]] || [ -e "${web_install_dir}/sbin/nginx" ]; then
|
||||||
|
sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -i 's@^Listen.*@Listen 127.0.0.1:88@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
TMP_PORT=88
|
||||||
|
fi
|
||||||
|
sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -ri 's@^#(LoadModule.*mod_proxy.so)@\1@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -ri 's@^#(LoadModule.*mod_proxy_fcgi.so)@\1@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -ri 's@^#(LoadModule.*mod_suexec.so)@\1@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -ri 's@^#(LoadModule.*mod_vhost_alias.so)@\1@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -ri 's@^#(LoadModule.*mod_rewrite.so)@\1@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -ri 's@^#(LoadModule.*mod_deflate.so)@\1@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -ri 's@^#(LoadModule.*mod_expires.so)@\1@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -ri 's@^#(LoadModule.*mod_ssl.so)@\1@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -ri 's@^#(LoadModule.*mod_http2.so)@\1@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -i "s@^DocumentRoot.*@DocumentRoot \"${wwwroot_dir}/default\"@" ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -i "s@^<Directory \"${apache_install_dir}/htdocs\">@<Directory \"${wwwroot_dir}/default\">@" ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" ${apache_install_dir}/conf/httpd.conf
|
||||||
|
if [ "${apache_mpm_option}" == '2' ]; then
|
||||||
|
sed -ri 's@^(LoadModule.*mod_mpm_event.so)@#\1@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -i 's@^#LoadModule mpm_prefork_module@LoadModule mpm_prefork_module@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
elif [ "${apache_mpm_option}" == '3' ]; then
|
||||||
|
sed -ri 's@^(LoadModule.*mod_mpm_event.so)@#\1@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -i 's@^#LoadModule mpm_worker_module@LoadModule mpm_worker_module@' ${apache_install_dir}/conf/httpd.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
#logrotate apache log
|
||||||
|
cat > /etc/logrotate.d/apache << EOF
|
||||||
|
${wwwlogs_dir}/*apache.log {
|
||||||
|
daily
|
||||||
|
rotate 5
|
||||||
|
missingok
|
||||||
|
dateext
|
||||||
|
compress
|
||||||
|
notifempty
|
||||||
|
sharedscripts
|
||||||
|
postrotate
|
||||||
|
[ -e /var/run/httpd.pid ] && kill -USR1 \`cat /var/run/httpd.pid\`
|
||||||
|
endscript
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
mkdir ${apache_install_dir}/conf/vhost
|
||||||
|
[ "${apache_mode_option}" != '2' ] && Apache_fcgi=$(echo -e "<Files ~ (\\.user.ini|\\.htaccess|\\.git|\\.svn|\\.project|LICENSE|README.md)\$>\n Order allow,deny\n Deny from all\n </Files>\n <FilesMatch \\.php\$>\n SetHandler \"proxy:unix:/dev/shm/php-cgi.sock|fcgi://localhost\"\n </FilesMatch>")
|
||||||
|
cat > ${apache_install_dir}/conf/vhost/0.conf << EOF
|
||||||
|
<VirtualHost *:$TMP_PORT>
|
||||||
|
ServerAdmin admin@example.com
|
||||||
|
DocumentRoot "${wwwroot_dir}/default"
|
||||||
|
ServerName 127.0.0.1
|
||||||
|
ErrorLog "${wwwlogs_dir}/error_apache.log"
|
||||||
|
CustomLog "${wwwlogs_dir}/access_apache.log" common
|
||||||
|
<Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)\$>
|
||||||
|
Order allow,deny
|
||||||
|
Deny from all
|
||||||
|
</Files>
|
||||||
|
${Apache_fcgi}
|
||||||
|
<Directory "${wwwroot_dir}/default">
|
||||||
|
SetOutputFilter DEFLATE
|
||||||
|
Options FollowSymLinks ExecCGI
|
||||||
|
Require all granted
|
||||||
|
AllowOverride All
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
DirectoryIndex index.html index.php
|
||||||
|
</Directory>
|
||||||
|
<Location /server-status>
|
||||||
|
SetHandler server-status
|
||||||
|
Order Deny,Allow
|
||||||
|
Deny from all
|
||||||
|
Allow from 127.0.0.1
|
||||||
|
</Location>
|
||||||
|
</VirtualHost>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat >> ${apache_install_dir}/conf/httpd.conf <<EOF
|
||||||
|
<IfModule mod_headers.c>
|
||||||
|
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript
|
||||||
|
<FilesMatch "\.(js|css|html|htm|png|jpg|swf|pdf|shtml|xml|flv|gif|ico|jpeg)\$">
|
||||||
|
RequestHeader edit "If-None-Match" "^(.*)-gzip(.*)\$" "\$1\$2"
|
||||||
|
Header edit "ETag" "^(.*)-gzip(.*)\$" "\$1\$2"
|
||||||
|
</FilesMatch>
|
||||||
|
DeflateCompressionLevel 6
|
||||||
|
SetOutputFilter DEFLATE
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
ProtocolsHonorOrder On
|
||||||
|
PidFile /var/run/httpd.pid
|
||||||
|
ServerTokens ProductOnly
|
||||||
|
ServerSignature Off
|
||||||
|
Include conf/vhost/*.conf
|
||||||
|
EOF
|
||||||
|
[ "${nginx_option}" == '4' -a ! -e "${web_install_dir}/sbin/nginx" ] && echo 'Protocols h2 http/1.1' >> ${apache_install_dir}/conf/httpd.conf
|
||||||
|
if [ "${nginx_option}" != '4' -o -e "${web_install_dir}/sbin/nginx" ]; then
|
||||||
|
cat > ${apache_install_dir}/conf/extra/httpd-remoteip.conf << EOF
|
||||||
|
LoadModule remoteip_module modules/mod_remoteip.so
|
||||||
|
RemoteIPHeader X-Forwarded-For
|
||||||
|
RemoteIPInternalProxy 127.0.0.1
|
||||||
|
EOF
|
||||||
|
sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" ${apache_install_dir}/conf/httpd.conf
|
||||||
|
sed -i "s@LogFormat \"%h %l@LogFormat \"%h %a %l@g" ${apache_install_dir}/conf/httpd.conf
|
||||||
|
fi
|
||||||
|
ldconfig
|
||||||
|
[ "${with_old_openssl_flag}" == 'y' ] && sed -i "s@^export LD_LIBRARY_PATH.*@export LD_LIBRARY_PATH=${openssl_install_dir}/lib:\$LD_LIBRARY_PATH@" ${apache_install_dir}/bin/envvars
|
||||||
|
systemctl start httpd
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_APCU() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
|
||||||
|
if [ "`${php_install_dir}/bin/php-config --version | awk -F. '{print $1}'`" == '5' ]; then
|
||||||
|
tar xzf apcu-${apcu_oldver}.tgz
|
||||||
|
pushd apcu-${apcu_oldver} > /dev/null
|
||||||
|
else
|
||||||
|
tar xzf apcu-${apcu_ver}.tgz
|
||||||
|
pushd apcu-${apcu_ver} > /dev/null
|
||||||
|
fi
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
if [ -f "${phpExtensionDir}/apcu.so" ]; then
|
||||||
|
cat > ${php_install_dir}/etc/php.d/02-apcu.ini << EOF
|
||||||
|
[apcu]
|
||||||
|
extension=apcu.so
|
||||||
|
apc.enabled=1
|
||||||
|
apc.shm_size=32M
|
||||||
|
apc.ttl=7200
|
||||||
|
apc.enable_cli=1
|
||||||
|
EOF
|
||||||
|
/bin/cp apc.php ${wwwroot_dir}/default
|
||||||
|
popd > /dev/null
|
||||||
|
echo "${CSUCCESS}PHP apcu module installed successfully! ${CEND}"
|
||||||
|
rm -rf apcu-${apcu_ver} apcu-${apcu_oldver} package.xml
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP apcu module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_APCU() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/02-apcu.ini" ]; then
|
||||||
|
rm -rf ${php_install_dir}/etc/php.d/02-apcu.ini ${wwwroot_dir}/default/apc.php
|
||||||
|
echo; echo "${CMSG}PHP apcu module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP apcu module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_Caddy() {
|
||||||
|
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
|
||||||
|
#unzip caddy_${caddy_ver}_linux_amd64.zip
|
||||||
|
tar xzf caddy-${caddy_ver}.tar.gz
|
||||||
|
|
||||||
|
#move caddy to /usr/local/caddy/bin
|
||||||
|
[ ! -d "${caddy_install_dir}/bin" ] && mkdir -p ${caddy_install_dir}/bin
|
||||||
|
/bin/cp caddy ${caddy_install_dir}/bin
|
||||||
|
|
||||||
|
chmod +x ${caddy_install_dir}/bin/caddy
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${caddy_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${caddy_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${caddy_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
#make soft link
|
||||||
|
# [ ! -L "/usr/local/bin/caddy" ] && ln -s ${caddy_install_dir}/bin/caddy /usr/local/bin/caddy
|
||||||
|
|
||||||
|
#move caddyfile to /usr/local/caddy/conf
|
||||||
|
[ ! -d "${caddy_install_dir}/conf" ] && mkdir -p ${caddy_install_dir}/conf
|
||||||
|
/bin/cp ../config/Caddyfile ${caddy_install_dir}/conf/
|
||||||
|
|
||||||
|
#move caddy.service to /lib/systemd/system
|
||||||
|
/bin/cp ../init.d/caddy.service /lib/systemd/system/
|
||||||
|
|
||||||
|
#modify caddy.service
|
||||||
|
sed -i "s@/usr/local/caddy@${caddy_install_dir}@g" /lib/systemd/system/caddy.service
|
||||||
|
|
||||||
|
#设置caddy开机启动
|
||||||
|
systemctl enable caddy
|
||||||
|
|
||||||
|
#reload systemd
|
||||||
|
systemctl daemon-reload
|
||||||
|
|
||||||
|
#start caddy service
|
||||||
|
systemctl start caddy
|
||||||
|
|
||||||
|
echo "${CSUCCESS}Caddy installed successfully! ${CEND}"
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
# check MySQL dir
|
||||||
|
[ -d "${mysql_install_dir}/support-files" ] && { db_install_dir=${mysql_install_dir}; db_data_dir=${mysql_data_dir}; }
|
||||||
|
[ -d "${mariadb_install_dir}/support-files" ] && { db_install_dir=${mariadb_install_dir}; db_data_dir=${mariadb_data_dir}; }
|
||||||
|
[ -d "${percona_install_dir}/support-files" ] && { db_install_dir=${percona_install_dir}; db_data_dir=${percona_data_dir}; }
|
||||||
|
|
||||||
|
# check Nginx dir
|
||||||
|
[ -e "${nginx_install_dir}/sbin/nginx" ] && web_install_dir=${nginx_install_dir}
|
||||||
|
[ -e "${tengine_install_dir}/sbin/nginx" ] && web_install_dir=${tengine_install_dir}
|
||||||
|
[ -e "${openresty_install_dir}/nginx/sbin/nginx" ] && web_install_dir=${openresty_install_dir}/nginx
|
||||||
@@ -0,0 +1,739 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: Alpha Eva <kaneawk AT gmail.com>
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
checkDownload() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
# icu
|
||||||
|
if ! command -v icu-config >/dev/null 2>&1 || icu-config --version | grep '^3.' || [ "${Ubuntu_ver}" == "20" ]; then
|
||||||
|
echo "Download icu..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/icu4c-${icu4c_ver}-src.tgz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# General system utils
|
||||||
|
if [ "${with_old_openssl_flag}" == 'y' ]; then
|
||||||
|
echo "Download openSSL..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/openssl-${openssl_ver}.tar.gz && Download_src
|
||||||
|
echo "Download cacert.pem..."
|
||||||
|
src_url=https://curl.se/ca/cacert.pem && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# openssl1.1
|
||||||
|
if [[ ${nginx_option} =~ ^[1-3]$ ]]; then
|
||||||
|
echo "Download openSSL1.1..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/openssl-${openssl11_ver}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# jemalloc
|
||||||
|
if [[ ${nginx_option} =~ ^[1-3]$ ]] || [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]]; then
|
||||||
|
echo "Download jemalloc..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/jemalloc-${jemalloc_ver}.tar.bz2 && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pcre
|
||||||
|
if [[ "${nginx_option}" =~ ^[1-3]$ ]] || [ "${apache_flag}" == 'y' ]; then
|
||||||
|
echo "Download pcre..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/pcre-${pcre_ver}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# nginx/tengine/openresty
|
||||||
|
case "${nginx_option}" in
|
||||||
|
1)
|
||||||
|
echo "Download nginx..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/nginx-${nginx_ver}.tar.gz && Download_src
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
echo "Download tengine..."
|
||||||
|
#src_url=http://tengine.taobao.org/download/tengine-${tengine_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/tengine-${tengine_ver}.tar.gz && Download_src
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
echo "Download openresty..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/openresty-${openresty_ver}.tar.gz && Download_src
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# if nginx_option=4 download caddy
|
||||||
|
if [ "${nginx_option}" == '4' ]; then
|
||||||
|
echo "Download caddy ${caddy_ver}"
|
||||||
|
src_url=${mirror_link}/caddy/v${caddy_ver}/caddy-${caddy_ver}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# caddy
|
||||||
|
if [ "${caddy_flag}" == 'y' ]; then
|
||||||
|
echo "Download caddy ${caddy_ver}"
|
||||||
|
src_url=${mirror_link}/caddy/v${caddy_ver}/caddy-${caddy_ver}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# apache
|
||||||
|
if [ "${apache_flag}" == 'y' ]; then
|
||||||
|
echo "Download apache 2.4..."
|
||||||
|
src_url=http://archive.apache.org/dist/httpd/httpd-${apache_ver}.tar.gz && Download_src
|
||||||
|
src_url=http://archive.apache.org/dist/apr/apr-${apr_ver}.tar.gz && Download_src
|
||||||
|
src_url=http://archive.apache.org/dist/apr/apr-util-${apr_util_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/apache/httpd/nghttp2-${nghttp2_ver}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# tomcat
|
||||||
|
case "${tomcat_option}" in
|
||||||
|
1)
|
||||||
|
echo "Download tomcat 10..."
|
||||||
|
src_url=${mirror_link}/apache/tomcat/v${tomcat10_ver}/apache-tomcat-${tomcat10_ver}.tar.gz && Download_src
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
echo "Download tomcat 9..."
|
||||||
|
src_url=${mirror_link}/apache/tomcat/v${tomcat9_ver}/apache-tomcat-${tomcat9_ver}.tar.gz && Download_src
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
echo "Download tomcat 8..."
|
||||||
|
src_url=${mirror_link}/apache/tomcat/v${tomcat8_ver}/apache-tomcat-${tomcat8_ver}.tar.gz && Download_src
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
echo "Download tomcat 7..."
|
||||||
|
src_url=${mirror_link}/apache/tomcat/v${tomcat7_ver}/apache-tomcat-${tomcat7_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/apache/tomcat/v${tomcat7_ver}/catalina-jmx-remote.jar && Download_src
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# jdk apr
|
||||||
|
if [[ "${jdk_option}" =~ ^[1-2]$ ]]; then
|
||||||
|
echo "Download apr..."
|
||||||
|
src_url=http://archive.apache.org/dist/apr/apr-${apr_ver}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${db_option}" =~ ^[1-9]$|^1[0-4]$ ]]; then
|
||||||
|
if [[ "${db_option}" =~ ^[1,2,5,6,7,9]$|^10$ ]] && [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
[[ "${db_option}" =~ ^[2,5,6,7]$|^10$ ]] && boost_ver=${boost_oldver}
|
||||||
|
[[ "${db_option}" =~ ^9$ ]] && boost_ver=${boost_percona_ver}
|
||||||
|
echo "Download boost..."
|
||||||
|
[ "${OUTIP_STATE}"x == "China"x ] && DOWN_ADDR_BOOST=${mirror_link}/oneinstack/src || DOWN_ADDR_BOOST=https://downloads.sourceforge.net/project/boost/boost/${boost_ver}
|
||||||
|
boostVersion2=$(echo ${boost_ver} | awk -F. '{print $1"_"$2"_"$3}')
|
||||||
|
src_url=${DOWN_ADDR_BOOST}/boost_${boostVersion2}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "${db_option}" in
|
||||||
|
1)
|
||||||
|
# MySQL 8.0
|
||||||
|
if [ "${OUTIP_STATE}"x == "China"x ]; then
|
||||||
|
DOWN_ADDR_MYSQL=https://cdn.mysql.com/Downloads/MySQL-8.0
|
||||||
|
DOWN_ADDR_MYSQL_BK=https://mirrors.aliyun.com/mysql/MySQL-8.0
|
||||||
|
DOWN_ADDR_MYSQL_BK2=http://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-8.0
|
||||||
|
else
|
||||||
|
DOWN_ADDR_MYSQL=https://cdn.mysql.com/Downloads/MySQL-8.0
|
||||||
|
DOWN_ADDR_MYSQL_BK=https://mirrors.dotsrc.org/mysql/Downloads/MySQL-8.0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == '1' ]; then
|
||||||
|
echo "Download MySQL 8.0 binary package..."
|
||||||
|
FILE_NAME=mysql-${mysql80_ver}-linux-glibc2.12-x86_64.tar.xz
|
||||||
|
elif [ "${dbinstallmethod}" == '2' ]; then
|
||||||
|
echo "Download MySQL 8.0 source package..."
|
||||||
|
FILE_NAME=mysql-${mysql80_ver}.tar.gz
|
||||||
|
fi
|
||||||
|
# start download
|
||||||
|
src_url=${DOWN_ADDR_MYSQL}/${FILE_NAME} && Download_src
|
||||||
|
src_url=${DOWN_ADDR_MYSQL}/${FILE_NAME}.md5 && Download_src
|
||||||
|
# verifying download
|
||||||
|
MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5)
|
||||||
|
[ -z "${MYSQL_TAR_MD5}" ] && MYSQL_TAR_MD5=$(curl -s ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME}.md5 | grep ${FILE_NAME} | awk '{print $1}')
|
||||||
|
tryDlCount=0
|
||||||
|
while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ]; do
|
||||||
|
wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1
|
||||||
|
let "tryDlCount++"
|
||||||
|
[ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue
|
||||||
|
done
|
||||||
|
if [ "${tryDlCount}" == '6' ]; then
|
||||||
|
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
# MySQL 5.7
|
||||||
|
if [ "${OUTIP_STATE}"x == "China"x ]; then
|
||||||
|
DOWN_ADDR_MYSQL=https://cdn.mysql.com/Downloads/MySQL-5.7
|
||||||
|
DOWN_ADDR_MYSQL_BK=https://mirrors.aliyun.com/mysql/MySQL-5.7
|
||||||
|
DOWN_ADDR_MYSQL_BK2=http://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.7
|
||||||
|
else
|
||||||
|
DOWN_ADDR_MYSQL=https://cdn.mysql.com/Downloads/MySQL-5.7
|
||||||
|
DOWN_ADDR_MYSQL_BK=https://mirrors.dotsrc.org/mysql/Downloads/MySQL-5.7
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == '1' ]; then
|
||||||
|
echo "Download MySQL 5.7 binary package..."
|
||||||
|
FILE_NAME=mysql-${mysql57_ver}-linux-glibc2.12-x86_64.tar.gz
|
||||||
|
elif [ "${dbinstallmethod}" == '2' ]; then
|
||||||
|
echo "Download MySQL 5.7 source package..."
|
||||||
|
FILE_NAME=mysql-${mysql57_ver}.tar.gz
|
||||||
|
fi
|
||||||
|
# start download
|
||||||
|
src_url=${DOWN_ADDR_MYSQL}/${FILE_NAME} && Download_src
|
||||||
|
src_url=${DOWN_ADDR_MYSQL}/${FILE_NAME}.md5 && Download_src
|
||||||
|
# verifying download
|
||||||
|
MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5)
|
||||||
|
[ -z "${MYSQL_TAR_MD5}" ] && MYSQL_TAR_MD5=$(curl -s ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME}.md5 | grep ${FILE_NAME} | awk '{print $1}')
|
||||||
|
tryDlCount=0
|
||||||
|
while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ]; do
|
||||||
|
wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1
|
||||||
|
let "tryDlCount++"
|
||||||
|
[ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue
|
||||||
|
done
|
||||||
|
if [ "${tryDlCount}" == '6' ]; then
|
||||||
|
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
# MySQL 5.6
|
||||||
|
if [ "${OUTIP_STATE}"x == "China"x ]; then
|
||||||
|
DOWN_ADDR_MYSQL=http://mirrors.aliyun.com/mysql/MySQL-5.6
|
||||||
|
DOWN_ADDR_MYSQL_BK=http://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.6
|
||||||
|
DOWN_ADDR_MYSQL_BK2=https://mirrors.aliyun.com/mysql/MySQL-5.6
|
||||||
|
else
|
||||||
|
DOWN_ADDR_MYSQL=https://cdn.mysql.com/Downloads/MySQL-5.6
|
||||||
|
DOWN_ADDR_MYSQL_BK=https://mirrors.dotsrc.org/mysql/Downloads/MySQL-5.6
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == '1' ]; then
|
||||||
|
echo "Download MySQL 5.6 binary package..."
|
||||||
|
FILE_NAME=mysql-${mysql56_ver}-linux-glibc2.12-x86_64.tar.gz
|
||||||
|
elif [ "${dbinstallmethod}" == '2' ]; then
|
||||||
|
echo "Download MySQL 5.6 source package..."
|
||||||
|
FILE_NAME=mysql-${mysql56_ver}.tar.gz
|
||||||
|
fi
|
||||||
|
# start download
|
||||||
|
src_url=${DOWN_ADDR_MYSQL}/${FILE_NAME} && Download_src
|
||||||
|
src_url=${DOWN_ADDR_MYSQL}/${FILE_NAME}.md5 && Download_src
|
||||||
|
# verifying download
|
||||||
|
MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5)
|
||||||
|
[ -z "${MYSQL_TAR_MD5}" ] && MYSQL_TAR_MD5=$(curl -s ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME}.md5 | grep ${FILE_NAME} | awk '{print $1}')
|
||||||
|
tryDlCount=0
|
||||||
|
while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ]; do
|
||||||
|
wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1
|
||||||
|
let "tryDlCount++"
|
||||||
|
[ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue
|
||||||
|
done
|
||||||
|
if [ "${tryDlCount}" == '6' ]; then
|
||||||
|
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
# MySQL 5.5
|
||||||
|
if [ "${OUTIP_STATE}"x == "China"x ]; then
|
||||||
|
DOWN_ADDR_MYSQL=http://mirrors.aliyun.com/mysql/MySQL-5.5
|
||||||
|
DOWN_ADDR_MYSQL_BK=http://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.5
|
||||||
|
DOWN_ADDR_MYSQL_BK2=https://mirrors.aliyun.com/mysql/MySQL-5.5
|
||||||
|
else
|
||||||
|
DOWN_ADDR_MYSQL=https://cdn.mysql.com/Downloads/MySQL-5.5
|
||||||
|
DOWN_ADDR_MYSQL_BK=https://mirrors.dotsrc.org/mysql/Downloads/MySQL-5.5
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == '1' ]; then
|
||||||
|
echo "Download MySQL 5.5 binary package..."
|
||||||
|
FILE_NAME=mysql-${mysql55_ver}-linux-glibc2.12-x86_64.tar.gz
|
||||||
|
elif [ "${dbinstallmethod}" == '2' ]; then
|
||||||
|
echo "Download MySQL 5.5 source package..."
|
||||||
|
FILE_NAME=mysql-${mysql55_ver}.tar.gz
|
||||||
|
src_url=${mirror_link}/oneinstack/src/mysql-5.5-fix-arm-client_plugin.patch && Download_src
|
||||||
|
fi
|
||||||
|
# start download
|
||||||
|
src_url=${DOWN_ADDR_MYSQL}/${FILE_NAME} && Download_src
|
||||||
|
src_url=${DOWN_ADDR_MYSQL}/${FILE_NAME}.md5 && Download_src
|
||||||
|
# verifying download
|
||||||
|
MYSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5)
|
||||||
|
[ -z "${MYSQL_TAR_MD5}" ] && MYSQL_TAR_MD5=$(curl -s ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME}.md5 | grep ${FILE_NAME} | awk '{print $1}')
|
||||||
|
tryDlCount=0
|
||||||
|
while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MYSQL_TAR_MD5}" ]; do
|
||||||
|
wget -c --no-check-certificate ${DOWN_ADDR_MYSQL_BK}/${FILE_NAME};sleep 1
|
||||||
|
let "tryDlCount++"
|
||||||
|
[ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MYSQL_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue
|
||||||
|
done
|
||||||
|
if [ "${tryDlCount}" == '6' ]; then
|
||||||
|
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
[5-8])
|
||||||
|
case "${db_option}" in
|
||||||
|
5)
|
||||||
|
mariadb_ver=${mariadb1011_ver}
|
||||||
|
;;
|
||||||
|
6)
|
||||||
|
mariadb_ver=${mariadb105_ver}
|
||||||
|
;;
|
||||||
|
7)
|
||||||
|
mariadb_ver=${mariadb104_ver}
|
||||||
|
;;
|
||||||
|
8)
|
||||||
|
mariadb_ver=${mariadb55_ver}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == '1' ]; then
|
||||||
|
FILE_NAME=mariadb-${mariadb_ver}-linux-systemd-x86_64.tar.gz
|
||||||
|
FILE_TYPE=bintar-linux-systemd-x86_64
|
||||||
|
elif [ "${dbinstallmethod}" == '2' ]; then
|
||||||
|
FILE_NAME=mariadb-${mariadb_ver}.tar.gz
|
||||||
|
FILE_TYPE=source
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${OUTIP_STATE}"x == "China"x ]; then
|
||||||
|
DOWN_ADDR_MARIADB=https://mirrors.xtom.com.hk/mariadb/mariadb-${mariadb_ver}/${FILE_TYPE}
|
||||||
|
DOWN_ADDR_MARIADB_BK=http://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_ver}/${FILE_TYPE}
|
||||||
|
else
|
||||||
|
DOWN_ADDR_MARIADB=https://mirrors.xtom.com.hk/mariadb/mariadb-${mariadb_ver}/${FILE_TYPE}
|
||||||
|
DOWN_ADDR_MARIADB_BK=http://mirror.nodesdirect.com/mariadb/mariadb-${mariadb_ver}/${FILE_TYPE}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${db_option}" == '8' ]; then
|
||||||
|
DOWN_ADDR_MARIADB=https://archive.mariadb.org/mariadb-${mariadb_ver}/${FILE_TYPE}
|
||||||
|
DOWN_ADDR_MARIADB_BK=${DOWN_ADDR_MARIADB}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Download MariaDB ${FILE_NAME} package..."
|
||||||
|
src_url=${DOWN_ADDR_MARIADB}/${FILE_NAME} && Download_src
|
||||||
|
wget --tries=6 -c --no-check-certificate ${DOWN_ADDR_MARIADB}/md5sums.txt -O ${FILE_NAME}.md5
|
||||||
|
MARAIDB_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5)
|
||||||
|
[ -z "${MARAIDB_TAR_MD5}" ] && MARAIDB_TAR_MD5=$(curl -s ${DOWN_ADDR_MARIADB_BK}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}')
|
||||||
|
tryDlCount=0
|
||||||
|
while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ]; do
|
||||||
|
wget -c --no-check-certificate ${DOWN_ADDR_MARIADB_BK}/${FILE_NAME};sleep 1
|
||||||
|
let "tryDlCount++"
|
||||||
|
[ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue
|
||||||
|
done
|
||||||
|
if [ "${tryDlCount}" == '6' ]; then
|
||||||
|
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
9)
|
||||||
|
# Percona 8.0
|
||||||
|
if [ "${dbinstallmethod}" == '1' ]; then
|
||||||
|
echo "Download Percona 8.0 binary package..."
|
||||||
|
FILE_NAME=Percona-Server-${percona80_ver}-Linux.x86_64.glibc2.28.tar.gz
|
||||||
|
DOWN_ADDR_PERCONA=https://downloads.percona.com/downloads/Percona-Server-8.0/Percona-Server-${percona80_ver}/binary/tarball
|
||||||
|
elif [ "${dbinstallmethod}" == '2' ]; then
|
||||||
|
echo "Download Percona 8.0 source package..."
|
||||||
|
FILE_NAME=percona-server-${percona80_ver}.tar.gz
|
||||||
|
if [ "${OUTIP_STATE}"x == "China"x ]; then
|
||||||
|
DOWN_ADDR_PERCONA=${mirror_link}/oneinstack/src
|
||||||
|
else
|
||||||
|
DOWN_ADDR_PERCONA=https://downloads.percona.com/downloads/Percona-Server-8.0/Percona-Server-${percona80_ver}/source/tarball
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# start download
|
||||||
|
src_url=${DOWN_ADDR_PERCONA}/${FILE_NAME} && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/${FILE_NAME}.md5sum && Download_src
|
||||||
|
# verifying download
|
||||||
|
PERCONA_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5sum)
|
||||||
|
[ -z "${PERCONA_TAR_MD5}" ] && PERCONA_TAR_MD5=$(curl -s ${mirror_link}/oneinstack/src/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}')
|
||||||
|
tryDlCount=0
|
||||||
|
while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ]; do
|
||||||
|
wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME}; sleep 1
|
||||||
|
let "tryDlCount++"
|
||||||
|
[ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue
|
||||||
|
done
|
||||||
|
if [ "${tryDlCount}" == '6' ]; then
|
||||||
|
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
10)
|
||||||
|
# Precona 5.7
|
||||||
|
if [ "${dbinstallmethod}" == '1' ]; then
|
||||||
|
echo "Download Percona 5.7 binary package..."
|
||||||
|
FILE_NAME=Percona-Server-${percona57_ver}-Linux.x86_64.glibc2.17.tar.gz
|
||||||
|
DOWN_ADDR_PERCONA=https://downloads.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona57_ver}/binary/tarball
|
||||||
|
elif [ "${dbinstallmethod}" == '2' ]; then
|
||||||
|
echo "Download Percona 5.7 source package..."
|
||||||
|
FILE_NAME=percona-server-${percona57_ver}.tar.gz
|
||||||
|
if [ "${OUTIP_STATE}"x == "China"x ]; then
|
||||||
|
DOWN_ADDR_PERCONA=${mirror_link}/oneinstack/src
|
||||||
|
else
|
||||||
|
DOWN_ADDR_PERCONA=https://downloads.percona.com/downloads/Percona-Server-5.7/Percona-Server-${percona57_ver}/source/tarball
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# start download
|
||||||
|
src_url=${DOWN_ADDR_PERCONA}/${FILE_NAME} && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/${FILE_NAME}.md5sum && Download_src
|
||||||
|
# verifying download
|
||||||
|
PERCONA_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5sum)
|
||||||
|
[ -z "${PERCONA_TAR_MD5}" ] && PERCONA_TAR_MD5=$(curl -s ${mirror_link}/oneinstack/src/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}')
|
||||||
|
tryDlCount=0
|
||||||
|
while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ]; do
|
||||||
|
wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME}; sleep 1
|
||||||
|
let "tryDlCount++"
|
||||||
|
[ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue
|
||||||
|
done
|
||||||
|
if [ "${tryDlCount}" == '6' ]; then
|
||||||
|
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
11)
|
||||||
|
# Precona 5.6
|
||||||
|
if [ "${dbinstallmethod}" == '1' ]; then
|
||||||
|
echo "Download Percona 5.6 binary package..."
|
||||||
|
perconaVerStr1=$(echo ${percona56_ver} | sed "s@-@-rel@")
|
||||||
|
FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.x86_64.${sslLibVer}.tar.gz
|
||||||
|
DOWN_ADDR_PERCONA=https://downloads.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona56_ver}/binary/tarball
|
||||||
|
elif [ "${dbinstallmethod}" == '2' ]; then
|
||||||
|
echo "Download Percona 5.6 source package..."
|
||||||
|
FILE_NAME=percona-server-${percona56_ver}.tar.gz
|
||||||
|
if [ "${OUTIP_STATE}"x == "China"x ]; then
|
||||||
|
DOWN_ADDR_PERCONA=${mirror_link}/oneinstack/src
|
||||||
|
else
|
||||||
|
DOWN_ADDR_PERCONA=https://downloads.percona.com/downloads/Percona-Server-5.6/Percona-Server-${percona56_ver}/source/tarball
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# start download
|
||||||
|
src_url=${DOWN_ADDR_PERCONA}/${FILE_NAME} && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/${FILE_NAME}.md5sum && Download_src
|
||||||
|
# verifying download
|
||||||
|
PERCONA_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5sum)
|
||||||
|
[ -z "${PERCONA_TAR_MD5}" ] && PERCONA_TAR_MD5=$(curl -s ${mirror_link}/oneinstack/src/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}')
|
||||||
|
tryDlCount=0
|
||||||
|
while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ]; do
|
||||||
|
wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME}; sleep 1
|
||||||
|
let "tryDlCount++"
|
||||||
|
[ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue
|
||||||
|
done
|
||||||
|
if [ "${tryDlCount}" == '6' ]; then
|
||||||
|
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
12)
|
||||||
|
# Percona 5.5
|
||||||
|
if [ "${dbinstallmethod}" == '1' ]; then
|
||||||
|
echo "Download Percona 5.5 binary package..."
|
||||||
|
perconaVerStr1=$(echo ${percona55_ver} | sed "s@-@-rel@")
|
||||||
|
FILE_NAME=Percona-Server-${perconaVerStr1}-Linux.x86_64.${sslLibVer}.tar.gz
|
||||||
|
DOWN_ADDR_PERCONA=https://downloads.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona55_ver}/binary/tarball
|
||||||
|
elif [ "${dbinstallmethod}" == '2' ]; then
|
||||||
|
echo "Download Percona 5.5 source package..."
|
||||||
|
FILE_NAME=percona-server-${percona55_ver}.tar.gz
|
||||||
|
if [ "${OUTIP_STATE}"x == "China"x ]; then
|
||||||
|
DOWN_ADDR_PERCONA=${mirror_link}/oneinstack/src
|
||||||
|
else
|
||||||
|
DOWN_ADDR_PERCONA=https://downloads.percona.com/downloads/Percona-Server-5.5/Percona-Server-${percona55_ver}/source/tarball
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# start download
|
||||||
|
src_url=${DOWN_ADDR_PERCONA}/${FILE_NAME} && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/${FILE_NAME}.md5sum && Download_src
|
||||||
|
# verifying download
|
||||||
|
PERCONA_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5sum)
|
||||||
|
[ -z "${PERCONA_TAR_MD5}" ] && PERCONA_TAR_MD5=$(curl -s ${mirror_link}/oneinstack/src/${FILE_NAME}.md5sum | grep ${FILE_NAME} | awk '{print $1}')
|
||||||
|
tryDlCount=0
|
||||||
|
while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PERCONA_TAR_MD5}" ]; do
|
||||||
|
wget -c --no-check-certificate ${DOWN_ADDR_PERCONA}/${FILE_NAME}; sleep 1
|
||||||
|
let "tryDlCount++"
|
||||||
|
[ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PERCONA_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue
|
||||||
|
done
|
||||||
|
if [ "${tryDlCount}" == '6' ]; then
|
||||||
|
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
13)
|
||||||
|
FILE_NAME=postgresql-${pgsql_ver}.tar.gz
|
||||||
|
if [ "${OUTIP_STATE}"x == "China"x ]; then
|
||||||
|
DOWN_ADDR_PGSQL=https://mirrors.tuna.tsinghua.edu.cn/postgresql/source/v${pgsql_ver}
|
||||||
|
DOWN_ADDR_PGSQL_BK=https://mirrors.ustc.edu.cn/postgresql/source/v${pgsql_ver}
|
||||||
|
else
|
||||||
|
DOWN_ADDR_PGSQL=https://ftp.postgresql.org/pub/source/v${pgsql_ver}
|
||||||
|
DOWN_ADDR_PGSQL_BK=https://ftp.heanet.ie/mirrors/postgresql/source/v${pgsql_ver}
|
||||||
|
fi
|
||||||
|
src_url=${DOWN_ADDR_PGSQL}/${FILE_NAME} && Download_src
|
||||||
|
src_url=${DOWN_ADDR_PGSQL}/${FILE_NAME}.md5 && Download_src
|
||||||
|
PGSQL_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5)
|
||||||
|
[ -z "${PGSQL_TAR_MD5}" ] && PGSQL_TAR_MD5=$(curl -s ${DOWN_ADDR_PGSQL_BK}/${FILE_NAME}.md5 | grep ${FILE_NAME} | awk '{print $1}')
|
||||||
|
tryDlCount=0
|
||||||
|
while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${PGSQL_TAR_MD5}" ]; do
|
||||||
|
wget -c --no-check-certificate ${DOWN_ADDR_PGSQL_BK}/${FILE_NAME};sleep 1
|
||||||
|
let "tryDlCount++"
|
||||||
|
[ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${PGSQL_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue
|
||||||
|
done
|
||||||
|
if [ "${tryDlCount}" == '6' ]; then
|
||||||
|
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
14)
|
||||||
|
# MongoDB
|
||||||
|
echo "Download MongoDB binary package..."
|
||||||
|
FILE_NAME=mongodb-linux-x86_64-${mongodb_ver}.tgz
|
||||||
|
if [ "${OUTIP_STATE}"x == "China"x ]; then
|
||||||
|
DOWN_ADDR_MongoDB=${mirror_link}/oneinstack/src
|
||||||
|
else
|
||||||
|
DOWN_ADDR_MongoDB=https://fastdl.mongodb.org/linux
|
||||||
|
fi
|
||||||
|
src_url=${DOWN_ADDR_MongoDB}/${FILE_NAME} && Download_src
|
||||||
|
src_url=${DOWN_ADDR_MongoDB}/${FILE_NAME}.md5 && Download_src
|
||||||
|
MongoDB_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5)
|
||||||
|
[ -z "${MongoDB_TAR_MD5}" ] && MongoDB_TAR_MD5=$(curl -s ${DOWN_ADDR_MongoDB}/${FILE_NAME}.md5 | grep ${FILE_NAME} | awk '{print $1}')
|
||||||
|
tryDlCount=0
|
||||||
|
while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MongoDB_TAR_MD5}" ]; do
|
||||||
|
wget -c --no-check-certificate ${DOWN_ADDR_MongoDB}/${FILE_NAME};sleep 1
|
||||||
|
let "tryDlCount++"
|
||||||
|
[ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MongoDB_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue
|
||||||
|
done
|
||||||
|
if [ "${tryDlCount}" == '6' ]; then
|
||||||
|
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# PHP
|
||||||
|
if [[ "${php_option}" =~ ^[1-9]$|^1[0-3]$ ]] || [[ "${mphp_ver}" =~ ^5[3-6]$|^7[0-4]$|^8[0-3]$ ]]; then
|
||||||
|
echo "PHP common..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/libiconv-${libiconv_ver}.tar.gz && Download_src
|
||||||
|
src_url=https://curl.haxx.se/download/curl-${curl_ver}.tar.gz && Download_src
|
||||||
|
src_url=https://downloads.sourceforge.net/project/mhash/mhash/${mhash_ver}/mhash-${mhash_ver}.tar.gz && Download_src
|
||||||
|
src_url=https://downloads.sourceforge.net/project/mcrypt/Libmcrypt/${libmcrypt_ver}/libmcrypt-${libmcrypt_ver}.tar.gz && Download_src
|
||||||
|
src_url=https://downloads.sourceforge.net/project/mcrypt/MCrypt/${mcrypt_ver}/mcrypt-${mcrypt_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/freetype-${freetype_ver}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${php_option}" == '1' ] || [ "${mphp_ver}" == '53' ]; then
|
||||||
|
src_url=${mirror_link}/oneinstack/src/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/php5.3patch && Download_src
|
||||||
|
src_url=https://secure.php.net/distributions/php-${php53_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/fpm-race-condition.patch && Download_src
|
||||||
|
elif [ "${php_option}" == '2' ] || [ "${mphp_ver}" == '54' ]; then
|
||||||
|
src_url=https://secure.php.net/distributions/php-${php54_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/fpm-race-condition.patch && Download_src
|
||||||
|
elif [ "${php_option}" == '3' ] || [ "${mphp_ver}" == '55' ]; then
|
||||||
|
src_url=https://secure.php.net/distributions/php-${php55_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/fpm-race-condition.patch && Download_src
|
||||||
|
elif [ "${php_option}" == '4' ] || [ "${mphp_ver}" == '56' ]; then
|
||||||
|
src_url=https://secure.php.net/distributions/php-${php56_ver}.tar.gz && Download_src
|
||||||
|
elif [ "${php_option}" == '5' ] || [ "${mphp_ver}" == '70' ]; then
|
||||||
|
src_url=https://secure.php.net/distributions/php-${php70_ver}.tar.gz && Download_src
|
||||||
|
elif [ "${php_option}" == '6' ] || [ "${mphp_ver}" == '71' ]; then
|
||||||
|
src_url=https://secure.php.net/distributions/php-${php71_ver}.tar.gz && Download_src
|
||||||
|
elif [ "${php_option}" == '7' ] || [ "${mphp_ver}" == '72' ]; then
|
||||||
|
src_url=${mirror_link}/oneinstack/src/php-${php72_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/argon2-${argon2_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/libsodium-${libsodium_ver}.tar.gz && Download_src
|
||||||
|
elif [ "${php_option}" == '8' ] || [ "${mphp_ver}" == '73' ]; then
|
||||||
|
src_url=${mirror_link}/oneinstack/src/php-${php73_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/argon2-${argon2_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/libsodium-${libsodium_ver}.tar.gz && Download_src
|
||||||
|
elif [ "${php_option}" == '9' ] || [ "${mphp_ver}" == '74' ]; then
|
||||||
|
src_url=${mirror_link}/oneinstack/src/php-${php74_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/argon2-${argon2_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/libsodium-${libsodium_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/libzip-${libzip_ver}.tar.gz && Download_src
|
||||||
|
elif [ "${php_option}" == '10' ] || [ "${mphp_ver}" == '80' ]; then
|
||||||
|
src_url=${mirror_link}/oneinstack/src/php-${php80_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/argon2-${argon2_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/libsodium-${libsodium_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/libzip-${libzip_ver}.tar.gz && Download_src
|
||||||
|
elif [ "${php_option}" == '11' ] || [ "${mphp_ver}" == '81' ]; then
|
||||||
|
src_url=${mirror_link}/oneinstack/src/php-${php81_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/argon2-${argon2_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/libsodium-${libsodium_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/libzip-${libzip_ver}.tar.gz && Download_src
|
||||||
|
elif [ "${php_option}" == '12' ] || [ "${mphp_ver}" == '82' ]; then
|
||||||
|
src_url=${mirror_link}/oneinstack/src/php-${php82_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/argon2-${argon2_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/libsodium-${libsodium_up_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/libzip-${libzip_ver}.tar.gz && Download_src
|
||||||
|
elif [ "${php_option}" == '13' ] || [ "${mphp_ver}" == '83' ]; then
|
||||||
|
src_url=${mirror_link}/oneinstack/src/php-${php83_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/argon2-${argon2_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/libsodium-${libsodium_up_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/libzip-${libzip_ver}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# PHP OPCache
|
||||||
|
case "${phpcache_option}" in
|
||||||
|
1)
|
||||||
|
if [[ "${php_option}" =~ ^[1-2]$ ]]; then
|
||||||
|
# php 5.3 5.4
|
||||||
|
echo "Download Zend OPCache..."
|
||||||
|
src_url=https://pecl.php.net/get/zendopcache-${zendopcache_ver}.tgz && Download_src
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
echo "Download apcu..."
|
||||||
|
if [[ "${php_option}" =~ ^[1-4]$ ]]; then
|
||||||
|
src_url=https://pecl.php.net/get/apcu-${apcu_oldver}.tgz && Download_src
|
||||||
|
else
|
||||||
|
src_url=https://pecl.php.net/get/apcu-${apcu_ver}.tgz && Download_src
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
if [[ "${php_option}" =~ ^[1-4]$ ]]; then
|
||||||
|
# php 5.3 5.4 5.5 5.6
|
||||||
|
echo "Download xcache..."
|
||||||
|
src_url=http://xcache.lighttpd.net/pub/Releases/${xcache_ver}/xcache-${xcache_ver}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
# php 5.3 5.4
|
||||||
|
if [ "${php_option}" == '1' ]; then
|
||||||
|
echo "Download eaccelerator 0.9..."
|
||||||
|
src_url=https://github.com/downloads/eaccelerator/eaccelerator/eaccelerator-${eaccelerator_ver}.tar.bz2 && Download_src
|
||||||
|
elif [ "${php_option}" == '2' ]; then
|
||||||
|
echo "Download eaccelerator 1.0 dev..."
|
||||||
|
src_url=https://github.com/eaccelerator/eaccelerator/tarball/master && Download_src
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Zend Guard Loader
|
||||||
|
if [ "${pecl_zendguardloader}" == '1' -a "${armplatform}" != 'y' ]; then
|
||||||
|
case "${php_option}" in
|
||||||
|
4)
|
||||||
|
echo "Download zend loader for php 5.6..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/zend-loader-php5.6-linux-x86_64.tar.gz && Download_src
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
echo "Download zend loader for php 5.5..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/zend-loader-php5.5-linux-x86_64.tar.gz && Download_src
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
echo "Download zend loader for php 5.4..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz && Download_src
|
||||||
|
;;
|
||||||
|
1)
|
||||||
|
echo "Download zend loader for php 5.3..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz && Download_src
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ioncube
|
||||||
|
if [ "${pecl_ioncube}" == '1' ]; then
|
||||||
|
echo "Download ioncube..."
|
||||||
|
src_url=https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_${SYS_ARCH_i}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# SourceGuardian
|
||||||
|
if [ "${pecl_sourceguardian}" == '1' ]; then
|
||||||
|
echo "Download SourceGuardian..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/loaders.linux-${ARCH}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# imageMagick
|
||||||
|
if [ "${pecl_imagick}" == '1' ]; then
|
||||||
|
echo "Download ImageMagick..."
|
||||||
|
src_url=${mirror_link}/oneinstack/src/ImageMagick-${imagemagick_ver}.tar.gz && Download_src
|
||||||
|
echo "Download imagick..."
|
||||||
|
if [[ "${php_option}" =~ ^1$ ]]; then
|
||||||
|
src_url=https://pecl.php.net/get/imagick-${imagick_oldver}.tgz && Download_src
|
||||||
|
else
|
||||||
|
src_url=https://pecl.php.net/get/imagick-${imagick_ver}.tgz && Download_src
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# graphicsmagick
|
||||||
|
if [ "${pecl_gmagick}" == '1' ]; then
|
||||||
|
echo "Download graphicsmagick..."
|
||||||
|
src_url=https://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/${graphicsmagick_ver}/GraphicsMagick-${graphicsmagick_ver}.tar.gz && Download_src
|
||||||
|
if [[ "${php_option}" =~ ^[1-4]$ ]]; then
|
||||||
|
echo "Download gmagick for php..."
|
||||||
|
src_url=https://pecl.php.net/get/gmagick-${gmagick_oldver}.tgz && Download_src
|
||||||
|
else
|
||||||
|
echo "Download gmagick for php 7.x..."
|
||||||
|
src_url=https://pecl.php.net/get/gmagick-${gmagick_ver}.tgz && Download_src
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# redis-server
|
||||||
|
if [ "${redis_flag}" == 'y' ]; then
|
||||||
|
echo "Download redis-server..."
|
||||||
|
src_url=http://download.redis.io/releases/redis-${redis_ver}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pecl_redis
|
||||||
|
if [ "${pecl_redis}" == '1' ]; then
|
||||||
|
if [[ "${php_option}" =~ ^[1-4]$ ]]; then
|
||||||
|
echo "Download pecl_redis for php 5.x..."
|
||||||
|
src_url=https://pecl.php.net/get/redis-4.3.0.tgz && Download_src
|
||||||
|
elif [[ "${php_option}" =~ ^[5-6]$ ]]; then
|
||||||
|
echo "Download pecl_redis for php 7.0~7.1..."
|
||||||
|
src_url=https://pecl.php.net/get/redis-5.3.7.tgz && Download_src
|
||||||
|
else
|
||||||
|
echo "Download pecl_redis for php 7.2+..."
|
||||||
|
src_url=https://pecl.php.net/get/redis-${pecl_redis_ver}.tgz && Download_src
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# memcached-server
|
||||||
|
if [ "${memcached_flag}" == 'y' ]; then
|
||||||
|
echo "Download memcached-server..."
|
||||||
|
[ "${OUTIP_STATE}"x == "China"x ] && DOWN_ADDR=${mirror_link}/oneinstack/src || DOWN_ADDR=http://www.memcached.org/files
|
||||||
|
src_url=${DOWN_ADDR}/memcached-${memcached_ver}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pecl_memcached
|
||||||
|
if [ "${pecl_memcached}" == '1' ]; then
|
||||||
|
echo "Download libmemcached..."
|
||||||
|
src_url=https://launchpad.net/libmemcached/1.0/${libmemcached_ver}/+download/libmemcached-${libmemcached_ver}.tar.gz && Download_src
|
||||||
|
if [[ "${php_option}" =~ ^[1-4]$ ]]; then
|
||||||
|
echo "Download pecl_memcached for php..."
|
||||||
|
src_url=https://pecl.php.net/get/memcached-${pecl_memcached_oldver}.tgz && Download_src
|
||||||
|
else
|
||||||
|
echo "Download pecl_memcached for php 7.x..."
|
||||||
|
src_url=https://pecl.php.net/get/memcached-${pecl_memcached_ver}.tgz && Download_src
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# memcached-server pecl_memcached pecl_memcache
|
||||||
|
if [ "${pecl_memcache}" == '1' ]; then
|
||||||
|
if [[ "${php_option}" =~ ^[1-4]$ ]]; then
|
||||||
|
echo "Download pecl_memcache for php 5.x..."
|
||||||
|
src_url=https://pecl.php.net/get/memcache-3.0.8.tgz && Download_src
|
||||||
|
elif [[ "${php_option}" =~ ^[5-9]$ ]]; then
|
||||||
|
echo "Download pecl_memcache for php 7.x..."
|
||||||
|
src_url=https://pecl.php.net/get/memcache-${pecl_memcache_oldver}.tgz && Download_src
|
||||||
|
else
|
||||||
|
echo "Download pecl_memcache for php 8.x..."
|
||||||
|
src_url=https://pecl.php.net/get/memcache-${pecl_memcache_ver}.tgz && Download_src
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pecl_mongodb
|
||||||
|
if [ "${pecl_mongodb}" == '1' ]; then
|
||||||
|
echo "Download pecl mongo for php..."
|
||||||
|
src_url=https://pecl.php.net/get/mongo-${pecl_mongo_ver}.tgz && Download_src
|
||||||
|
echo "Download pecl mongodb for php..."
|
||||||
|
src_url=https://pecl.php.net/get/mongodb-${pecl_mongodb_ver}.tgz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# nodejs
|
||||||
|
if [ "${nodejs_flag}" == 'y' ]; then
|
||||||
|
echo "Download Nodejs..."
|
||||||
|
[ "${OUTIP_STATE}"x == "China"x ] && DOWN_ADDR_NODE=https://mirrors.tuna.tsinghua.edu.cn/nodejs-release || DOWN_ADDR_NODE=https://nodejs.org/dist
|
||||||
|
src_url=${DOWN_ADDR_NODE}/v${nodejs_ver}/node-v${nodejs_ver}-linux-${SYS_ARCH_n}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pureftpd
|
||||||
|
if [ "${pureftpd_flag}" == 'y' ]; then
|
||||||
|
echo "Download pureftpd..."
|
||||||
|
src_url=https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${pureftpd_ver}.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# phpMyAdmin
|
||||||
|
if [ "${phpmyadmin_flag}" == 'y' ]; then
|
||||||
|
echo "Download phpMyAdmin..."
|
||||||
|
if [[ "${php_option}" =~ ^[1-5]$ ]] || [[ "${mphp_ver}" =~ ^5[3-6]$|^70$ ]]; then
|
||||||
|
src_url=https://files.phpmyadmin.net/phpMyAdmin/${phpmyadmin_oldver}/phpMyAdmin-${phpmyadmin_oldver}-all-languages.tar.gz && Download_src
|
||||||
|
else
|
||||||
|
src_url=https://files.phpmyadmin.net/phpMyAdmin/${phpmyadmin_ver}/phpMyAdmin-${phpmyadmin_ver}-all-languages.tar.gz && Download_src
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
if [ -e "/etc/os-release" ]; then
|
||||||
|
. /etc/os-release
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}/etc/os-release does not exist! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get OS Version
|
||||||
|
Platform=${ID,,}
|
||||||
|
VERSION_MAIN_ID=${VERSION_ID%%.*}
|
||||||
|
ARCH=$(arch)
|
||||||
|
if [[ "${Platform}" =~ ^centos$|^rhel$|^almalinux$|^rocky$|^fedora$|^amzn$|^ol$|^alinux$|^anolis$|^tencentos$|^opencloudos$|^euleros$|^openeuler$|^kylin$|^uos$|^kylinsecos$ ]]; then
|
||||||
|
PM=yum
|
||||||
|
Family=rhel
|
||||||
|
RHEL_ver=${VERSION_MAIN_ID}
|
||||||
|
if [[ "${Platform}" =~ ^centos$ ]]; then
|
||||||
|
if [ "${VERSION_MAIN_ID}" == '6' ]; then
|
||||||
|
sed -i "s@centos/\$releasever@centos-vault/6.10@g" /etc/yum.repos.d/CentOS-Base.repo
|
||||||
|
sed -i 's@centos/RPM-GPG@centos-vault/RPM-GPG@g' /etc/yum.repos.d/CentOS-Base.repo
|
||||||
|
[ -e /etc/yum.repos.d/epel.repo ] && rm -f /etc/yum.repos.d/epel.repo
|
||||||
|
fi
|
||||||
|
elif [[ "${Platform}" =~ ^fedora$ ]]; then
|
||||||
|
Fedora_ver=${VERSION_MAIN_ID}
|
||||||
|
[ ${VERSION_MAIN_ID} -ge 19 ] && [ ${VERSION_MAIN_ID} -lt 28 ] && RHEL_ver=7
|
||||||
|
[ ${VERSION_MAIN_ID} -ge 28 ] && [ ${VERSION_MAIN_ID} -lt 34 ] && RHEL_ver=8
|
||||||
|
[ ${VERSION_MAIN_ID} -ge 34 ] && RHEL_ver=9
|
||||||
|
elif [[ "${Platform}" =~ ^amzn$|^alinux$|^tencentos$|^euleros$ ]]; then
|
||||||
|
[[ "${VERSION_MAIN_ID}" =~ ^2$ ]] && RHEL_ver=7
|
||||||
|
[[ "${VERSION_MAIN_ID}" =~ ^3$ ]] && RHEL_ver=8
|
||||||
|
elif [[ "${Platform}" =~ ^openeuler$ ]]; then
|
||||||
|
[[ "${RHEL_ver}" =~ ^20$ ]] && RHEL_ver=7
|
||||||
|
[[ "${RHEL_ver}" =~ ^2[1,2]$ ]] && RHEL_ver=8
|
||||||
|
elif [[ "${Platform}" =~ ^kylin$ ]]; then
|
||||||
|
[[ "${RHEL_ver}" =~ ^V10$ ]] && RHEL_ver=7
|
||||||
|
elif [[ "${Platform}" =~ ^uos$ ]]; then
|
||||||
|
[[ "${RHEL_ver}" =~ ^20$ ]] && RHEL_ver=8
|
||||||
|
elif [[ "${Platform}" =~ ^kylinsecos$ ]]; then
|
||||||
|
[[ "${VERSION_ID}" =~ ^3.4 ]] && RHEL_ver=7
|
||||||
|
[[ "${VERSION_ID}" =~ ^3.5 ]] && RHEL_ver=8
|
||||||
|
fi
|
||||||
|
elif [[ "${Platform}" =~ ^debian$|^deepin$|^kali$ ]]; then
|
||||||
|
PM=apt-get
|
||||||
|
Family=debian
|
||||||
|
Debian_ver=${VERSION_MAIN_ID}
|
||||||
|
if [[ "${Platform}" =~ ^deepin$ ]]; then
|
||||||
|
[[ "${Debian_ver}" =~ ^20$ ]] && Debian_ver=10
|
||||||
|
[[ "${Debian_ver}" =~ ^23$ ]] && Debian_ver=11
|
||||||
|
elif [[ "${Platform}" =~ ^kali$ ]]; then
|
||||||
|
[[ "${Debian_ver}" =~ ^202 ]] && Debian_ver=10
|
||||||
|
fi
|
||||||
|
elif [[ "${Platform}" =~ ^ubuntu$|^linuxmint$|^elementary$ ]]; then
|
||||||
|
PM=apt-get
|
||||||
|
Family=ubuntu
|
||||||
|
Ubuntu_ver=${VERSION_MAIN_ID}
|
||||||
|
if [[ "${Platform}" =~ ^linuxmint$ ]]; then
|
||||||
|
[[ "${VERSION_MAIN_ID}" =~ ^18$ ]] && Ubuntu_ver=16
|
||||||
|
[[ "${VERSION_MAIN_ID}" =~ ^19$ ]] && Ubuntu_ver=18
|
||||||
|
[[ "${VERSION_MAIN_ID}" =~ ^20$ ]] && Ubuntu_ver=20
|
||||||
|
[[ "${VERSION_MAIN_ID}" =~ ^21$ ]] && Ubuntu_ver=22
|
||||||
|
elif [[ "${Platform}" =~ ^elementary$ ]]; then
|
||||||
|
[[ "${VERSION_MAIN_ID}" =~ ^5$ ]] && Ubuntu_ver=18
|
||||||
|
[[ "${VERSION_MAIN_ID}" =~ ^6$ ]] && Ubuntu_ver=20
|
||||||
|
[[ "${VERSION_MAIN_ID}" =~ ^7$ ]] && Ubuntu_ver=22
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}Does not support this OS ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check OS Version
|
||||||
|
if [ ${RHEL_ver} -lt 7 >/dev/null 2>&1 ] || [ ${Debian_ver} -lt 9 >/dev/null 2>&1 ] || [ ${Ubuntu_ver} -lt 16 >/dev/null 2>&1 ]; then
|
||||||
|
echo "${CFAILURE}Does not support this OS, Please install CentOS 7+,Debian 9+,Ubuntu 16+ ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
command -v gcc > /dev/null 2>&1 || $PM -y install gcc
|
||||||
|
gcc_ver=$(gcc -dumpversion | awk -F. '{print $1}')
|
||||||
|
|
||||||
|
[ ${gcc_ver} -lt 5 >/dev/null 2>&1 ] && redis_ver=${redis_oldver}
|
||||||
|
|
||||||
|
if uname -m | grep -Eqi "arm|aarch64"; then
|
||||||
|
armplatform="y"
|
||||||
|
if uname -m | grep -Eqi "armv7"; then
|
||||||
|
TARGET_ARCH="armv7"
|
||||||
|
elif uname -m | grep -Eqi "armv8"; then
|
||||||
|
TARGET_ARCH="arm64"
|
||||||
|
elif uname -m | grep -Eqi "aarch64"; then
|
||||||
|
TARGET_ARCH="aarch64"
|
||||||
|
else
|
||||||
|
TARGET_ARCH="unknown"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(uname -r | awk -F- '{print $3}' 2>/dev/null)" == "Microsoft" ]; then
|
||||||
|
Wsl=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(getconf WORD_BIT)" == "32" ] && [ "$(getconf LONG_BIT)" == "64" ]; then
|
||||||
|
if [ "${TARGET_ARCH}" == 'aarch64' ]; then
|
||||||
|
SYS_ARCH=arm64
|
||||||
|
SYS_ARCH_i=aarch64
|
||||||
|
SYS_ARCH_n=arm64
|
||||||
|
else
|
||||||
|
SYS_ARCH=amd64 #openjdk
|
||||||
|
SYS_ARCH_i=x86-64 #ioncube
|
||||||
|
SYS_ARCH_n=x64 #nodejs
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${CWARNING}32-bit OS are not supported! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l)
|
||||||
|
|
||||||
|
# Percona binary: https://docs.percona.com/percona-server/5.7/installation/binary-tarball.html
|
||||||
|
if [ ${Debian_ver} -lt 9 >/dev/null 2>&1 ]; then
|
||||||
|
sslLibVer=ssl100
|
||||||
|
elif [ "${RHEL_ver}" == '7' ] && [ "${Platform}" != 'fedora' ]; then
|
||||||
|
sslLibVer=ssl101
|
||||||
|
elif [ ${Debian_ver} -ge 9 >/dev/null 2>&1 ] || [ ${Ubuntu_ver} -ge 16 >/dev/null 2>&1 ]; then
|
||||||
|
sslLibVer=ssl102
|
||||||
|
elif [ ${Fedora_ver} -ge 27 >/dev/null 2>&1 ]; then
|
||||||
|
sslLibVer=ssl102
|
||||||
|
elif [ "${RHEL_ver}" == '8' ]; then
|
||||||
|
sslLibVer=ssl1:111
|
||||||
|
else
|
||||||
|
sslLibVer=unknown
|
||||||
|
fi
|
||||||
@@ -0,0 +1,162 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: Alpha Eva <kaneawk AT gmail.com>
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
installDepsDebian() {
|
||||||
|
echo "${CMSG}Removing the conflicting packages...${CEND}"
|
||||||
|
if [ "${apache_flag}" == 'y' ]; then
|
||||||
|
killall apache2
|
||||||
|
pkgList="apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker php5 php5-common php5-cgi php5-cli php5-mysql php5-curl php5-gd"
|
||||||
|
for Package in ${pkgList};do
|
||||||
|
apt-get -y purge ${Package}
|
||||||
|
done
|
||||||
|
dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]]; then
|
||||||
|
pkgList="mysql-client mysql-server mysql-common mysql-server-core-5.5 mysql-client-5.5 mariadb-client mariadb-server mariadb-common"
|
||||||
|
for Package in ${pkgList};do
|
||||||
|
apt-get -y purge ${Package}
|
||||||
|
done
|
||||||
|
dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${CMSG}Installing dependencies packages...${CEND}"
|
||||||
|
apt-get -y update
|
||||||
|
apt-get -y autoremove
|
||||||
|
apt-get -yf install
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# critical security updates
|
||||||
|
grep security /etc/apt/sources.list > /tmp/security.sources.list
|
||||||
|
apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list
|
||||||
|
|
||||||
|
# Install needed packages
|
||||||
|
case "${Debian_ver}" in
|
||||||
|
9|10|11|12)
|
||||||
|
pkgList="debian-keyring debian-archive-keyring build-essential gcc g++ make cmake autoconf libjpeg62-turbo-dev libjpeg-dev libpng-dev libgd-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libc-client2007e-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3-gnutls libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl net-tools libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales patch vim zip unzip tmux htop bc dc expect libexpat1-dev libonig-dev libtirpc-dev rsync git lsof lrzsz rsyslog cron logrotate chrony libsqlite3-dev psmisc wget sysv-rc apt-transport-https ca-certificates software-properties-common gnupg ufw"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "${CFAILURE}Your system Debian ${Debian_ver} are not supported!${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
for Package in ${pkgList}; do
|
||||||
|
apt-get --no-install-recommends -y install ${Package}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
installDepsRHEL() {
|
||||||
|
[ -e '/etc/yum.conf' ] && sed -i 's@^exclude@#exclude@' /etc/yum.conf
|
||||||
|
if [ "${RHEL_ver}" == '9' ]; then
|
||||||
|
if [[ "${Platform}" =~ "rhel" ]]; then
|
||||||
|
subscription-manager repos --enable codeready-builder-for-rhel-9-${ARCH}-rpms
|
||||||
|
dnf -y install chrony oniguruma-devel rpcgen
|
||||||
|
elif [[ "${Platform}" =~ "ol" ]]; then
|
||||||
|
dnf config-manager --set-enabled ol9_codeready_builder
|
||||||
|
dnf -y install chrony oniguruma-devel rpcgen
|
||||||
|
else
|
||||||
|
dnf -y --enablerepo=crb install chrony oniguruma-devel rpcgen
|
||||||
|
fi
|
||||||
|
systemctl enable chronyd
|
||||||
|
elif [ "${RHEL_ver}" == '8' ]; then
|
||||||
|
if [[ "${Platform}" =~ "rhel" ]]; then
|
||||||
|
subscription-manager repos --enable codeready-builder-for-rhel-8-${ARCH}-rpms
|
||||||
|
dnf -y install chrony oniguruma-devel rpcgen
|
||||||
|
elif [[ "${Platform}" =~ "ol" ]]; then
|
||||||
|
dnf config-manager --set-enabled ol8_codeready_builder
|
||||||
|
dnf -y install chrony oniguruma-devel rpcgen
|
||||||
|
else
|
||||||
|
[ -z "`grep -w epel /etc/yum.repos.d/*.repo`" ] && yum -y install epel-release
|
||||||
|
if grep -qw "^\[PowerTools\]" /etc/yum.repos.d/*.repo; then
|
||||||
|
dnf -y --enablerepo=PowerTools install chrony oniguruma-devel rpcgen
|
||||||
|
elif grep -qw "^\[powertools\]" /etc/yum.repos.d/*.repo; then
|
||||||
|
dnf -y --enablerepo=powertools install chrony oniguruma-devel rpcgen
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
systemctl enable chronyd
|
||||||
|
elif [ "${RHEL_ver}" == '7' ]; then
|
||||||
|
[ -z "`grep -w epel /etc/yum.repos.d/*.repo`" ] && yum -y install epel-release
|
||||||
|
yum -y groupremove "Basic Web Server" "MySQL Database server" "MySQL Database client"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${RHEL_ver}" == '9' ]; then
|
||||||
|
[ ! -e "/usr/lib64/libtinfo.so.5" ] && ln -s /usr/lib64/libtinfo.so.6 /usr/lib64/libtinfo.so.5
|
||||||
|
[ ! -e "/usr/lib64/libncurses.so.5" ] && ln -s /usr/lib64/libncurses.so.6 /usr/lib64/libncurses.so.5
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${CMSG}Installing dependencies packages...${CEND}"
|
||||||
|
# Install needed packages
|
||||||
|
pkgList="perl-FindBin deltarpm drpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libjpeg-turbo libjpeg-turbo-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel libzip libzip-devel glibc glibc-devel krb5-devel libc-client libc-client-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel ncurses-compat-libs libaio numactl numactl-libs readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel net-tools libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel libmcrypt libmcrypt-devel mhash mhash-devel mcrypt zip unzip chrony oniguruma-devel rpcgen sqlite-devel sysstat patch bc expect expat-devel perl-devel oniguruma oniguruma-devel libtirpc-devel nss libnsl rsync rsyslog git lsof lrzsz psmisc wget which libatomic tmux chkconfig firewalld"
|
||||||
|
for Package in ${pkgList}; do
|
||||||
|
yum -y install ${Package}
|
||||||
|
done
|
||||||
|
[ ${RHEL_ver} -lt 8 >/dev/null 2>&1 ] && yum -y install cmake3
|
||||||
|
|
||||||
|
yum -y update bash openssl glibc
|
||||||
|
}
|
||||||
|
|
||||||
|
installDepsUbuntu() {
|
||||||
|
# Uninstall the conflicting software
|
||||||
|
echo "${CMSG}Removing the conflicting packages...${CEND}"
|
||||||
|
if [ "${apache_flag}" == 'y' ]; then
|
||||||
|
killall apache2
|
||||||
|
pkgList="apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker php5 php5-common php5-cgi php5-cli php5-mysql php5-curl php5-gd"
|
||||||
|
for Package in ${pkgList};do
|
||||||
|
apt-get -y purge ${Package}
|
||||||
|
done
|
||||||
|
dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]]; then
|
||||||
|
pkgList="mysql-client mysql-server mysql-common mysql-server-core-5.5 mysql-client-5.5 mariadb-client mariadb-server mariadb-common"
|
||||||
|
for Package in ${pkgList};do
|
||||||
|
apt-get -y purge ${Package}
|
||||||
|
done
|
||||||
|
dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg -P
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${CMSG}Installing dependencies packages...${CEND}"
|
||||||
|
apt-get -y update
|
||||||
|
apt-get -y autoremove
|
||||||
|
apt-get -yf install
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
[[ "${Ubuntu_ver}" =~ ^22$ ]] && apt-get -y --allow-downgrades install libicu70=70.1-2 libglib2.0-0=2.72.1-1 libxml2-dev
|
||||||
|
|
||||||
|
# critical security updates
|
||||||
|
grep security /etc/apt/sources.list > /tmp/security.sources.list
|
||||||
|
apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list
|
||||||
|
|
||||||
|
# Install needed packages
|
||||||
|
pkgList="libperl-dev debian-keyring debian-archive-keyring build-essential gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng-dev libpng12-0 libpng12-dev libpng3 libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libc-client2007e-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3-gnutls libcurl4-gnutls-dev libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl net-tools libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev libsqlite3-dev libcloog-ppl1 bison patch vim zip unzip tmux htop bc dc expect libexpat1-dev rsyslog libonig-dev libtirpc-dev libnss3 rsync git lsof lrzsz chrony psmisc wget sysv-rc apt-transport-https ca-certificates software-properties-common gnupg ufw"
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
for Package in ${pkgList}; do
|
||||||
|
apt-get --no-install-recommends -y install ${Package}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
installDepsBySrc() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if ! command -v icu-config > /dev/null 2>&1 || icu-config --version | grep '^3.' || [ "${Ubuntu_ver}" == "20" ]; then
|
||||||
|
tar xzf icu4c-${icu4c_ver}-src.tgz
|
||||||
|
pushd icu/source > /dev/null
|
||||||
|
./configure --prefix=/usr/local
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf icu
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v lsof >/dev/null 2>&1; then
|
||||||
|
echo 'already initialize' > ~/.oneinstack
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}${PM} config error parsing file failed${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
echo=echo
|
||||||
|
for cmd in echo /bin/echo; do
|
||||||
|
$cmd >/dev/null 2>&1 || continue
|
||||||
|
if ! $cmd -e "" | grep -qE '^-e'; then
|
||||||
|
echo=$cmd
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
CSI=$($echo -e "\033[")
|
||||||
|
CEND="${CSI}0m"
|
||||||
|
CDGREEN="${CSI}32m"
|
||||||
|
CRED="${CSI}1;31m"
|
||||||
|
CGREEN="${CSI}1;32m"
|
||||||
|
CYELLOW="${CSI}1;33m"
|
||||||
|
CBLUE="${CSI}1;34m"
|
||||||
|
CMAGENTA="${CSI}1;35m"
|
||||||
|
CCYAN="${CSI}1;36m"
|
||||||
|
CSUCCESS="$CDGREEN"
|
||||||
|
CFAILURE="$CRED"
|
||||||
|
CQUESTION="$CMAGENTA"
|
||||||
|
CWARNING="$CYELLOW"
|
||||||
|
CMSG="$CCYAN"
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_composer() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
if [ -e "/usr/local/bin/composer" ]; then
|
||||||
|
echo "${CWARNING}PHP Composer already installed! ${CEND}"
|
||||||
|
else
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ "${OUTIP_STATE}"x == "China"x ]; then
|
||||||
|
wget --no-check-certificate -c https://mirrors.aliyun.com/composer/composer.phar -O /usr/local/bin/composer > /dev/null 2>&1
|
||||||
|
${php_install_dir}/bin/php /usr/local/bin/composer config -g repo.packagist composer https://packagist.phpcomposer.com
|
||||||
|
else
|
||||||
|
wget --no-check-certificate -c https://getcomposer.org/composer.phar -O /usr/local/bin/composer > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
chmod +x /usr/local/bin/composer
|
||||||
|
if [ -e "/usr/local/bin/composer" ]; then
|
||||||
|
echo; echo "${CSUCCESS}PHP Composer installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CFAILURE}PHP Composer install failed, Please try again! ${CEND}"
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_composer() {
|
||||||
|
if [ -e "/usr/local/bin/composer" ]; then
|
||||||
|
rm -f /usr/local/bin/composer
|
||||||
|
echo; echo "${CMSG}Composer uninstall completed${CEND}";
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}Composer does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
DEMO() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ ! -e ${wwwroot_dir}/default/index.html ]; then
|
||||||
|
[ "${OUTIP_STATE}"x == "China"x ] && /bin/cp ${oneinstack_dir}/config/index_cn.html ${wwwroot_dir}/default/index.html || /bin/cp ${oneinstack_dir}/config/index.html ${wwwroot_dir}/default
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "${php_install_dir}/bin/php" ]; then
|
||||||
|
src_url=${mirror_link}/oneinstack/src/xprober.php && Download_src
|
||||||
|
/bin/cp xprober.php ${wwwroot_dir}/default
|
||||||
|
|
||||||
|
echo "<?php phpinfo() ?>" > ${wwwroot_dir}/default/phpinfo.php
|
||||||
|
case "${phpcache_option}" in
|
||||||
|
1)
|
||||||
|
src_url=${mirror_link}/oneinstack/src/ocp.php && Download_src
|
||||||
|
/bin/cp ocp.php ${wwwroot_dir}/default
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
sed -i 's@<a href="/ocp.php" target="_blank" class="links">Opcache</a>@<a href="/apc.php" target="_blank" class="links">APC</a>@' ${wwwroot_dir}/default/index.html
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
sed -i 's@<a href="/ocp.php" target="_blank" class="links">Opcache</a>@<a href="/xcache" target="_blank" class="links">xcache</a>@' ${wwwroot_dir}/default/index.html
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
/bin/cp eaccelerator-*/control.php ${wwwroot_dir}/default
|
||||||
|
sed -i 's@<a href="/ocp.php" target="_blank" class="links">Opcache</a>@<a href="/control.php" target="_blank" class="links">eAccelerator</a>@' ${wwwroot_dir}/default/index.html
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
sed -i 's@<a href="/ocp.php" target="_blank" class="links">Opcache</a>@@' ${wwwroot_dir}/default/index.html
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
chown -R ${run_user}:${run_group} ${wwwroot_dir}/default
|
||||||
|
[ -e /bin/systemctl ] && systemctl daemon-reload
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Download_src() {
|
||||||
|
[ -s "${src_url##*/}" ] && echo "[${CMSG}${src_url##*/}${CEND}] found" || { wget --limit-rate=100M --tries=6 -c --no-check-certificate ${src_url}; sleep 1; }
|
||||||
|
if [ ! -e "${src_url##*/}" ]; then
|
||||||
|
echo "${CFAILURE}Auto download failed! You can manually download ${src_url} into the oneinstack/src directory.${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_eAccelerator() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
PHP_main_ver=${PHP_detail_ver%.*}
|
||||||
|
phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
|
||||||
|
if [[ "${PHP_main_ver}" =~ ^5.[3-4]$ ]]; then
|
||||||
|
if [ "${PHP_main_ver}" == '5.3' ]; then
|
||||||
|
tar jxf eaccelerator-${eaccelerator_ver}.tar.bz2
|
||||||
|
pushd eaccelerator-${eaccelerator_ver} > /dev/null
|
||||||
|
elif [ "${PHP_main_ver}" == '5.4' ]; then
|
||||||
|
/bin/mv master eaccelerator-eaccelerator-42067ac.tar.gz
|
||||||
|
tar xzf eaccelerator-eaccelerator-42067ac.tar.gz
|
||||||
|
pushd eaccelerator-eaccelerator-42067ac > /dev/null
|
||||||
|
fi
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --enable-eaccelerator=shared --with-php-config=${php_install_dir}/bin/php-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/eaccelerator.so" ]; then
|
||||||
|
mkdir /var/eaccelerator_cache;chown -R ${run_user}:${run_group} /var/eaccelerator_cache
|
||||||
|
cat > ${php_install_dir}/etc/php.d/02-eaccelerator.ini << EOF
|
||||||
|
[eaccelerator]
|
||||||
|
zend_extension=${phpExtensionDir}/eaccelerator.so
|
||||||
|
eaccelerator.shm_size=64
|
||||||
|
eaccelerator.cache_dir=/var/eaccelerator_cache
|
||||||
|
eaccelerator.enable=1
|
||||||
|
eaccelerator.optimizer=1
|
||||||
|
eaccelerator.check_mtime=1
|
||||||
|
eaccelerator.debug=0
|
||||||
|
eaccelerator.filter=
|
||||||
|
eaccelerator.shm_max=0
|
||||||
|
eaccelerator.shm_ttl=0
|
||||||
|
eaccelerator.shm_prune_period=0
|
||||||
|
eaccelerator.shm_only=0
|
||||||
|
eaccelerator.compress=0
|
||||||
|
eaccelerator.compress_level=9
|
||||||
|
eaccelerator.keys=disk_only
|
||||||
|
eaccelerator.sessions=disk_only
|
||||||
|
eaccelerator.content=disk_only
|
||||||
|
EOF
|
||||||
|
[ -z "$(grep 'kernel.shmmax = 67108864' /etc/sysctl.conf)" ] && echo "kernel.shmmax = 67108864" >> /etc/sysctl.conf
|
||||||
|
sysctl -p
|
||||||
|
echo "${CSUCCESS}PHP eaccelerator module installed successfully! ${CEND}"
|
||||||
|
rm -rf eaccelerator-${eaccelerator_ver} eaccelerator-eaccelerator-42067ac
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP eaccelerator module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}Your php ${PHP_detail_ver} does not support eAccelerator! ${CEND}";
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_eAccelerator() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/02-eaccelerator.ini" ]; then
|
||||||
|
rm -rf ${php_install_dir}/etc/php.d/02-eaccelerator.ini /var/eaccelerator_cache
|
||||||
|
echo; echo "${CMSG}PHP eaccelerator module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP eaccelerator module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_fail2ban() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
src_url=${mirror_link}/oneinstack/src/fail2ban-${fail2ban_ver}.tar.gz && Download_src
|
||||||
|
tar xzf fail2ban-${fail2ban_ver}.tar.gz
|
||||||
|
pushd fail2ban-${fail2ban_ver} > /dev/null
|
||||||
|
if command -v python3 > /dev/null 2>&1; then
|
||||||
|
python3 setup.py install
|
||||||
|
else
|
||||||
|
python setup.py install
|
||||||
|
fi
|
||||||
|
/bin/cp build/fail2ban.service /lib/systemd/system/
|
||||||
|
systemctl enable fail2ban
|
||||||
|
[ -z "`grep ^Port /etc/ssh/sshd_config`" ] && now_ssh_port=22 || now_ssh_port=`grep ^Port /etc/ssh/sshd_config | awk '{print $2}' | head -1`
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
cat > /etc/fail2ban/jail.local << EOF
|
||||||
|
[DEFAULT]
|
||||||
|
ignoreip = 127.0.0.1/8
|
||||||
|
bantime = 86400
|
||||||
|
findtime = 600
|
||||||
|
maxretry = 5
|
||||||
|
backend = auto
|
||||||
|
banaction = firewallcmd-ipset
|
||||||
|
action = %(action_mwl)s
|
||||||
|
|
||||||
|
[sshd]
|
||||||
|
enabled = true
|
||||||
|
filter = sshd
|
||||||
|
port = ${now_ssh_port}
|
||||||
|
action = %(action_mwl)s
|
||||||
|
logpath = /var/log/secure
|
||||||
|
bantime = 86400
|
||||||
|
findtime = 600
|
||||||
|
maxretry = 5
|
||||||
|
EOF
|
||||||
|
elif [ "${PM}" == 'apt-get' ]; then
|
||||||
|
if ufw status | grep -wq inactive; then
|
||||||
|
ufw default allow incoming
|
||||||
|
ufw --force enable
|
||||||
|
fi
|
||||||
|
cat > /etc/fail2ban/jail.local << EOF
|
||||||
|
[DEFAULT]
|
||||||
|
ignoreip = 127.0.0.1/8
|
||||||
|
bantime = 86400
|
||||||
|
findtime = 600
|
||||||
|
maxretry = 5
|
||||||
|
backend = auto
|
||||||
|
banaction = ufw
|
||||||
|
action = %(action_mwl)s
|
||||||
|
|
||||||
|
[sshd]
|
||||||
|
enabled = true
|
||||||
|
filter = sshd
|
||||||
|
port = ${now_ssh_port}
|
||||||
|
action = %(action_mwl)s
|
||||||
|
logpath = /var/log/auth.log
|
||||||
|
bantime = 86400
|
||||||
|
findtime = 600
|
||||||
|
maxretry = 5
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
cat > /etc/logrotate.d/fail2ban << EOF
|
||||||
|
/var/log/fail2ban.log {
|
||||||
|
missingok
|
||||||
|
notifempty
|
||||||
|
postrotate
|
||||||
|
/usr/local/bin/fail2ban-client flushlogs >/dev/null || true
|
||||||
|
endscript
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
kill -9 `ps -ef | grep fail2ban | grep -v grep | awk '{print $2}'` > /dev/null 2>&1
|
||||||
|
systemctl start fail2ban
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -e "/usr/local/bin/fail2ban-server" ]; then
|
||||||
|
echo; echo "${CSUCCESS}fail2ban installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CFAILURE}fail2ban install failed, Please try again! ${CEND}"
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_fail2ban() {
|
||||||
|
systemctl stop fail2ban
|
||||||
|
systemctl disable fail2ban
|
||||||
|
rm -rf /usr/local/bin/fail2ban* /etc/init.d/fail2ban /etc/fail2ban /etc/logrotate.d/fail2ban /var/log/fail2ban.* /var/run/fail2ban /lib/systemd/system/fail2ban.service
|
||||||
|
echo; echo "${CMSG}fail2ban uninstall completed${CEND}";
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
get_char() {
|
||||||
|
SAVEDSTTY=`stty -g`
|
||||||
|
stty -echo
|
||||||
|
stty cbreak
|
||||||
|
dd if=/dev/tty bs=1 count=1 2> /dev/null
|
||||||
|
stty -raw
|
||||||
|
stty echo
|
||||||
|
stty $SAVEDSTTY
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
# Custom profile
|
||||||
|
cat > /etc/profile.d/oneinstack.sh << EOF
|
||||||
|
HISTSIZE=10000
|
||||||
|
PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '
|
||||||
|
HISTTIMEFORMAT="%F %T \$(whoami) "
|
||||||
|
|
||||||
|
alias l='ls -AFhlt --color=auto'
|
||||||
|
alias lh='l | head'
|
||||||
|
alias ll='ls -l --color=auto'
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
alias vi=vim
|
||||||
|
|
||||||
|
GREP_OPTIONS="--color=auto"
|
||||||
|
alias grep='grep --color'
|
||||||
|
alias egrep='egrep --color'
|
||||||
|
alias fgrep='fgrep --color'
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i 's@^"syntax on@syntax on@' /etc/vim/vimrc
|
||||||
|
|
||||||
|
# history
|
||||||
|
[ -z "$(grep history-timestamp ~/.bashrc)" ] && echo "PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc
|
||||||
|
|
||||||
|
# /etc/security/limits.conf
|
||||||
|
[ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf
|
||||||
|
[ -z "$(grep 'session required pam_limits.so' /etc/pam.d/common-session)" ] && echo "session required pam_limits.so" >> /etc/pam.d/common-session
|
||||||
|
sed -i '/^# End of file/,$d' /etc/security/limits.conf
|
||||||
|
cat >> /etc/security/limits.conf <<EOF
|
||||||
|
# End of file
|
||||||
|
* soft nproc 1000000
|
||||||
|
* hard nproc 1000000
|
||||||
|
* soft nofile 1000000
|
||||||
|
* hard nofile 1000000
|
||||||
|
root soft nproc 1000000
|
||||||
|
root hard nproc 1000000
|
||||||
|
root soft nofile 1000000
|
||||||
|
root hard nofile 1000000
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# /etc/hosts
|
||||||
|
[ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@127.0.0.1.*localhost@&\n127.0.0.1 $(hostname)@g" /etc/hosts
|
||||||
|
|
||||||
|
# Set timezone
|
||||||
|
rm -rf /etc/localtime
|
||||||
|
ln -s /usr/share/zoneinfo/${timezone} /etc/localtime
|
||||||
|
|
||||||
|
# Set DNS
|
||||||
|
#cat > /etc/resolv.conf << EOF
|
||||||
|
#nameserver 114.114.114.114
|
||||||
|
#nameserver 8.8.8.8
|
||||||
|
#EOF
|
||||||
|
|
||||||
|
# /etc/sysctl.conf
|
||||||
|
[ -z "$(grep 'fs.file-max' /etc/sysctl.conf)" ] && cat >> /etc/sysctl.conf << EOF
|
||||||
|
fs.file-max = 1000000
|
||||||
|
fs.inotify.max_user_instances = 8192
|
||||||
|
net.ipv4.tcp_syncookies = 1
|
||||||
|
net.ipv4.tcp_fin_timeout = 30
|
||||||
|
net.ipv4.tcp_tw_reuse = 1
|
||||||
|
net.ipv4.ip_local_port_range = 1024 65000
|
||||||
|
net.ipv4.tcp_max_syn_backlog = 16384
|
||||||
|
net.ipv4.tcp_max_tw_buckets = 6000
|
||||||
|
net.ipv4.route.gc_timeout = 100
|
||||||
|
net.ipv4.tcp_syn_retries = 1
|
||||||
|
net.ipv4.tcp_synack_retries = 1
|
||||||
|
net.core.somaxconn = 32768
|
||||||
|
net.core.netdev_max_backlog = 32768
|
||||||
|
net.ipv4.tcp_timestamps = 0
|
||||||
|
net.ipv4.tcp_max_orphans = 32768
|
||||||
|
EOF
|
||||||
|
sysctl -p
|
||||||
|
|
||||||
|
sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES="/dev/tty[1-2]"@' /etc/default/console-setup
|
||||||
|
sed -i 's@^# en_US.UTF-8@en_US.UTF-8@' /etc/locale.gen
|
||||||
|
init q
|
||||||
|
|
||||||
|
# ufw
|
||||||
|
if [ "${firewall_flag}" == 'y' ]; then
|
||||||
|
ufw allow 22/tcp
|
||||||
|
[ "${ssh_port}" != "22" ] && ufw allow ${ssh_port}/tcp
|
||||||
|
ufw allow 80/tcp
|
||||||
|
ufw allow 443/tcp
|
||||||
|
ufw --force enable
|
||||||
|
else
|
||||||
|
ufw --force disable
|
||||||
|
fi
|
||||||
|
systemctl restart rsyslog ssh
|
||||||
|
|
||||||
|
. /etc/profile
|
||||||
|
. ~/.bashrc
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
# Close SELINUX
|
||||||
|
setenforce 0
|
||||||
|
sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config
|
||||||
|
|
||||||
|
# Custom profile
|
||||||
|
cat > /etc/profile.d/oneinstack.sh << EOF
|
||||||
|
HISTSIZE=10000
|
||||||
|
PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\\\$ "
|
||||||
|
HISTTIMEFORMAT="%F %T \$(whoami) "
|
||||||
|
|
||||||
|
alias l='ls -AFhlt'
|
||||||
|
alias lh='l | head'
|
||||||
|
alias vi=vim
|
||||||
|
|
||||||
|
GREP_OPTIONS="--color=auto"
|
||||||
|
alias grep='grep --color'
|
||||||
|
alias egrep='egrep --color'
|
||||||
|
alias fgrep='fgrep --color'
|
||||||
|
EOF
|
||||||
|
[[ "${Platform}" =~ ^euleros$|^openeuler$ ]] && sed -i '/HISTTIMEFORMAT=/d' /etc/profile.d/oneinstack.sh
|
||||||
|
|
||||||
|
[[ ! "${Platform}" =~ ^euleros$|^openeuler$ ]] && [ -z "$(grep ^'PROMPT_COMMAND=' /etc/bashrc)" ] && cat >> /etc/bashrc << EOF
|
||||||
|
PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });logger "[euid=\$(whoami)]":\$(who am i):[\`pwd\`]"\$msg"; }'
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# /etc/security/limits.conf
|
||||||
|
[ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf
|
||||||
|
sed -i '/^# End of file/,$d' /etc/security/limits.conf
|
||||||
|
cat >> /etc/security/limits.conf <<EOF
|
||||||
|
# End of file
|
||||||
|
* soft nproc 1000000
|
||||||
|
* hard nproc 1000000
|
||||||
|
* soft nofile 1000000
|
||||||
|
* hard nofile 1000000
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# /etc/hosts
|
||||||
|
[ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@127.0.0.1.*localhost@&\n127.0.0.1 $(hostname)@g" /etc/hosts
|
||||||
|
|
||||||
|
# Set timezone
|
||||||
|
rm -rf /etc/localtime
|
||||||
|
ln -s /usr/share/zoneinfo/${timezone} /etc/localtime
|
||||||
|
|
||||||
|
# ip_conntrack table full dropping packets
|
||||||
|
echo -e "modprobe nf_conntrack\nmodprobe nf_conntrack_ipv4" > /etc/sysconfig/modules/nf_conntrack.modules
|
||||||
|
chmod +x /etc/sysconfig/modules/nf_conntrack.modules
|
||||||
|
modprobe nf_conntrack
|
||||||
|
modprobe nf_conntrack_ipv4
|
||||||
|
echo options nf_conntrack hashsize=131072 > /etc/modprobe.d/nf_conntrack.conf
|
||||||
|
|
||||||
|
# /etc/sysctl.conf
|
||||||
|
[ ! -e "/etc/sysctl.conf_bk" ] && /bin/mv /etc/sysctl.conf{,_bk}
|
||||||
|
cat > /etc/sysctl.conf << EOF
|
||||||
|
fs.file-max=1000000
|
||||||
|
net.ipv4.tcp_max_tw_buckets = 6000
|
||||||
|
net.ipv4.tcp_sack = 1
|
||||||
|
net.ipv4.tcp_window_scaling = 1
|
||||||
|
net.ipv4.tcp_rmem = 4096 87380 4194304
|
||||||
|
net.ipv4.tcp_wmem = 4096 16384 4194304
|
||||||
|
net.ipv4.tcp_max_syn_backlog = 16384
|
||||||
|
net.core.netdev_max_backlog = 32768
|
||||||
|
net.core.somaxconn = 32768
|
||||||
|
net.core.wmem_default = 8388608
|
||||||
|
net.core.rmem_default = 8388608
|
||||||
|
net.core.rmem_max = 16777216
|
||||||
|
net.core.wmem_max = 16777216
|
||||||
|
net.ipv4.tcp_timestamps = 0
|
||||||
|
net.ipv4.tcp_fin_timeout = 20
|
||||||
|
net.ipv4.tcp_synack_retries = 2
|
||||||
|
net.ipv4.tcp_syn_retries = 2
|
||||||
|
net.ipv4.tcp_syncookies = 1
|
||||||
|
#net.ipv4.tcp_tw_len = 1
|
||||||
|
net.ipv4.tcp_tw_reuse = 1
|
||||||
|
net.ipv4.tcp_mem = 94500000 915000000 927000000
|
||||||
|
net.ipv4.tcp_max_orphans = 3276800
|
||||||
|
net.ipv4.ip_local_port_range = 1024 65000
|
||||||
|
net.nf_conntrack_max = 6553500
|
||||||
|
net.netfilter.nf_conntrack_max = 6553500
|
||||||
|
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60
|
||||||
|
net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120
|
||||||
|
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120
|
||||||
|
net.netfilter.nf_conntrack_tcp_timeout_established = 3600
|
||||||
|
EOF
|
||||||
|
sysctl -p
|
||||||
|
|
||||||
|
if [ ${RHEL_ver} -ge 7 >/dev/null 2>&1 ]; then
|
||||||
|
sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/locale.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# firewall
|
||||||
|
if [ "${firewall_flag}" == 'y' ]; then
|
||||||
|
systemctl enable firewalld
|
||||||
|
systemctl start firewalld
|
||||||
|
firewall-cmd --permanent --zone=public --add-port={22/tcp,80/tcp,443/tcp}
|
||||||
|
[ "${ssh_port}" != "22" ] && firewall-cmd --permanent --zone=public --add-port=${ssh_port}/tcp
|
||||||
|
firewall-cmd --reload
|
||||||
|
else
|
||||||
|
systemctl stop firewalld
|
||||||
|
systemctl disable firewalld
|
||||||
|
fi
|
||||||
|
systemctl restart rsyslog sshd
|
||||||
|
|
||||||
|
. /etc/profile
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
# Custom profile
|
||||||
|
cat > /etc/profile.d/oneinstack.sh << EOF
|
||||||
|
HISTSIZE=10000
|
||||||
|
HISTTIMEFORMAT="%F %T \$(whoami) "
|
||||||
|
|
||||||
|
alias l='ls -AFhlt --color=auto'
|
||||||
|
alias lh='l | head'
|
||||||
|
alias ll='ls -l --color=auto'
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
alias vi=vim
|
||||||
|
|
||||||
|
GREP_OPTIONS="--color=auto"
|
||||||
|
alias grep='grep --color'
|
||||||
|
alias egrep='egrep --color'
|
||||||
|
alias fgrep='fgrep --color'
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i 's@^"syntax on@syntax on@' /etc/vim/vimrc
|
||||||
|
|
||||||
|
# PS1
|
||||||
|
[ -z "$(grep ^PS1 ~/.bashrc)" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc
|
||||||
|
|
||||||
|
# history
|
||||||
|
[ -z "$(grep history-timestamp ~/.bashrc)" ] && echo "PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc
|
||||||
|
|
||||||
|
# /etc/security/limits.conf
|
||||||
|
[ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf
|
||||||
|
[ -z "$(grep 'session required pam_limits.so' /etc/pam.d/common-session)" ] && echo "session required pam_limits.so" >> /etc/pam.d/common-session
|
||||||
|
sed -i '/^# End of file/,$d' /etc/security/limits.conf
|
||||||
|
cat >> /etc/security/limits.conf <<EOF
|
||||||
|
# End of file
|
||||||
|
* soft nproc 1000000
|
||||||
|
* hard nproc 1000000
|
||||||
|
* soft nofile 1000000
|
||||||
|
* hard nofile 1000000
|
||||||
|
root soft nproc 1000000
|
||||||
|
root hard nproc 1000000
|
||||||
|
root soft nofile 1000000
|
||||||
|
root hard nofile 1000000
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# /etc/hosts
|
||||||
|
[ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@127.0.0.1.*localhost@&\n127.0.0.1 $(hostname)@g" /etc/hosts
|
||||||
|
|
||||||
|
# Set timezone
|
||||||
|
rm -rf /etc/localtime
|
||||||
|
ln -s /usr/share/zoneinfo/${timezone} /etc/localtime
|
||||||
|
|
||||||
|
# /etc/sysctl.conf
|
||||||
|
[ -z "$(grep 'fs.file-max' /etc/sysctl.conf)" ] && cat >> /etc/sysctl.conf << EOF
|
||||||
|
fs.file-max = 1000000
|
||||||
|
fs.inotify.max_user_instances = 8192
|
||||||
|
net.ipv4.tcp_syncookies = 1
|
||||||
|
net.ipv4.tcp_fin_timeout = 30
|
||||||
|
net.ipv4.tcp_tw_reuse = 1
|
||||||
|
net.ipv4.ip_local_port_range = 1024 65000
|
||||||
|
net.ipv4.tcp_max_syn_backlog = 16384
|
||||||
|
net.ipv4.tcp_max_tw_buckets = 6000
|
||||||
|
net.ipv4.route.gc_timeout = 100
|
||||||
|
net.ipv4.tcp_syn_retries = 1
|
||||||
|
net.ipv4.tcp_synack_retries = 1
|
||||||
|
net.core.somaxconn = 32768
|
||||||
|
net.core.netdev_max_backlog = 32768
|
||||||
|
net.ipv4.tcp_timestamps = 0
|
||||||
|
net.ipv4.tcp_max_orphans = 32768
|
||||||
|
EOF
|
||||||
|
sysctl -p
|
||||||
|
|
||||||
|
sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES="/dev/tty[1-2]"@' /etc/default/console-setup
|
||||||
|
locale-gen en_US.UTF-8
|
||||||
|
[ -d "/var/lib/locales/supported.d" ] && echo "en_US.UTF-8 UTF-8" > /var/lib/locales/supported.d/local
|
||||||
|
cat > /etc/default/locale << EOF
|
||||||
|
LANG=en_US.UTF-8
|
||||||
|
LANGUAGE=en_US:en
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# ufw
|
||||||
|
if [ "${firewall_flag}" == 'y' ]; then
|
||||||
|
ufw allow 22/tcp
|
||||||
|
[ "${ssh_port}" != "22" ] && ufw allow ${ssh_port}/tcp
|
||||||
|
ufw allow 80/tcp
|
||||||
|
ufw allow 443/tcp
|
||||||
|
ufw --force enable
|
||||||
|
else
|
||||||
|
ufw --force disable
|
||||||
|
fi
|
||||||
|
systemctl restart rsyslog ssh
|
||||||
|
|
||||||
|
. /etc/profile
|
||||||
|
. ~/.bashrc
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_ionCube() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
PHP_detail_ver=`${php_install_dir}/bin/php-config --version`
|
||||||
|
PHP_main_ver=${PHP_detail_ver%.*}
|
||||||
|
phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
|
||||||
|
[ ! -d "${phpExtensionDir}" ] && mkdir -p ${phpExtensionDir}
|
||||||
|
[ -e "ioncube_loaders_lin_${SYS_ARCH_i}.tar.gz" ] && tar xzf ioncube_loaders_lin_${SYS_ARCH_i}.tar.gz
|
||||||
|
if [ -z "`echo ${phpExtensionDir} | grep 'non-zts'`" ]; then
|
||||||
|
/bin/mv ioncube/ioncube_loader_lin_${PHP_main_ver}_ts.so ${phpExtensionDir}
|
||||||
|
zend_extension="${phpExtensionDir}/ioncube_loader_lin_${PHP_main_ver}_ts.so"
|
||||||
|
else
|
||||||
|
/bin/mv ioncube/ioncube_loader_lin_${PHP_main_ver}.so ${phpExtensionDir}
|
||||||
|
zend_extension="${phpExtensionDir}/ioncube_loader_lin_${PHP_main_ver}.so"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "${zend_extension}" ]; then
|
||||||
|
echo "zend_extension=${zend_extension}" > ${php_install_dir}/etc/php.d/00-ioncube.ini
|
||||||
|
echo "${CSUCCESS}PHP ionCube module installed successfully! ${CEND}"
|
||||||
|
rm -rf ioncube
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_ionCube() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/00-ioncube.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/00-ioncube.ini
|
||||||
|
echo; echo "${CMSG}PHP ionCube module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP ionCube module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_Jemalloc() {
|
||||||
|
if [ ! -e "/usr/local/lib/libjemalloc.so" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
tar xjf jemalloc-${jemalloc_ver}.tar.bz2
|
||||||
|
pushd jemalloc-${jemalloc_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "/usr/local/lib/libjemalloc.so" ]; then
|
||||||
|
if [ "${Family}" == 'rhel' ]; then
|
||||||
|
ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib64/libjemalloc.so.1
|
||||||
|
else
|
||||||
|
ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib/libjemalloc.so.1
|
||||||
|
fi
|
||||||
|
[ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
|
||||||
|
ldconfig
|
||||||
|
echo "${CSUCCESS}jemalloc module installed successfully! ${CEND}"
|
||||||
|
rm -rf jemalloc-${jemalloc_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}jemalloc install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,215 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_MariaDB1011() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mysql >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
|
||||||
|
|
||||||
|
[ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir}
|
||||||
|
mkdir -p ${mariadb_data_dir};chown mysql:mysql -R ${mariadb_data_dir}
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
tar zxf mariadb-${mariadb1011_ver}-linux-systemd-x86_64.tar.gz
|
||||||
|
mv mariadb-${mariadb1011_ver}-linux-systemd-x86_64/* ${mariadb_install_dir}
|
||||||
|
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe
|
||||||
|
sed -i "s@/usr/local/mysql@${mariadb_install_dir}@g" ${mariadb_install_dir}/bin/mysqld_safe
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
boostVersion2=$(echo ${boost_oldver} | awk -F. '{print $1"_"$2"_"$3}')
|
||||||
|
tar xzf boost_${boostVersion2}.tar.gz
|
||||||
|
tar xzf mariadb-${mariadb1011_ver}.tar.gz
|
||||||
|
pushd mariadb-${mariadb1011_ver}
|
||||||
|
cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install_dir} \
|
||||||
|
-DMYSQL_DATADIR=${mariadb_data_dir} \
|
||||||
|
-DDOWNLOAD_BOOST=1 \
|
||||||
|
-DWITH_BOOST=../boost_${boostVersion2} \
|
||||||
|
-DSYSCONFDIR=/etc \
|
||||||
|
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_EMBEDDED_SERVER=1 \
|
||||||
|
-DENABLE_DTRACE=0 \
|
||||||
|
-DENABLED_LOCAL_INFILE=1 \
|
||||||
|
-DDEFAULT_CHARSET=utf8mb4 \
|
||||||
|
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||||
|
-DEXTRA_CHARSETS=all \
|
||||||
|
-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'
|
||||||
|
make -j ${THREAD}
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "${mariadb_install_dir}/support-files" ]; then
|
||||||
|
sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}MariaDB installed successfully! ${CEND}"
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
rm -rf mariadb-${mariadb1011_ver}-linux-systemd-x86_64
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
rm -rf mariadb-${mariadb1011_ver} boost_${boostVersion2}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -rf ${mariadb_install_dir}
|
||||||
|
echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/cp ${mariadb_install_dir}/support-files/mysql.server /etc/init.d/mysqld
|
||||||
|
sed -i "s@^basedir=.*@basedir=${mariadb_install_dir}@" /etc/init.d/mysqld
|
||||||
|
sed -i "s@^datadir=.*@datadir=${mariadb_data_dir}@" /etc/init.d/mysqld
|
||||||
|
chmod +x /etc/init.d/mysqld
|
||||||
|
[ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; }
|
||||||
|
[ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults
|
||||||
|
popd
|
||||||
|
|
||||||
|
# my.cnf
|
||||||
|
cat > /etc/my.cnf << EOF
|
||||||
|
[client]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
default-character-set = utf8mb4
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
basedir = ${mariadb_install_dir}
|
||||||
|
datadir = ${mariadb_data_dir}
|
||||||
|
pid-file = ${mariadb_data_dir}/mysql.pid
|
||||||
|
user = mysql
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
server-id = 1
|
||||||
|
|
||||||
|
init-connect = 'SET NAMES utf8mb4'
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
|
||||||
|
skip-name-resolve
|
||||||
|
#skip-networking
|
||||||
|
back_log = 300
|
||||||
|
|
||||||
|
max_connections = 1000
|
||||||
|
max_connect_errors = 6000
|
||||||
|
open_files_limit = 65535
|
||||||
|
table_open_cache = 128
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
binlog_cache_size = 1M
|
||||||
|
max_heap_table_size = 8M
|
||||||
|
tmp_table_size = 16M
|
||||||
|
|
||||||
|
read_buffer_size = 2M
|
||||||
|
read_rnd_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
join_buffer_size = 8M
|
||||||
|
key_buffer_size = 4M
|
||||||
|
|
||||||
|
thread_cache_size = 8
|
||||||
|
|
||||||
|
query_cache_type = 1
|
||||||
|
query_cache_size = 8M
|
||||||
|
query_cache_limit = 2M
|
||||||
|
|
||||||
|
ft_min_word_len = 4
|
||||||
|
|
||||||
|
log_bin = mysql-bin
|
||||||
|
binlog_format = mixed
|
||||||
|
expire_logs_days = 7
|
||||||
|
|
||||||
|
log_error = ${mariadb_data_dir}/mysql-error.log
|
||||||
|
slow_query_log = 1
|
||||||
|
long_query_time = 1
|
||||||
|
slow_query_log_file = ${mariadb_data_dir}/mysql-slow.log
|
||||||
|
|
||||||
|
performance_schema = 0
|
||||||
|
|
||||||
|
#lower_case_table_names = 1
|
||||||
|
|
||||||
|
skip-external-locking
|
||||||
|
|
||||||
|
default_storage_engine = InnoDB
|
||||||
|
innodb_file_per_table = 1
|
||||||
|
innodb_open_files = 500
|
||||||
|
innodb_buffer_pool_size = 64M
|
||||||
|
innodb_write_io_threads = 4
|
||||||
|
innodb_read_io_threads = 4
|
||||||
|
innodb_purge_threads = 1
|
||||||
|
innodb_flush_log_at_trx_commit = 2
|
||||||
|
innodb_log_buffer_size = 2M
|
||||||
|
innodb_log_file_size = 32M
|
||||||
|
innodb_max_dirty_pages_pct = 90
|
||||||
|
innodb_lock_wait_timeout = 120
|
||||||
|
|
||||||
|
bulk_insert_buffer_size = 8M
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
myisam_max_sort_file_size = 10G
|
||||||
|
|
||||||
|
interactive_timeout = 28800
|
||||||
|
wait_timeout = 28800
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
read_buffer = 4M
|
||||||
|
write_buffer = 4M
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
|
||||||
|
if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
|
${mariadb_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mariadb_install_dir} --datadir=${mariadb_data_dir}
|
||||||
|
|
||||||
|
[ "${Wsl}" == true ] && chmod 600 /etc/my.cnf
|
||||||
|
chown mysql:mysql -R ${mariadb_data_dir}
|
||||||
|
[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
|
||||||
|
service mysqld start
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mariadb_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mariadb_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mariadb_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='' and User not like 'mariadb.%';"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
|
||||||
|
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
|
||||||
|
echo "${mariadb_install_dir}/lib" > /etc/ld.so.conf.d/z-mariadb.conf
|
||||||
|
ldconfig
|
||||||
|
service mysqld stop
|
||||||
|
}
|
||||||
@@ -0,0 +1,217 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_MariaDB104() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mysql >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
|
||||||
|
|
||||||
|
[ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir}
|
||||||
|
mkdir -p ${mariadb_data_dir};chown mysql:mysql -R ${mariadb_data_dir}
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
tar zxf mariadb-${mariadb104_ver}-linux-systemd-x86_64.tar.gz
|
||||||
|
mv mariadb-${mariadb104_ver}-linux-systemd-x86_64/* ${mariadb_install_dir}
|
||||||
|
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe
|
||||||
|
sed -i "s@/usr/local/mysql@${mariadb_install_dir}@g" ${mariadb_install_dir}/bin/mysqld_safe
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
boostVersion2=$(echo ${boost_oldver} | awk -F. '{print $1"_"$2"_"$3}')
|
||||||
|
tar xzf boost_${boostVersion2}.tar.gz
|
||||||
|
tar xzf mariadb-${mariadb104_ver}.tar.gz
|
||||||
|
pushd mariadb-${mariadb104_ver}
|
||||||
|
cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install_dir} \
|
||||||
|
-DMYSQL_DATADIR=${mariadb_data_dir} \
|
||||||
|
-DDOWNLOAD_BOOST=1 \
|
||||||
|
-DWITH_BOOST=../boost_${boostVersion2} \
|
||||||
|
-DSYSCONFDIR=/etc \
|
||||||
|
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_EMBEDDED_SERVER=1 \
|
||||||
|
-DENABLE_DTRACE=0 \
|
||||||
|
-DENABLED_LOCAL_INFILE=1 \
|
||||||
|
-DDEFAULT_CHARSET=utf8mb4 \
|
||||||
|
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||||
|
-DEXTRA_CHARSETS=all \
|
||||||
|
-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'
|
||||||
|
make -j ${THREAD}
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "${mariadb_install_dir}/support-files" ]; then
|
||||||
|
sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}MariaDB installed successfully! ${CEND}"
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
rm -rf mariadb-${mariadb104_ver}-linux-systemd-x86_64
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
rm -rf mariadb-${mariadb104_ver} boost_${boostVersion2}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -rf ${mariadb_install_dir}
|
||||||
|
echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/cp ${mariadb_install_dir}/support-files/mysql.server /etc/init.d/mysqld
|
||||||
|
sed -i "s@^basedir=.*@basedir=${mariadb_install_dir}@" /etc/init.d/mysqld
|
||||||
|
sed -i "s@^datadir=.*@datadir=${mariadb_data_dir}@" /etc/init.d/mysqld
|
||||||
|
chmod +x /etc/init.d/mysqld
|
||||||
|
[ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; }
|
||||||
|
[ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults
|
||||||
|
popd
|
||||||
|
|
||||||
|
# my.cnf
|
||||||
|
cat > /etc/my.cnf << EOF
|
||||||
|
[client]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
default-character-set = utf8mb4
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
basedir = ${mariadb_install_dir}
|
||||||
|
datadir = ${mariadb_data_dir}
|
||||||
|
pid-file = ${mariadb_data_dir}/mysql.pid
|
||||||
|
user = mysql
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
server-id = 1
|
||||||
|
|
||||||
|
init-connect = 'SET NAMES utf8mb4'
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
|
||||||
|
skip-name-resolve
|
||||||
|
#skip-networking
|
||||||
|
back_log = 300
|
||||||
|
|
||||||
|
max_connections = 1000
|
||||||
|
max_connect_errors = 6000
|
||||||
|
open_files_limit = 65535
|
||||||
|
table_open_cache = 128
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
binlog_cache_size = 1M
|
||||||
|
max_heap_table_size = 8M
|
||||||
|
tmp_table_size = 16M
|
||||||
|
|
||||||
|
read_buffer_size = 2M
|
||||||
|
read_rnd_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
join_buffer_size = 8M
|
||||||
|
key_buffer_size = 4M
|
||||||
|
|
||||||
|
thread_cache_size = 8
|
||||||
|
|
||||||
|
query_cache_type = 1
|
||||||
|
query_cache_size = 8M
|
||||||
|
query_cache_limit = 2M
|
||||||
|
|
||||||
|
ft_min_word_len = 4
|
||||||
|
|
||||||
|
log_bin = mysql-bin
|
||||||
|
binlog_format = mixed
|
||||||
|
expire_logs_days = 7
|
||||||
|
|
||||||
|
log_error = ${mariadb_data_dir}/mysql-error.log
|
||||||
|
slow_query_log = 1
|
||||||
|
long_query_time = 1
|
||||||
|
slow_query_log_file = ${mariadb_data_dir}/mysql-slow.log
|
||||||
|
|
||||||
|
performance_schema = 0
|
||||||
|
|
||||||
|
#lower_case_table_names = 1
|
||||||
|
|
||||||
|
skip-external-locking
|
||||||
|
|
||||||
|
default_storage_engine = InnoDB
|
||||||
|
innodb_file_per_table = 1
|
||||||
|
innodb_open_files = 500
|
||||||
|
innodb_buffer_pool_size = 64M
|
||||||
|
innodb_write_io_threads = 4
|
||||||
|
innodb_read_io_threads = 4
|
||||||
|
innodb_thread_concurrency = 0
|
||||||
|
innodb_purge_threads = 1
|
||||||
|
innodb_flush_log_at_trx_commit = 2
|
||||||
|
innodb_log_buffer_size = 2M
|
||||||
|
innodb_log_file_size = 32M
|
||||||
|
innodb_log_files_in_group = 3
|
||||||
|
innodb_max_dirty_pages_pct = 90
|
||||||
|
innodb_lock_wait_timeout = 120
|
||||||
|
|
||||||
|
bulk_insert_buffer_size = 8M
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
myisam_max_sort_file_size = 10G
|
||||||
|
|
||||||
|
interactive_timeout = 28800
|
||||||
|
wait_timeout = 28800
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
read_buffer = 4M
|
||||||
|
write_buffer = 4M
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
|
||||||
|
if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
|
${mariadb_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mariadb_install_dir} --datadir=${mariadb_data_dir}
|
||||||
|
|
||||||
|
[ "${Wsl}" == true ] && chmod 600 /etc/my.cnf
|
||||||
|
chown mysql:mysql -R ${mariadb_data_dir}
|
||||||
|
[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
|
||||||
|
service mysqld start
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mariadb_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mariadb_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mariadb_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='' and User not like 'mariadb.%';"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
|
||||||
|
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
|
||||||
|
echo "${mariadb_install_dir}/lib" > /etc/ld.so.conf.d/z-mariadb.conf
|
||||||
|
ldconfig
|
||||||
|
service mysqld stop
|
||||||
|
}
|
||||||
@@ -0,0 +1,215 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_MariaDB105() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mysql >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
|
||||||
|
|
||||||
|
[ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir}
|
||||||
|
mkdir -p ${mariadb_data_dir};chown mysql:mysql -R ${mariadb_data_dir}
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
tar zxf mariadb-${mariadb105_ver}-linux-systemd-x86_64.tar.gz
|
||||||
|
mv mariadb-${mariadb105_ver}-linux-systemd-x86_64/* ${mariadb_install_dir}
|
||||||
|
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe
|
||||||
|
sed -i "s@/usr/local/mysql@${mariadb_install_dir}@g" ${mariadb_install_dir}/bin/mysqld_safe
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
boostVersion2=$(echo ${boost_oldver} | awk -F. '{print $1"_"$2"_"$3}')
|
||||||
|
tar xzf boost_${boostVersion2}.tar.gz
|
||||||
|
tar xzf mariadb-${mariadb105_ver}.tar.gz
|
||||||
|
pushd mariadb-${mariadb105_ver}
|
||||||
|
cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install_dir} \
|
||||||
|
-DMYSQL_DATADIR=${mariadb_data_dir} \
|
||||||
|
-DDOWNLOAD_BOOST=1 \
|
||||||
|
-DWITH_BOOST=../boost_${boostVersion2} \
|
||||||
|
-DSYSCONFDIR=/etc \
|
||||||
|
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_EMBEDDED_SERVER=1 \
|
||||||
|
-DENABLE_DTRACE=0 \
|
||||||
|
-DENABLED_LOCAL_INFILE=1 \
|
||||||
|
-DDEFAULT_CHARSET=utf8mb4 \
|
||||||
|
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||||
|
-DEXTRA_CHARSETS=all \
|
||||||
|
-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'
|
||||||
|
make -j ${THREAD}
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "${mariadb_install_dir}/support-files" ]; then
|
||||||
|
sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}MariaDB installed successfully! ${CEND}"
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
rm -rf mariadb-${mariadb105_ver}-linux-systemd-x86_64
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
rm -rf mariadb-${mariadb105_ver} boost_${boostVersion2}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -rf ${mariadb_install_dir}
|
||||||
|
echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/cp ${mariadb_install_dir}/support-files/mysql.server /etc/init.d/mysqld
|
||||||
|
sed -i "s@^basedir=.*@basedir=${mariadb_install_dir}@" /etc/init.d/mysqld
|
||||||
|
sed -i "s@^datadir=.*@datadir=${mariadb_data_dir}@" /etc/init.d/mysqld
|
||||||
|
chmod +x /etc/init.d/mysqld
|
||||||
|
[ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; }
|
||||||
|
[ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults
|
||||||
|
popd
|
||||||
|
|
||||||
|
# my.cnf
|
||||||
|
cat > /etc/my.cnf << EOF
|
||||||
|
[client]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
default-character-set = utf8mb4
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
basedir = ${mariadb_install_dir}
|
||||||
|
datadir = ${mariadb_data_dir}
|
||||||
|
pid-file = ${mariadb_data_dir}/mysql.pid
|
||||||
|
user = mysql
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
server-id = 1
|
||||||
|
|
||||||
|
init-connect = 'SET NAMES utf8mb4'
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
|
||||||
|
skip-name-resolve
|
||||||
|
#skip-networking
|
||||||
|
back_log = 300
|
||||||
|
|
||||||
|
max_connections = 1000
|
||||||
|
max_connect_errors = 6000
|
||||||
|
open_files_limit = 65535
|
||||||
|
table_open_cache = 128
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
binlog_cache_size = 1M
|
||||||
|
max_heap_table_size = 8M
|
||||||
|
tmp_table_size = 16M
|
||||||
|
|
||||||
|
read_buffer_size = 2M
|
||||||
|
read_rnd_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
join_buffer_size = 8M
|
||||||
|
key_buffer_size = 4M
|
||||||
|
|
||||||
|
thread_cache_size = 8
|
||||||
|
|
||||||
|
query_cache_type = 1
|
||||||
|
query_cache_size = 8M
|
||||||
|
query_cache_limit = 2M
|
||||||
|
|
||||||
|
ft_min_word_len = 4
|
||||||
|
|
||||||
|
log_bin = mysql-bin
|
||||||
|
binlog_format = mixed
|
||||||
|
expire_logs_days = 7
|
||||||
|
|
||||||
|
log_error = ${mariadb_data_dir}/mysql-error.log
|
||||||
|
slow_query_log = 1
|
||||||
|
long_query_time = 1
|
||||||
|
slow_query_log_file = ${mariadb_data_dir}/mysql-slow.log
|
||||||
|
|
||||||
|
performance_schema = 0
|
||||||
|
|
||||||
|
#lower_case_table_names = 1
|
||||||
|
|
||||||
|
skip-external-locking
|
||||||
|
|
||||||
|
default_storage_engine = InnoDB
|
||||||
|
innodb_file_per_table = 1
|
||||||
|
innodb_open_files = 500
|
||||||
|
innodb_buffer_pool_size = 64M
|
||||||
|
innodb_write_io_threads = 4
|
||||||
|
innodb_read_io_threads = 4
|
||||||
|
innodb_purge_threads = 1
|
||||||
|
innodb_flush_log_at_trx_commit = 2
|
||||||
|
innodb_log_buffer_size = 2M
|
||||||
|
innodb_log_file_size = 32M
|
||||||
|
innodb_max_dirty_pages_pct = 90
|
||||||
|
innodb_lock_wait_timeout = 120
|
||||||
|
|
||||||
|
bulk_insert_buffer_size = 8M
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
myisam_max_sort_file_size = 10G
|
||||||
|
|
||||||
|
interactive_timeout = 28800
|
||||||
|
wait_timeout = 28800
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
read_buffer = 4M
|
||||||
|
write_buffer = 4M
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
|
||||||
|
if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
|
${mariadb_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mariadb_install_dir} --datadir=${mariadb_data_dir}
|
||||||
|
|
||||||
|
[ "${Wsl}" == true ] && chmod 600 /etc/my.cnf
|
||||||
|
chown mysql:mysql -R ${mariadb_data_dir}
|
||||||
|
[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
|
||||||
|
service mysqld start
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mariadb_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mariadb_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mariadb_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='' and User not like 'mariadb.%';"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
|
||||||
|
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
|
||||||
|
echo "${mariadb_install_dir}/lib" > /etc/ld.so.conf.d/z-mariadb.conf
|
||||||
|
ldconfig
|
||||||
|
service mysqld stop
|
||||||
|
}
|
||||||
@@ -0,0 +1,216 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_MariaDB55() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mysql >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
|
||||||
|
|
||||||
|
[ ! -d "${mariadb_install_dir}" ] && mkdir -p ${mariadb_install_dir}
|
||||||
|
mkdir -p ${mariadb_data_dir};chown mysql:mysql -R ${mariadb_data_dir}
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
tar zxf mariadb-${mariadb55_ver}-linux-systemd-x86_64.tar.gz
|
||||||
|
mv mariadb-${mariadb55_ver}-linux-systemd-x86_64/* ${mariadb_install_dir}
|
||||||
|
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mariadb_install_dir}/bin/mysqld_safe
|
||||||
|
sed -i "s@/usr/local/mysql@${mariadb_install_dir}@g" ${mariadb_install_dir}/bin/mysqld_safe
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
tar xzf mariadb-${mariadb55_ver}.tar.gz
|
||||||
|
pushd mariadb-${mariadb55_ver}
|
||||||
|
[ "${armplatform}" == "y" ] && patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch
|
||||||
|
cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_install_dir} \
|
||||||
|
-DMYSQL_DATADIR=${mariadb_data_dir} \
|
||||||
|
-DSYSCONFDIR=/etc \
|
||||||
|
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_READLINE=1 \
|
||||||
|
-DWITH_EMBEDDED_SERVER=1 \
|
||||||
|
-DENABLE_DTRACE=0 \
|
||||||
|
-DENABLED_LOCAL_INFILE=1 \
|
||||||
|
-DDEFAULT_CHARSET=utf8mb4 \
|
||||||
|
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||||
|
-DEXTRA_CHARSETS=all \
|
||||||
|
-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'
|
||||||
|
make -j ${THREAD}
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "${mariadb_install_dir}/support-files" ]; then
|
||||||
|
sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}MariaDB installed successfully! ${CEND}"
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
rm -rf mariadb-${mariadb55_ver}-linux-systemd-x86_64
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
rm -rf mariadb-${mariadb55_ver}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -rf ${mariadb_install_dir}
|
||||||
|
echo "${CFAILURE}MariaDB install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/cp ${mariadb_install_dir}/support-files/mysql.server /etc/init.d/mysqld
|
||||||
|
sed -i "s@^basedir=.*@basedir=${mariadb_install_dir}@" /etc/init.d/mysqld
|
||||||
|
sed -i "s@^datadir=.*@datadir=${mariadb_data_dir}@" /etc/init.d/mysqld
|
||||||
|
chmod +x /etc/init.d/mysqld
|
||||||
|
[ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; }
|
||||||
|
[ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults
|
||||||
|
popd
|
||||||
|
|
||||||
|
# my.cnf
|
||||||
|
cat > /etc/my.cnf << EOF
|
||||||
|
[client]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
basedir = ${mariadb_install_dir}
|
||||||
|
datadir = ${mariadb_data_dir}
|
||||||
|
pid-file = ${mariadb_data_dir}/mysql.pid
|
||||||
|
user = mysql
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
server-id = 1
|
||||||
|
|
||||||
|
init-connect = 'SET NAMES utf8mb4'
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
|
||||||
|
skip-name-resolve
|
||||||
|
#skip-networking
|
||||||
|
back_log = 300
|
||||||
|
|
||||||
|
max_connections = 1000
|
||||||
|
max_connect_errors = 6000
|
||||||
|
open_files_limit = 65535
|
||||||
|
table_open_cache = 128
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
binlog_cache_size = 1M
|
||||||
|
max_heap_table_size = 8M
|
||||||
|
tmp_table_size = 16M
|
||||||
|
|
||||||
|
read_buffer_size = 2M
|
||||||
|
read_rnd_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
join_buffer_size = 8M
|
||||||
|
key_buffer_size = 4M
|
||||||
|
|
||||||
|
thread_cache_size = 8
|
||||||
|
|
||||||
|
query_cache_type = 1
|
||||||
|
query_cache_size = 8M
|
||||||
|
query_cache_limit = 2M
|
||||||
|
|
||||||
|
ft_min_word_len = 4
|
||||||
|
|
||||||
|
log_bin = mysql-bin
|
||||||
|
binlog_format = mixed
|
||||||
|
expire_logs_days = 7
|
||||||
|
|
||||||
|
log_error = ${mariadb_data_dir}/mysql-error.log
|
||||||
|
slow_query_log = 1
|
||||||
|
long_query_time = 1
|
||||||
|
slow_query_log_file = ${mariadb_data_dir}/mysql-slow.log
|
||||||
|
|
||||||
|
performance_schema = 0
|
||||||
|
|
||||||
|
#lower_case_table_names = 1
|
||||||
|
|
||||||
|
skip-external-locking
|
||||||
|
|
||||||
|
default_storage_engine = InnoDB
|
||||||
|
#default-storage-engine = MyISAM
|
||||||
|
innodb_file_per_table = 1
|
||||||
|
innodb_open_files = 500
|
||||||
|
innodb_buffer_pool_size = 64M
|
||||||
|
innodb_write_io_threads = 4
|
||||||
|
innodb_read_io_threads = 4
|
||||||
|
innodb_thread_concurrency = 0
|
||||||
|
innodb_purge_threads = 1
|
||||||
|
innodb_flush_log_at_trx_commit = 2
|
||||||
|
innodb_log_buffer_size = 2M
|
||||||
|
innodb_log_file_size = 32M
|
||||||
|
innodb_log_files_in_group = 3
|
||||||
|
innodb_max_dirty_pages_pct = 90
|
||||||
|
innodb_lock_wait_timeout = 120
|
||||||
|
|
||||||
|
bulk_insert_buffer_size = 8M
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
myisam_max_sort_file_size = 10G
|
||||||
|
myisam_repair_threads = 1
|
||||||
|
|
||||||
|
interactive_timeout = 28800
|
||||||
|
wait_timeout = 28800
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
read_buffer = 4M
|
||||||
|
write_buffer = 4M
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
|
||||||
|
if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
|
${mariadb_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mariadb_install_dir} --datadir=${mariadb_data_dir}
|
||||||
|
|
||||||
|
[ "${Wsl}" == true ] && chmod 600 /etc/my.cnf
|
||||||
|
chown mysql:mysql -R ${mariadb_data_dir}
|
||||||
|
[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
|
||||||
|
service mysqld start
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mariadb_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mariadb_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mariadb_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mariadb_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='' and User not like 'mariadb.%';"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
|
||||||
|
${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
|
||||||
|
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
|
||||||
|
echo "${mariadb_install_dir}/lib" > /etc/ld.so.conf.d/z-mariadb.conf
|
||||||
|
ldconfig
|
||||||
|
service mysqld stop
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_memcached_server() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
# memcached server
|
||||||
|
id -u memcached >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin memcached
|
||||||
|
|
||||||
|
tar xzf memcached-${memcached_ver}.tar.gz
|
||||||
|
pushd memcached-${memcached_ver} > /dev/null
|
||||||
|
[ ! -d "${memcached_install_dir}" ] && mkdir -p ${memcached_install_dir}
|
||||||
|
./configure --prefix=${memcached_install_dir}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${memcached_install_dir}/bin/memcached" ]; then
|
||||||
|
echo "${CSUCCESS}memcached installed successfully! ${CEND}"
|
||||||
|
rm -rf memcached-${memcached_ver}
|
||||||
|
ln -s ${memcached_install_dir}/bin/memcached /usr/bin/memcached
|
||||||
|
/bin/cp ../init.d/memcached.service /lib/systemd/system/
|
||||||
|
systemctl enable memcached
|
||||||
|
systemctl start memcached
|
||||||
|
rm -rf memcached-${memcached_ver}
|
||||||
|
else
|
||||||
|
rm -rf ${memcached_install_dir}
|
||||||
|
echo "${CFAILURE}memcached-server install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
Install_pecl_memcache() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
PHP_main_ver=${PHP_detail_ver%.*}
|
||||||
|
if [ "$(${php_install_dir}/bin/php-config --version | awk -F. '{print $1}')" == '5' ]; then
|
||||||
|
tar xzf memcache-3.0.8.tgz
|
||||||
|
pushd memcache-3.0.8 > /dev/null
|
||||||
|
elif [ "$(${php_install_dir}/bin/php-config --version | awk -F. '{print $1}')" == '7' ]; then
|
||||||
|
tar xzf memcache-${pecl_memcache_oldver}.tgz
|
||||||
|
pushd memcache-${pecl_memcache_oldver} > /dev/null
|
||||||
|
else
|
||||||
|
#git clone https://github.com/websupport-sk/pecl-memcache.git
|
||||||
|
tar xzf memcache-${pecl_memcache_ver}.tgz
|
||||||
|
pushd memcache-${pecl_memcache_ver} > /dev/null
|
||||||
|
fi
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/memcache.so" ]; then
|
||||||
|
echo "extension=memcache.so" > ${php_install_dir}/etc/php.d/05-memcache.ini
|
||||||
|
echo "${CSUCCESS}PHP memcache module installed successfully! ${CEND}"
|
||||||
|
rm -rf memcache-${pecl_memcache_ver} memcache-${pecl_memcache_oldver} memcache-3.0.8
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP memcache module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Install_pecl_memcached() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
|
||||||
|
# php memcached extension
|
||||||
|
tar xzf libmemcached-${libmemcached_ver}.tar.gz
|
||||||
|
patch -d libmemcached-${libmemcached_ver} -p0 < libmemcached-build.patch
|
||||||
|
pushd libmemcached-${libmemcached_ver} > /dev/null
|
||||||
|
[ "${PM}" == 'yum' ] && yum -y install cyrus-sasl-devel
|
||||||
|
[ "${PM}" == 'apt-get' ] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure
|
||||||
|
./configure --with-memcached=${memcached_install_dir}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libmemcached-${libmemcached_ver}
|
||||||
|
|
||||||
|
if [ "$(${php_install_dir}/bin/php-config --version | awk -F. '{print $1}')" == '5' ]; then
|
||||||
|
tar xzf memcached-${pecl_memcached_oldver}.tgz
|
||||||
|
pushd memcached-${pecl_memcached_oldver} > /dev/null
|
||||||
|
else
|
||||||
|
tar xzf memcached-${pecl_memcached_ver}.tgz
|
||||||
|
pushd memcached-${pecl_memcached_ver} > /dev/null
|
||||||
|
fi
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/memcached.so" ]; then
|
||||||
|
cat > ${php_install_dir}/etc/php.d/05-memcached.ini << EOF
|
||||||
|
extension=memcached.so
|
||||||
|
memcached.use_sasl=1
|
||||||
|
EOF
|
||||||
|
echo "${CSUCCESS}PHP memcached module installed successfully! ${CEND}"
|
||||||
|
rm -rf memcached-${pecl_memcached_oldver} memcached-${pecl_memcached_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP memcached module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_memcache() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/05-memcache.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/05-memcache.ini
|
||||||
|
echo; echo "${CMSG}PHP memcache module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP memcache module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_memcached() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/05-memcached.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/05-memcached.ini
|
||||||
|
echo; echo "${CMSG}PHP memcached module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP memcached module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
export LANG=en_US.UTF-8
|
||||||
|
export LANGUAGE=en_US:en
|
||||||
|
Mem=`free -m | awk '/Mem:/{print $2}'`
|
||||||
|
Swap=`free -m | awk '/Swap:/{print $2}'`
|
||||||
|
|
||||||
|
if [ $Mem -le 640 ]; then
|
||||||
|
Mem_level=512M
|
||||||
|
Memory_limit=64
|
||||||
|
THREAD=1
|
||||||
|
elif [ $Mem -gt 640 -a $Mem -le 1280 ]; then
|
||||||
|
Mem_level=1G
|
||||||
|
Memory_limit=128
|
||||||
|
elif [ $Mem -gt 1280 -a $Mem -le 2500 ]; then
|
||||||
|
Mem_level=2G
|
||||||
|
Memory_limit=192
|
||||||
|
elif [ $Mem -gt 2500 -a $Mem -le 3500 ]; then
|
||||||
|
Mem_level=3G
|
||||||
|
Memory_limit=256
|
||||||
|
elif [ $Mem -gt 3500 -a $Mem -le 4500 ]; then
|
||||||
|
Mem_level=4G
|
||||||
|
Memory_limit=320
|
||||||
|
elif [ $Mem -gt 4500 -a $Mem -le 8000 ]; then
|
||||||
|
Mem_level=6G
|
||||||
|
Memory_limit=384
|
||||||
|
elif [ $Mem -gt 8000 ]; then
|
||||||
|
Mem_level=8G
|
||||||
|
Memory_limit=448
|
||||||
|
fi
|
||||||
|
|
||||||
|
# add swapfile
|
||||||
|
if [ ! -e ~/.oneinstack ] && [ "${Swap}" == '0' ] && [ ${Mem} -le 2048 ]; then
|
||||||
|
echo "${CWARNING}Add Swap file, It may take a few minutes... ${CEND}"
|
||||||
|
dd if=/dev/zero of=/swapfile count=2048 bs=1M
|
||||||
|
mkswap /swapfile
|
||||||
|
swapon /swapfile
|
||||||
|
chmod 600 /swapfile
|
||||||
|
[ -z "`grep swapfile /etc/fstab`" ] && echo '/swapfile swap swap defaults 0 0' >> /etc/fstab
|
||||||
|
fi
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_MongoDB() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mongod >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -s /sbin/nologin mongod
|
||||||
|
mkdir -p ${mongo_data_dir};chown mongod.mongod -R ${mongo_data_dir}
|
||||||
|
tar xzf mongodb-linux-x86_64-${mongodb_ver}.tgz
|
||||||
|
/bin/mv mongodb-linux-x86_64-${mongodb_ver} ${mongo_install_dir}
|
||||||
|
/bin/cp ${oneinstack_dir}/init.d/mongod.service /lib/systemd/system/
|
||||||
|
sed -i "s@=/usr/local/mongodb@=${mongo_install_dir}@g" /lib/systemd/system/mongod.service
|
||||||
|
systemctl enable mongod
|
||||||
|
|
||||||
|
cat > /etc/mongod.conf << EOF
|
||||||
|
# mongod.conf
|
||||||
|
|
||||||
|
# for documentation of all options, see:
|
||||||
|
# http://docs.mongodb.org/manual/reference/configuration-options/
|
||||||
|
|
||||||
|
# where to write logging data.
|
||||||
|
systemLog:
|
||||||
|
destination: file
|
||||||
|
logAppend: true
|
||||||
|
path: ${mongo_data_dir}/mongod.log
|
||||||
|
|
||||||
|
# Where and how to store data.
|
||||||
|
storage:
|
||||||
|
dbPath: ${mongo_data_dir}
|
||||||
|
journal:
|
||||||
|
enabled: true
|
||||||
|
# engine:
|
||||||
|
# mmapv1:
|
||||||
|
# wiredTiger:
|
||||||
|
|
||||||
|
# how the process runs
|
||||||
|
processManagement:
|
||||||
|
fork: true # fork and run in background
|
||||||
|
pidFilePath: /var/run/mongodb/mongod.pid
|
||||||
|
|
||||||
|
# network interfaces
|
||||||
|
net:
|
||||||
|
port: 27017
|
||||||
|
bindIp: 0.0.0.0
|
||||||
|
unixDomainSocket:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
#security:
|
||||||
|
# authorization: enabled
|
||||||
|
|
||||||
|
#operationProfiling:
|
||||||
|
#replication:
|
||||||
|
#sharding:
|
||||||
|
EOF
|
||||||
|
systemctl start mongod
|
||||||
|
echo ${mongo_install_dir}/bin/mongo 127.0.0.1/admin --eval \"db.createUser\(\{user:\'root\',pwd:\'$dbmongopwd\',roles:[\'userAdminAnyDatabase\']\}\)\" | bash
|
||||||
|
sed -i 's@^#security:@security:@' /etc/mongod.conf
|
||||||
|
sed -i 's@^# authorization:@ authorization:@' /etc/mongod.conf
|
||||||
|
if [ -e "${mongo_install_dir}/bin/mongo" ]; then
|
||||||
|
sed -i "s+^dbmongopwd.*+dbmongopwd='$dbmongopwd'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}MongoDB installed successfully! ${CEND}"
|
||||||
|
rm -rf mongodb-linux-x86_64-${mongodb_ver}
|
||||||
|
else
|
||||||
|
rm -rf ${mongo_install_dir} ${mongo_data_dir}
|
||||||
|
echo "${CFAILURE}MongoDB install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mongo_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mongo_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mongo_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_MPHP() {
|
||||||
|
if [ -e "${php_install_dir}/sbin/php-fpm" ]; then
|
||||||
|
if [ -e "${php_install_dir}${mphp_ver}/bin/phpize" ]; then
|
||||||
|
echo "${CWARNING}PHP${mphp_ver} already installed! ${CEND}"
|
||||||
|
else
|
||||||
|
[ -e "/lib/systemd/system/php-fpm.service" ] && /bin/mv /lib/systemd/system/php-fpm.service{,_bk}
|
||||||
|
php_install_dir=${php_install_dir}${mphp_ver}
|
||||||
|
case "${mphp_ver}" in
|
||||||
|
53)
|
||||||
|
. include/php-5.3.sh
|
||||||
|
Install_PHP53 2>&1 | tee -a ${oneinstack_dir}/install.log
|
||||||
|
;;
|
||||||
|
54)
|
||||||
|
. include/php-5.4.sh
|
||||||
|
Install_PHP54 2>&1 | tee -a ${oneinstack_dir}/install.log
|
||||||
|
;;
|
||||||
|
55)
|
||||||
|
. include/php-5.5.sh
|
||||||
|
Install_PHP55 2>&1 | tee -a ${oneinstack_dir}/install.log
|
||||||
|
;;
|
||||||
|
56)
|
||||||
|
. include/php-5.6.sh
|
||||||
|
Install_PHP56 2>&1 | tee -a ${oneinstack_dir}/install.log
|
||||||
|
;;
|
||||||
|
70)
|
||||||
|
. include/php-7.0.sh
|
||||||
|
Install_PHP70 2>&1 | tee -a ${oneinstack_dir}/install.log
|
||||||
|
;;
|
||||||
|
71)
|
||||||
|
. include/php-7.1.sh
|
||||||
|
Install_PHP71 2>&1 | tee -a ${oneinstack_dir}/install.log
|
||||||
|
;;
|
||||||
|
72)
|
||||||
|
. include/php-7.2.sh
|
||||||
|
Install_PHP72 2>&1 | tee -a ${oneinstack_dir}/install.log
|
||||||
|
;;
|
||||||
|
73)
|
||||||
|
. include/php-7.3.sh
|
||||||
|
Install_PHP73 2>&1 | tee -a ${oneinstack_dir}/install.log
|
||||||
|
;;
|
||||||
|
74)
|
||||||
|
. include/php-7.4.sh
|
||||||
|
Install_PHP74 2>&1 | tee -a ${oneinstack_dir}/install.log
|
||||||
|
;;
|
||||||
|
80)
|
||||||
|
. include/php-8.0.sh
|
||||||
|
Install_PHP80 2>&1 | tee -a ${oneinstack_dir}/install.log
|
||||||
|
;;
|
||||||
|
81)
|
||||||
|
. include/php-8.1.sh
|
||||||
|
Install_PHP81 2>&1 | tee -a ${oneinstack_dir}/install.log
|
||||||
|
;;
|
||||||
|
82)
|
||||||
|
. include/php-8.2.sh
|
||||||
|
Install_PHP82 2>&1 | tee -a ${oneinstack_dir}/install.log
|
||||||
|
;;
|
||||||
|
83)
|
||||||
|
. include/php-8.3.sh
|
||||||
|
Install_PHP83 2>&1 | tee -a ${oneinstack_dir}/install.log
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if [ -e "${php_install_dir}/sbin/php-fpm" ]; then
|
||||||
|
systemctl stop php-fpm
|
||||||
|
sed -i "s@/dev/shm/php-cgi.sock@/dev/shm/php${mphp_ver}-cgi.sock@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
[ -e "/lib/systemd/system/php-fpm.service" ] && /bin/mv /lib/systemd/system/php-fpm.service /lib/systemd/system/php${mphp_ver}-fpm.service
|
||||||
|
[ -e "/lib/systemd/system/php-fpm.service_bk" ] && /bin/mv /lib/systemd/system/php-fpm.service{_bk,}
|
||||||
|
systemctl enable php${mphp_ver}-fpm
|
||||||
|
systemctl enable php-fpm
|
||||||
|
systemctl start php-fpm
|
||||||
|
systemctl start php${mphp_ver}-fpm
|
||||||
|
sed -i "s@${php_install_dir}/bin:@@" /etc/profile
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${CWARNING}To use the multiple PHP versions, You need to use PHP-FPM! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_MySQL55() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mysql >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
|
||||||
|
|
||||||
|
[ ! -d "${mysql_install_dir}" ] && mkdir -p ${mysql_install_dir}
|
||||||
|
mkdir -p ${mysql_data_dir};chown mysql:mysql -R ${mysql_data_dir}
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
tar xzf mysql-${mysql55_ver}-linux-glibc2.12-x86_64.tar.gz
|
||||||
|
mv mysql-${mysql55_ver}-linux-glibc2.12-x86_64/* ${mysql_install_dir}
|
||||||
|
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe
|
||||||
|
sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
tar xzf mysql-${mysql55_ver}.tar.gz
|
||||||
|
pushd mysql-${mysql55_ver}
|
||||||
|
[ "${armplatform}" == "y" ] && patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch
|
||||||
|
cmake . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \
|
||||||
|
-DMYSQL_DATADIR=${mysql_data_dir} \
|
||||||
|
-DSYSCONFDIR=/etc \
|
||||||
|
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_READLINE=1 \
|
||||||
|
-DWITH_EMBEDDED_SERVER=1 \
|
||||||
|
-DENABLE_DTRACE=0 \
|
||||||
|
-DENABLED_LOCAL_INFILE=1 \
|
||||||
|
-DDEFAULT_CHARSET=utf8mb4 \
|
||||||
|
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||||
|
-DEXTRA_CHARSETS=all \
|
||||||
|
-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'
|
||||||
|
make -j ${THREAD}
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "${mysql_install_dir}/support-files" ]; then
|
||||||
|
sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}MySQL installed successfully! ${CEND}"
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
rm -rf mysql-${mysql55_ver}-*-x86_64
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
rm -rf mysql-${mysql55_ver}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -rf ${mysql_install_dir}
|
||||||
|
echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/cp ${mysql_install_dir}/support-files/mysql.server /etc/init.d/mysqld
|
||||||
|
sed -i "s@^basedir=.*@basedir=${mysql_install_dir}@" /etc/init.d/mysqld
|
||||||
|
sed -i "s@^datadir=.*@datadir=${mysql_data_dir}@" /etc/init.d/mysqld
|
||||||
|
chmod +x /etc/init.d/mysqld
|
||||||
|
[ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; }
|
||||||
|
[ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults
|
||||||
|
popd
|
||||||
|
|
||||||
|
# my.cnf
|
||||||
|
cat > /etc/my.cnf << EOF
|
||||||
|
[client]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
prompt="MySQL [\\d]> "
|
||||||
|
no-auto-rehash
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
basedir = ${mysql_install_dir}
|
||||||
|
datadir = ${mysql_data_dir}
|
||||||
|
pid-file = ${mysql_data_dir}/mysql.pid
|
||||||
|
user = mysql
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
server-id = 1
|
||||||
|
|
||||||
|
init-connect = 'SET NAMES utf8mb4'
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
|
||||||
|
skip-name-resolve
|
||||||
|
#skip-networking
|
||||||
|
back_log = 300
|
||||||
|
|
||||||
|
max_connections = 1000
|
||||||
|
max_connect_errors = 6000
|
||||||
|
open_files_limit = 65535
|
||||||
|
table_open_cache = 128
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
binlog_cache_size = 1M
|
||||||
|
max_heap_table_size = 8M
|
||||||
|
tmp_table_size = 16M
|
||||||
|
|
||||||
|
read_buffer_size = 2M
|
||||||
|
read_rnd_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
join_buffer_size = 8M
|
||||||
|
key_buffer_size = 4M
|
||||||
|
|
||||||
|
thread_cache_size = 8
|
||||||
|
|
||||||
|
query_cache_type = 1
|
||||||
|
query_cache_size = 8M
|
||||||
|
query_cache_limit = 2M
|
||||||
|
|
||||||
|
ft_min_word_len = 4
|
||||||
|
|
||||||
|
log_bin = mysql-bin
|
||||||
|
binlog_format = mixed
|
||||||
|
expire_logs_days = 7
|
||||||
|
|
||||||
|
log_error = ${mysql_data_dir}/mysql-error.log
|
||||||
|
slow_query_log = 1
|
||||||
|
long_query_time = 1
|
||||||
|
slow_query_log_file = ${mysql_data_dir}/mysql-slow.log
|
||||||
|
|
||||||
|
performance_schema = 0
|
||||||
|
|
||||||
|
#lower_case_table_names = 1
|
||||||
|
|
||||||
|
skip-external-locking
|
||||||
|
|
||||||
|
default_storage_engine = InnoDB
|
||||||
|
innodb_file_per_table = 1
|
||||||
|
innodb_open_files = 500
|
||||||
|
innodb_buffer_pool_size = 64M
|
||||||
|
innodb_write_io_threads = 4
|
||||||
|
innodb_read_io_threads = 4
|
||||||
|
innodb_thread_concurrency = 0
|
||||||
|
innodb_purge_threads = 1
|
||||||
|
innodb_flush_log_at_trx_commit = 2
|
||||||
|
innodb_log_buffer_size = 2M
|
||||||
|
innodb_log_file_size = 32M
|
||||||
|
innodb_log_files_in_group = 3
|
||||||
|
innodb_max_dirty_pages_pct = 90
|
||||||
|
innodb_lock_wait_timeout = 120
|
||||||
|
|
||||||
|
bulk_insert_buffer_size = 8M
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
myisam_max_sort_file_size = 10G
|
||||||
|
myisam_repair_threads = 1
|
||||||
|
|
||||||
|
interactive_timeout = 28800
|
||||||
|
wait_timeout = 28800
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
read_buffer = 4M
|
||||||
|
write_buffer = 4M
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
|
||||||
|
if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
|
${mysql_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir}
|
||||||
|
|
||||||
|
[ "${Wsl}" == true ] && chmod 600 /etc/my.cnf
|
||||||
|
chown mysql:mysql -R ${mysql_data_dir}
|
||||||
|
[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
|
||||||
|
service mysqld start
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mysql_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mysql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mysql_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='' and User not like 'mysql.%';"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
|
||||||
|
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
|
||||||
|
[ -e "${mysql_install_dir}/my.cnf" ] && rm -f ${mysql_install_dir}/my.cnf
|
||||||
|
echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/z-mysql.conf
|
||||||
|
ldconfig
|
||||||
|
service mysqld stop
|
||||||
|
}
|
||||||
@@ -0,0 +1,219 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_MySQL56() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mysql >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
|
||||||
|
|
||||||
|
[ ! -d "${mysql_install_dir}" ] && mkdir -p ${mysql_install_dir}
|
||||||
|
mkdir -p ${mysql_data_dir};chown mysql:mysql -R ${mysql_data_dir}
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
tar xzf mysql-${mysql56_ver}-linux-glibc2.12-x86_64.tar.gz
|
||||||
|
mv mysql-${mysql56_ver}-linux-glibc2.12-x86_64/* ${mysql_install_dir}
|
||||||
|
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe
|
||||||
|
sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
tar xzf mysql-${mysql56_ver}.tar.gz
|
||||||
|
pushd mysql-${mysql56_ver}
|
||||||
|
cmake . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \
|
||||||
|
-DMYSQL_DATADIR=${mysql_data_dir} \
|
||||||
|
-DSYSCONFDIR=/etc \
|
||||||
|
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_EMBEDDED_SERVER=1 \
|
||||||
|
-DENABLE_DTRACE=0 \
|
||||||
|
-DENABLED_LOCAL_INFILE=1 \
|
||||||
|
-DDEFAULT_CHARSET=utf8mb4 \
|
||||||
|
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||||
|
-DEXTRA_CHARSETS=all \
|
||||||
|
-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'
|
||||||
|
make -j ${THREAD}
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "${mysql_install_dir}/support-files" ]; then
|
||||||
|
sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}MySQL installed successfully! ${CEND}"
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
rm -rf mysql-${mysql56_ver}-*-x86_64
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
rm -rf mysql-${mysql56_ver}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -rf ${mysql_install_dir}
|
||||||
|
echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/cp ${mysql_install_dir}/support-files/mysql.server /etc/init.d/mysqld
|
||||||
|
sed -i "s@^basedir=.*@basedir=${mysql_install_dir}@" /etc/init.d/mysqld
|
||||||
|
sed -i "s@^datadir=.*@datadir=${mysql_data_dir}@" /etc/init.d/mysqld
|
||||||
|
chmod +x /etc/init.d/mysqld
|
||||||
|
[ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; }
|
||||||
|
[ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults
|
||||||
|
popd
|
||||||
|
|
||||||
|
# my.cnf
|
||||||
|
cat > /etc/my.cnf << EOF
|
||||||
|
[client]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
prompt="MySQL [\\d]> "
|
||||||
|
no-auto-rehash
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
basedir = ${mysql_install_dir}
|
||||||
|
datadir = ${mysql_data_dir}
|
||||||
|
pid-file = ${mysql_data_dir}/mysql.pid
|
||||||
|
user = mysql
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
server-id = 1
|
||||||
|
|
||||||
|
init-connect = 'SET NAMES utf8mb4'
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
|
||||||
|
skip-name-resolve
|
||||||
|
#skip-networking
|
||||||
|
back_log = 300
|
||||||
|
|
||||||
|
max_connections = 1000
|
||||||
|
max_connect_errors = 6000
|
||||||
|
open_files_limit = 65535
|
||||||
|
table_open_cache = 128
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
binlog_cache_size = 1M
|
||||||
|
max_heap_table_size = 8M
|
||||||
|
tmp_table_size = 16M
|
||||||
|
|
||||||
|
read_buffer_size = 2M
|
||||||
|
read_rnd_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
join_buffer_size = 8M
|
||||||
|
key_buffer_size = 4M
|
||||||
|
|
||||||
|
thread_cache_size = 8
|
||||||
|
|
||||||
|
query_cache_type = 1
|
||||||
|
query_cache_size = 8M
|
||||||
|
query_cache_limit = 2M
|
||||||
|
|
||||||
|
ft_min_word_len = 4
|
||||||
|
|
||||||
|
log_bin = mysql-bin
|
||||||
|
binlog_format = mixed
|
||||||
|
expire_logs_days = 7
|
||||||
|
|
||||||
|
log_error = ${mysql_data_dir}/mysql-error.log
|
||||||
|
slow_query_log = 1
|
||||||
|
long_query_time = 1
|
||||||
|
slow_query_log_file = ${mysql_data_dir}/mysql-slow.log
|
||||||
|
|
||||||
|
performance_schema = 0
|
||||||
|
explicit_defaults_for_timestamp
|
||||||
|
|
||||||
|
#lower_case_table_names = 1
|
||||||
|
|
||||||
|
skip-external-locking
|
||||||
|
|
||||||
|
default_storage_engine = InnoDB
|
||||||
|
innodb_file_per_table = 1
|
||||||
|
innodb_open_files = 500
|
||||||
|
innodb_buffer_pool_size = 64M
|
||||||
|
innodb_write_io_threads = 4
|
||||||
|
innodb_read_io_threads = 4
|
||||||
|
innodb_thread_concurrency = 0
|
||||||
|
innodb_purge_threads = 1
|
||||||
|
innodb_flush_log_at_trx_commit = 2
|
||||||
|
innodb_log_buffer_size = 2M
|
||||||
|
innodb_log_file_size = 32M
|
||||||
|
innodb_log_files_in_group = 3
|
||||||
|
innodb_max_dirty_pages_pct = 90
|
||||||
|
innodb_lock_wait_timeout = 120
|
||||||
|
|
||||||
|
bulk_insert_buffer_size = 8M
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
myisam_max_sort_file_size = 10G
|
||||||
|
myisam_repair_threads = 1
|
||||||
|
|
||||||
|
interactive_timeout = 28800
|
||||||
|
wait_timeout = 28800
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
read_buffer = 4M
|
||||||
|
write_buffer = 4M
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
|
||||||
|
if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
|
${mysql_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir}
|
||||||
|
|
||||||
|
[ "${Wsl}" == true ] && chmod 600 /etc/my.cnf
|
||||||
|
chown mysql:mysql -R ${mysql_data_dir}
|
||||||
|
[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
|
||||||
|
service mysqld start
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mysql_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mysql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mysql_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='' and User not like 'mysql.%';"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
|
||||||
|
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
|
||||||
|
[ -e "${mysql_install_dir}/my.cnf" ] && rm -f ${mysql_install_dir}/my.cnf
|
||||||
|
echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/z-mysql.conf
|
||||||
|
ldconfig
|
||||||
|
service mysqld stop
|
||||||
|
}
|
||||||
@@ -0,0 +1,219 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_MySQL57() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mysql >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
|
||||||
|
|
||||||
|
[ ! -d "${mysql_install_dir}" ] && mkdir -p ${mysql_install_dir}
|
||||||
|
mkdir -p ${mysql_data_dir};chown mysql:mysql -R ${mysql_data_dir}
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
tar xzf mysql-${mysql57_ver}-linux-glibc2.12-x86_64.tar.gz
|
||||||
|
mv mysql-${mysql57_ver}-linux-glibc2.12-x86_64/* ${mysql_install_dir}
|
||||||
|
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe
|
||||||
|
sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
boostVersion2=$(echo ${boost_oldver} | awk -F. '{print $1"_"$2"_"$3}')
|
||||||
|
tar xzf boost_${boostVersion2}.tar.gz
|
||||||
|
tar xzf mysql-${mysql57_ver}.tar.gz
|
||||||
|
pushd mysql-${mysql57_ver}
|
||||||
|
cmake . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \
|
||||||
|
-DMYSQL_DATADIR=${mysql_data_dir} \
|
||||||
|
-DDOWNLOAD_BOOST=1 \
|
||||||
|
-DWITH_BOOST=../boost_${boostVersion2} \
|
||||||
|
-DSYSCONFDIR=/etc \
|
||||||
|
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_EMBEDDED_SERVER=1 \
|
||||||
|
-DENABLE_DTRACE=0 \
|
||||||
|
-DENABLED_LOCAL_INFILE=1 \
|
||||||
|
-DDEFAULT_CHARSET=utf8mb4 \
|
||||||
|
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||||
|
-DEXTRA_CHARSETS=all \
|
||||||
|
-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'
|
||||||
|
make -j ${THREAD}
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "${mysql_install_dir}/support-files" ]; then
|
||||||
|
sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}MySQL installed successfully! ${CEND}"
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
rm -rf mysql-${mysql57_ver}-*-x86_64
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
rm -rf mysql-${mysql57_ver} boost_${boostVersion2}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -rf ${mysql_install_dir}
|
||||||
|
echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/cp ${mysql_install_dir}/support-files/mysql.server /etc/init.d/mysqld
|
||||||
|
sed -i "s@^basedir=.*@basedir=${mysql_install_dir}@" /etc/init.d/mysqld
|
||||||
|
sed -i "s@^datadir=.*@datadir=${mysql_data_dir}@" /etc/init.d/mysqld
|
||||||
|
chmod +x /etc/init.d/mysqld
|
||||||
|
[ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; }
|
||||||
|
[ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults
|
||||||
|
popd
|
||||||
|
|
||||||
|
# my.cnf
|
||||||
|
cat > /etc/my.cnf << EOF
|
||||||
|
[client]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
prompt="MySQL [\\d]> "
|
||||||
|
no-auto-rehash
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
basedir = ${mysql_install_dir}
|
||||||
|
datadir = ${mysql_data_dir}
|
||||||
|
pid-file = ${mysql_data_dir}/mysql.pid
|
||||||
|
user = mysql
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
server-id = 1
|
||||||
|
|
||||||
|
init-connect = 'SET NAMES utf8mb4'
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
|
||||||
|
skip-name-resolve
|
||||||
|
#skip-networking
|
||||||
|
back_log = 300
|
||||||
|
|
||||||
|
max_connections = 1000
|
||||||
|
max_connect_errors = 6000
|
||||||
|
open_files_limit = 65535
|
||||||
|
table_open_cache = 128
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
binlog_cache_size = 1M
|
||||||
|
max_heap_table_size = 8M
|
||||||
|
tmp_table_size = 16M
|
||||||
|
|
||||||
|
read_buffer_size = 2M
|
||||||
|
read_rnd_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
join_buffer_size = 8M
|
||||||
|
key_buffer_size = 4M
|
||||||
|
|
||||||
|
thread_cache_size = 8
|
||||||
|
|
||||||
|
query_cache_type = 1
|
||||||
|
query_cache_size = 8M
|
||||||
|
query_cache_limit = 2M
|
||||||
|
|
||||||
|
ft_min_word_len = 4
|
||||||
|
|
||||||
|
log_bin = mysql-bin
|
||||||
|
binlog_format = mixed
|
||||||
|
expire_logs_days = 7
|
||||||
|
|
||||||
|
log_error = ${mysql_data_dir}/mysql-error.log
|
||||||
|
slow_query_log = 1
|
||||||
|
long_query_time = 1
|
||||||
|
slow_query_log_file = ${mysql_data_dir}/mysql-slow.log
|
||||||
|
|
||||||
|
performance_schema = 0
|
||||||
|
explicit_defaults_for_timestamp
|
||||||
|
|
||||||
|
#lower_case_table_names = 1
|
||||||
|
|
||||||
|
skip-external-locking
|
||||||
|
|
||||||
|
default_storage_engine = InnoDB
|
||||||
|
#default-storage-engine = MyISAM
|
||||||
|
innodb_file_per_table = 1
|
||||||
|
innodb_open_files = 500
|
||||||
|
innodb_buffer_pool_size = 64M
|
||||||
|
innodb_write_io_threads = 4
|
||||||
|
innodb_read_io_threads = 4
|
||||||
|
innodb_thread_concurrency = 0
|
||||||
|
innodb_purge_threads = 1
|
||||||
|
innodb_flush_log_at_trx_commit = 2
|
||||||
|
innodb_log_buffer_size = 2M
|
||||||
|
innodb_log_file_size = 32M
|
||||||
|
innodb_log_files_in_group = 3
|
||||||
|
innodb_max_dirty_pages_pct = 90
|
||||||
|
innodb_lock_wait_timeout = 120
|
||||||
|
|
||||||
|
bulk_insert_buffer_size = 8M
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
myisam_max_sort_file_size = 10G
|
||||||
|
|
||||||
|
interactive_timeout = 28800
|
||||||
|
wait_timeout = 28800
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
read_buffer = 4M
|
||||||
|
write_buffer = 4M
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
|
||||||
|
if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
|
${mysql_install_dir}/bin/mysqld --initialize-insecure --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir}
|
||||||
|
|
||||||
|
[ "${Wsl}" == true ] && chmod 600 /etc/my.cnf
|
||||||
|
chown mysql:mysql -R ${mysql_data_dir}
|
||||||
|
[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
|
||||||
|
service mysqld start
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mysql_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mysql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mysql_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mysql_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
|
||||||
|
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
|
||||||
|
[ -e "${mysql_install_dir}/my.cnf" ] && rm -f ${mysql_install_dir}/my.cnf
|
||||||
|
echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/z-mysql.conf
|
||||||
|
ldconfig
|
||||||
|
service mysqld stop
|
||||||
|
}
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_MySQL80() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mysql >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
|
||||||
|
|
||||||
|
[ ! -d "${mysql_install_dir}" ] && mkdir -p ${mysql_install_dir}
|
||||||
|
mkdir -p ${mysql_data_dir};chown mysql:mysql -R ${mysql_data_dir}
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
tar xJf mysql-${mysql80_ver}-linux-glibc2.12-x86_64.tar.xz
|
||||||
|
mv mysql-${mysql80_ver}-linux-glibc2.12-x86_64/* ${mysql_install_dir}
|
||||||
|
sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
boostVersion2=$(echo ${boost_ver} | awk -F. '{print $1"_"$2"_"$3}')
|
||||||
|
tar xzf boost_${boostVersion2}.tar.gz
|
||||||
|
tar xzf mysql-${mysql80_ver}.tar.gz
|
||||||
|
pushd mysql-${mysql80_ver}
|
||||||
|
[ -e "/usr/bin/cmake3" ] && CMAKE=cmake3 || CMAKE=cmake
|
||||||
|
$CMAKE . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \
|
||||||
|
-DMYSQL_DATADIR=${mysql_data_dir} \
|
||||||
|
-DDOWNLOAD_BOOST=1 \
|
||||||
|
-DWITH_BOOST=../boost_${boostVersion2} \
|
||||||
|
-DFORCE_INSOURCE_BUILD=1 \
|
||||||
|
-DSYSCONFDIR=/etc \
|
||||||
|
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||||
|
-DENABLED_LOCAL_INFILE=1 \
|
||||||
|
-DFORCE_INSOURCE_BUILD=1 \
|
||||||
|
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||||
|
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
|
||||||
|
-DDEFAULT_CHARSET=utf8mb4
|
||||||
|
make -j ${THREAD}
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
# backup openssl so
|
||||||
|
#[ ! -e "${mysql_install_dir}/lib/lib_bk" ] && mkdir ${mysql_install_dir}/lib/lib_bk
|
||||||
|
#/bin/mv ${mysql_install_dir}/lib/{libssl,libcrypto}.so* ${mysql_install_dir}/lib/lib_bk/
|
||||||
|
|
||||||
|
if [ -d "${mysql_install_dir}/support-files" ]; then
|
||||||
|
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe
|
||||||
|
sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}MySQL installed successfully! ${CEND}"
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
rm -rf mysql-${mysql80_ver}-*-x86_64
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
rm -rf mysql-${mysql80_ver} boost_${boostVersion2}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -rf ${mysql_install_dir}
|
||||||
|
echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/cp ${mysql_install_dir}/support-files/mysql.server /etc/init.d/mysqld
|
||||||
|
sed -i "s@^basedir=.*@basedir=${mysql_install_dir}@" /etc/init.d/mysqld
|
||||||
|
sed -i "s@^datadir=.*@datadir=${mysql_data_dir}@" /etc/init.d/mysqld
|
||||||
|
chmod +x /etc/init.d/mysqld
|
||||||
|
[ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; }
|
||||||
|
[ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults
|
||||||
|
popd
|
||||||
|
|
||||||
|
# my.cnf
|
||||||
|
cat > /etc/my.cnf << EOF
|
||||||
|
[client]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
default-character-set = utf8mb4
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
prompt="MySQL [\\d]> "
|
||||||
|
no-auto-rehash
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
default_authentication_plugin = mysql_native_password
|
||||||
|
|
||||||
|
basedir = ${mysql_install_dir}
|
||||||
|
datadir = ${mysql_data_dir}
|
||||||
|
pid-file = ${mysql_data_dir}/mysql.pid
|
||||||
|
user = mysql
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
server-id = 1
|
||||||
|
|
||||||
|
init-connect = 'SET NAMES utf8mb4'
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
collation-server = utf8mb4_0900_ai_ci
|
||||||
|
|
||||||
|
skip-name-resolve
|
||||||
|
#skip-networking
|
||||||
|
back_log = 300
|
||||||
|
|
||||||
|
max_connections = 1000
|
||||||
|
max_connect_errors = 6000
|
||||||
|
open_files_limit = 65535
|
||||||
|
table_open_cache = 128
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
binlog_cache_size = 1M
|
||||||
|
max_heap_table_size = 8M
|
||||||
|
tmp_table_size = 16M
|
||||||
|
|
||||||
|
read_buffer_size = 2M
|
||||||
|
read_rnd_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
join_buffer_size = 8M
|
||||||
|
key_buffer_size = 4M
|
||||||
|
|
||||||
|
thread_cache_size = 8
|
||||||
|
|
||||||
|
ft_min_word_len = 4
|
||||||
|
|
||||||
|
log_bin = mysql-bin
|
||||||
|
binlog_format = mixed
|
||||||
|
binlog_expire_logs_seconds = 604800
|
||||||
|
|
||||||
|
log_error = ${mysql_data_dir}/mysql-error.log
|
||||||
|
slow_query_log = 1
|
||||||
|
long_query_time = 1
|
||||||
|
slow_query_log_file = ${mysql_data_dir}/mysql-slow.log
|
||||||
|
|
||||||
|
performance_schema = 0
|
||||||
|
explicit_defaults_for_timestamp
|
||||||
|
|
||||||
|
#lower_case_table_names = 1
|
||||||
|
|
||||||
|
skip-external-locking
|
||||||
|
|
||||||
|
default_storage_engine = InnoDB
|
||||||
|
#default-storage-engine = MyISAM
|
||||||
|
innodb_file_per_table = 1
|
||||||
|
innodb_open_files = 500
|
||||||
|
innodb_buffer_pool_size = 64M
|
||||||
|
innodb_write_io_threads = 4
|
||||||
|
innodb_read_io_threads = 4
|
||||||
|
innodb_thread_concurrency = 0
|
||||||
|
innodb_purge_threads = 1
|
||||||
|
innodb_flush_log_at_trx_commit = 2
|
||||||
|
innodb_log_buffer_size = 2M
|
||||||
|
innodb_log_file_size = 32M
|
||||||
|
innodb_log_files_in_group = 3
|
||||||
|
innodb_max_dirty_pages_pct = 90
|
||||||
|
innodb_lock_wait_timeout = 120
|
||||||
|
|
||||||
|
bulk_insert_buffer_size = 8M
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
myisam_max_sort_file_size = 10G
|
||||||
|
|
||||||
|
interactive_timeout = 28800
|
||||||
|
wait_timeout = 28800
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
read_buffer = 4M
|
||||||
|
write_buffer = 4M
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
|
||||||
|
if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
|
${mysql_install_dir}/bin/mysqld --initialize-insecure --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir}
|
||||||
|
|
||||||
|
[ "${Wsl}" == true ] && chmod 600 /etc/my.cnf
|
||||||
|
chown mysql:mysql -R ${mysql_data_dir}
|
||||||
|
[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
|
||||||
|
service mysqld start
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mysql_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mysql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mysql_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "create user root@'127.0.0.1' identified by \"${dbrootpwd}\";"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "grant all privileges on *.* to root@'127.0.0.1' with grant option;"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "grant all privileges on *.* to root@'localhost' with grant option;"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "alter user root@'localhost' identified by \"${dbrootpwd}\";"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
|
||||||
|
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
|
||||||
|
[ -e "${mysql_install_dir}/my.cnf" ] && rm -f ${mysql_install_dir}/my.cnf
|
||||||
|
echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/z-mysql.conf
|
||||||
|
ldconfig
|
||||||
|
service mysqld stop
|
||||||
|
}
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_MySQL82() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mysql >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
|
||||||
|
|
||||||
|
[ ! -d "${mysql_install_dir}" ] && mkdir -p ${mysql_install_dir}
|
||||||
|
mkdir -p ${mysql_data_dir};chown mysql:mysql -R ${mysql_data_dir}
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
tar xJf mysql-${mysql82_ver}-linux-glibc2.17-x86_64.tar.xz
|
||||||
|
mv mysql-${mysql82_ver}-linux-glibc2.17-x86_64/* ${mysql_install_dir}
|
||||||
|
sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
boostVersion2=$(echo ${boost_ver} | awk -F. '{print $1"_"$2"_"$3}')
|
||||||
|
tar xzf boost_${boostVersion2}.tar.gz
|
||||||
|
tar xzf mysql-${mysql82_ver}.tar.gz
|
||||||
|
pushd mysql-${mysql82_ver}
|
||||||
|
[ -e "/usr/bin/cmake3" ] && CMAKE=cmake3 || CMAKE=cmake
|
||||||
|
$CMAKE . -DCMAKE_INSTALL_PREFIX=${mysql_install_dir} \
|
||||||
|
-DMYSQL_DATADIR=${mysql_data_dir} \
|
||||||
|
-DDOWNLOAD_BOOST=1 \
|
||||||
|
-DWITH_BOOST=../boost_${boostVersion2} \
|
||||||
|
-DFORCE_INSOURCE_BUILD=1 \
|
||||||
|
-DSYSCONFDIR=/etc \
|
||||||
|
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||||
|
-DENABLED_LOCAL_INFILE=1 \
|
||||||
|
-DFORCE_INSOURCE_BUILD=1 \
|
||||||
|
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||||
|
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
|
||||||
|
-DDEFAULT_CHARSET=utf8mb4
|
||||||
|
make -j ${THREAD}
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
# backup openssl so
|
||||||
|
#[ ! -e "${mysql_install_dir}/lib/lib_bk" ] && mkdir ${mysql_install_dir}/lib/lib_bk
|
||||||
|
#/bin/mv ${mysql_install_dir}/lib/{libssl,libcrypto}.so* ${mysql_install_dir}/lib/lib_bk/
|
||||||
|
|
||||||
|
if [ -d "${mysql_install_dir}/support-files" ]; then
|
||||||
|
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe
|
||||||
|
sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}MySQL installed successfully! ${CEND}"
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
rm -rf mysql-${mysql82_ver}-*-x86_64
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
rm -rf mysql-${mysql82_ver} boost_${boostVersion2}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -rf ${mysql_install_dir}
|
||||||
|
echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/cp ${mysql_install_dir}/support-files/mysql.server /etc/init.d/mysqld
|
||||||
|
sed -i "s@^basedir=.*@basedir=${mysql_install_dir}@" /etc/init.d/mysqld
|
||||||
|
sed -i "s@^datadir=.*@datadir=${mysql_data_dir}@" /etc/init.d/mysqld
|
||||||
|
chmod +x /etc/init.d/mysqld
|
||||||
|
[ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; }
|
||||||
|
[ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults
|
||||||
|
popd
|
||||||
|
|
||||||
|
# my.cnf
|
||||||
|
cat > /etc/my.cnf << EOF
|
||||||
|
[client]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
default-character-set = utf8mb4
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
prompt="MySQL [\\d]> "
|
||||||
|
no-auto-rehash
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
default_authentication_plugin = mysql_native_password
|
||||||
|
|
||||||
|
basedir = ${mysql_install_dir}
|
||||||
|
datadir = ${mysql_data_dir}
|
||||||
|
pid-file = ${mysql_data_dir}/mysql.pid
|
||||||
|
user = mysql
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
server-id = 1
|
||||||
|
|
||||||
|
init-connect = 'SET NAMES utf8mb4'
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
collation-server = utf8mb4_0900_ai_ci
|
||||||
|
|
||||||
|
skip-name-resolve
|
||||||
|
#skip-networking
|
||||||
|
back_log = 300
|
||||||
|
|
||||||
|
max_connections = 1000
|
||||||
|
max_connect_errors = 6000
|
||||||
|
open_files_limit = 65535
|
||||||
|
table_open_cache = 128
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
binlog_cache_size = 1M
|
||||||
|
max_heap_table_size = 8M
|
||||||
|
tmp_table_size = 16M
|
||||||
|
|
||||||
|
read_buffer_size = 2M
|
||||||
|
read_rnd_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
join_buffer_size = 8M
|
||||||
|
key_buffer_size = 4M
|
||||||
|
|
||||||
|
thread_cache_size = 8
|
||||||
|
|
||||||
|
ft_min_word_len = 4
|
||||||
|
|
||||||
|
log_bin = mysql-bin
|
||||||
|
binlog_format = mixed
|
||||||
|
binlog_expire_logs_seconds = 604800
|
||||||
|
|
||||||
|
log_error = ${mysql_data_dir}/mysql-error.log
|
||||||
|
slow_query_log = 1
|
||||||
|
long_query_time = 1
|
||||||
|
slow_query_log_file = ${mysql_data_dir}/mysql-slow.log
|
||||||
|
|
||||||
|
performance_schema = 0
|
||||||
|
explicit_defaults_for_timestamp
|
||||||
|
|
||||||
|
#lower_case_table_names = 1
|
||||||
|
|
||||||
|
skip-external-locking
|
||||||
|
|
||||||
|
default_storage_engine = InnoDB
|
||||||
|
#default-storage-engine = MyISAM
|
||||||
|
innodb_file_per_table = 1
|
||||||
|
innodb_open_files = 500
|
||||||
|
innodb_buffer_pool_size = 64M
|
||||||
|
innodb_write_io_threads = 4
|
||||||
|
innodb_read_io_threads = 4
|
||||||
|
innodb_thread_concurrency = 0
|
||||||
|
innodb_purge_threads = 1
|
||||||
|
innodb_flush_log_at_trx_commit = 2
|
||||||
|
innodb_log_buffer_size = 2M
|
||||||
|
innodb_log_file_size = 32M
|
||||||
|
innodb_log_files_in_group = 3
|
||||||
|
innodb_max_dirty_pages_pct = 90
|
||||||
|
innodb_lock_wait_timeout = 120
|
||||||
|
|
||||||
|
bulk_insert_buffer_size = 8M
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
myisam_max_sort_file_size = 10G
|
||||||
|
|
||||||
|
interactive_timeout = 28800
|
||||||
|
wait_timeout = 28800
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
read_buffer = 4M
|
||||||
|
write_buffer = 4M
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
|
||||||
|
if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
|
${mysql_install_dir}/bin/mysqld --initialize-insecure --user=mysql --basedir=${mysql_install_dir} --datadir=${mysql_data_dir}
|
||||||
|
|
||||||
|
[ "${Wsl}" == true ] && chmod 600 /etc/my.cnf
|
||||||
|
chown mysql:mysql -R ${mysql_data_dir}
|
||||||
|
[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
|
||||||
|
service mysqld start
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${mysql_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${mysql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${mysql_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "create user root@'127.0.0.1' identified by \"${dbrootpwd}\";"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "grant all privileges on *.* to root@'127.0.0.1' with grant option;"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "grant all privileges on *.* to root@'localhost' with grant option;"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -hlocalhost -e "alter user root@'localhost' identified by \"${dbrootpwd}\";"
|
||||||
|
${mysql_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
|
||||||
|
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
|
||||||
|
[ -e "${mysql_install_dir}/my.cnf" ] && rm -f ${mysql_install_dir}/my.cnf
|
||||||
|
echo "${mysql_install_dir}/lib" > /etc/ld.so.conf.d/z-mysql.conf
|
||||||
|
ldconfig
|
||||||
|
service mysqld stop
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_Nginx() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
|
||||||
|
tar xzf pcre-${pcre_ver}.tar.gz
|
||||||
|
tar xzf nginx-${nginx_ver}.tar.gz
|
||||||
|
tar xzf openssl-${openssl11_ver}.tar.gz
|
||||||
|
pushd nginx-${nginx_ver} > /dev/null
|
||||||
|
# Modify Nginx version
|
||||||
|
#sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h
|
||||||
|
#sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@' src/core/nginx.h
|
||||||
|
#sed -i 's@Server: nginx@Server: linuxeye@' src/http/ngx_http_header_filter_module.c
|
||||||
|
|
||||||
|
# close debug
|
||||||
|
sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc
|
||||||
|
|
||||||
|
[ ! -d "${nginx_install_dir}" ] && mkdir -p ${nginx_install_dir}
|
||||||
|
./configure --prefix=${nginx_install_dir} --user=${run_user} --group=${run_group} --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_ssl_module --with-stream --with-stream_ssl_preread_module --with-stream_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-${openssl11_ver} --with-pcre=../pcre-${pcre_ver} --with-pcre-jit --with-ld-opt='-ljemalloc' ${nginx_modules_options}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
if [ -e "${nginx_install_dir}/conf/nginx.conf" ]; then
|
||||||
|
popd > /dev/null
|
||||||
|
#rm -rf pcre-${pcre_ver}* openssl-${openssl11_ver}* nginx-${nginx_ver}* ${nginx_install_dir}*
|
||||||
|
echo "${CSUCCESS}Nginx installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
rm -rf pcre-${pcre_ver}* openssl-${openssl11_ver}* nginx-${nginx_ver}* ${nginx_install_dir}*
|
||||||
|
echo "${CFAILURE}Nginx install failed, Please Contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${nginx_install_dir}/sbin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${nginx_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${nginx_install_dir}/sbin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
/bin/cp ../init.d/nginx.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/nginx@${nginx_install_dir}@g" /lib/systemd/system/nginx.service
|
||||||
|
systemctl enable nginx
|
||||||
|
|
||||||
|
mv ${nginx_install_dir}/conf/nginx.conf{,_bk}
|
||||||
|
if [ "${apache_flag}" == 'y' ] || [ -e "${apache_install_dir}/bin/httpd" ]; then
|
||||||
|
/bin/cp ../config/nginx_apache.conf ${nginx_install_dir}/conf/nginx.conf
|
||||||
|
elif { [[ ${tomcat_option} =~ ^[1-4]$ ]] || [ -e "${tomcat_install_dir}/conf/server.xml" ]; } && { [[ ! ${php_option} =~ ^[1-9]$|^1[0-1]$ ]] && [ ! -e "${php_install_dir}/bin/php" ]; }; then
|
||||||
|
/bin/cp ../config/nginx_tomcat.conf ${nginx_install_dir}/conf/nginx.conf
|
||||||
|
else
|
||||||
|
/bin/cp ../config/nginx.conf ${nginx_install_dir}/conf/nginx.conf
|
||||||
|
[[ "${php_option}" =~ ^[1-9]$|^1[0-1]$ ]] && [ -z "`grep '/php-fpm_status' ${nginx_install_dir}/conf/nginx.conf`" ] && sed -i "s@index index.html index.php;@index index.html index.php;\n location ~ /php-fpm_status {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi.conf;\n allow 127.0.0.1;\n deny all;\n }@" ${nginx_install_dir}/conf/nginx.conf
|
||||||
|
fi
|
||||||
|
cat > ${nginx_install_dir}/conf/proxy.conf << EOF
|
||||||
|
proxy_connect_timeout 300s;
|
||||||
|
proxy_send_timeout 900;
|
||||||
|
proxy_read_timeout 900;
|
||||||
|
proxy_buffer_size 32k;
|
||||||
|
proxy_buffers 4 64k;
|
||||||
|
proxy_busy_buffers_size 128k;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_hide_header Vary;
|
||||||
|
proxy_set_header Accept-Encoding '';
|
||||||
|
proxy_set_header Referer \$http_referer;
|
||||||
|
proxy_set_header Cookie \$http_cookie;
|
||||||
|
proxy_set_header Host \$host;
|
||||||
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||||
|
EOF
|
||||||
|
sed -i "s@/data/wwwroot/default@${wwwroot_dir}/default@" ${nginx_install_dir}/conf/nginx.conf
|
||||||
|
sed -i "s@/data/wwwlogs@${wwwlogs_dir}@g" ${nginx_install_dir}/conf/nginx.conf
|
||||||
|
sed -i "s@^user www www@user ${run_user} ${run_group}@" ${nginx_install_dir}/conf/nginx.conf
|
||||||
|
|
||||||
|
# logrotate nginx log
|
||||||
|
cat > /etc/logrotate.d/nginx << EOF
|
||||||
|
${wwwlogs_dir}/*nginx.log {
|
||||||
|
daily
|
||||||
|
rotate 5
|
||||||
|
missingok
|
||||||
|
dateext
|
||||||
|
compress
|
||||||
|
notifempty
|
||||||
|
sharedscripts
|
||||||
|
postrotate
|
||||||
|
[ -e /var/run/nginx.pid ] && kill -USR1 \`cat /var/run/nginx.pid\`
|
||||||
|
endscript
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
popd > /dev/null
|
||||||
|
ldconfig
|
||||||
|
systemctl start nginx
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Nginx_lua_waf() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
[ ! -e "${nginx_install_dir}/sbin/nginx" ] && echo "${CWARNING}Nginx is not installed on your system! ${CEND}" && exit 1
|
||||||
|
if [ ! -e "/usr/local/lib/libluajit-5.1.so.2.1.0" ]; then
|
||||||
|
[ -e "/usr/local/lib/libluajit-5.1.so.2.0.5" ] && find /usr/local -name *luajit* | xargs rm -rf
|
||||||
|
src_url=${mirror_link}/oneinstack/src/luajit2-${luajit2_ver}.tar.gz && Download_src
|
||||||
|
tar xzf luajit2-${luajit2_ver}.tar.gz
|
||||||
|
pushd luajit2-${luajit2_ver}
|
||||||
|
make && make install
|
||||||
|
[ ! -e "/usr/local/lib/libluajit-5.1.so.2.1.0" ] && { echo "${CFAILURE}LuaJIT install failed! ${CEND}"; kill -9 $$; exit 1; }
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf luajit2-${luajit2_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
src_url=${mirror_link}/oneinstack/src/lua-resty-core-${lua_resty_core_ver}.tar.gz && Download_src
|
||||||
|
tar xzf lua-resty-core-${lua_resty_core_ver}.tar.gz
|
||||||
|
pushd lua-resty-core-${lua_resty_core_ver}
|
||||||
|
make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf lua-resty-core-${lua_resty_core_ver}
|
||||||
|
|
||||||
|
src_url=${mirror_link}/oneinstack/src/lua-resty-lrucache-${lua_resty_lrucache_ver}.tar.gz && Download_src
|
||||||
|
tar xzf lua-resty-lrucache-${lua_resty_lrucache_ver}.tar.gz
|
||||||
|
pushd lua-resty-lrucache-${lua_resty_lrucache_ver}
|
||||||
|
make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf lua-resty-lrucache-${lua_resty_lrucache_ver}
|
||||||
|
|
||||||
|
[ ! -h "/usr/local/share/lua/5.1" ] && { rm -rf /usr/local/share/lua/5.1 ; ln -s /usr/local/lib/lua /usr/local/share/lua/5.1; }
|
||||||
|
if [ ! -e "/usr/local/lib/lua/5.1/cjson.so" ]; then
|
||||||
|
src_url=${mirror_link}/oneinstack/src/lua-cjson-${lua_cjson_ver}.tar.gz && Download_src
|
||||||
|
tar xzf lua-cjson-${lua_cjson_ver}.tar.gz
|
||||||
|
pushd lua-cjson-${lua_cjson_ver}
|
||||||
|
sed -i 's@^LUA_INCLUDE_DIR.*@&/luajit-2.1@' Makefile
|
||||||
|
make && make install
|
||||||
|
[ ! -e "/usr/local/lib/lua/5.1/cjson.so" ] && { echo "${CFAILURE}lua-cjson install failed! ${CEND}"; kill -9 $$; exit 1; }
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
${nginx_install_dir}/sbin/nginx -V &> $$
|
||||||
|
nginx_configure_args_tmp=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'`
|
||||||
|
rm -rf $$
|
||||||
|
nginx_configure_args=`echo ${nginx_configure_args_tmp} | sed "s@--with-openssl=../openssl-\w.\w.\w\+ @--with-openssl=../openssl-${openssl11_ver} @" | sed "s@--with-pcre=../pcre-\w.\w\+ @--with-pcre=../pcre-${pcre_ver} @"`
|
||||||
|
if [ -z "`echo ${nginx_configure_args} | grep lua-nginx-module`" ]; then
|
||||||
|
src_url=http://nginx.org/download/nginx-${nginx_ver}.tar.gz && Download_src
|
||||||
|
src_url=https://www.openssl.org/source/openssl-${openssl11_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/pcre-${pcre_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/ngx_devel_kit.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/lua-nginx-module-${lua_nginx_module_ver}.tar.gz && Download_src
|
||||||
|
tar xzf nginx-${nginx_ver}.tar.gz
|
||||||
|
tar xzf openssl-${openssl11_ver}.tar.gz
|
||||||
|
tar xzf pcre-${pcre_ver}.tar.gz
|
||||||
|
tar xzf ngx_devel_kit.tar.gz
|
||||||
|
tar xzf lua-nginx-module-${lua_nginx_module_ver}.tar.gz
|
||||||
|
pushd nginx-${nginx_ver}
|
||||||
|
make clean
|
||||||
|
sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc # close debug
|
||||||
|
export LUAJIT_LIB=/usr/local/lib
|
||||||
|
export LUAJIT_INC=/usr/local/include/luajit-2.1
|
||||||
|
./configure ${nginx_configure_args} --with-ld-opt="-Wl,-rpath,/usr/local/lib" --add-module=../lua-nginx-module-${lua_nginx_module_ver} --add-module=../ngx_devel_kit
|
||||||
|
make -j ${THREAD}
|
||||||
|
if [ -f "objs/nginx" ]; then
|
||||||
|
/bin/mv ${nginx_install_dir}/sbin/nginx{,`date +%m%d`}
|
||||||
|
/bin/cp objs/nginx ${nginx_install_dir}/sbin/nginx
|
||||||
|
kill -USR2 `cat /var/run/nginx.pid`
|
||||||
|
sleep 1
|
||||||
|
kill -QUIT `cat /var/run/nginx.pid.oldbin`
|
||||||
|
popd > /dev/null
|
||||||
|
echo "${CSUCCESS}lua-nginx-module installed successfully! ${CEND}"
|
||||||
|
sed -i "s@^nginx_modules_options='\(.*\)'@nginx_modules_options=\'\1 --with-ld-opt=\"-Wl,-rpath,/usr/local/lib\" --add-module=../lua-nginx-module-${lua_nginx_module_ver} --add-module=../ngx_devel_kit\'@" ../options.conf
|
||||||
|
rm -rf nginx-${nginx_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}lua-nginx-module install failed! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
Tengine_lua_waf() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
[ ! -e "${tengine_install_dir}/sbin/nginx" ] && echo "${CWARNING}Tengine is not installed on your system! ${CEND}" && exit 1
|
||||||
|
if [ ! -e "/usr/local/lib/libluajit-5.1.so.2.1.0" ]; then
|
||||||
|
[ -e "/usr/local/lib/libluajit-5.1.so.2.0.5" ] && find /usr/local -name *luajit* | xargs rm -rf
|
||||||
|
src_url=${mirror_link}/oneinstack/src/luajit2-${luajit2_ver}.tar.gz && Download_src
|
||||||
|
tar xzf luajit2-${luajit2_ver}.tar.gz
|
||||||
|
pushd luajit2-${luajit2_ver}
|
||||||
|
make && make install
|
||||||
|
[ ! -e "/usr/local/lib/libluajit-5.1.so.2.1.0" ] && { echo "${CFAILURE}LuaJIT install failed! ${CEND}"; kill -9 $$; exit 1; }
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
if [ ! -e "/usr/local/lib/lua/5.1/cjson.so" ]; then
|
||||||
|
src_url=${mirror_link}/oneinstack/src/lua-cjson-${lua_cjson_ver}.tar.gz && Download_src
|
||||||
|
tar xzf lua-cjson-${lua_cjson_ver}.tar.gz
|
||||||
|
pushd lua-cjson-${lua_cjson_ver}
|
||||||
|
sed -i 's@^LUA_INCLUDE_DIR.*@&/luajit-2.1@' Makefile
|
||||||
|
make && make install
|
||||||
|
[ ! -e "/usr/local/lib/lua/5.1/cjson.so" ] && { echo "${CFAILURE}lua-cjson install failed! ${CEND}"; kill -9 $$; exit 1; }
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
${tengine_install_dir}/sbin/nginx -V &> $$
|
||||||
|
tengine_configure_args_tmp=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'`
|
||||||
|
rm -rf $$
|
||||||
|
tengine_configure_args=`echo ${tengine_configure_args_tmp} | sed "s@--with-openssl=../openssl-\w.\w.\w\+ @--with-openssl=../openssl-${openssl11_ver} @" | sed "s@--with-pcre=../pcre-\w.\w\+ @--with-pcre=../pcre-${pcre_ver} @"`
|
||||||
|
if [ -z "`echo ${tengine_configure_args} | grep lua`" ]; then
|
||||||
|
src_url=http://tengine.taobao.org/download/tengine-${tengine_ver}.tar.gz && Download_src
|
||||||
|
src_url=https://www.openssl.org/source/openssl-${openssl11_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/pcre-${pcre_ver}.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/ngx_devel_kit.tar.gz && Download_src
|
||||||
|
src_url=${mirror_link}/oneinstack/src/lua-nginx-module.tar.gz && Download_src
|
||||||
|
tar xzf tengine-${tengine_ver}.tar.gz
|
||||||
|
tar xzf openssl-${openssl11_ver}.tar.gz
|
||||||
|
tar xzf pcre-${pcre_ver}.tar.gz
|
||||||
|
tar xzf ngx_devel_kit.tar.gz
|
||||||
|
tar xzf lua-nginx-module.tar.gz
|
||||||
|
pushd tengine-${tengine_ver}
|
||||||
|
make clean
|
||||||
|
export LUAJIT_LIB=/usr/local/lib
|
||||||
|
export LUAJIT_INC=/usr/local/include/luajit-2.1
|
||||||
|
./configure ${tengine_configure_args} --with-ld-opt="-Wl,-rpath,/usr/local/lib" --add-module=../lua-nginx-module --add-module=../ngx_devel_kit
|
||||||
|
make -j ${THREAD}
|
||||||
|
if [ -f "objs/nginx" ]; then
|
||||||
|
/bin/mv ${tengine_install_dir}/sbin/nginx{,`date +%m%d`}
|
||||||
|
/bin/mv ${tengine_install_dir}/modules{,`date +%m%d`}
|
||||||
|
/bin/cp objs/nginx ${tengine_install_dir}/sbin/nginx
|
||||||
|
chmod +x ${tengine_install_dir}/sbin/*
|
||||||
|
make install
|
||||||
|
kill -USR2 `cat /var/run/nginx.pid`
|
||||||
|
sleep 1
|
||||||
|
kill -QUIT `cat /var/run/nginx.pid.oldbin`
|
||||||
|
popd > /dev/null
|
||||||
|
sed -i "s@^nginx_modules_options='\(.*\)'@nginx_modules_options=\'\1 --with-ld-opt=\"-Wl,-rpath,/usr/local/lib\" --add-module=../lua-nginx-module --add-module=../ngx_devel_kit\'@" ../options.conf
|
||||||
|
echo "${CSUCCESS}lua_module installed successfully! ${CEND}"
|
||||||
|
rm -rf tengine-${tengine_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}lua_module install failed! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
enable_lua_waf() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
. ../include/check_dir.sh
|
||||||
|
rm -f ngx_lua_waf.tar.gz
|
||||||
|
src_url=${mirror_link}/oneinstack/src/ngx_lua_waf.tar.gz && Download_src
|
||||||
|
tar xzf ngx_lua_waf.tar.gz -C ${web_install_dir}/conf
|
||||||
|
[ -e "${web_install_dir}/conf/resty" ] && /bin/mv ${web_install_dir}/conf/resty{,_bak}
|
||||||
|
sed -i "s@/usr/local/nginx@${web_install_dir}@g" ${web_install_dir}/conf/waf.conf
|
||||||
|
sed -i "s@/usr/local/nginx@${web_install_dir}@" ${web_install_dir}/conf/waf/config.lua
|
||||||
|
sed -i "s@/data/wwwlogs@${wwwlogs_dir}@" ${web_install_dir}/conf/waf/config.lua
|
||||||
|
[ -z "`grep 'include waf.conf;' ${web_install_dir}/conf/nginx.conf`" ] && sed -i "s@ vhost/\*.conf;@&\n include waf.conf;@" ${web_install_dir}/conf/nginx.conf
|
||||||
|
${web_install_dir}/sbin/nginx -t
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
service nginx reload
|
||||||
|
echo "${CSUCCESS}ngx_lua_waf enabled successfully! ${CEND}"
|
||||||
|
chown ${run_user}:${run_group} ${wwwlogs_dir}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}ngx_lua_waf enable failed! ${CEND}"
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
disable_lua_waf() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
. ../include/check_dir.sh
|
||||||
|
sed -i '/include waf.conf;/d' ${web_install_dir}/conf/nginx.conf
|
||||||
|
${web_install_dir}/sbin/nginx -t
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
rm -rf ${web_install_dir}/conf/{waf,waf.conf}
|
||||||
|
service nginx reload
|
||||||
|
echo "${CSUCCESS}ngx_lua_waf disabled successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}ngx_lua_waf disable failed! ${CEND}"
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_Nodejs() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
tar xzf node-v${nodejs_ver}-linux-${SYS_ARCH_n}.tar.gz
|
||||||
|
/bin/mv node-v${nodejs_ver}-linux-${SYS_ARCH_n} ${nodejs_install_dir}
|
||||||
|
if [ -e "${nodejs_install_dir}/bin/node" ]; then
|
||||||
|
cat > /etc/profile.d/nodejs.sh << EOF
|
||||||
|
export NODE_HOME=${nodejs_install_dir}
|
||||||
|
export PATH=\$NODE_HOME/bin:\$PATH
|
||||||
|
EOF
|
||||||
|
. /etc/profile
|
||||||
|
echo "${CSUCCESS}Nodejs installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}Nodejs install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_Nodejs() {
|
||||||
|
if [ -e "${nodejs_install_dir}" ]; then
|
||||||
|
rm -rf ${nodejs_install_dir} /etc/profile.d/nodejs.sh
|
||||||
|
echo "${CMSG}Nodejs uninstall completed! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_OpenJDK11() {
|
||||||
|
if [ "${Family}" == 'rhel' ]; then
|
||||||
|
yum -y install java-11-openjdk-devel
|
||||||
|
JAVA_HOME=/usr/lib/jvm/java-11-openjdk
|
||||||
|
elif [ "${Family}" == 'debian' ]; then
|
||||||
|
apt-get --no-install-recommends -y install openjdk-11-jdk
|
||||||
|
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-${SYS_ARCH}
|
||||||
|
elif [ "${Family}" == 'ubuntu' ]; then
|
||||||
|
if [[ "${Ubuntu_ver}" =~ ^16$ ]]; then
|
||||||
|
cat ${oneinstack_dir}/src/adoptium.key | sudo apt-key add -
|
||||||
|
apt-add-repository --yes https://mirrors.tuna.tsinghua.edu.cn/Adoptium/deb
|
||||||
|
apt -y update
|
||||||
|
apt-get --no-install-recommends -y install temurin-11-jdk
|
||||||
|
JAVA_HOME=/usr/lib/jvm/temurin-11-jdk-${SYS_ARCH}
|
||||||
|
else
|
||||||
|
apt-get --no-install-recommends -y install openjdk-11-jdk
|
||||||
|
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-${SYS_ARCH}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -e "${JAVA_HOME}/bin/java" ]; then
|
||||||
|
cat > /etc/profile.d/openjdk.sh << EOF
|
||||||
|
export JAVA_HOME=${JAVA_HOME}
|
||||||
|
export CLASSPATH=\$JAVA_HOME/lib/tools.jar:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib
|
||||||
|
EOF
|
||||||
|
. /etc/profile.d/openjdk.sh
|
||||||
|
echo "${CSUCCESS}OpenJDK11 installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}OpenJDK11 install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_OpenJDK17() {
|
||||||
|
if [ "${Family}" == 'rhel' ]; then
|
||||||
|
if [[ "${RHEL_ver}" =~ ^7$ ]]; then
|
||||||
|
cat > /etc/yum.repos.d/adoptium.repo << EOF
|
||||||
|
[Adoptium]
|
||||||
|
name=Adoptium
|
||||||
|
baseurl=https://mirrors.tuna.tsinghua.edu.cn/Adoptium/rpm/rhel\$releasever-\$basearch/
|
||||||
|
enabled=1
|
||||||
|
gpgcheck=0
|
||||||
|
EOF
|
||||||
|
yum -y install temurin-17-jdk
|
||||||
|
JAVA_HOME=/usr/lib/jvm/temurin-17-jdk
|
||||||
|
else
|
||||||
|
yum -y install java-17-openjdk-devel
|
||||||
|
JAVA_HOME=/usr/lib/jvm/java-17-openjdk
|
||||||
|
fi
|
||||||
|
elif [ "${Family}" == 'debian' ]; then
|
||||||
|
if [[ "${Debian_ver}" =~ ^9$|^10$ ]]; then
|
||||||
|
#wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | apt-key add -
|
||||||
|
cat ${oneinstack_dir}/src/adoptium.key | sudo apt-key add -
|
||||||
|
apt-add-repository --yes https://mirrors.tuna.tsinghua.edu.cn/Adoptium/deb
|
||||||
|
apt -y update
|
||||||
|
apt-get --no-install-recommends -y install temurin-17-jdk
|
||||||
|
JAVA_HOME=/usr/lib/jvm/temurin-17-jdk-${SYS_ARCH}
|
||||||
|
else
|
||||||
|
apt-get --no-install-recommends -y install openjdk-17-jdk
|
||||||
|
JAVA_HOME=/usr/lib/jvm/java-17-openjdk-${SYS_ARCH}
|
||||||
|
fi
|
||||||
|
elif [ "${Family}" == 'ubuntu' ]; then
|
||||||
|
if [[ "${Ubuntu_ver}" =~ ^16$ ]]; then
|
||||||
|
cat ${oneinstack_dir}/src/adoptium.key | sudo apt-key add -
|
||||||
|
apt-add-repository --yes https://mirrors.tuna.tsinghua.edu.cn/Adoptium/deb
|
||||||
|
apt -y update
|
||||||
|
apt-get --no-install-recommends -y install temurin-17-jdk
|
||||||
|
JAVA_HOME=/usr/lib/jvm/temurin-17-jdk-${SYS_ARCH}
|
||||||
|
else
|
||||||
|
apt-get --no-install-recommends -y install openjdk-17-jdk
|
||||||
|
JAVA_HOME=/usr/lib/jvm/java-17-openjdk-${SYS_ARCH}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -e "${JAVA_HOME}/bin/java" ]; then
|
||||||
|
cat > /etc/profile.d/openjdk.sh << EOF
|
||||||
|
export JAVA_HOME=${JAVA_HOME}
|
||||||
|
export CLASSPATH=\$JAVA_HOME/lib/tools.jar:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib
|
||||||
|
EOF
|
||||||
|
. /etc/profile.d/openjdk.sh
|
||||||
|
echo "${CSUCCESS}OpenJDK17 installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}OpenJDK17 install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_OpenJDK8() {
|
||||||
|
if [ "${Family}" == 'rhel' ]; then
|
||||||
|
yum -y install java-1.8.0-openjdk-devel
|
||||||
|
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
|
||||||
|
elif [ "${Family}" == 'debian' ]; then
|
||||||
|
if [[ "${Debian_ver}" =~ ^10$|^11$|^12$ ]]; then
|
||||||
|
#wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | apt-key add -
|
||||||
|
cat ${oneinstack_dir}/src/adoptium.key | sudo apt-key add -
|
||||||
|
apt-add-repository --yes https://mirrors.tuna.tsinghua.edu.cn/Adoptium/deb
|
||||||
|
apt -y update
|
||||||
|
apt-get --no-install-recommends -y install temurin-8-jdk
|
||||||
|
JAVA_HOME=/usr/lib/jvm/temurin-8-jdk-${SYS_ARCH}
|
||||||
|
elif [[ "${Debian_ver}" =~ ^9$ ]]; then
|
||||||
|
apt-get --no-install-recommends -y install openjdk-8-jdk
|
||||||
|
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-${SYS_ARCH}
|
||||||
|
fi
|
||||||
|
elif [ "${Family}" == 'ubuntu' ]; then
|
||||||
|
apt-get --no-install-recommends -y install openjdk-8-jdk
|
||||||
|
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-${SYS_ARCH}
|
||||||
|
fi
|
||||||
|
if [ -e "${JAVA_HOME}/bin/java" ]; then
|
||||||
|
cat > /etc/profile.d/openjdk.sh << EOF
|
||||||
|
export JAVA_HOME=${JAVA_HOME}
|
||||||
|
export CLASSPATH=\$JAVA_HOME/lib/tools.jar:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib
|
||||||
|
EOF
|
||||||
|
. /etc/profile.d/openjdk.sh
|
||||||
|
echo "${CSUCCESS}OpenJDK8 installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}OpenJDK8 install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_OpenResty() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
|
||||||
|
tar xzf pcre-${pcre_ver}.tar.gz
|
||||||
|
tar xzf openresty-${openresty_ver}.tar.gz
|
||||||
|
tar xzf openssl-${openssl11_ver}.tar.gz
|
||||||
|
pushd openresty-${openresty_ver} > /dev/null
|
||||||
|
|
||||||
|
# close debug
|
||||||
|
sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' bundle/nginx-${openresty_ver%.*}/auto/cc/gcc # close debug
|
||||||
|
|
||||||
|
[ ! -d "${openresty_install_dir}" ] && mkdir -p ${openresty_install_dir}
|
||||||
|
./configure --prefix=${openresty_install_dir} --user=${run_user} --group=${run_group} --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-${openssl11_ver} --with-pcre=../pcre-${pcre_ver} --with-pcre-jit --with-ld-opt='-ljemalloc -Wl,-u,pcre_version' ${nginx_modules_options}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
if [ -e "${openresty_install_dir}/nginx/conf/nginx.conf" ]; then
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf pcre-${pcre_ver}* openssl-${openssl11_ver}* openresty-${openresty_ver}* ${openresty_install_dir}*
|
||||||
|
echo "${CSUCCESS}OpenResty installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
rm -rf pcre-${pcre_ver}* openssl-${openssl11_ver}* openresty-${openresty_ver}* ${openresty_install_dir}*
|
||||||
|
echo "${CFAILURE}OpenResty install failed, Please Contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${openresty_install_dir}/nginx/sbin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${openresty_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${openresty_install_dir}/nginx/sbin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
/bin/cp ../init.d/nginx.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/nginx@${openresty_install_dir}/nginx@g" /lib/systemd/system/nginx.service
|
||||||
|
systemctl enable nginx
|
||||||
|
|
||||||
|
mv ${openresty_install_dir}/nginx/conf/nginx.conf{,_bk}
|
||||||
|
if [ "${apache_flag}" == 'y' ] || [ -e "${apache_install_dir}/bin/httpd" ]; then
|
||||||
|
/bin/cp ../config/nginx_apache.conf ${openresty_install_dir}/nginx/conf/nginx.conf
|
||||||
|
elif { [[ ${tomcat_option} =~ ^[1-4]$ ]] || [ -e "${tomcat_install_dir}/conf/server.xml" ]; } && { [[ ! ${php_option} =~ ^[1-9]$|^1[0-1]$ ]] && [ ! -e "${php_install_dir}/bin/php" ]; }; then
|
||||||
|
/bin/cp ../config/nginx_tomcat.conf ${openresty_install_dir}/nginx/conf/nginx.conf
|
||||||
|
else
|
||||||
|
/bin/cp ../config/nginx.conf ${openresty_install_dir}/nginx/conf/nginx.conf
|
||||||
|
[[ "${php_option}" =~ ^[1-9]$|^1[0-1]$ ]] && [ -z "`grep '/php-fpm_status' ${openresty_install_dir}/nginx/conf/nginx.conf`" ] && sed -i "s@index index.html index.php;@index index.html index.php;\n location ~ /php-fpm_status {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi.conf;\n allow 127.0.0.1;\n deny all;\n }@" ${openresty_install_dir}/nginx/conf/nginx.conf
|
||||||
|
fi
|
||||||
|
cat > ${openresty_install_dir}/nginx/conf/proxy.conf << EOF
|
||||||
|
proxy_connect_timeout 300s;
|
||||||
|
proxy_send_timeout 900;
|
||||||
|
proxy_read_timeout 900;
|
||||||
|
proxy_buffer_size 32k;
|
||||||
|
proxy_buffers 4 64k;
|
||||||
|
proxy_busy_buffers_size 128k;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_hide_header Vary;
|
||||||
|
proxy_set_header Accept-Encoding '';
|
||||||
|
proxy_set_header Referer \$http_referer;
|
||||||
|
proxy_set_header Cookie \$http_cookie;
|
||||||
|
proxy_set_header Host \$host;
|
||||||
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||||
|
EOF
|
||||||
|
sed -i "s@/data/wwwroot/default@${wwwroot_dir}/default@" ${openresty_install_dir}/nginx/conf/nginx.conf
|
||||||
|
sed -i "s@/data/wwwlogs@${wwwlogs_dir}@g" ${openresty_install_dir}/nginx/conf/nginx.conf
|
||||||
|
sed -i "s@^user www www@user ${run_user} ${run_group}@" ${openresty_install_dir}/nginx/conf/nginx.conf
|
||||||
|
|
||||||
|
# logrotate nginx log
|
||||||
|
cat > /etc/logrotate.d/nginx << EOF
|
||||||
|
${wwwlogs_dir}/*nginx.log {
|
||||||
|
daily
|
||||||
|
rotate 5
|
||||||
|
missingok
|
||||||
|
dateext
|
||||||
|
compress
|
||||||
|
notifempty
|
||||||
|
sharedscripts
|
||||||
|
postrotate
|
||||||
|
[ -e /var/run/nginx.pid ] && kill -USR1 \`cat /var/run/nginx.pid\`
|
||||||
|
endscript
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
popd > /dev/null
|
||||||
|
ldconfig
|
||||||
|
systemctl start nginx
|
||||||
|
}
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
if openssl version | grep -Eqi 'OpenSSL 1.0.2*'; then
|
||||||
|
php5_with_openssl="--with-openssl"
|
||||||
|
php70_with_openssl="--with-openssl"
|
||||||
|
php71_with_openssl="--with-openssl"
|
||||||
|
php72_with_openssl="--with-openssl"
|
||||||
|
php73_with_openssl="--with-openssl"
|
||||||
|
php74_with_openssl="--with-openssl"
|
||||||
|
php80_with_openssl="--with-openssl"
|
||||||
|
php81_with_openssl="--with-openssl"
|
||||||
|
php82_with_openssl="--with-openssl"
|
||||||
|
php83_with_openssl="--with-openssl"
|
||||||
|
|
||||||
|
php5_with_ssl="--with-ssl"
|
||||||
|
php70_with_ssl="--with-ssl"
|
||||||
|
php71_with_ssl="--with-ssl"
|
||||||
|
php72_with_ssl="--with-ssl"
|
||||||
|
php73_with_ssl="--with-ssl"
|
||||||
|
php74_with_ssl="--with-ssl"
|
||||||
|
php80_with_ssl="--with-ssl"
|
||||||
|
php81_with_ssl="--with-ssl"
|
||||||
|
php82_with_ssl="--with-ssl"
|
||||||
|
php83_with_ssl="--with-ssl"
|
||||||
|
|
||||||
|
php5_with_curl="--with-curl"
|
||||||
|
php70_with_curl="--with-curl"
|
||||||
|
php71_with_curl="--with-curl"
|
||||||
|
php72_with_curl="--with-curl"
|
||||||
|
php73_with_curl="--with-curl"
|
||||||
|
php74_with_curl="--with-curl"
|
||||||
|
php80_with_curl="--with-curl"
|
||||||
|
php81_with_curl="--with-curl"
|
||||||
|
php82_with_curl="--with-curl"
|
||||||
|
php83_with_curl="--with-curl"
|
||||||
|
elif openssl version | grep -Eqi 'OpenSSL 1.1.*'; then
|
||||||
|
php5_with_openssl="--with-openssl=${openssl_install_dir}"
|
||||||
|
php70_with_openssl="--with-openssl"
|
||||||
|
php71_with_openssl="--with-openssl"
|
||||||
|
php72_with_openssl="--with-openssl"
|
||||||
|
php73_with_openssl="--with-openssl"
|
||||||
|
php74_with_openssl="--with-openssl"
|
||||||
|
php80_with_openssl="--with-openssl"
|
||||||
|
php81_with_openssl="--with-openssl"
|
||||||
|
php82_with_openssl="--with-openssl"
|
||||||
|
php83_with_openssl="--with-openssl"
|
||||||
|
|
||||||
|
php5_with_ssl="--with-ssl=${openssl_install_dir}"
|
||||||
|
php70_with_ssl="--with-ssl"
|
||||||
|
php71_with_ssl="--with-ssl"
|
||||||
|
php72_with_ssl="--with-ssl"
|
||||||
|
php73_with_ssl="--with-ssl"
|
||||||
|
php74_with_ssl="--with-ssl"
|
||||||
|
php80_with_ssl="--with-ssl"
|
||||||
|
php81_with_ssl="--with-ssl"
|
||||||
|
php82_with_ssl="--with-ssl"
|
||||||
|
php83_with_ssl="--with-ssl"
|
||||||
|
|
||||||
|
php5_with_curl="--with-curl=${curl_install_dir}"
|
||||||
|
php70_with_curl="--with-curl"
|
||||||
|
php71_with_curl="--with-curl"
|
||||||
|
php72_with_curl="--with-curl"
|
||||||
|
php73_with_curl="--with-curl"
|
||||||
|
php74_with_curl="--with-curl"
|
||||||
|
php80_with_curl="--with-curl"
|
||||||
|
php81_with_curl="--with-curl"
|
||||||
|
php82_with_curl="--with-curl"
|
||||||
|
php83_with_curl="--with-curl"
|
||||||
|
[[ ${php_option} =~ ^[1-4]$ ]] || [[ "${mphp_ver}" =~ ^5[3-6]$ ]] && with_old_openssl_flag=y
|
||||||
|
elif openssl version | grep -Eqi 'OpenSSL 3.*'; then
|
||||||
|
php5_with_openssl="--with-openssl=${openssl_install_dir}"
|
||||||
|
php70_with_openssl="--with-openssl=${openssl_install_dir}"
|
||||||
|
php71_with_openssl="--with-openssl"
|
||||||
|
php72_with_openssl="--with-openssl"
|
||||||
|
php73_with_openssl="--with-openssl"
|
||||||
|
php74_with_openssl="--with-openssl"
|
||||||
|
php80_with_openssl="--with-openssl"
|
||||||
|
php81_with_openssl="--with-openssl"
|
||||||
|
php82_with_openssl="--with-openssl"
|
||||||
|
php83_with_openssl="--with-openssl"
|
||||||
|
|
||||||
|
php5_with_ssl="--with-ssl=${openssl_install_dir}"
|
||||||
|
php70_with_ssl="--with-ssl=${openssl_install_dir}"
|
||||||
|
php71_with_ssl="--with-ssl"
|
||||||
|
php72_with_ssl="--with-ssl"
|
||||||
|
php73_with_ssl="--with-ssl"
|
||||||
|
php74_with_ssl="--with-ssl"
|
||||||
|
php80_with_ssl="--with-ssl"
|
||||||
|
php81_with_ssl="--with-ssl"
|
||||||
|
php82_with_ssl="--with-ssl"
|
||||||
|
php83_with_ssl="--with-ssl"
|
||||||
|
|
||||||
|
php5_with_curl="--with-curl=${curl_install_dir}"
|
||||||
|
php70_with_curl="--with-curl=${curl_install_dir}"
|
||||||
|
php71_with_curl="--with-curl"
|
||||||
|
php72_with_curl="--with-curl"
|
||||||
|
php73_with_curl="--with-curl"
|
||||||
|
php74_with_curl="--with-curl"
|
||||||
|
php80_with_curl="--with-curl"
|
||||||
|
php81_with_curl="--with-curl"
|
||||||
|
php82_with_curl="--with-curl"
|
||||||
|
php83_with_curl="--with-curl"
|
||||||
|
[[ ${php_option} =~ ^[1-5]$ ]] || [[ "${mphp_ver}" =~ ^5[3-6]$|^70$ ]] && with_old_openssl_flag=y
|
||||||
|
else
|
||||||
|
php5_with_openssl="--with-openssl=${openssl_install_dir}"
|
||||||
|
php70_with_openssl="--with-openssl=${openssl_install_dir}"
|
||||||
|
php71_with_openssl="--with-openssl=${openssl_install_dir}"
|
||||||
|
php72_with_openssl="--with-openssl=${openssl_install_dir}"
|
||||||
|
php73_with_openssl="--with-openssl=${openssl_install_dir}"
|
||||||
|
php74_with_openssl="--with-openssl=${openssl_install_dir} --with-openssl-dir=${openssl_install_dir}"
|
||||||
|
php80_with_openssl="--with-openssl=${openssl_install_dir} --with-openssl-dir=${openssl_install_dir}"
|
||||||
|
php81_with_openssl="--with-openssl=${openssl_install_dir} --with-openssl-dir=${openssl_install_dir}"
|
||||||
|
php82_with_openssl="--with-openssl=${openssl_install_dir} --with-openssl-dir=${openssl_install_dir}"
|
||||||
|
php83_with_openssl="--with-openssl=${openssl_install_dir} --with-openssl-dir=${openssl_install_dir}"
|
||||||
|
|
||||||
|
php5_with_ssl="--with-ssl=${openssl_install_dir}"
|
||||||
|
php70_with_ssl="--with-ssl=${openssl_install_dir}"
|
||||||
|
php71_with_ssl="--with-ssl=${openssl_install_dir}"
|
||||||
|
php72_with_ssl="--with-ssl=${openssl_install_dir}"
|
||||||
|
php73_with_ssl="--with-ssl=${openssl_install_dir}"
|
||||||
|
php74_with_ssl="--with-ssl=${openssl_install_dir}"
|
||||||
|
php80_with_ssl="--with-ssl=${openssl_install_dir}"
|
||||||
|
php81_with_ssl="--with-ssl=${openssl_install_dir}"
|
||||||
|
php82_with_ssl="--with-ssl=${openssl_install_dir}"
|
||||||
|
php83_with_ssl="--with-ssl=${openssl_install_dir}"
|
||||||
|
|
||||||
|
php5_with_curl="--with-curl=${curl_install_dir}"
|
||||||
|
php70_with_curl="--with-curl=${curl_install_dir}"
|
||||||
|
php71_with_curl="--with-curl=${curl_install_dir}"
|
||||||
|
php72_with_curl="--with-curl=${curl_install_dir}"
|
||||||
|
php73_with_curl="--with-curl=${curl_install_dir}"
|
||||||
|
php74_with_curl="--with-curl=${curl_install_dir}"
|
||||||
|
php80_with_curl="--with-curl=${curl_install_dir}"
|
||||||
|
php81_with_curl="--with-curl=${curl_install_dir}"
|
||||||
|
php82_with_curl="--with-curl=${curl_install_dir}"
|
||||||
|
php83_with_curl="--with-curl=${curl_install_dir}"
|
||||||
|
with_old_openssl_flag=y
|
||||||
|
fi
|
||||||
|
|
||||||
|
Install_openSSL() {
|
||||||
|
if [ "${with_old_openssl_flag}" == 'y' ]; then
|
||||||
|
if [ ! -e "${openssl_install_dir}/lib/libssl.a" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
tar xzf openssl-${openssl_ver}.tar.gz
|
||||||
|
pushd openssl-${openssl_ver} > /dev/null
|
||||||
|
make clean
|
||||||
|
./config -Wl,-rpath=${openssl_install_dir}/lib -fPIC --prefix=${openssl_install_dir} --openssldir=${openssl_install_dir}
|
||||||
|
make depend
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${openssl_install_dir}/lib/libcrypto.a" ]; then
|
||||||
|
echo "${CSUCCESS}openSSL installed successfully! ${CEND}"
|
||||||
|
/bin/cp cacert.pem ${openssl_install_dir}/cert.pem
|
||||||
|
rm -rf openssl-${openssl_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}openSSL install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_pecl_calendar() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
src_url=https://secure.php.net/distributions/php-${PHP_detail_ver}.tar.gz && Download_src
|
||||||
|
tar xzf php-${PHP_detail_ver}.tar.gz
|
||||||
|
pushd php-${PHP_detail_ver}/ext/calendar > /dev/null
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/calendar.so" ]; then
|
||||||
|
echo 'extension=calendar.so' > ${php_install_dir}/etc/php.d/04-calendar.ini
|
||||||
|
echo "${CSUCCESS}PHP calendar module installed successfully! ${CEND}"
|
||||||
|
rm -rf php-${PHP_detail_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP calendar module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_calendar() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/04-calendar.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/04-calendar.ini
|
||||||
|
echo; echo "${CMSG}PHP calendar module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP calendar module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_pecl_fileinfo() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
src_url=https://secure.php.net/distributions/php-${PHP_detail_ver}.tar.gz && Download_src
|
||||||
|
tar xzf php-${PHP_detail_ver}.tar.gz
|
||||||
|
pushd php-${PHP_detail_ver}/ext/fileinfo > /dev/null
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config
|
||||||
|
sed -i 's@^CFLAGS =.*@CFLAGS = -std=c99 -g@' Makefile
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/fileinfo.so" ]; then
|
||||||
|
echo 'extension=fileinfo.so' > ${php_install_dir}/etc/php.d/04-fileinfo.ini
|
||||||
|
echo "${CSUCCESS}PHP fileinfo module installed successfully! ${CEND}"
|
||||||
|
rm -rf php-${PHP_detail_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP fileinfo module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_fileinfo() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/04-fileinfo.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/04-fileinfo.ini
|
||||||
|
echo; echo "${CMSG}PHP fileinfo module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP fileinfo module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_pecl_imap() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
if [ "${RHEL_ver}" == '9' ]; then
|
||||||
|
cat > /etc/yum.repos.d/remi.repo << EOF
|
||||||
|
[remi]
|
||||||
|
name=Remi's RPM repository for Enterprise Linux 9 - \$basearch
|
||||||
|
mirrorlist=http://cdn.remirepo.net/enterprise/9/remi/\$basearch/mirror
|
||||||
|
enabled=0
|
||||||
|
gpgcheck=0
|
||||||
|
EOF
|
||||||
|
dnf -y --enablerepo=remi install uw-imap-devel
|
||||||
|
else
|
||||||
|
yum -y install libc-client-devel
|
||||||
|
[ ! -e /usr/lib/libc-client.so ] && ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
apt-get -y install libc-client2007e-dev
|
||||||
|
fi
|
||||||
|
phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
src_url=https://secure.php.net/distributions/php-${PHP_detail_ver}.tar.gz && Download_src
|
||||||
|
tar xzf php-${PHP_detail_ver}.tar.gz
|
||||||
|
pushd php-${PHP_detail_ver}/ext/imap > /dev/null
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config --with-kerberos --with-imap --with-imap-ssl
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/imap.so" ]; then
|
||||||
|
echo 'extension=imap.so' > ${php_install_dir}/etc/php.d/04-imap.ini
|
||||||
|
echo "${CSUCCESS}PHP imap module installed successfully! ${CEND}"
|
||||||
|
rm -rf php-${PHP_detail_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP imap module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_imap() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/04-imap.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/04-imap.ini
|
||||||
|
echo; echo "${CMSG}PHP imap module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP imap module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_pecl_ldap() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
src_url=https://secure.php.net/distributions/php-${PHP_detail_ver}.tar.gz && Download_src
|
||||||
|
tar xzf php-${PHP_detail_ver}.tar.gz
|
||||||
|
pushd php-${PHP_detail_ver}/ext/ldap > /dev/null
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
yum -y install openldap-devel
|
||||||
|
else
|
||||||
|
apt-get -y install libldap2-dev
|
||||||
|
ln -s /usr/lib/${ARCH}-linux-gnu/libldap.so /usr/lib/
|
||||||
|
ln -s /usr/lib/${ARCH}-linux-gnu/liblber.so /usr/lib/
|
||||||
|
fi
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config --with-ldap --with-libdir=lib64
|
||||||
|
else
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config --with-ldap --with-libdir=lib/x86_64-linux-gnu
|
||||||
|
fi
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/ldap.so" ]; then
|
||||||
|
echo 'extension=ldap.so' > ${php_install_dir}/etc/php.d/04-ldap.ini
|
||||||
|
echo "${CSUCCESS}PHP ldap module installed successfully! ${CEND}"
|
||||||
|
rm -rf php-${PHP_detail_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP ldap module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_ldap() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/04-ldap.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/04-ldap.ini
|
||||||
|
echo; echo "${CMSG}PHP ldap module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP ldap module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_pecl_mongodb() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
|
||||||
|
if [[ "$(${php_install_dir}/bin/php-config --version | awk -F. '{print $1$2}')" =~ ^5[3-4]$ ]]; then
|
||||||
|
src_url=https://pecl.php.net/get/mongo-${pecl_mongo_ver}.tgz && Download_src
|
||||||
|
tar xzf mongo-${pecl_mongo_ver}.tgz
|
||||||
|
pushd mongo-${pecl_mongo_ver} > /dev/null
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/mongo.so" ]; then
|
||||||
|
echo 'extension=mongo.so' > ${php_install_dir}/etc/php.d/07-mongo.ini
|
||||||
|
rm -rf mongo-${pecl_mongo_ver}
|
||||||
|
echo "${CSUCCESS}PHP mongo module installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP mongo module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ "$(${php_install_dir}/bin/php-config --version | awk -F. '{print $1$2}')" =~ ^7[0-2]$ ]]; then
|
||||||
|
src_url=https://pecl.php.net/get/mongodb-${pecl_mongodb_oldver}.tgz && Download_src
|
||||||
|
tar xzf mongodb-${pecl_mongodb_oldver}.tgz
|
||||||
|
pushd mongodb-${pecl_mongodb_oldver} > /dev/null
|
||||||
|
else
|
||||||
|
src_url=https://pecl.php.net/get/mongodb-${pecl_mongodb_ver}.tgz && Download_src
|
||||||
|
tar xzf mongodb-${pecl_mongodb_ver}.tgz
|
||||||
|
pushd mongodb-${pecl_mongodb_ver} > /dev/null
|
||||||
|
fi
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/mongodb.so" ]; then
|
||||||
|
echo 'extension=mongodb.so' > ${php_install_dir}/etc/php.d/07-mongodb.ini
|
||||||
|
echo "${CSUCCESS}PHP mongodb module installed successfully! ${CEND}"
|
||||||
|
rm -rf mongodb-${pecl_mongodb_oldver} mongodb-${pecl_mongodb_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP mongodb module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_mongodb() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/07-mongo.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/07-mongo.ini
|
||||||
|
echo; echo "${CMSG}PHP mongo module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP mongo module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/07-mongodb.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/07-mongodb.ini
|
||||||
|
echo; echo "${CMSG}PHP mongodb module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP mongodb module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_pecl_pgsql() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
tar xzf php-${PHP_detail_ver}.tar.gz
|
||||||
|
pushd php-${PHP_detail_ver}/ext/pgsql > /dev/null
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-pgsql=${pgsql_install_dir} --with-php-config=${php_install_dir}/bin/php-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
pushd php-${PHP_detail_ver}/ext/pdo_pgsql > /dev/null
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-pdo-pgsql=${pgsql_install_dir} --with-php-config=${php_install_dir}/bin/php-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/pgsql.so" -a -f "${phpExtensionDir}/pdo_pgsql.so" ]; then
|
||||||
|
echo 'extension=pgsql.so' > ${php_install_dir}/etc/php.d/07-pgsql.ini
|
||||||
|
echo 'extension=pdo_pgsql.so' >> ${php_install_dir}/etc/php.d/07-pgsql.ini
|
||||||
|
echo "${CSUCCESS}PHP pgsql module installed successfully! ${CEND}"
|
||||||
|
rm -rf php-${PHP_detail_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP pgsql module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_pgsql() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/07-pgsql.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/07-pgsql.ini
|
||||||
|
echo; echo "${CMSG}PHP pgsql module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP pgsql module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_pecl_phalcon() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
PHP_main_ver=${PHP_detail_ver%.*}
|
||||||
|
phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
|
||||||
|
if [[ "${PHP_main_ver}" =~ ^7.[2-4]$|^8.3$ ]]; then
|
||||||
|
src_url=https://pecl.php.net/get/phalcon-${phalcon_ver}.tgz && Download_src
|
||||||
|
tar xzf phalcon-${phalcon_ver}.tgz
|
||||||
|
pushd phalcon-${phalcon_ver} > /dev/null
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
echo "${CMSG}It may take a few minutes... ${CEND}"
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
elif [[ "${PHP_main_ver}" =~ ^5.[5-6]$|^7.[0-1]$ ]]; then
|
||||||
|
src_url=${mirror_link}/oneinstack/src/cphalcon-${phalcon_oldver}.tar.gz && Download_src
|
||||||
|
tar xzf cphalcon-${phalcon_oldver}.tar.gz
|
||||||
|
pushd cphalcon-${phalcon_oldver}/build > /dev/null
|
||||||
|
echo "${CMSG}It may take a few minutes... ${CEND}"
|
||||||
|
./install --phpize ${php_install_dir}/bin/phpize --php-config ${php_install_dir}/bin/php-config --arch 64bits
|
||||||
|
popd > /dev/null
|
||||||
|
else
|
||||||
|
echo "${CWARNING}Your php ${PHP_detail_ver} does not support phalcon! ${CEND}"
|
||||||
|
fi
|
||||||
|
if [ -f "${phpExtensionDir}/phalcon.so" ]; then
|
||||||
|
echo 'extension=phalcon.so' > ${php_install_dir}/etc/php.d/04-phalcon.ini
|
||||||
|
echo "${CSUCCESS}PHP phalcon module installed successfully! ${CEND}"
|
||||||
|
rm -rf cphalcon-${phalcon_oldver} phalcon-${phalcon_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP phalcon module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_phalcon() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/04-phalcon.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/04-phalcon.ini
|
||||||
|
echo; echo "${CMSG}PHP phalcon module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP phalcon module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_pecl_swoole() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
PHP_main_ver=${PHP_detail_ver%.*}
|
||||||
|
if [[ "${PHP_main_ver}" =~ ^5.[3-6]$ ]]; then
|
||||||
|
src_url=https://pecl.php.net/get/swoole-1.10.5.tgz && Download_src
|
||||||
|
tar xzf swoole-1.10.5.tgz
|
||||||
|
pushd swoole-1.10.5 > /dev/null
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config --enable-openssl --with-openssl-dir=${openssl_install_dir}
|
||||||
|
elif [[ "${PHP_main_ver}" =~ ^7.[0-1]$ ]]; then
|
||||||
|
src_url=https://pecl.php.net/get/swoole-4.5.2.tgz && Download_src
|
||||||
|
tar xzf swoole-4.5.2.tgz
|
||||||
|
pushd swoole-4.5.2 > /dev/null
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config --enable-openssl --with-openssl-dir=${openssl_install_dir}
|
||||||
|
elif [[ "${PHP_main_ver}" =~ ^7.[2-4]$ ]]; then
|
||||||
|
src_url=https://pecl.php.net/get/swoole-${swoole_oldver}.tgz && Download_src
|
||||||
|
tar xzf swoole-${swoole_oldver}.tgz
|
||||||
|
pushd swoole-${swoole_oldver} > /dev/null
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config --enable-openssl --with-openssl-dir=${openssl_install_dir} --enable-http2 --enable-swoole-json --enable-swoole-curl
|
||||||
|
else
|
||||||
|
src_url=https://pecl.php.net/get/swoole-${swoole_ver}.tgz && Download_src
|
||||||
|
tar xzf swoole-${swoole_ver}.tgz
|
||||||
|
pushd swoole-${swoole_ver} > /dev/null
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config --enable-openssl --with-openssl-dir=${openssl_install_dir} --enable-http2 --enable-swoole-json --enable-swoole-curl
|
||||||
|
fi
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/swoole.so" ]; then
|
||||||
|
echo 'extension=swoole.so' > ${php_install_dir}/etc/php.d/06-swoole.ini
|
||||||
|
echo "${CSUCCESS}PHP swoole module installed successfully! ${CEND}"
|
||||||
|
rm -rf swoole-${swoole_ver} swoole-${swoole_oldver} swoole-1.10.5 swoole-4.5.2
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP swoole module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_swoole() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/06-swoole.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/06-swoole.ini
|
||||||
|
echo; echo "${CMSG}PHP swoole module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP swoole module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_pecl_xdebug() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
PHP_main_ver=${PHP_detail_ver%.*}
|
||||||
|
if [[ "${PHP_main_ver}" =~ ^7.[0-4]$|^80$ ]]; then
|
||||||
|
if [[ "${PHP_main_ver}" =~ ^7.[0-1]$ ]]; then
|
||||||
|
src_url=https://pecl.php.net/get/xdebug-${xdebug_oldver}.tgz && Download_src
|
||||||
|
tar xzf xdebug-${xdebug_oldver}.tgz
|
||||||
|
pushd xdebug-${xdebug_oldver} > /dev/null
|
||||||
|
else
|
||||||
|
src_url=https://pecl.php.net/get/xdebug-${xdebug_ver}.tgz && Download_src
|
||||||
|
tar xzf xdebug-${xdebug_ver}.tgz
|
||||||
|
pushd xdebug-${xdebug_ver} > /dev/null
|
||||||
|
fi
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/xdebug.so" ]; then
|
||||||
|
src_url=${mirror_link}/oneinstack/src/webgrind-master.zip && Download_src
|
||||||
|
unzip -q webgrind-master.zip
|
||||||
|
/bin/mv webgrind-master ${wwwroot_dir}/default/webgrind
|
||||||
|
[ ! -e /tmp/xdebug ] && { mkdir /tmp/xdebug; chown ${run_user}:${run_group} /tmp/xdebug; }
|
||||||
|
[ ! -e /tmp/webgrind ] && { mkdir /tmp/webgrind; chown ${run_user}:${run_group} /tmp/webgrind; }
|
||||||
|
chown -R ${run_user}:${run_group} ${wwwroot_dir}/default/webgrind
|
||||||
|
sed -i 's@static $storageDir.*@static $storageDir = "/tmp/webgrind";@' ${wwwroot_dir}/default/webgrind/config.php
|
||||||
|
sed -i 's@static $profilerDir.*@static $profilerDir = "/tmp/xdebug";@' ${wwwroot_dir}/default/webgrind/config.php
|
||||||
|
cat > ${php_install_dir}/etc/php.d/08-xdebug.ini << EOF
|
||||||
|
[xdebug]
|
||||||
|
zend_extension=xdebug.so
|
||||||
|
xdebug.trace_output_dir=/tmp/xdebug
|
||||||
|
xdebug.profiler_output_dir = /tmp/xdebug
|
||||||
|
xdebug.profiler_enable = On
|
||||||
|
xdebug.profiler_enable_trigger = 1
|
||||||
|
EOF
|
||||||
|
echo "${CSUCCESS}PHP xdebug module installed successfully! ${CEND}"
|
||||||
|
echo; echo "Webgrind URL: ${CMSG}http://{Public IP}/webgrind ${CEND}"
|
||||||
|
rm -rf xdebug-${xdebug_ver} xdebug-${xdebug_oldver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP xdebug module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${CWARNING}Your php ${PHP_detail_ver} does not support xdebug! ${CEND}";
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_xdebug() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/08-xdebug.ini" ]; then
|
||||||
|
rm -rf ${php_install_dir}/etc/php.d/08-xdebug.ini /tmp/{xdebug,webgrind} ${wwwroot_dir}/default/webgrind
|
||||||
|
echo; echo "${CMSG}PHP xdebug module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP xdebug module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_pecl_yaf() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
PHP_main_ver=${PHP_detail_ver%.*}
|
||||||
|
if [[ "${PHP_main_ver}" =~ ^7.[0-4]$|^8.0$ ]]; then
|
||||||
|
phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
|
||||||
|
src_url=https://pecl.php.net/get/yaf-${yaf_ver}.tgz && Download_src
|
||||||
|
tar xzf yaf-${yaf_ver}.tgz
|
||||||
|
pushd yaf-${yaf_ver} > /dev/null
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/yaf.so" ]; then
|
||||||
|
echo 'extension=yaf.so' > ${php_install_dir}/etc/php.d/04-yaf.ini
|
||||||
|
echo "${CSUCCESS}PHP yaf module installed successfully! ${CEND}"
|
||||||
|
rm -rf yaf-${yaf_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP yaf module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${CWARNING}Your php ${PHP_detail_ver} does not support yaf! ${CEND}";
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_yaf() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/04-yaf.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/04-yaf.ini
|
||||||
|
echo; echo "${CMSG}PHP yaf module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP yaf module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_pecl_yar() {
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
|
||||||
|
PHP_main_ver=${PHP_detail_ver%.*}
|
||||||
|
if [[ "${PHP_main_ver}" =~ ^7.[0-4]$|^8.0$ ]]; then
|
||||||
|
phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir)
|
||||||
|
src_url=https://pecl.php.net/get/yar-${yar_ver}.tgz && Download_src
|
||||||
|
tar xzf yar-${yar_ver}.tgz
|
||||||
|
pushd yar-${yar_ver} > /dev/null
|
||||||
|
${php_install_dir}/bin/phpize
|
||||||
|
./configure --with-php-config=${php_install_dir}/bin/php-config --with-curl=${curl_install_dir}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
if [ -f "${phpExtensionDir}/yar.so" ]; then
|
||||||
|
echo 'extension=yar.so' > ${php_install_dir}/etc/php.d/04-yar.ini
|
||||||
|
echo "${CSUCCESS}PHP yar module installed successfully! ${CEND}"
|
||||||
|
rm -rf yar-${yar_ver}
|
||||||
|
else
|
||||||
|
echo "${CFAILURE}PHP yar module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${CWARNING}Your php ${PHP_detail_ver} does not support yar! ${CEND}";
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_pecl_yar() {
|
||||||
|
if [ -e "${php_install_dir}/etc/php.d/04-yar.ini" ]; then
|
||||||
|
rm -f ${php_install_dir}/etc/php.d/04-yar.ini
|
||||||
|
echo; echo "${CMSG}PHP yar module uninstall completed${CEND}"
|
||||||
|
else
|
||||||
|
echo; echo "${CWARNING}PHP yar module does not exist! ${CEND}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_Percona55() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mysql >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
|
||||||
|
|
||||||
|
[ ! -d "${percona_install_dir}" ] && mkdir -p ${percona_install_dir}
|
||||||
|
mkdir -p ${percona_data_dir};chown mysql:mysql -R ${percona_data_dir}
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
perconaVerStr1=$(echo ${percona55_ver} | sed "s@-@-rel@")
|
||||||
|
tar xzf ./Percona-Server-${perconaVerStr1}-Linux.x86_64.${sslLibVer}.tar.gz
|
||||||
|
mv Percona-Server-${perconaVerStr1}-Linux.x86_64.${sslLibVer}/* ${percona_install_dir}
|
||||||
|
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe
|
||||||
|
sed -i "s@/usr/local/Percona-Server-${perconaVerStr1}-Linux.x86_64.${sslLibVer}@${percona_install_dir}@g" ${percona_install_dir}/bin/mysqld_safe
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
tar xzf percona-server-${percona55_ver}.tar.gz
|
||||||
|
pushd percona-server-${percona55_ver}
|
||||||
|
[ "${armplatform}" == "y" ] && patch -p1 < ../mysql-5.5-fix-arm-client_plugin.patch
|
||||||
|
cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \
|
||||||
|
-DMYSQL_DATADIR=${percona_data_dir} \
|
||||||
|
-DSYSCONFDIR=/etc \
|
||||||
|
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_READLINE=1 \
|
||||||
|
-DENABLE_DTRACE=0 \
|
||||||
|
-DENABLED_LOCAL_INFILE=1 \
|
||||||
|
-DDEFAULT_CHARSET=utf8mb4 \
|
||||||
|
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||||
|
-DEXTRA_CHARSETS=all \
|
||||||
|
-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'
|
||||||
|
make -j ${THREAD}
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "${percona_install_dir}/support-files" ]; then
|
||||||
|
sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}Percona installed successfully! ${CEND}"
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
rm -rf Percona-Server-${perconaVerStr1}-Linux.x86_64.${sslLibVer}
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
rm -rf percona-server-${percona55_ver}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -rf ${percona_install_dir}
|
||||||
|
echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/cp ${percona_install_dir}/support-files/mysql.server /etc/init.d/mysqld
|
||||||
|
sed -i "s@^basedir=.*@basedir=${percona_install_dir}@" /etc/init.d/mysqld
|
||||||
|
sed -i "s@^datadir=.*@datadir=${percona_data_dir}@" /etc/init.d/mysqld
|
||||||
|
chmod +x /etc/init.d/mysqld
|
||||||
|
[ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; }
|
||||||
|
[ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults
|
||||||
|
popd
|
||||||
|
|
||||||
|
# my.cnf
|
||||||
|
cat > /etc/my.cnf << EOF
|
||||||
|
[client]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
prompt="Percona [\\d]> "
|
||||||
|
no-auto-rehash
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
basedir = ${percona_install_dir}
|
||||||
|
datadir = ${percona_data_dir}
|
||||||
|
pid-file = ${percona_data_dir}/mysql.pid
|
||||||
|
user = mysql
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
server-id = 1
|
||||||
|
|
||||||
|
init-connect = 'SET NAMES utf8mb4'
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
|
||||||
|
skip-name-resolve
|
||||||
|
#skip-networking
|
||||||
|
back_log = 300
|
||||||
|
|
||||||
|
max_connections = 1000
|
||||||
|
max_connect_errors = 6000
|
||||||
|
open_files_limit = 65535
|
||||||
|
table_open_cache = 128
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
binlog_cache_size = 1M
|
||||||
|
max_heap_table_size = 8M
|
||||||
|
tmp_table_size = 16M
|
||||||
|
|
||||||
|
read_buffer_size = 2M
|
||||||
|
read_rnd_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
join_buffer_size = 8M
|
||||||
|
key_buffer_size = 4M
|
||||||
|
|
||||||
|
thread_cache_size = 8
|
||||||
|
|
||||||
|
query_cache_type = 1
|
||||||
|
query_cache_size = 8M
|
||||||
|
query_cache_limit = 2M
|
||||||
|
|
||||||
|
ft_min_word_len = 4
|
||||||
|
|
||||||
|
log_bin = mysql-bin
|
||||||
|
binlog_format = mixed
|
||||||
|
expire_logs_days = 7
|
||||||
|
|
||||||
|
log_error = ${percona_data_dir}/mysql-error.log
|
||||||
|
slow_query_log = 1
|
||||||
|
long_query_time = 1
|
||||||
|
slow_query_log_file = ${percona_data_dir}/mysql-slow.log
|
||||||
|
|
||||||
|
performance_schema = 0
|
||||||
|
|
||||||
|
#lower_case_table_names = 1
|
||||||
|
|
||||||
|
skip-external-locking
|
||||||
|
|
||||||
|
default_storage_engine = InnoDB
|
||||||
|
innodb_file_per_table = 1
|
||||||
|
innodb_open_files = 500
|
||||||
|
innodb_buffer_pool_size = 64M
|
||||||
|
innodb_write_io_threads = 4
|
||||||
|
innodb_read_io_threads = 4
|
||||||
|
innodb_thread_concurrency = 0
|
||||||
|
innodb_purge_threads = 1
|
||||||
|
innodb_flush_log_at_trx_commit = 2
|
||||||
|
innodb_log_buffer_size = 2M
|
||||||
|
innodb_log_file_size = 32M
|
||||||
|
innodb_log_files_in_group = 3
|
||||||
|
innodb_max_dirty_pages_pct = 90
|
||||||
|
innodb_lock_wait_timeout = 120
|
||||||
|
|
||||||
|
bulk_insert_buffer_size = 8M
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
myisam_max_sort_file_size = 10G
|
||||||
|
myisam_repair_threads = 1
|
||||||
|
|
||||||
|
interactive_timeout = 28800
|
||||||
|
wait_timeout = 28800
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
read_buffer = 4M
|
||||||
|
write_buffer = 4M
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
|
||||||
|
if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
|
${percona_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${percona_install_dir} --datadir=${percona_data_dir}
|
||||||
|
|
||||||
|
[ "${Wsl}" == true ] && chmod 600 /etc/my.cnf
|
||||||
|
chown mysql:mysql -R ${percona_data_dir}
|
||||||
|
[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
|
||||||
|
service mysqld start
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${percona_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${percona_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${percona_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
${percona_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${percona_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='' and User not like 'mysql.%';"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
|
||||||
|
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
|
||||||
|
echo "${percona_install_dir}/lib" > /etc/ld.so.conf.d/z-percona.conf
|
||||||
|
ldconfig
|
||||||
|
service mysqld stop
|
||||||
|
}
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_Percona56() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mysql >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
|
||||||
|
|
||||||
|
[ ! -d "${percona_install_dir}" ] && mkdir -p ${percona_install_dir}
|
||||||
|
mkdir -p ${percona_data_dir};chown mysql:mysql -R ${percona_data_dir}
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
perconaVerStr1=$(echo ${percona56_ver} | sed "s@-@-rel@")
|
||||||
|
tar xzf ./Percona-Server-${perconaVerStr1}-Linux.x86_64.${sslLibVer}.tar.gz
|
||||||
|
mv Percona-Server-${perconaVerStr1}-Linux.x86_64.${sslLibVer}/* ${percona_install_dir}
|
||||||
|
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe
|
||||||
|
sed -i "s@/usr/local/Percona-Server-${perconaVerStr1}-Linux.x86_64.${sslLibVer}@${percona_install_dir}@g" ${percona_install_dir}/bin/mysqld_safe
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
tar xzf percona-server-${percona56_ver}.tar.gz
|
||||||
|
pushd percona-server-${percona56_ver}
|
||||||
|
cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \
|
||||||
|
-DMYSQL_DATADIR=${percona_data_dir} \
|
||||||
|
-DSYSCONFDIR=/etc \
|
||||||
|
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_EMBEDDED_SERVER=1 \
|
||||||
|
-DENABLE_DTRACE=0 \
|
||||||
|
-DENABLED_LOCAL_INFILE=1 \
|
||||||
|
-DDEFAULT_CHARSET=utf8mb4 \
|
||||||
|
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||||
|
-DEXTRA_CHARSETS=all \
|
||||||
|
-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'
|
||||||
|
make -j ${THREAD}
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "${percona_install_dir}/support-files" ]; then
|
||||||
|
sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}Percona installed successfully! ${CEND}"
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
rm -rf Percona-Server-${perconaVerStr1}-Linux.x86_64.${sslLibVer}
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
rm -rf percona-server-${percona56_ver}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -rf ${percona_install_dir}
|
||||||
|
echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/cp ${percona_install_dir}/support-files/mysql.server /etc/init.d/mysqld
|
||||||
|
sed -i "s@^basedir=.*@basedir=${percona_install_dir}@" /etc/init.d/mysqld
|
||||||
|
sed -i "s@^datadir=.*@datadir=${percona_data_dir}@" /etc/init.d/mysqld
|
||||||
|
chmod +x /etc/init.d/mysqld
|
||||||
|
[ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; }
|
||||||
|
[ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults
|
||||||
|
popd
|
||||||
|
|
||||||
|
# my.cnf
|
||||||
|
cat > /etc/my.cnf << EOF
|
||||||
|
[client]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
prompt="Percona [\\d]> "
|
||||||
|
no-auto-rehash
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
basedir = ${percona_install_dir}
|
||||||
|
datadir = ${percona_data_dir}
|
||||||
|
pid-file = ${percona_data_dir}/mysql.pid
|
||||||
|
user = mysql
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
server-id = 1
|
||||||
|
|
||||||
|
init-connect = 'SET NAMES utf8mb4'
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
|
||||||
|
skip-name-resolve
|
||||||
|
#skip-networking
|
||||||
|
back_log = 300
|
||||||
|
|
||||||
|
max_connections = 1000
|
||||||
|
max_connect_errors = 6000
|
||||||
|
open_files_limit = 65535
|
||||||
|
table_open_cache = 128
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
binlog_cache_size = 1M
|
||||||
|
max_heap_table_size = 8M
|
||||||
|
tmp_table_size = 16M
|
||||||
|
|
||||||
|
read_buffer_size = 2M
|
||||||
|
read_rnd_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
join_buffer_size = 8M
|
||||||
|
key_buffer_size = 4M
|
||||||
|
|
||||||
|
thread_cache_size = 8
|
||||||
|
|
||||||
|
query_cache_type = 1
|
||||||
|
query_cache_size = 8M
|
||||||
|
query_cache_limit = 2M
|
||||||
|
|
||||||
|
ft_min_word_len = 4
|
||||||
|
|
||||||
|
log_bin = mysql-bin
|
||||||
|
binlog_format = mixed
|
||||||
|
expire_logs_days = 7
|
||||||
|
|
||||||
|
log_error = ${percona_data_dir}/mysql-error.log
|
||||||
|
slow_query_log = 1
|
||||||
|
long_query_time = 1
|
||||||
|
slow_query_log_file = ${percona_data_dir}/mysql-slow.log
|
||||||
|
|
||||||
|
performance_schema = 0
|
||||||
|
explicit_defaults_for_timestamp
|
||||||
|
|
||||||
|
#lower_case_table_names = 1
|
||||||
|
|
||||||
|
skip-external-locking
|
||||||
|
|
||||||
|
default_storage_engine = InnoDB
|
||||||
|
innodb_file_per_table = 1
|
||||||
|
innodb_open_files = 500
|
||||||
|
innodb_buffer_pool_size = 64M
|
||||||
|
innodb_write_io_threads = 4
|
||||||
|
innodb_read_io_threads = 4
|
||||||
|
innodb_thread_concurrency = 0
|
||||||
|
innodb_purge_threads = 1
|
||||||
|
innodb_flush_log_at_trx_commit = 2
|
||||||
|
innodb_log_buffer_size = 2M
|
||||||
|
innodb_log_file_size = 32M
|
||||||
|
innodb_log_files_in_group = 3
|
||||||
|
innodb_max_dirty_pages_pct = 90
|
||||||
|
innodb_lock_wait_timeout = 120
|
||||||
|
|
||||||
|
bulk_insert_buffer_size = 8M
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
myisam_max_sort_file_size = 10G
|
||||||
|
myisam_repair_threads = 1
|
||||||
|
|
||||||
|
interactive_timeout = 28800
|
||||||
|
wait_timeout = 28800
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
read_buffer = 4M
|
||||||
|
write_buffer = 4M
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
|
||||||
|
if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
|
${percona_install_dir}/scripts/mysql_install_db --user=mysql --basedir=${percona_install_dir} --datadir=${percona_data_dir}
|
||||||
|
|
||||||
|
[ "${Wsl}" == true ] && chmod 600 /etc/my.cnf
|
||||||
|
chown mysql:mysql -R ${percona_data_dir}
|
||||||
|
[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
|
||||||
|
service mysqld start
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${percona_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${percona_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${percona_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
${percona_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${percona_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.user where Password='' and User not like 'mysql.%';"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.db where User='';"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "delete from mysql.proxies_priv where Host!='localhost';"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
|
||||||
|
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
|
||||||
|
echo "${percona_install_dir}/lib" > /etc/ld.so.conf.d/z-percona.conf
|
||||||
|
ldconfig
|
||||||
|
service mysqld stop
|
||||||
|
}
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_Percona57() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mysql >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
|
||||||
|
|
||||||
|
[ ! -d "${percona_install_dir}" ] && mkdir -p ${percona_install_dir}
|
||||||
|
mkdir -p ${percona_data_dir};chown mysql:mysql -R ${percona_data_dir}
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
tar xzf Percona-Server-${percona57_ver}-Linux.x86_64.glibc2.17.tar.gz
|
||||||
|
mv Percona-Server-${percona57_ver}-Linux.x86_64.glibc2.17/* ${percona_install_dir}
|
||||||
|
sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe
|
||||||
|
sed -i "s@Percona-Server-${percona57_ver}-Linux.x86_64.glibc2.17@${percona_install_dir}@g" ${percona_install_dir}/bin/mysqld_safe
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
boostVersion2=$(echo ${boost_oldver} | awk -F. '{print $1"_"$2"_"$3}')
|
||||||
|
tar xzf boost_${boostVersion2}.tar.gz
|
||||||
|
tar xzf percona-server-${percona57_ver}.tar.gz
|
||||||
|
pushd percona-server-${percona57_ver}
|
||||||
|
cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \
|
||||||
|
-DMYSQL_DATADIR=${percona_data_dir} \
|
||||||
|
-DDOWNLOAD_BOOST=1 \
|
||||||
|
-DWITH_BOOST=../boost_${boostVersion2} \
|
||||||
|
-DSYSCONFDIR=/etc \
|
||||||
|
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_EMBEDDED_SERVER=1 \
|
||||||
|
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_ZLIB=system \
|
||||||
|
-DENABLE_DTRACE=0 \
|
||||||
|
-DENABLED_LOCAL_INFILE=1 \
|
||||||
|
-DDEFAULT_CHARSET=utf8mb4 \
|
||||||
|
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||||
|
-DEXTRA_CHARSETS=all \
|
||||||
|
-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc'
|
||||||
|
make -j ${THREAD}
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "${percona_install_dir}/support-files" ]; then
|
||||||
|
sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}Percona installed successfully! ${CEND}"
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
rm -rf Percona-Server-${percona57_ver}-Linux.x86_64.${sslLibVer}
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
rm -rf percona-server-${percona57_ver} boost_${boostVersion2}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -rf ${percona_install_dir}
|
||||||
|
echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/cp ${percona_install_dir}/support-files/mysql.server /etc/init.d/mysqld
|
||||||
|
sed -i "s@^basedir=.*@basedir=${percona_install_dir}@" /etc/init.d/mysqld
|
||||||
|
sed -i "s@^datadir=.*@datadir=${percona_data_dir}@" /etc/init.d/mysqld
|
||||||
|
chmod +x /etc/init.d/mysqld
|
||||||
|
[ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; }
|
||||||
|
[ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults
|
||||||
|
popd
|
||||||
|
|
||||||
|
# my.cnf
|
||||||
|
cat > /etc/my.cnf << EOF
|
||||||
|
[client]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
prompt="Percona [\\d]> "
|
||||||
|
no-auto-rehash
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
|
||||||
|
basedir = ${percona_install_dir}
|
||||||
|
datadir = ${percona_data_dir}
|
||||||
|
pid-file = ${percona_data_dir}/mysql.pid
|
||||||
|
user = mysql
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
server-id = 1
|
||||||
|
|
||||||
|
init-connect = 'SET NAMES utf8mb4'
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
|
||||||
|
skip-name-resolve
|
||||||
|
#skip-networking
|
||||||
|
back_log = 300
|
||||||
|
|
||||||
|
max_connections = 1000
|
||||||
|
max_connect_errors = 6000
|
||||||
|
open_files_limit = 65535
|
||||||
|
table_open_cache = 128
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
binlog_cache_size = 1M
|
||||||
|
max_heap_table_size = 8M
|
||||||
|
tmp_table_size = 16M
|
||||||
|
|
||||||
|
read_buffer_size = 2M
|
||||||
|
read_rnd_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
join_buffer_size = 8M
|
||||||
|
key_buffer_size = 4M
|
||||||
|
|
||||||
|
thread_cache_size = 8
|
||||||
|
|
||||||
|
query_cache_type = 1
|
||||||
|
query_cache_size = 8M
|
||||||
|
query_cache_limit = 2M
|
||||||
|
|
||||||
|
ft_min_word_len = 4
|
||||||
|
|
||||||
|
log_bin = mysql-bin
|
||||||
|
binlog_format = mixed
|
||||||
|
expire_logs_days = 7
|
||||||
|
|
||||||
|
log_error = ${percona_data_dir}/mysql-error.log
|
||||||
|
slow_query_log = 1
|
||||||
|
long_query_time = 1
|
||||||
|
slow_query_log_file = ${percona_data_dir}/mysql-slow.log
|
||||||
|
|
||||||
|
performance_schema = 0
|
||||||
|
explicit_defaults_for_timestamp
|
||||||
|
|
||||||
|
#lower_case_table_names = 1
|
||||||
|
|
||||||
|
skip-external-locking
|
||||||
|
|
||||||
|
default_storage_engine = InnoDB
|
||||||
|
innodb_file_per_table = 1
|
||||||
|
innodb_open_files = 500
|
||||||
|
innodb_buffer_pool_size = 64M
|
||||||
|
innodb_write_io_threads = 4
|
||||||
|
innodb_read_io_threads = 4
|
||||||
|
innodb_thread_concurrency = 0
|
||||||
|
innodb_purge_threads = 1
|
||||||
|
innodb_flush_log_at_trx_commit = 2
|
||||||
|
innodb_log_buffer_size = 2M
|
||||||
|
innodb_log_file_size = 32M
|
||||||
|
innodb_log_files_in_group = 3
|
||||||
|
innodb_max_dirty_pages_pct = 90
|
||||||
|
innodb_lock_wait_timeout = 120
|
||||||
|
|
||||||
|
bulk_insert_buffer_size = 8M
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
myisam_max_sort_file_size = 10G
|
||||||
|
|
||||||
|
interactive_timeout = 28800
|
||||||
|
wait_timeout = 28800
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
read_buffer = 4M
|
||||||
|
write_buffer = 4M
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
|
||||||
|
if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
|
||||||
|
sed -i 's@^query_cache_size.*@query_cache_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
|
${percona_install_dir}/bin/mysqld --initialize-insecure --user=mysql --basedir=${percona_install_dir} --datadir=${percona_data_dir}
|
||||||
|
|
||||||
|
[ "${Wsl}" == true ] && chmod 600 /etc/my.cnf
|
||||||
|
chown mysql:mysql -R ${percona_data_dir}
|
||||||
|
[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
|
||||||
|
service mysqld start
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${percona_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${percona_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${percona_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
${percona_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${percona_install_dir}/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by \"${dbrootpwd}\" with grant option;"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
|
||||||
|
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
|
||||||
|
[ -e "${percona_install_dir}/my.cnf" ] && rm -rf ${percona_install_dir}/my.cnf
|
||||||
|
echo "${percona_install_dir}/lib" > /etc/ld.so.conf.d/z-percona.conf
|
||||||
|
ldconfig
|
||||||
|
service mysqld stop
|
||||||
|
}
|
||||||
@@ -0,0 +1,221 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_Percona80() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
id -u mysql >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql
|
||||||
|
|
||||||
|
[ ! -d "${percona_install_dir}" ] && mkdir -p ${percona_install_dir}
|
||||||
|
mkdir -p ${percona_data_dir};chown mysql:mysql -R ${percona_data_dir}
|
||||||
|
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
tar xzf ./Percona-Server-${percona80_ver}-Linux.x86_64.glibc2.28.tar.gz
|
||||||
|
mv Percona-Server-${percona80_ver}-Linux.x86_64.glibc2.28/* ${percona_install_dir}
|
||||||
|
#sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${percona_install_dir}/bin/mysqld_safe
|
||||||
|
sed -i "s@/usr/local/Percona-Server-${percona80_ver}-Linux.x86_64.glibc2.28@${percona_install_dir}@g" ${percona_install_dir}/bin/mysqld_safe
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
boostVersion2=$(echo ${boost_percona_ver} | awk -F. '{print $1"_"$2"_"$3}')
|
||||||
|
tar xzf boost_${boostVersion2}.tar.gz
|
||||||
|
tar xzf percona-server-${percona80_ver}.tar.gz
|
||||||
|
pushd percona-server-${percona80_ver}
|
||||||
|
cmake . -DCMAKE_INSTALL_PREFIX=${percona_install_dir} \
|
||||||
|
-DMYSQL_DATADIR=${percona_data_dir} \
|
||||||
|
-DDOWNLOAD_BOOST=1 \
|
||||||
|
-DWITH_BOOST=../boost_${boostVersion2} \
|
||||||
|
-DFORCE_INSOURCE_BUILD=1 \
|
||||||
|
-DSYSCONFDIR=/etc \
|
||||||
|
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||||
|
-DWITH_EMBEDDED_SERVER=1 \
|
||||||
|
-DENABLE_DTRACE=0 \
|
||||||
|
-DENABLED_LOCAL_INFILE=1 \
|
||||||
|
-DDEFAULT_CHARSET=utf8mb4 \
|
||||||
|
-DEXTRA_CHARSETS=all
|
||||||
|
make -j ${THREAD}
|
||||||
|
make install
|
||||||
|
sed -i 's@^load_jemalloc=1@load_jemalloc=0@' ${percona_install_dir}/bin/mysqld_safe
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
# backup openssl so
|
||||||
|
#[ ! -e "${percona_install_dir}/lib/lib_bk" ] && mkdir ${percona_install_dir}/lib/lib_bk
|
||||||
|
#/bin/mv ${percona_install_dir}/lib/{libssl,libcrypto}.so* ${percona_install_dir}/lib/lib_bk/
|
||||||
|
|
||||||
|
if [ -d "${percona_install_dir}/support-files" ]; then
|
||||||
|
sed -i "s+^dbrootpwd.*+dbrootpwd='${dbrootpwd}'+" ../options.conf
|
||||||
|
echo "${CSUCCESS}Percona installed successfully! ${CEND}"
|
||||||
|
if [ "${dbinstallmethod}" == "1" ]; then
|
||||||
|
rm -rf Percona-Server-${percona80_ver}-Linux.x86_64.glibc2.28
|
||||||
|
elif [ "${dbinstallmethod}" == "2" ]; then
|
||||||
|
rm -rf percona-server-${percona80_ver} boost_${boostVersion2}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rm -rf ${percona_install_dir}
|
||||||
|
echo "${CFAILURE}Percona install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/cp ${percona_install_dir}/support-files/mysql.server /etc/init.d/mysqld
|
||||||
|
sed -i "s@^basedir=.*@basedir=${percona_install_dir}@" /etc/init.d/mysqld
|
||||||
|
sed -i "s@^datadir=.*@datadir=${percona_data_dir}@" /etc/init.d/mysqld
|
||||||
|
chmod +x /etc/init.d/mysqld
|
||||||
|
[ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; }
|
||||||
|
[ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults
|
||||||
|
popd
|
||||||
|
|
||||||
|
# my.cnf
|
||||||
|
cat > /etc/my.cnf << EOF
|
||||||
|
[client]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
default-character-set = utf8mb4
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
prompt="Percona [\\d]> "
|
||||||
|
no-auto-rehash
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
port = 3306
|
||||||
|
socket = /tmp/mysql.sock
|
||||||
|
default_authentication_plugin = mysql_native_password
|
||||||
|
|
||||||
|
basedir = ${percona_install_dir}
|
||||||
|
datadir = ${percona_data_dir}
|
||||||
|
pid-file = ${percona_data_dir}/mysql.pid
|
||||||
|
user = mysql
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
server-id = 1
|
||||||
|
|
||||||
|
init-connect = 'SET NAMES utf8mb4'
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
collation-server = utf8mb4_0900_ai_ci
|
||||||
|
|
||||||
|
skip-name-resolve
|
||||||
|
#skip-networking
|
||||||
|
back_log = 300
|
||||||
|
|
||||||
|
max_connections = 1000
|
||||||
|
max_connect_errors = 6000
|
||||||
|
open_files_limit = 65535
|
||||||
|
table_open_cache = 128
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
binlog_cache_size = 1M
|
||||||
|
max_heap_table_size = 8M
|
||||||
|
tmp_table_size = 16M
|
||||||
|
|
||||||
|
read_buffer_size = 2M
|
||||||
|
read_rnd_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
join_buffer_size = 8M
|
||||||
|
key_buffer_size = 4M
|
||||||
|
|
||||||
|
thread_cache_size = 8
|
||||||
|
|
||||||
|
ft_min_word_len = 4
|
||||||
|
|
||||||
|
log_bin = mysql-bin
|
||||||
|
binlog_format = mixed
|
||||||
|
binlog_expire_logs_seconds = 604800
|
||||||
|
|
||||||
|
log_error = ${percona_data_dir}/mysql-error.log
|
||||||
|
slow_query_log = 1
|
||||||
|
long_query_time = 1
|
||||||
|
slow_query_log_file = ${percona_data_dir}/mysql-slow.log
|
||||||
|
|
||||||
|
performance_schema = 0
|
||||||
|
explicit_defaults_for_timestamp
|
||||||
|
|
||||||
|
#lower_case_table_names = 1
|
||||||
|
|
||||||
|
skip-external-locking
|
||||||
|
|
||||||
|
default_storage_engine = InnoDB
|
||||||
|
#default-storage-engine = MyISAM
|
||||||
|
innodb_file_per_table = 1
|
||||||
|
innodb_open_files = 500
|
||||||
|
innodb_buffer_pool_size = 64M
|
||||||
|
innodb_write_io_threads = 4
|
||||||
|
innodb_read_io_threads = 4
|
||||||
|
innodb_thread_concurrency = 0
|
||||||
|
innodb_purge_threads = 1
|
||||||
|
innodb_flush_log_at_trx_commit = 2
|
||||||
|
innodb_log_buffer_size = 2M
|
||||||
|
innodb_log_file_size = 32M
|
||||||
|
innodb_log_files_in_group = 3
|
||||||
|
innodb_max_dirty_pages_pct = 90
|
||||||
|
innodb_lock_wait_timeout = 120
|
||||||
|
|
||||||
|
bulk_insert_buffer_size = 8M
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
myisam_max_sort_file_size = 10G
|
||||||
|
|
||||||
|
interactive_timeout = 28800
|
||||||
|
wait_timeout = 28800
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 500M
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 8M
|
||||||
|
sort_buffer_size = 8M
|
||||||
|
read_buffer = 4M
|
||||||
|
write_buffer = 4M
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
|
||||||
|
if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 16M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 256@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 2500 -a ${Mem} -le 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 32@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 32M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 512M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 512@' /etc/my.cnf
|
||||||
|
elif [ ${Mem} -gt 3500 ]; then
|
||||||
|
sed -i 's@^thread_cache_size.*@thread_cache_size = 64@' /etc/my.cnf
|
||||||
|
sed -i 's@^myisam_sort_buffer_size.*@myisam_sort_buffer_size = 64M@' /etc/my.cnf
|
||||||
|
sed -i 's@^key_buffer_size.*@key_buffer_size = 256M@' /etc/my.cnf
|
||||||
|
sed -i 's@^innodb_buffer_pool_size.*@innodb_buffer_pool_size = 1024M@' /etc/my.cnf
|
||||||
|
sed -i 's@^tmp_table_size.*@tmp_table_size = 128M@' /etc/my.cnf
|
||||||
|
sed -i 's@^table_open_cache.*@table_open_cache = 1024@' /etc/my.cnf
|
||||||
|
fi
|
||||||
|
|
||||||
|
${percona_install_dir}/bin/mysqld --initialize-insecure --user=mysql --basedir=${percona_install_dir} --datadir=${percona_data_dir}
|
||||||
|
|
||||||
|
[ "${Wsl}" == true ] && chmod 600 /etc/my.cnf
|
||||||
|
chown mysql:mysql -R ${percona_data_dir}
|
||||||
|
[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
|
||||||
|
service mysqld start
|
||||||
|
[ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${percona_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${percona_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${percona_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -hlocalhost -e "create user root@'127.0.0.1' identified by \"${dbrootpwd}\";"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -hlocalhost -e "grant all privileges on *.* to root@'127.0.0.1' with grant option;"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -hlocalhost -e "grant all privileges on *.* to root@'localhost' with grant option;"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -hlocalhost -e "alter user root@'localhost' identified by \"${dbrootpwd}\";"
|
||||||
|
${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;"
|
||||||
|
rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf
|
||||||
|
[ -e "${percona_install_dir}/my.cnf" ] && rm -f ${percona_install_dir}/my.cnf
|
||||||
|
echo "${percona_install_dir}/lib" > /etc/ld.so.conf.d/z-percona.conf
|
||||||
|
ldconfig
|
||||||
|
service mysqld stop
|
||||||
|
}
|
||||||
@@ -0,0 +1,253 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_PHP53() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ ! -e "/usr/local/lib/libiconv.la" ]; then
|
||||||
|
tar xzf libiconv-${libiconv_ver}.tar.gz
|
||||||
|
pushd libiconv-${libiconv_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libiconv-${libiconv_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then
|
||||||
|
tar xzf curl-${curl_ver}.tar.gz
|
||||||
|
pushd curl-${curl_ver} > /dev/null
|
||||||
|
[ -e "/usr/local/lib/libnghttp2.so" ] && with_nghttp2='--with-nghttp2=/usr/local'
|
||||||
|
./configure --prefix=${curl_install_dir} ${php5_with_ssl} ${with_nghttp2}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf curl-${curl_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${freetype_install_dir}/lib/libfreetype.la" ]; then
|
||||||
|
tar xzf freetype-${freetype_ver}.tar.gz
|
||||||
|
pushd freetype-${freetype_ver} > /dev/null
|
||||||
|
./configure --prefix=${freetype_install_dir} --enable-freetype-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ln -sf ${freetype_install_dir}/include/freetype2/* /usr/include/
|
||||||
|
[ -d /usr/lib/pkgconfig ] && /bin/cp ${freetype_install_dir}/lib/pkgconfig/freetype2.pc /usr/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf freetype-${freetype_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/bin/libmcrypt-config" -a ! -e "/usr/bin/libmcrypt-config" ]; then
|
||||||
|
tar xzf libmcrypt-${libmcrypt_ver}.tar.gz
|
||||||
|
pushd libmcrypt-${libmcrypt_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ldconfig
|
||||||
|
pushd libltdl > /dev/null
|
||||||
|
./configure --enable-ltdl-install
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libmcrypt-${libmcrypt_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/include/mhash.h" -a ! -e "/usr/include/mhash.h" ]; then
|
||||||
|
tar xzf mhash-${mhash_ver}.tar.gz
|
||||||
|
pushd mhash-${mhash_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mhash-${mhash_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
[ ! -e "/usr/bin/libmcrypt-config" ] && ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
|
||||||
|
[ ! -e "/lib64/libpcre.so.1" ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
|
||||||
|
[ ! -e "/usr/lib/libc-client.so" ] && ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/bin/mcrypt" -a ! -e "/usr/bin/mcrypt" ]; then
|
||||||
|
tar xzf mcrypt-${mcrypt_ver}.tar.gz
|
||||||
|
pushd mcrypt-${mcrypt_ver} > /dev/null
|
||||||
|
ldconfig
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mcrypt-${mcrypt_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
|
||||||
|
tar xzf php-${php53_ver}.tar.gz
|
||||||
|
patch -d php-${php53_ver} -p0 < fpm-race-condition.patch
|
||||||
|
pushd php-${php53_ver} > /dev/null
|
||||||
|
patch -p1 < ../php5.3patch
|
||||||
|
patch -p1 < ../debian_patches_disable_SSLv2_for_openssl_1_0_0.patch
|
||||||
|
make clean
|
||||||
|
[ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
|
||||||
|
{ [ ${RHEL_ver} -ge 9 >/dev/null 2>&1 ] || [ ${Debian_ver} -ge 10 >/dev/null 2>&1 ] || [ ${Ubuntu_ver} -ge 19 >/dev/null 2>&1 ]; } || intl_modules_options='--enable-intl'
|
||||||
|
if [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-apxs2=${apache_install_dir}/bin/apxs --disable-fileinfo \
|
||||||
|
--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php5_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf ${php5_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --with-xsl ${intl_modules_options} \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
else
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-fpm-user=${run_user} --with-fpm-group=${run_group} --enable-fpm --disable-fileinfo \
|
||||||
|
--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php5_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf ${php5_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --with-xsl ${intl_modules_options} \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
fi
|
||||||
|
{ [ ${RHEL_ver} -ge 9 >/dev/null 2>&1 ] || [ ${Debian_ver} -ge 10 >/dev/null 2>&1 ] || [ ${Ubuntu_ver} -ge 19 >/dev/null 2>&1 ]; } || sed -i '/^BUILD_/ s/\$(CC)/\$(CXX)/g' Makefile
|
||||||
|
make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
|
||||||
|
make install
|
||||||
|
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
[ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
|
||||||
|
echo "${CSUCCESS}PHP installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
rm -rf ${php_install_dir}
|
||||||
|
echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
# wget -c http://pear.php.net/go-pear.phar
|
||||||
|
# ${php_install_dir}/bin/php go-pear.phar
|
||||||
|
|
||||||
|
/bin/cp php.ini-production ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
|
||||||
|
#sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;date.timezone.*@date.timezone = ${timezone}@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^max_execution_time.*@max_execution_time = 5@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
|
||||||
|
[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
if [ "${apache_mode_option}" != '2' ]; then
|
||||||
|
# php-fpm Init Script
|
||||||
|
/bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
|
||||||
|
systemctl enable php-fpm
|
||||||
|
|
||||||
|
cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; FPM Configuration ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
; Global Options ;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[global]
|
||||||
|
pid = run/php-fpm.pid
|
||||||
|
error_log = log/php-fpm.log
|
||||||
|
log_level = warning
|
||||||
|
|
||||||
|
emergency_restart_threshold = 30
|
||||||
|
emergency_restart_interval = 60s
|
||||||
|
process_control_timeout = 5s
|
||||||
|
daemonize = yes
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Pool Definitions ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[${run_user}]
|
||||||
|
listen = /dev/shm/php-cgi.sock
|
||||||
|
listen.backlog = -1
|
||||||
|
listen.allowed_clients = 127.0.0.1
|
||||||
|
listen.owner = ${run_user}
|
||||||
|
listen.group = ${run_group}
|
||||||
|
listen.mode = 0666
|
||||||
|
user = ${run_user}
|
||||||
|
group = ${run_group}
|
||||||
|
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 12
|
||||||
|
pm.start_servers = 8
|
||||||
|
pm.min_spare_servers = 6
|
||||||
|
pm.max_spare_servers = 12
|
||||||
|
pm.max_requests = 2048
|
||||||
|
pm.process_idle_timeout = 10s
|
||||||
|
request_terminate_timeout = 120
|
||||||
|
request_slowlog_timeout = 0
|
||||||
|
|
||||||
|
pm.status_path = /php-fpm_status
|
||||||
|
slowlog = var/log/slow.log
|
||||||
|
rlimit_files = 51200
|
||||||
|
rlimit_core = 0
|
||||||
|
|
||||||
|
catch_workers_output = yes
|
||||||
|
;env[HOSTNAME] = $HOSTNAME
|
||||||
|
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||||
|
env[TMP] = /tmp
|
||||||
|
env[TMPDIR] = /tmp
|
||||||
|
env[TEMP] = /tmp
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ $Mem -le 3000 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl start php-fpm
|
||||||
|
|
||||||
|
elif [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
systemctl restart httpd
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
[ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php53_ver}
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,250 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_PHP54() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ ! -e "/usr/local/lib/libiconv.la" ]; then
|
||||||
|
tar xzf libiconv-${libiconv_ver}.tar.gz
|
||||||
|
pushd libiconv-${libiconv_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libiconv-${libiconv_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then
|
||||||
|
tar xzf curl-${curl_ver}.tar.gz
|
||||||
|
pushd curl-${curl_ver} > /dev/null
|
||||||
|
[ -e "/usr/local/lib/libnghttp2.so" ] && with_nghttp2='--with-nghttp2=/usr/local'
|
||||||
|
./configure --prefix=${curl_install_dir} ${php5_with_ssl} ${with_nghttp2}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf curl-${curl_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${freetype_install_dir}/lib/libfreetype.la" ]; then
|
||||||
|
tar xzf freetype-${freetype_ver}.tar.gz
|
||||||
|
pushd freetype-${freetype_ver} > /dev/null
|
||||||
|
./configure --prefix=${freetype_install_dir} --enable-freetype-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ln -sf ${freetype_install_dir}/include/freetype2/* /usr/include/
|
||||||
|
[ -d /usr/lib/pkgconfig ] && /bin/cp ${freetype_install_dir}/lib/pkgconfig/freetype2.pc /usr/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf freetype-${freetype_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/bin/libmcrypt-config" -a ! -e "/usr/bin/libmcrypt-config" ]; then
|
||||||
|
tar xzf libmcrypt-${libmcrypt_ver}.tar.gz
|
||||||
|
pushd libmcrypt-${libmcrypt_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ldconfig
|
||||||
|
pushd libltdl > /dev/null
|
||||||
|
./configure --enable-ltdl-install
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libmcrypt-${libmcrypt_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/include/mhash.h" -a ! -e "/usr/include/mhash.h" ]; then
|
||||||
|
tar xzf mhash-${mhash_ver}.tar.gz
|
||||||
|
pushd mhash-${mhash_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mhash-${mhash_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
[ ! -e "/usr/bin/libmcrypt-config" ] && ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
|
||||||
|
[ ! -e "/lib64/libpcre.so.1" ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
|
||||||
|
[ ! -e "/usr/lib/libc-client.so" ] && ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/bin/mcrypt" -a ! -e "/usr/bin/mcrypt" ]; then
|
||||||
|
tar xzf mcrypt-${mcrypt_ver}.tar.gz
|
||||||
|
pushd mcrypt-${mcrypt_ver} > /dev/null
|
||||||
|
ldconfig
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mcrypt-${mcrypt_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
|
||||||
|
tar xzf php-${php54_ver}.tar.gz
|
||||||
|
patch -d php-${php54_ver} -p0 < fpm-race-condition.patch
|
||||||
|
pushd php-${php54_ver} > /dev/null
|
||||||
|
make clean
|
||||||
|
[ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
|
||||||
|
{ [ ${RHEL_ver} -ge 9 >/dev/null 2>&1 ] || [ ${Debian_ver} -ge 10 >/dev/null 2>&1 ] || [ ${Ubuntu_ver} -ge 19 >/dev/null 2>&1 ]; } || intl_modules_options='--enable-intl'
|
||||||
|
if [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-apxs2=${apache_install_dir}/bin/apxs --disable-fileinfo \
|
||||||
|
--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php5_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf ${php5_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --with-xsl ${intl_modules_options} \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
else
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-fpm-user=${run_user} --with-fpm-group=${run_group} --enable-fpm --disable-fileinfo \
|
||||||
|
--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php5_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf ${php5_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --with-xsl ${intl_modules_options} \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
fi
|
||||||
|
make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
|
||||||
|
make install
|
||||||
|
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
[ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
|
||||||
|
echo "${CSUCCESS}PHP installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
rm -rf ${php_install_dir}
|
||||||
|
echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
# wget -c http://pear.php.net/go-pear.phar
|
||||||
|
# ${php_install_dir}/bin/php go-pear.phar
|
||||||
|
|
||||||
|
/bin/cp php.ini-production ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
|
||||||
|
#sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;date.timezone.*@date.timezone = ${timezone}@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^max_execution_time.*@max_execution_time = 5@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
|
||||||
|
[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
if [ "${apache_mode_option}" != '2' ]; then
|
||||||
|
# php-fpm Init Script
|
||||||
|
/bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
|
||||||
|
systemctl enable php-fpm
|
||||||
|
|
||||||
|
cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; FPM Configuration ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
; Global Options ;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[global]
|
||||||
|
pid = run/php-fpm.pid
|
||||||
|
error_log = log/php-fpm.log
|
||||||
|
log_level = warning
|
||||||
|
|
||||||
|
emergency_restart_threshold = 30
|
||||||
|
emergency_restart_interval = 60s
|
||||||
|
process_control_timeout = 5s
|
||||||
|
daemonize = yes
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Pool Definitions ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[${run_user}]
|
||||||
|
listen = /dev/shm/php-cgi.sock
|
||||||
|
listen.backlog = -1
|
||||||
|
listen.allowed_clients = 127.0.0.1
|
||||||
|
listen.owner = ${run_user}
|
||||||
|
listen.group = ${run_group}
|
||||||
|
listen.mode = 0666
|
||||||
|
user = ${run_user}
|
||||||
|
group = ${run_group}
|
||||||
|
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 12
|
||||||
|
pm.start_servers = 8
|
||||||
|
pm.min_spare_servers = 6
|
||||||
|
pm.max_spare_servers = 12
|
||||||
|
pm.max_requests = 2048
|
||||||
|
pm.process_idle_timeout = 10s
|
||||||
|
request_terminate_timeout = 120
|
||||||
|
request_slowlog_timeout = 0
|
||||||
|
|
||||||
|
pm.status_path = /php-fpm_status
|
||||||
|
slowlog = var/log/slow.log
|
||||||
|
rlimit_files = 51200
|
||||||
|
rlimit_core = 0
|
||||||
|
|
||||||
|
catch_workers_output = yes
|
||||||
|
;env[HOSTNAME] = $HOSTNAME
|
||||||
|
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||||
|
env[TMP] = /tmp
|
||||||
|
env[TMPDIR] = /tmp
|
||||||
|
env[TEMP] = /tmp
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ $Mem -le 3000 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl start php-fpm
|
||||||
|
|
||||||
|
elif [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
systemctl restart httpd
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
[ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php54_ver}
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,263 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_PHP55() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ ! -e "/usr/local/lib/libiconv.la" ]; then
|
||||||
|
tar xzf libiconv-${libiconv_ver}.tar.gz
|
||||||
|
pushd libiconv-${libiconv_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libiconv-${libiconv_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then
|
||||||
|
tar xzf curl-${curl_ver}.tar.gz
|
||||||
|
pushd curl-${curl_ver} > /dev/null
|
||||||
|
[ -e "/usr/local/lib/libnghttp2.so" ] && with_nghttp2='--with-nghttp2=/usr/local'
|
||||||
|
./configure --prefix=${curl_install_dir} ${php5_with_ssl} ${with_nghttp2}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf curl-${curl_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${freetype_install_dir}/lib/libfreetype.la" ]; then
|
||||||
|
tar xzf freetype-${freetype_ver}.tar.gz
|
||||||
|
pushd freetype-${freetype_ver} > /dev/null
|
||||||
|
./configure --prefix=${freetype_install_dir} --enable-freetype-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ln -sf ${freetype_install_dir}/include/freetype2/* /usr/include/
|
||||||
|
[ -d /usr/lib/pkgconfig ] && /bin/cp ${freetype_install_dir}/lib/pkgconfig/freetype2.pc /usr/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf freetype-${freetype_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/bin/libmcrypt-config" -a ! -e "/usr/bin/libmcrypt-config" ]; then
|
||||||
|
tar xzf libmcrypt-${libmcrypt_ver}.tar.gz
|
||||||
|
pushd libmcrypt-${libmcrypt_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ldconfig
|
||||||
|
pushd libltdl > /dev/null
|
||||||
|
./configure --enable-ltdl-install
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libmcrypt-${libmcrypt_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/include/mhash.h" -a ! -e "/usr/include/mhash.h" ]; then
|
||||||
|
tar xzf mhash-${mhash_ver}.tar.gz
|
||||||
|
pushd mhash-${mhash_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mhash-${mhash_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
[ ! -e "/usr/bin/libmcrypt-config" ] && ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
|
||||||
|
[ ! -e "/lib64/libpcre.so.1" ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
|
||||||
|
[ ! -e "/usr/lib/libc-client.so" ] && ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/bin/mcrypt" -a ! -e "/usr/bin/mcrypt" ]; then
|
||||||
|
tar xzf mcrypt-${mcrypt_ver}.tar.gz
|
||||||
|
pushd mcrypt-${mcrypt_ver} > /dev/null
|
||||||
|
ldconfig
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mcrypt-${mcrypt_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
tar xzf php-${php55_ver}.tar.gz
|
||||||
|
patch -d php-${php55_ver} -p0 < fpm-race-condition.patch
|
||||||
|
pushd php-${php55_ver} > /dev/null
|
||||||
|
[ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
|
||||||
|
{ [ ${RHEL_ver} -ge 9 >/dev/null 2>&1 ] || [ ${Debian_ver} -ge 10 >/dev/null 2>&1 ] || [ ${Ubuntu_ver} -ge 19 >/dev/null 2>&1 ]; } || intl_modules_options='--enable-intl'
|
||||||
|
[ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
|
||||||
|
if [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php5_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf ${php5_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --with-xsl ${intl_modules_options} \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
else
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-fpm-user=${run_user} --with-fpm-group=${run_group} --enable-fpm ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php5_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf ${php5_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --with-xsl ${intl_modules_options} \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
fi
|
||||||
|
make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
|
||||||
|
make install
|
||||||
|
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
[ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
|
||||||
|
echo "${CSUCCESS}PHP installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
rm -rf ${php_install_dir}
|
||||||
|
echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
# wget -c http://pear.php.net/go-pear.phar
|
||||||
|
# ${php_install_dir}/bin/php go-pear.phar
|
||||||
|
|
||||||
|
/bin/cp php.ini-production ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
|
||||||
|
#sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;date.timezone.*@date.timezone = ${timezone}@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^max_execution_time.*@max_execution_time = 5@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
|
||||||
|
[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
[ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/02-opcache.ini << EOF
|
||||||
|
[opcache]
|
||||||
|
zend_extension=opcache.so
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.memory_consumption=${Memory_limit}
|
||||||
|
opcache.interned_strings_buffer=8
|
||||||
|
opcache.max_accelerated_files=4000
|
||||||
|
opcache.revalidate_freq=60
|
||||||
|
;opcache.save_comments=0
|
||||||
|
opcache.fast_shutdown=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
;opcache.optimization_level=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "${apache_mode_option}" != '2' ]; then
|
||||||
|
# php-fpm Init Script
|
||||||
|
/bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
|
||||||
|
systemctl enable php-fpm
|
||||||
|
|
||||||
|
cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; FPM Configuration ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
; Global Options ;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[global]
|
||||||
|
pid = run/php-fpm.pid
|
||||||
|
error_log = log/php-fpm.log
|
||||||
|
log_level = warning
|
||||||
|
|
||||||
|
emergency_restart_threshold = 30
|
||||||
|
emergency_restart_interval = 60s
|
||||||
|
process_control_timeout = 5s
|
||||||
|
daemonize = yes
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Pool Definitions ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[${run_user}]
|
||||||
|
listen = /dev/shm/php-cgi.sock
|
||||||
|
listen.backlog = -1
|
||||||
|
listen.allowed_clients = 127.0.0.1
|
||||||
|
listen.owner = ${run_user}
|
||||||
|
listen.group = ${run_group}
|
||||||
|
listen.mode = 0666
|
||||||
|
user = ${run_user}
|
||||||
|
group = ${run_group}
|
||||||
|
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 12
|
||||||
|
pm.start_servers = 8
|
||||||
|
pm.min_spare_servers = 6
|
||||||
|
pm.max_spare_servers = 12
|
||||||
|
pm.max_requests = 2048
|
||||||
|
pm.process_idle_timeout = 10s
|
||||||
|
request_terminate_timeout = 120
|
||||||
|
request_slowlog_timeout = 0
|
||||||
|
|
||||||
|
pm.status_path = /php-fpm_status
|
||||||
|
slowlog = var/log/slow.log
|
||||||
|
rlimit_files = 51200
|
||||||
|
rlimit_core = 0
|
||||||
|
|
||||||
|
catch_workers_output = yes
|
||||||
|
;env[HOSTNAME] = $HOSTNAME
|
||||||
|
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||||
|
env[TMP] = /tmp
|
||||||
|
env[TMPDIR] = /tmp
|
||||||
|
env[TEMP] = /tmp
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ $Mem -le 3000 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl start php-fpm
|
||||||
|
|
||||||
|
elif [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
systemctl restart httpd
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
[ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php55_ver}
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,269 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_PHP56() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ ! -e "/usr/local/lib/libiconv.la" ]; then
|
||||||
|
tar xzf libiconv-${libiconv_ver}.tar.gz
|
||||||
|
pushd libiconv-${libiconv_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libiconv-${libiconv_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then
|
||||||
|
tar xzf curl-${curl_ver}.tar.gz
|
||||||
|
pushd curl-${curl_ver} > /dev/null
|
||||||
|
[ -e "/usr/local/lib/libnghttp2.so" ] && with_nghttp2='--with-nghttp2=/usr/local'
|
||||||
|
./configure --prefix=${curl_install_dir} ${php5_with_ssl} ${with_nghttp2}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf curl-${curl_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${freetype_install_dir}/lib/libfreetype.la" ]; then
|
||||||
|
tar xzf freetype-${freetype_ver}.tar.gz
|
||||||
|
pushd freetype-${freetype_ver} > /dev/null
|
||||||
|
./configure --prefix=${freetype_install_dir} --enable-freetype-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ln -sf ${freetype_install_dir}/include/freetype2/* /usr/include/
|
||||||
|
[ -d /usr/lib/pkgconfig ] && /bin/cp ${freetype_install_dir}/lib/pkgconfig/freetype2.pc /usr/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf freetype-${freetype_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/bin/libmcrypt-config" -a ! -e "/usr/bin/libmcrypt-config" ]; then
|
||||||
|
tar xzf libmcrypt-${libmcrypt_ver}.tar.gz
|
||||||
|
pushd libmcrypt-${libmcrypt_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ldconfig
|
||||||
|
pushd libltdl > /dev/null
|
||||||
|
./configure --enable-ltdl-install
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libmcrypt-${libmcrypt_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/include/mhash.h" -a ! -e "/usr/include/mhash.h" ]; then
|
||||||
|
tar xzf mhash-${mhash_ver}.tar.gz
|
||||||
|
pushd mhash-${mhash_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mhash-${mhash_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
[ ! -e "/usr/bin/libmcrypt-config" ] && ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
|
||||||
|
[ ! -e "/lib64/libpcre.so.1" ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
|
||||||
|
[ ! -e "/usr/lib/libc-client.so" ] && ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/bin/mcrypt" -a ! -e "/usr/bin/mcrypt" ]; then
|
||||||
|
tar xzf mcrypt-${mcrypt_ver}.tar.gz
|
||||||
|
pushd mcrypt-${mcrypt_ver} > /dev/null
|
||||||
|
ldconfig
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mcrypt-${mcrypt_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
|
||||||
|
tar xzf php-${php56_ver}.tar.gz
|
||||||
|
pushd php-${php56_ver} > /dev/null
|
||||||
|
make clean
|
||||||
|
[ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
|
||||||
|
{ [ ${RHEL_ver} -ge 9 >/dev/null 2>&1 ] || [ ${Debian_ver} -ge 10 >/dev/null 2>&1 ] || [ ${Ubuntu_ver} -ge 19 >/dev/null 2>&1 ]; } || intl_modules_options='--enable-intl'
|
||||||
|
[ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
|
||||||
|
if [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php5_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf ${php5_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --with-xsl ${intl_modules_options} \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
else
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-fpm-user=${run_user} --with-fpm-group=${run_group} --enable-fpm ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php5_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf ${php5_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --with-xsl ${intl_modules_options} \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
fi
|
||||||
|
make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
|
||||||
|
make install
|
||||||
|
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
[ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
|
||||||
|
echo "${CSUCCESS}PHP installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
rm -rf ${php_install_dir}
|
||||||
|
echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
# wget -c http://pear.php.net/go-pear.phar
|
||||||
|
# ${php_install_dir}/bin/php go-pear.phar
|
||||||
|
|
||||||
|
/bin/cp php.ini-production ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
|
||||||
|
#sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;date.timezone.*@date.timezone = ${timezone}@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^max_execution_time.*@max_execution_time = 5@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
|
||||||
|
[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
|
||||||
|
if [ "${with_old_openssl_flag}" = 'y' ]; then
|
||||||
|
sed -i "s@^;curl.cainfo.*@curl.cainfo = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.cafile.*@openssl.cafile = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.capath.*@openssl.capath = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/02-opcache.ini << EOF
|
||||||
|
[opcache]
|
||||||
|
zend_extension=opcache.so
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.memory_consumption=${Memory_limit}
|
||||||
|
opcache.interned_strings_buffer=8
|
||||||
|
opcache.max_accelerated_files=4000
|
||||||
|
opcache.revalidate_freq=60
|
||||||
|
;opcache.save_comments=0
|
||||||
|
opcache.fast_shutdown=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
;opcache.optimization_level=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "${apache_mode_option}" != '2' ]; then
|
||||||
|
# php-fpm Init Script
|
||||||
|
/bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
|
||||||
|
systemctl enable php-fpm
|
||||||
|
|
||||||
|
cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; FPM Configuration ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
; Global Options ;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[global]
|
||||||
|
pid = run/php-fpm.pid
|
||||||
|
error_log = log/php-fpm.log
|
||||||
|
log_level = warning
|
||||||
|
|
||||||
|
emergency_restart_threshold = 30
|
||||||
|
emergency_restart_interval = 60s
|
||||||
|
process_control_timeout = 5s
|
||||||
|
daemonize = yes
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Pool Definitions ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[${run_user}]
|
||||||
|
listen = /dev/shm/php-cgi.sock
|
||||||
|
listen.backlog = -1
|
||||||
|
listen.allowed_clients = 127.0.0.1
|
||||||
|
listen.owner = ${run_user}
|
||||||
|
listen.group = ${run_group}
|
||||||
|
listen.mode = 0666
|
||||||
|
user = ${run_user}
|
||||||
|
group = ${run_group}
|
||||||
|
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 12
|
||||||
|
pm.start_servers = 8
|
||||||
|
pm.min_spare_servers = 6
|
||||||
|
pm.max_spare_servers = 12
|
||||||
|
pm.max_requests = 2048
|
||||||
|
pm.process_idle_timeout = 10s
|
||||||
|
request_terminate_timeout = 120
|
||||||
|
request_slowlog_timeout = 0
|
||||||
|
|
||||||
|
pm.status_path = /php-fpm_status
|
||||||
|
slowlog = var/log/slow.log
|
||||||
|
rlimit_files = 51200
|
||||||
|
rlimit_core = 0
|
||||||
|
|
||||||
|
catch_workers_output = yes
|
||||||
|
;env[HOSTNAME] = $HOSTNAME
|
||||||
|
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||||
|
env[TMP] = /tmp
|
||||||
|
env[TMPDIR] = /tmp
|
||||||
|
env[TEMP] = /tmp
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ $Mem -le 3000 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl start php-fpm
|
||||||
|
|
||||||
|
elif [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
systemctl restart httpd
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
[ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php56_ver}
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,274 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_PHP70() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ ! -e "/usr/local/lib/libiconv.la" ]; then
|
||||||
|
tar xzf libiconv-${libiconv_ver}.tar.gz
|
||||||
|
pushd libiconv-${libiconv_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libiconv-${libiconv_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then
|
||||||
|
tar xzf curl-${curl_ver}.tar.gz
|
||||||
|
pushd curl-${curl_ver} > /dev/null
|
||||||
|
[ -e "/usr/local/lib/libnghttp2.so" ] && with_nghttp2='--with-nghttp2=/usr/local'
|
||||||
|
./configure --prefix=${curl_install_dir} ${php70_with_ssl} ${with_nghttp2}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf curl-${curl_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${freetype_install_dir}/lib/libfreetype.la" ]; then
|
||||||
|
tar xzf freetype-${freetype_ver}.tar.gz
|
||||||
|
pushd freetype-${freetype_ver} > /dev/null
|
||||||
|
./configure --prefix=${freetype_install_dir} --enable-freetype-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ln -sf ${freetype_install_dir}/include/freetype2/* /usr/include/
|
||||||
|
[ -d /usr/lib/pkgconfig ] && /bin/cp ${freetype_install_dir}/lib/pkgconfig/freetype2.pc /usr/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf freetype-${freetype_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/bin/libmcrypt-config" -a ! -e "/usr/bin/libmcrypt-config" ]; then
|
||||||
|
tar xzf libmcrypt-${libmcrypt_ver}.tar.gz
|
||||||
|
pushd libmcrypt-${libmcrypt_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ldconfig
|
||||||
|
pushd libltdl > /dev/null
|
||||||
|
./configure --enable-ltdl-install
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libmcrypt-${libmcrypt_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/include/mhash.h" -a ! -e "/usr/include/mhash.h" ]; then
|
||||||
|
tar xzf mhash-${mhash_ver}.tar.gz
|
||||||
|
pushd mhash-${mhash_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mhash-${mhash_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
[ ! -e "/usr/bin/libmcrypt-config" ] && ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
|
||||||
|
[ ! -e "/lib64/libpcre.so.1" ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
|
||||||
|
[ ! -e "/usr/lib/libc-client.so" ] && ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/bin/mcrypt" -a ! -e "/usr/bin/mcrypt" ]; then
|
||||||
|
tar xzf mcrypt-${mcrypt_ver}.tar.gz
|
||||||
|
pushd mcrypt-${mcrypt_ver} > /dev/null
|
||||||
|
ldconfig
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mcrypt-${mcrypt_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
|
||||||
|
tar xzf php-${php70_ver}.tar.gz
|
||||||
|
pushd php-${php70_ver}
|
||||||
|
make clean
|
||||||
|
[ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
|
||||||
|
{ [ ${Debian_ver} -ge 10 >/dev/null 2>&1 ] || [ ${Ubuntu_ver} -ge 19 >/dev/null 2>&1 ]; } || intl_modules_options='--enable-intl'
|
||||||
|
[ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
|
||||||
|
if [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php70_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf ${php70_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --with-xsl ${intl_modules_options} \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
else
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-fpm-user=${run_user} --with-fpm-group=${run_group} --enable-fpm ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php70_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf ${php70_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --with-xsl ${intl_modules_options} \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
fi
|
||||||
|
make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
|
||||||
|
make install
|
||||||
|
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
[ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
|
||||||
|
echo "${CSUCCESS}PHP installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
rm -rf ${php_install_dir}
|
||||||
|
echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
# wget -c http://pear.php.net/go-pear.phar
|
||||||
|
# ${php_install_dir}/bin/php go-pear.phar
|
||||||
|
|
||||||
|
/bin/cp php.ini-production ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
|
||||||
|
#sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;date.timezone.*@date.timezone = ${timezone}@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^max_execution_time.*@max_execution_time = 600@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
|
||||||
|
[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
|
||||||
|
if [ "${with_old_openssl_flag}" = 'y' ]; then
|
||||||
|
sed -i "s@^;curl.cainfo.*@curl.cainfo = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.cafile.*@openssl.cafile = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.capath.*@openssl.capath = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/02-opcache.ini << EOF
|
||||||
|
[opcache]
|
||||||
|
zend_extension=opcache.so
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
opcache.memory_consumption=${Memory_limit}
|
||||||
|
opcache.interned_strings_buffer=8
|
||||||
|
opcache.max_accelerated_files=100000
|
||||||
|
opcache.max_wasted_percentage=5
|
||||||
|
opcache.use_cwd=1
|
||||||
|
opcache.validate_timestamps=1
|
||||||
|
opcache.revalidate_freq=60
|
||||||
|
;opcache.save_comments=0
|
||||||
|
opcache.fast_shutdown=1
|
||||||
|
opcache.consistency_checks=0
|
||||||
|
;opcache.optimization_level=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "${apache_mode_option}" != '2' ]; then
|
||||||
|
# php-fpm Init Script
|
||||||
|
/bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
|
||||||
|
systemctl enable php-fpm
|
||||||
|
|
||||||
|
cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; FPM Configuration ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
; Global Options ;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[global]
|
||||||
|
pid = run/php-fpm.pid
|
||||||
|
error_log = log/php-fpm.log
|
||||||
|
log_level = warning
|
||||||
|
|
||||||
|
emergency_restart_threshold = 30
|
||||||
|
emergency_restart_interval = 60s
|
||||||
|
process_control_timeout = 5s
|
||||||
|
daemonize = yes
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Pool Definitions ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[${run_user}]
|
||||||
|
listen = /dev/shm/php-cgi.sock
|
||||||
|
listen.backlog = -1
|
||||||
|
listen.allowed_clients = 127.0.0.1
|
||||||
|
listen.owner = ${run_user}
|
||||||
|
listen.group = ${run_group}
|
||||||
|
listen.mode = 0666
|
||||||
|
user = ${run_user}
|
||||||
|
group = ${run_group}
|
||||||
|
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 12
|
||||||
|
pm.start_servers = 8
|
||||||
|
pm.min_spare_servers = 6
|
||||||
|
pm.max_spare_servers = 12
|
||||||
|
pm.max_requests = 2048
|
||||||
|
pm.process_idle_timeout = 10s
|
||||||
|
request_terminate_timeout = 120
|
||||||
|
request_slowlog_timeout = 0
|
||||||
|
|
||||||
|
pm.status_path = /php-fpm_status
|
||||||
|
slowlog = var/log/slow.log
|
||||||
|
rlimit_files = 51200
|
||||||
|
rlimit_core = 0
|
||||||
|
|
||||||
|
catch_workers_output = yes
|
||||||
|
;env[HOSTNAME] = $HOSTNAME
|
||||||
|
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||||
|
env[TMP] = /tmp
|
||||||
|
env[TMPDIR] = /tmp
|
||||||
|
env[TEMP] = /tmp
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ $Mem -le 3000 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl start php-fpm
|
||||||
|
|
||||||
|
elif [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
systemctl restart httpd
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
[ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php70_ver}
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,277 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_PHP71() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ ! -e "/usr/local/lib/libiconv.la" ]; then
|
||||||
|
tar xzf libiconv-${libiconv_ver}.tar.gz
|
||||||
|
pushd libiconv-${libiconv_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libiconv-${libiconv_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then
|
||||||
|
tar xzf curl-${curl_ver}.tar.gz
|
||||||
|
pushd curl-${curl_ver} > /dev/null
|
||||||
|
[ -e "/usr/local/lib/libnghttp2.so" ] && with_nghttp2='--with-nghttp2=/usr/local'
|
||||||
|
./configure --prefix=${curl_install_dir} ${php71_with_ssl} ${with_nghttp2}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf curl-${curl_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${freetype_install_dir}/lib/libfreetype.la" ]; then
|
||||||
|
tar xzf freetype-${freetype_ver}.tar.gz
|
||||||
|
pushd freetype-${freetype_ver} > /dev/null
|
||||||
|
./configure --prefix=${freetype_install_dir} --enable-freetype-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ln -sf ${freetype_install_dir}/include/freetype2/* /usr/include/
|
||||||
|
[ -d /usr/lib/pkgconfig ] && /bin/cp ${freetype_install_dir}/lib/pkgconfig/freetype2.pc /usr/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf freetype-${freetype_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/bin/libmcrypt-config" -a ! -e "/usr/bin/libmcrypt-config" ]; then
|
||||||
|
tar xzf libmcrypt-${libmcrypt_ver}.tar.gz
|
||||||
|
pushd libmcrypt-${libmcrypt_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ldconfig
|
||||||
|
pushd libltdl > /dev/null
|
||||||
|
./configure --enable-ltdl-install
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libmcrypt-${libmcrypt_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/include/mhash.h" -a ! -e "/usr/include/mhash.h" ]; then
|
||||||
|
tar xzf mhash-${mhash_ver}.tar.gz
|
||||||
|
pushd mhash-${mhash_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mhash-${mhash_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
[ ! -e "/usr/bin/libmcrypt-config" ] && ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
|
||||||
|
[ ! -e "/lib64/libpcre.so.1" ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
|
||||||
|
[ ! -e "/usr/lib/libc-client.so" ] && ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/bin/mcrypt" -a ! -e "/usr/bin/mcrypt" ]; then
|
||||||
|
tar xzf mcrypt-${mcrypt_ver}.tar.gz
|
||||||
|
pushd mcrypt-${mcrypt_ver} > /dev/null
|
||||||
|
ldconfig
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mcrypt-${mcrypt_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
|
||||||
|
tar xzf php-${php71_ver}.tar.gz
|
||||||
|
pushd php-${php71_ver} > /dev/null
|
||||||
|
if [ -e ext/openssl/openssl.c ] && ! grep -Eqi '^#ifdef RSA_SSLV23_PADDING' ext/openssl/openssl.c; then
|
||||||
|
sed -i '/OPENSSL_SSLV23_PADDING/i#ifdef RSA_SSLV23_PADDING' ext/openssl/openssl.c
|
||||||
|
sed -i '/OPENSSL_SSLV23_PADDING/a#endif' ext/openssl/openssl.c
|
||||||
|
fi
|
||||||
|
make clean
|
||||||
|
[ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
|
||||||
|
[ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
|
||||||
|
if [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php71_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf ${php71_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
else
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-fpm-user=${run_user} --with-fpm-group=${run_group} --enable-fpm ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php71_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf ${php71_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
fi
|
||||||
|
make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
|
||||||
|
make install
|
||||||
|
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
[ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
|
||||||
|
echo "${CSUCCESS}PHP installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
rm -rf ${php_install_dir}
|
||||||
|
echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
# wget -c http://pear.php.net/go-pear.phar
|
||||||
|
# ${php_install_dir}/bin/php go-pear.phar
|
||||||
|
|
||||||
|
/bin/cp php.ini-production ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
|
||||||
|
#sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;date.timezone.*@date.timezone = ${timezone}@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^max_execution_time.*@max_execution_time = 600@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
|
||||||
|
[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
|
||||||
|
if [ "${with_old_openssl_flag}" = 'y' ]; then
|
||||||
|
sed -i "s@^;curl.cainfo.*@curl.cainfo = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.cafile.*@openssl.cafile = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.capath.*@openssl.capath = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/02-opcache.ini << EOF
|
||||||
|
[opcache]
|
||||||
|
zend_extension=opcache.so
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
opcache.memory_consumption=${Memory_limit}
|
||||||
|
opcache.interned_strings_buffer=8
|
||||||
|
opcache.max_accelerated_files=100000
|
||||||
|
opcache.max_wasted_percentage=5
|
||||||
|
opcache.use_cwd=1
|
||||||
|
opcache.validate_timestamps=1
|
||||||
|
opcache.revalidate_freq=60
|
||||||
|
;opcache.save_comments=0
|
||||||
|
opcache.fast_shutdown=1
|
||||||
|
opcache.consistency_checks=0
|
||||||
|
;opcache.optimization_level=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "${apache_mode_option}" != '2' ]; then
|
||||||
|
# php-fpm Init Script
|
||||||
|
/bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
|
||||||
|
systemctl enable php-fpm
|
||||||
|
|
||||||
|
cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; FPM Configuration ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
; Global Options ;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[global]
|
||||||
|
pid = run/php-fpm.pid
|
||||||
|
error_log = log/php-fpm.log
|
||||||
|
log_level = warning
|
||||||
|
|
||||||
|
emergency_restart_threshold = 30
|
||||||
|
emergency_restart_interval = 60s
|
||||||
|
process_control_timeout = 5s
|
||||||
|
daemonize = yes
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Pool Definitions ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[${run_user}]
|
||||||
|
listen = /dev/shm/php-cgi.sock
|
||||||
|
listen.backlog = -1
|
||||||
|
listen.allowed_clients = 127.0.0.1
|
||||||
|
listen.owner = ${run_user}
|
||||||
|
listen.group = ${run_group}
|
||||||
|
listen.mode = 0666
|
||||||
|
user = ${run_user}
|
||||||
|
group = ${run_group}
|
||||||
|
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 12
|
||||||
|
pm.start_servers = 8
|
||||||
|
pm.min_spare_servers = 6
|
||||||
|
pm.max_spare_servers = 12
|
||||||
|
pm.max_requests = 2048
|
||||||
|
pm.process_idle_timeout = 10s
|
||||||
|
request_terminate_timeout = 120
|
||||||
|
request_slowlog_timeout = 0
|
||||||
|
|
||||||
|
pm.status_path = /php-fpm_status
|
||||||
|
slowlog = var/log/slow.log
|
||||||
|
rlimit_files = 51200
|
||||||
|
rlimit_core = 0
|
||||||
|
|
||||||
|
catch_workers_output = yes
|
||||||
|
;env[HOSTNAME] = $HOSTNAME
|
||||||
|
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||||
|
env[TMP] = /tmp
|
||||||
|
env[TMPDIR] = /tmp
|
||||||
|
env[TEMP] = /tmp
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ $Mem -le 3000 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl start php-fpm
|
||||||
|
|
||||||
|
elif [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
systemctl restart httpd
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
[ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php71_ver}
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,270 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_PHP72() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ ! -e "/usr/local/lib/libiconv.la" ]; then
|
||||||
|
tar xzf libiconv-${libiconv_ver}.tar.gz
|
||||||
|
pushd libiconv-${libiconv_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libiconv-${libiconv_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then
|
||||||
|
tar xzf curl-${curl_ver}.tar.gz
|
||||||
|
pushd curl-${curl_ver} > /dev/null
|
||||||
|
[ -e "/usr/local/lib/libnghttp2.so" ] && with_nghttp2='--with-nghttp2=/usr/local'
|
||||||
|
./configure --prefix=${curl_install_dir} ${php72_with_ssl} ${with_nghttp2}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf curl-${curl_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${freetype_install_dir}/lib/libfreetype.la" ]; then
|
||||||
|
tar xzf freetype-${freetype_ver}.tar.gz
|
||||||
|
pushd freetype-${freetype_ver} > /dev/null
|
||||||
|
./configure --prefix=${freetype_install_dir} --enable-freetype-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ln -sf ${freetype_install_dir}/include/freetype2/* /usr/include/
|
||||||
|
[ -d /usr/lib/pkgconfig ] && /bin/cp ${freetype_install_dir}/lib/pkgconfig/freetype2.pc /usr/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf freetype-${freetype_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/lib/pkgconfig/libargon2.pc" ]; then
|
||||||
|
tar xzf argon2-${argon2_ver}.tar.gz
|
||||||
|
pushd argon2-${argon2_ver} > /dev/null
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
[ ! -d /usr/local/lib/pkgconfig ] && mkdir -p /usr/local/lib/pkgconfig
|
||||||
|
/bin/cp libargon2.pc /usr/local/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf argon2-${argon2_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/lib/libsodium.la" ]; then
|
||||||
|
tar xzf libsodium-${libsodium_ver}.tar.gz
|
||||||
|
pushd libsodium-${libsodium_ver} > /dev/null
|
||||||
|
./configure --disable-dependency-tracking --enable-minimal
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libsodium-${libsodium_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/include/mhash.h" -a ! -e "/usr/include/mhash.h" ]; then
|
||||||
|
tar xzf mhash-${mhash_ver}.tar.gz
|
||||||
|
pushd mhash-${mhash_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mhash-${mhash_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
[ ! -e "/lib64/libpcre.so.1" ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
|
||||||
|
[ ! -e "/usr/lib/libc-client.so" ] && ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
|
||||||
|
fi
|
||||||
|
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
|
||||||
|
tar xzf php-${php72_ver}.tar.gz
|
||||||
|
pushd php-${php72_ver} > /dev/null
|
||||||
|
if [ -e ext/openssl/openssl.c ] && ! grep -Eqi '^#ifdef RSA_SSLV23_PADDING' ext/openssl/openssl.c; then
|
||||||
|
sed -i '/OPENSSL_SSLV23_PADDING/i#ifdef RSA_SSLV23_PADDING' ext/openssl/openssl.c
|
||||||
|
sed -i '/OPENSSL_SSLV23_PADDING/a#endif' ext/openssl/openssl.c
|
||||||
|
fi
|
||||||
|
make clean
|
||||||
|
[ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
|
||||||
|
[ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
|
||||||
|
if [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php72_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-password-argon2 --with-sodium=/usr/local --with-gd ${php72_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
else
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-fpm-user=${run_user} --with-fpm-group=${run_group} --enable-fpm ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php72_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-password-argon2 --with-sodium=/usr/local --with-gd ${php72_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
|
||||||
|
--with-gettext --enable-zip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
fi
|
||||||
|
make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
|
||||||
|
make install
|
||||||
|
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
[ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
|
||||||
|
echo "${CSUCCESS}PHP installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
rm -rf ${php_install_dir}
|
||||||
|
echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
# wget -c http://pear.php.net/go-pear.phar
|
||||||
|
# ${php_install_dir}/bin/php go-pear.phar
|
||||||
|
|
||||||
|
/bin/cp php.ini-production ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
|
||||||
|
#sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;date.timezone.*@date.timezone = ${timezone}@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^max_execution_time.*@max_execution_time = 600@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
|
||||||
|
[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
|
||||||
|
if [ "${with_old_openssl_flag}" = 'y' ]; then
|
||||||
|
sed -i "s@^;curl.cainfo.*@curl.cainfo = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.cafile.*@openssl.cafile = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.capath.*@openssl.capath = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/02-opcache.ini << EOF
|
||||||
|
[opcache]
|
||||||
|
zend_extension=opcache.so
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
opcache.memory_consumption=${Memory_limit}
|
||||||
|
opcache.interned_strings_buffer=8
|
||||||
|
opcache.max_accelerated_files=100000
|
||||||
|
opcache.max_wasted_percentage=5
|
||||||
|
opcache.use_cwd=1
|
||||||
|
opcache.validate_timestamps=1
|
||||||
|
opcache.revalidate_freq=60
|
||||||
|
;opcache.save_comments=0
|
||||||
|
opcache.consistency_checks=0
|
||||||
|
;opcache.optimization_level=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "${apache_mode_option}" != '2' ]; then
|
||||||
|
# php-fpm Init Script
|
||||||
|
/bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
|
||||||
|
systemctl enable php-fpm
|
||||||
|
|
||||||
|
cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; FPM Configuration ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
; Global Options ;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[global]
|
||||||
|
pid = run/php-fpm.pid
|
||||||
|
error_log = log/php-fpm.log
|
||||||
|
log_level = warning
|
||||||
|
|
||||||
|
emergency_restart_threshold = 30
|
||||||
|
emergency_restart_interval = 60s
|
||||||
|
process_control_timeout = 5s
|
||||||
|
daemonize = yes
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Pool Definitions ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[${run_user}]
|
||||||
|
listen = /dev/shm/php-cgi.sock
|
||||||
|
listen.backlog = -1
|
||||||
|
listen.allowed_clients = 127.0.0.1
|
||||||
|
listen.owner = ${run_user}
|
||||||
|
listen.group = ${run_group}
|
||||||
|
listen.mode = 0666
|
||||||
|
user = ${run_user}
|
||||||
|
group = ${run_group}
|
||||||
|
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 12
|
||||||
|
pm.start_servers = 8
|
||||||
|
pm.min_spare_servers = 6
|
||||||
|
pm.max_spare_servers = 12
|
||||||
|
pm.max_requests = 2048
|
||||||
|
pm.process_idle_timeout = 10s
|
||||||
|
request_terminate_timeout = 120
|
||||||
|
request_slowlog_timeout = 0
|
||||||
|
|
||||||
|
pm.status_path = /php-fpm_status
|
||||||
|
slowlog = var/log/slow.log
|
||||||
|
rlimit_files = 51200
|
||||||
|
rlimit_core = 0
|
||||||
|
|
||||||
|
catch_workers_output = yes
|
||||||
|
;env[HOSTNAME] = $HOSTNAME
|
||||||
|
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||||
|
env[TMP] = /tmp
|
||||||
|
env[TMPDIR] = /tmp
|
||||||
|
env[TEMP] = /tmp
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ $Mem -le 3000 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl start php-fpm
|
||||||
|
|
||||||
|
elif [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
systemctl restart httpd
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
[ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php72_ver}
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,270 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_PHP73() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ ! -e "/usr/local/lib/libiconv.la" ]; then
|
||||||
|
tar xzf libiconv-${libiconv_ver}.tar.gz
|
||||||
|
pushd libiconv-${libiconv_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libiconv-${libiconv_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then
|
||||||
|
tar xzf curl-${curl_ver}.tar.gz
|
||||||
|
pushd curl-${curl_ver} > /dev/null
|
||||||
|
[ -e "/usr/local/lib/libnghttp2.so" ] && with_nghttp2='--with-nghttp2=/usr/local'
|
||||||
|
./configure --prefix=${curl_install_dir} ${php73_with_ssl} ${with_nghttp2}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf curl-${curl_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${freetype_install_dir}/lib/libfreetype.la" ]; then
|
||||||
|
tar xzf freetype-${freetype_ver}.tar.gz
|
||||||
|
pushd freetype-${freetype_ver} > /dev/null
|
||||||
|
./configure --prefix=${freetype_install_dir} --enable-freetype-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ln -sf ${freetype_install_dir}/include/freetype2/* /usr/include/
|
||||||
|
[ -d /usr/lib/pkgconfig ] && /bin/cp ${freetype_install_dir}/lib/pkgconfig/freetype2.pc /usr/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf freetype-${freetype_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/lib/pkgconfig/libargon2.pc" ]; then
|
||||||
|
tar xzf argon2-${argon2_ver}.tar.gz
|
||||||
|
pushd argon2-${argon2_ver} > /dev/null
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
[ ! -d /usr/local/lib/pkgconfig ] && mkdir -p /usr/local/lib/pkgconfig
|
||||||
|
/bin/cp libargon2.pc /usr/local/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf argon2-${argon2_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/lib/libsodium.la" ]; then
|
||||||
|
tar xzf libsodium-${libsodium_ver}.tar.gz
|
||||||
|
pushd libsodium-${libsodium_ver} > /dev/null
|
||||||
|
./configure --disable-dependency-tracking --enable-minimal
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libsodium-${libsodium_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/include/mhash.h" -a ! -e "/usr/include/mhash.h" ]; then
|
||||||
|
tar xzf mhash-${mhash_ver}.tar.gz
|
||||||
|
pushd mhash-${mhash_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mhash-${mhash_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
[ ! -e "/lib64/libpcre.so.1" ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
|
||||||
|
[ ! -e "/usr/lib/libc-client.so" ] && ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
|
||||||
|
fi
|
||||||
|
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
|
||||||
|
tar xzf php-${php73_ver}.tar.gz
|
||||||
|
pushd php-${php73_ver} > /dev/null
|
||||||
|
if [ -e ext/openssl/openssl.c ] && ! grep -Eqi '^#ifdef RSA_SSLV23_PADDING' ext/openssl/openssl.c; then
|
||||||
|
sed -i '/OPENSSL_SSLV23_PADDING/i#ifdef RSA_SSLV23_PADDING' ext/openssl/openssl.c
|
||||||
|
sed -i '/OPENSSL_SSLV23_PADDING/a#endif' ext/openssl/openssl.c
|
||||||
|
fi
|
||||||
|
make clean
|
||||||
|
[ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
|
||||||
|
[ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
|
||||||
|
if [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php73_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-password-argon2 --with-sodium=/usr/local --with-gd ${php73_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
|
||||||
|
--with-gettext --enable-zip --without-libzip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
else
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-fpm-user=${run_user} --with-fpm-group=${run_group} --enable-fpm ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype-dir=${freetype_install_dir} --with-jpeg-dir --with-png-dir --with-zlib \
|
||||||
|
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php73_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-password-argon2 --with-sodium=/usr/local --with-gd ${php73_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
|
||||||
|
--with-gettext --enable-zip --without-libzip --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
fi
|
||||||
|
make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
|
||||||
|
make install
|
||||||
|
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
[ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
|
||||||
|
echo "${CSUCCESS}PHP installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
rm -rf ${php_install_dir}
|
||||||
|
echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
# wget -c http://pear.php.net/go-pear.phar
|
||||||
|
# ${php_install_dir}/bin/php go-pear.phar
|
||||||
|
|
||||||
|
/bin/cp php.ini-production ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
|
||||||
|
#sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;date.timezone.*@date.timezone = ${timezone}@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^max_execution_time.*@max_execution_time = 600@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
|
||||||
|
[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
|
||||||
|
if [ "${with_old_openssl_flag}" = 'y' ]; then
|
||||||
|
sed -i "s@^;curl.cainfo.*@curl.cainfo = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.cafile.*@openssl.cafile = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.capath.*@openssl.capath = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/02-opcache.ini << EOF
|
||||||
|
[opcache]
|
||||||
|
zend_extension=opcache.so
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
opcache.memory_consumption=${Memory_limit}
|
||||||
|
opcache.interned_strings_buffer=8
|
||||||
|
opcache.max_accelerated_files=100000
|
||||||
|
opcache.max_wasted_percentage=5
|
||||||
|
opcache.use_cwd=1
|
||||||
|
opcache.validate_timestamps=1
|
||||||
|
opcache.revalidate_freq=60
|
||||||
|
;opcache.save_comments=0
|
||||||
|
opcache.consistency_checks=0
|
||||||
|
;opcache.optimization_level=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "${apache_mode_option}" != '2' ]; then
|
||||||
|
# php-fpm Init Script
|
||||||
|
/bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
|
||||||
|
systemctl enable php-fpm
|
||||||
|
|
||||||
|
cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; FPM Configuration ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
; Global Options ;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[global]
|
||||||
|
pid = run/php-fpm.pid
|
||||||
|
error_log = log/php-fpm.log
|
||||||
|
log_level = warning
|
||||||
|
|
||||||
|
emergency_restart_threshold = 30
|
||||||
|
emergency_restart_interval = 60s
|
||||||
|
process_control_timeout = 5s
|
||||||
|
daemonize = yes
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Pool Definitions ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[${run_user}]
|
||||||
|
listen = /dev/shm/php-cgi.sock
|
||||||
|
listen.backlog = -1
|
||||||
|
listen.allowed_clients = 127.0.0.1
|
||||||
|
listen.owner = ${run_user}
|
||||||
|
listen.group = ${run_group}
|
||||||
|
listen.mode = 0666
|
||||||
|
user = ${run_user}
|
||||||
|
group = ${run_group}
|
||||||
|
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 12
|
||||||
|
pm.start_servers = 8
|
||||||
|
pm.min_spare_servers = 6
|
||||||
|
pm.max_spare_servers = 12
|
||||||
|
pm.max_requests = 2048
|
||||||
|
pm.process_idle_timeout = 10s
|
||||||
|
request_terminate_timeout = 120
|
||||||
|
request_slowlog_timeout = 0
|
||||||
|
|
||||||
|
pm.status_path = /php-fpm_status
|
||||||
|
slowlog = var/log/slow.log
|
||||||
|
rlimit_files = 51200
|
||||||
|
rlimit_core = 0
|
||||||
|
|
||||||
|
catch_workers_output = yes
|
||||||
|
;env[HOSTNAME] = $HOSTNAME
|
||||||
|
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||||
|
env[TMP] = /tmp
|
||||||
|
env[TMPDIR] = /tmp
|
||||||
|
env[TEMP] = /tmp
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ $Mem -le 3000 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl start php-fpm
|
||||||
|
|
||||||
|
elif [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
systemctl restart httpd
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
[ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php73_ver}
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,280 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_PHP74() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ ! -e "/usr/local/lib/libiconv.la" ]; then
|
||||||
|
tar xzf libiconv-${libiconv_ver}.tar.gz
|
||||||
|
pushd libiconv-${libiconv_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libiconv-${libiconv_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then
|
||||||
|
tar xzf curl-${curl_ver}.tar.gz
|
||||||
|
pushd curl-${curl_ver} > /dev/null
|
||||||
|
[ -e "/usr/local/lib/libnghttp2.so" ] && with_nghttp2='--with-nghttp2=/usr/local'
|
||||||
|
./configure --prefix=${curl_install_dir} ${php74_with_ssl} ${with_nghttp2}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf curl-${curl_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${freetype_install_dir}/lib/libfreetype.la" ]; then
|
||||||
|
tar xzf freetype-${freetype_ver}.tar.gz
|
||||||
|
pushd freetype-${freetype_ver} > /dev/null
|
||||||
|
./configure --prefix=${freetype_install_dir} --enable-freetype-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ln -sf ${freetype_install_dir}/include/freetype2/* /usr/include/
|
||||||
|
[ -d /usr/lib/pkgconfig ] && /bin/cp ${freetype_install_dir}/lib/pkgconfig/freetype2.pc /usr/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf freetype-${freetype_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/lib/pkgconfig/libargon2.pc" ]; then
|
||||||
|
tar xzf argon2-${argon2_ver}.tar.gz
|
||||||
|
pushd argon2-${argon2_ver} > /dev/null
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
[ ! -d /usr/local/lib/pkgconfig ] && mkdir -p /usr/local/lib/pkgconfig
|
||||||
|
/bin/cp libargon2.pc /usr/local/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf argon2-${argon2_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/lib/libsodium.la" ]; then
|
||||||
|
tar xzf libsodium-${libsodium_ver}.tar.gz
|
||||||
|
pushd libsodium-${libsodium_ver} > /dev/null
|
||||||
|
./configure --disable-dependency-tracking --enable-minimal
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libsodium-${libsodium_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/lib/libzip.la" ]; then
|
||||||
|
tar xzf libzip-${libzip_ver}.tar.gz
|
||||||
|
pushd libzip-${libzip_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libzip-${libzip_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/include/mhash.h" -a ! -e "/usr/include/mhash.h" ]; then
|
||||||
|
tar xzf mhash-${mhash_ver}.tar.gz
|
||||||
|
pushd mhash-${mhash_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mhash-${mhash_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
[ ! -e "/lib64/libpcre.so.1" ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
|
||||||
|
[ ! -e "/usr/lib/libc-client.so" ] && ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
|
||||||
|
fi
|
||||||
|
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
|
||||||
|
tar xzf php-${php74_ver}.tar.gz
|
||||||
|
pushd php-${php74_ver} > /dev/null
|
||||||
|
if [ -e ext/openssl/openssl.c ] && ! grep -Eqi '^#ifdef RSA_SSLV23_PADDING' ext/openssl/openssl.c; then
|
||||||
|
sed -i '/OPENSSL_SSLV23_PADDING/i#ifdef RSA_SSLV23_PADDING' ext/openssl/openssl.c
|
||||||
|
sed -i '/OPENSSL_SSLV23_PADDING/a#endif' ext/openssl/openssl.c
|
||||||
|
fi
|
||||||
|
make clean
|
||||||
|
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:$PKG_CONFIG_PATH
|
||||||
|
[ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
|
||||||
|
[ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
|
||||||
|
if [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype --with-jpeg --with-zlib \
|
||||||
|
--enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php74_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-password-argon2 --with-sodium=/usr/local --enable-gd ${php74_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
|
||||||
|
--with-gettext --with-zip=/usr/local --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
else
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-fpm-user=${run_user} --with-fpm-group=${run_group} --enable-fpm ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv-dir=/usr/local --with-freetype --with-jpeg --with-zlib \
|
||||||
|
--enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem --enable-inline-optimization ${php74_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-password-argon2 --with-sodium=/usr/local --enable-gd ${php74_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp --enable-intl --with-xsl \
|
||||||
|
--with-gettext --with-zip=/usr/local --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
fi
|
||||||
|
make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
|
||||||
|
make install
|
||||||
|
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
[ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
|
||||||
|
echo "${CSUCCESS}PHP installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
rm -rf ${php_install_dir}
|
||||||
|
echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
# wget -c http://pear.php.net/go-pear.phar
|
||||||
|
# ${php_install_dir}/bin/php go-pear.phar
|
||||||
|
|
||||||
|
/bin/cp php.ini-production ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
|
||||||
|
#sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;date.timezone.*@date.timezone = ${timezone}@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^max_execution_time.*@max_execution_time = 600@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
|
||||||
|
[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
|
||||||
|
if [ "${with_old_openssl_flag}" = 'y' ]; then
|
||||||
|
sed -i "s@^;curl.cainfo.*@curl.cainfo = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.cafile.*@openssl.cafile = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.capath.*@openssl.capath = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/02-opcache.ini << EOF
|
||||||
|
[opcache]
|
||||||
|
zend_extension=opcache.so
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
opcache.memory_consumption=${Memory_limit}
|
||||||
|
opcache.interned_strings_buffer=8
|
||||||
|
opcache.max_accelerated_files=100000
|
||||||
|
opcache.max_wasted_percentage=5
|
||||||
|
opcache.use_cwd=1
|
||||||
|
opcache.validate_timestamps=1
|
||||||
|
opcache.revalidate_freq=60
|
||||||
|
;opcache.save_comments=0
|
||||||
|
opcache.consistency_checks=0
|
||||||
|
;opcache.optimization_level=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "${apache_mode_option}" != '2' ]; then
|
||||||
|
# php-fpm Init Script
|
||||||
|
/bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
|
||||||
|
systemctl enable php-fpm
|
||||||
|
|
||||||
|
cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; FPM Configuration ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
; Global Options ;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[global]
|
||||||
|
pid = run/php-fpm.pid
|
||||||
|
error_log = log/php-fpm.log
|
||||||
|
log_level = warning
|
||||||
|
|
||||||
|
emergency_restart_threshold = 30
|
||||||
|
emergency_restart_interval = 60s
|
||||||
|
process_control_timeout = 5s
|
||||||
|
daemonize = yes
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Pool Definitions ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[${run_user}]
|
||||||
|
listen = /dev/shm/php-cgi.sock
|
||||||
|
listen.backlog = -1
|
||||||
|
listen.allowed_clients = 127.0.0.1
|
||||||
|
listen.owner = ${run_user}
|
||||||
|
listen.group = ${run_group}
|
||||||
|
listen.mode = 0666
|
||||||
|
user = ${run_user}
|
||||||
|
group = ${run_group}
|
||||||
|
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 12
|
||||||
|
pm.start_servers = 8
|
||||||
|
pm.min_spare_servers = 6
|
||||||
|
pm.max_spare_servers = 12
|
||||||
|
pm.max_requests = 2048
|
||||||
|
pm.process_idle_timeout = 10s
|
||||||
|
request_terminate_timeout = 120
|
||||||
|
request_slowlog_timeout = 0
|
||||||
|
|
||||||
|
pm.status_path = /php-fpm_status
|
||||||
|
slowlog = var/log/slow.log
|
||||||
|
rlimit_files = 51200
|
||||||
|
rlimit_core = 0
|
||||||
|
|
||||||
|
catch_workers_output = yes
|
||||||
|
;env[HOSTNAME] = $HOSTNAME
|
||||||
|
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||||
|
env[TMP] = /tmp
|
||||||
|
env[TMPDIR] = /tmp
|
||||||
|
env[TEMP] = /tmp
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ $Mem -le 3000 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl start php-fpm
|
||||||
|
|
||||||
|
elif [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
systemctl restart httpd
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
[ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php74_ver}
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,280 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_PHP80() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ ! -e "/usr/local/lib/libiconv.la" ]; then
|
||||||
|
tar xzf libiconv-${libiconv_ver}.tar.gz
|
||||||
|
pushd libiconv-${libiconv_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libiconv-${libiconv_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then
|
||||||
|
tar xzf curl-${curl_ver}.tar.gz
|
||||||
|
pushd curl-${curl_ver} > /dev/null
|
||||||
|
[ -e "/usr/local/lib/libnghttp2.so" ] && with_nghttp2='--with-nghttp2=/usr/local'
|
||||||
|
./configure --prefix=${curl_install_dir} ${php80_with_ssl} ${with_nghttp2}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf curl-${curl_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${freetype_install_dir}/lib/libfreetype.la" ]; then
|
||||||
|
tar xzf freetype-${freetype_ver}.tar.gz
|
||||||
|
pushd freetype-${freetype_ver} > /dev/null
|
||||||
|
./configure --prefix=${freetype_install_dir} --enable-freetype-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ln -sf ${freetype_install_dir}/include/freetype2/* /usr/include/
|
||||||
|
[ -d /usr/lib/pkgconfig ] && /bin/cp ${freetype_install_dir}/lib/pkgconfig/freetype2.pc /usr/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf freetype-${freetype_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/lib/pkgconfig/libargon2.pc" ]; then
|
||||||
|
tar xzf argon2-${argon2_ver}.tar.gz
|
||||||
|
pushd argon2-${argon2_ver} > /dev/null
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
[ ! -d /usr/local/lib/pkgconfig ] && mkdir -p /usr/local/lib/pkgconfig
|
||||||
|
/bin/cp libargon2.pc /usr/local/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf argon2-${argon2_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/lib/libsodium.la" ]; then
|
||||||
|
tar xzf libsodium-${libsodium_ver}.tar.gz
|
||||||
|
pushd libsodium-${libsodium_ver} > /dev/null
|
||||||
|
./configure --disable-dependency-tracking --enable-minimal
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libsodium-${libsodium_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/lib/libzip.la" ]; then
|
||||||
|
tar xzf libzip-${libzip_ver}.tar.gz
|
||||||
|
pushd libzip-${libzip_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libzip-${libzip_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/include/mhash.h" -a ! -e "/usr/include/mhash.h" ]; then
|
||||||
|
tar xzf mhash-${mhash_ver}.tar.gz
|
||||||
|
pushd mhash-${mhash_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mhash-${mhash_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
[ ! -e "/lib64/libpcre.so.1" ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
|
||||||
|
[ ! -e "/usr/lib/libc-client.so" ] && ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
|
||||||
|
fi
|
||||||
|
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
|
||||||
|
tar xzf php-${php80_ver}.tar.gz
|
||||||
|
pushd php-${php80_ver} > /dev/null
|
||||||
|
if [ -e ext/openssl/openssl.c ] && ! grep -Eqi '^#ifdef RSA_SSLV23_PADDING' ext/openssl/openssl.c; then
|
||||||
|
sed -i '/OPENSSL_SSLV23_PADDING/i#ifdef RSA_SSLV23_PADDING' ext/openssl/openssl.c
|
||||||
|
sed -i '/OPENSSL_SSLV23_PADDING/a#endif' ext/openssl/openssl.c
|
||||||
|
fi
|
||||||
|
make clean
|
||||||
|
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:$PKG_CONFIG_PATH
|
||||||
|
[ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
|
||||||
|
[ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
|
||||||
|
if [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv=/usr/local --with-freetype --with-jpeg --with-zlib \
|
||||||
|
--enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem ${php80_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-password-argon2 --with-sodium=/usr/local --enable-gd ${php80_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --enable-ftp --enable-intl --with-xsl \
|
||||||
|
--with-gettext --with-zip=/usr/local --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
else
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-fpm-user=${run_user} --with-fpm-group=${run_group} --enable-fpm ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv=/usr/local --with-freetype --with-jpeg --with-zlib \
|
||||||
|
--enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem ${php80_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-password-argon2 --with-sodium=/usr/local --enable-gd ${php80_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --enable-ftp --enable-intl --with-xsl \
|
||||||
|
--with-gettext --with-zip=/usr/local --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
fi
|
||||||
|
make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
|
||||||
|
make install
|
||||||
|
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
[ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
|
||||||
|
echo "${CSUCCESS}PHP installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
rm -rf ${php_install_dir}
|
||||||
|
echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
# wget -c http://pear.php.net/go-pear.phar
|
||||||
|
# ${php_install_dir}/bin/php go-pear.phar
|
||||||
|
|
||||||
|
/bin/cp php.ini-production ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
|
||||||
|
#sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;date.timezone.*@date.timezone = ${timezone}@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^max_execution_time.*@max_execution_time = 600@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
|
||||||
|
[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
|
||||||
|
if [ "${with_old_openssl_flag}" = 'y' ]; then
|
||||||
|
sed -i "s@^;curl.cainfo.*@curl.cainfo = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.cafile.*@openssl.cafile = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.capath.*@openssl.capath = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/02-opcache.ini << EOF
|
||||||
|
[opcache]
|
||||||
|
zend_extension=opcache.so
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
opcache.memory_consumption=${Memory_limit}
|
||||||
|
opcache.interned_strings_buffer=8
|
||||||
|
opcache.max_accelerated_files=100000
|
||||||
|
opcache.max_wasted_percentage=5
|
||||||
|
opcache.use_cwd=1
|
||||||
|
opcache.validate_timestamps=1
|
||||||
|
opcache.revalidate_freq=60
|
||||||
|
;opcache.save_comments=0
|
||||||
|
opcache.consistency_checks=0
|
||||||
|
;opcache.optimization_level=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "${apache_mode_option}" != '2' ]; then
|
||||||
|
# php-fpm Init Script
|
||||||
|
/bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
|
||||||
|
systemctl enable php-fpm
|
||||||
|
|
||||||
|
cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; FPM Configuration ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
; Global Options ;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[global]
|
||||||
|
pid = run/php-fpm.pid
|
||||||
|
error_log = log/php-fpm.log
|
||||||
|
log_level = warning
|
||||||
|
|
||||||
|
emergency_restart_threshold = 30
|
||||||
|
emergency_restart_interval = 60s
|
||||||
|
process_control_timeout = 5s
|
||||||
|
daemonize = yes
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Pool Definitions ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[${run_user}]
|
||||||
|
listen = /dev/shm/php-cgi.sock
|
||||||
|
listen.backlog = -1
|
||||||
|
listen.allowed_clients = 127.0.0.1
|
||||||
|
listen.owner = ${run_user}
|
||||||
|
listen.group = ${run_group}
|
||||||
|
listen.mode = 0666
|
||||||
|
user = ${run_user}
|
||||||
|
group = ${run_group}
|
||||||
|
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 12
|
||||||
|
pm.start_servers = 8
|
||||||
|
pm.min_spare_servers = 6
|
||||||
|
pm.max_spare_servers = 12
|
||||||
|
pm.max_requests = 2048
|
||||||
|
pm.process_idle_timeout = 10s
|
||||||
|
request_terminate_timeout = 120
|
||||||
|
request_slowlog_timeout = 0
|
||||||
|
|
||||||
|
pm.status_path = /php-fpm_status
|
||||||
|
slowlog = var/log/slow.log
|
||||||
|
rlimit_files = 51200
|
||||||
|
rlimit_core = 0
|
||||||
|
|
||||||
|
catch_workers_output = yes
|
||||||
|
;env[HOSTNAME] = $HOSTNAME
|
||||||
|
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||||
|
env[TMP] = /tmp
|
||||||
|
env[TMPDIR] = /tmp
|
||||||
|
env[TEMP] = /tmp
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ $Mem -le 3000 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl start php-fpm
|
||||||
|
|
||||||
|
elif [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
systemctl restart httpd
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
[ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php80_ver}
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
@@ -0,0 +1,276 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: yeho <lj2007331 AT gmail.com>
|
||||||
|
# BLOG: https://linuxeye.com
|
||||||
|
#
|
||||||
|
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
|
||||||
|
#
|
||||||
|
# Project home page:
|
||||||
|
# https://oneinstack.com
|
||||||
|
# https://github.com/oneinstack/oneinstack
|
||||||
|
|
||||||
|
Install_PHP81() {
|
||||||
|
pushd ${oneinstack_dir}/src > /dev/null
|
||||||
|
if [ ! -e "/usr/local/lib/libiconv.la" ]; then
|
||||||
|
tar xzf libiconv-${libiconv_ver}.tar.gz
|
||||||
|
pushd libiconv-${libiconv_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libiconv-${libiconv_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then
|
||||||
|
tar xzf curl-${curl_ver}.tar.gz
|
||||||
|
pushd curl-${curl_ver} > /dev/null
|
||||||
|
[ -e "/usr/local/lib/libnghttp2.so" ] && with_nghttp2='--with-nghttp2=/usr/local'
|
||||||
|
./configure --prefix=${curl_install_dir} ${php81_with_ssl} ${with_nghttp2}
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf curl-${curl_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "${freetype_install_dir}/lib/libfreetype.la" ]; then
|
||||||
|
tar xzf freetype-${freetype_ver}.tar.gz
|
||||||
|
pushd freetype-${freetype_ver} > /dev/null
|
||||||
|
./configure --prefix=${freetype_install_dir} --enable-freetype-config
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
ln -sf ${freetype_install_dir}/include/freetype2/* /usr/include/
|
||||||
|
[ -d /usr/lib/pkgconfig ] && /bin/cp ${freetype_install_dir}/lib/pkgconfig/freetype2.pc /usr/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf freetype-${freetype_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/lib/pkgconfig/libargon2.pc" ]; then
|
||||||
|
tar xzf argon2-${argon2_ver}.tar.gz
|
||||||
|
pushd argon2-${argon2_ver} > /dev/null
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
[ ! -d /usr/local/lib/pkgconfig ] && mkdir -p /usr/local/lib/pkgconfig
|
||||||
|
/bin/cp libargon2.pc /usr/local/lib/pkgconfig/
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf argon2-${argon2_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/lib/libsodium.la" ]; then
|
||||||
|
tar xzf libsodium-${libsodium_ver}.tar.gz
|
||||||
|
pushd libsodium-${libsodium_ver} > /dev/null
|
||||||
|
./configure --disable-dependency-tracking --enable-minimal
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libsodium-${libsodium_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/lib/libzip.la" ]; then
|
||||||
|
tar xzf libzip-${libzip_ver}.tar.gz
|
||||||
|
pushd libzip-${libzip_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf libzip-${libzip_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/usr/local/include/mhash.h" -a ! -e "/usr/include/mhash.h" ]; then
|
||||||
|
tar xzf mhash-${mhash_ver}.tar.gz
|
||||||
|
pushd mhash-${mhash_ver} > /dev/null
|
||||||
|
./configure
|
||||||
|
make -j ${THREAD} && make install
|
||||||
|
popd > /dev/null
|
||||||
|
rm -rf mhash-${mhash_ver}
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
if [ "${PM}" == 'yum' ]; then
|
||||||
|
[ ! -e "/lib64/libpcre.so.1" ] && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
|
||||||
|
[ ! -e "/usr/lib/libc-client.so" ] && ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
|
||||||
|
fi
|
||||||
|
|
||||||
|
id -g ${run_group} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && groupadd ${run_group}
|
||||||
|
id -u ${run_user} >/dev/null 2>&1
|
||||||
|
[ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
|
||||||
|
|
||||||
|
tar xzf php-${php81_ver}.tar.gz
|
||||||
|
pushd php-${php81_ver} > /dev/null
|
||||||
|
make clean
|
||||||
|
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:$PKG_CONFIG_PATH
|
||||||
|
[ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
|
||||||
|
[ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache'
|
||||||
|
if [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv=/usr/local --with-freetype --with-jpeg --with-zlib \
|
||||||
|
--enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem ${php81_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-password-argon2 --with-sodium=/usr/local --enable-gd ${php81_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --enable-ftp --enable-intl --with-xsl \
|
||||||
|
--with-gettext --with-zip=/usr/local --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
else
|
||||||
|
./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \
|
||||||
|
--with-config-file-scan-dir=${php_install_dir}/etc/php.d \
|
||||||
|
--with-fpm-user=${run_user} --with-fpm-group=${run_group} --enable-fpm ${phpcache_arg} --disable-fileinfo \
|
||||||
|
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
|
||||||
|
--with-iconv=/usr/local --with-freetype --with-jpeg --with-zlib \
|
||||||
|
--enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \
|
||||||
|
--enable-sysvsem ${php81_with_curl} --enable-mbregex \
|
||||||
|
--enable-mbstring --with-password-argon2 --with-sodium=/usr/local --enable-gd ${php81_with_openssl} \
|
||||||
|
--with-mhash --enable-pcntl --enable-sockets --enable-ftp --enable-intl --with-xsl \
|
||||||
|
--with-gettext --with-zip=/usr/local --enable-soap --disable-debug ${php_modules_options}
|
||||||
|
fi
|
||||||
|
make ZEND_EXTRA_LIBS='-liconv' -j ${THREAD}
|
||||||
|
make install
|
||||||
|
|
||||||
|
if [ -e "${php_install_dir}/bin/phpize" ]; then
|
||||||
|
[ ! -e "${php_install_dir}/etc/php.d" ] && mkdir -p ${php_install_dir}/etc/php.d
|
||||||
|
echo "${CSUCCESS}PHP installed successfully! ${CEND}"
|
||||||
|
else
|
||||||
|
rm -rf ${php_install_dir}
|
||||||
|
echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}"
|
||||||
|
kill -9 $$; exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${php_install_dir}/bin:\$PATH" >> /etc/profile
|
||||||
|
[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${php_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${php_install_dir}/bin:\1@" /etc/profile
|
||||||
|
. /etc/profile
|
||||||
|
|
||||||
|
# wget -c http://pear.php.net/go-pear.phar
|
||||||
|
# ${php_install_dir}/bin/php go-pear.phar
|
||||||
|
|
||||||
|
/bin/cp php.ini-production ${php_install_dir}/etc/php.ini
|
||||||
|
|
||||||
|
sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' ${php_install_dir}/etc/php.ini
|
||||||
|
#sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^short_open_tag = Off@short_open_tag = On@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^expose_php = On@expose_php = Off@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^request_order.*@request_order = "CGP"@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;date.timezone.*@date.timezone = ${timezone}@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^post_max_size.*@post_max_size = 100M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^max_execution_time.*@max_execution_time = 600@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini
|
||||||
|
[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini
|
||||||
|
if [ "${with_old_openssl_flag}" = 'y' ]; then
|
||||||
|
sed -i "s@^;curl.cainfo.*@curl.cainfo = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.cafile.*@openssl.cafile = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
sed -i "s@^;openssl.capath.*@openssl.capath = \"${openssl_install_dir}/cert.pem\"@" ${php_install_dir}/etc/php.ini
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "${phpcache_option}" == '1' ] && cat > ${php_install_dir}/etc/php.d/02-opcache.ini << EOF
|
||||||
|
[opcache]
|
||||||
|
zend_extension=opcache.so
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
opcache.memory_consumption=${Memory_limit}
|
||||||
|
opcache.interned_strings_buffer=8
|
||||||
|
opcache.max_accelerated_files=100000
|
||||||
|
opcache.max_wasted_percentage=5
|
||||||
|
opcache.use_cwd=1
|
||||||
|
opcache.validate_timestamps=1
|
||||||
|
opcache.revalidate_freq=60
|
||||||
|
;opcache.save_comments=0
|
||||||
|
opcache.consistency_checks=0
|
||||||
|
;opcache.optimization_level=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "${apache_mode_option}" != '2' ]; then
|
||||||
|
# php-fpm Init Script
|
||||||
|
/bin/cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
|
||||||
|
sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
|
||||||
|
systemctl enable php-fpm
|
||||||
|
|
||||||
|
cat > ${php_install_dir}/etc/php-fpm.conf <<EOF
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; FPM Configuration ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
; Global Options ;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[global]
|
||||||
|
pid = run/php-fpm.pid
|
||||||
|
error_log = log/php-fpm.log
|
||||||
|
log_level = warning
|
||||||
|
|
||||||
|
emergency_restart_threshold = 30
|
||||||
|
emergency_restart_interval = 60s
|
||||||
|
process_control_timeout = 5s
|
||||||
|
daemonize = yes
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Pool Definitions ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
[${run_user}]
|
||||||
|
listen = /dev/shm/php-cgi.sock
|
||||||
|
listen.backlog = -1
|
||||||
|
listen.allowed_clients = 127.0.0.1
|
||||||
|
listen.owner = ${run_user}
|
||||||
|
listen.group = ${run_group}
|
||||||
|
listen.mode = 0666
|
||||||
|
user = ${run_user}
|
||||||
|
group = ${run_group}
|
||||||
|
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 12
|
||||||
|
pm.start_servers = 8
|
||||||
|
pm.min_spare_servers = 6
|
||||||
|
pm.max_spare_servers = 12
|
||||||
|
pm.max_requests = 2048
|
||||||
|
pm.process_idle_timeout = 10s
|
||||||
|
request_terminate_timeout = 120
|
||||||
|
request_slowlog_timeout = 0
|
||||||
|
|
||||||
|
pm.status_path = /php-fpm_status
|
||||||
|
slowlog = var/log/slow.log
|
||||||
|
rlimit_files = 51200
|
||||||
|
rlimit_core = 0
|
||||||
|
|
||||||
|
catch_workers_output = yes
|
||||||
|
;env[HOSTNAME] = $HOSTNAME
|
||||||
|
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||||
|
env[TMP] = /tmp
|
||||||
|
env[TMPDIR] = /tmp
|
||||||
|
env[TEMP] = /tmp
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ $Mem -le 3000 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = $(($Mem/3/30))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = $(($Mem/3/40))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = $(($Mem/3/20))@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 3000 -a $Mem -le 4500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 20@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 4500 -a $Mem -le 6500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 30@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 6500 -a $Mem -le 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 40@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 70@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
elif [ $Mem -gt 8500 ]; then
|
||||||
|
sed -i "s@^pm.max_children.*@pm.max_children = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.start_servers.*@pm.start_servers = 60@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 50@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 80@" ${php_install_dir}/etc/php-fpm.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl start php-fpm
|
||||||
|
|
||||||
|
elif [ "${apache_mode_option}" == '2' ]; then
|
||||||
|
systemctl restart httpd
|
||||||
|
fi
|
||||||
|
popd > /dev/null
|
||||||
|
[ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php81_ver}
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user