install.sh 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://linuxeye.com
  4. #
  5. # Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
  6. #
  7. # Project home page:
  8. # https://oneinstack.com
  9. # https://github.com/oneinstack/oneinstack
  10. export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
  11. clear
  12. printf "
  13. #######################################################################
  14. # OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+ #
  15. # For more information please visit https://oneinstack.com #
  16. #######################################################################
  17. "
  18. # Check if user is root
  19. [ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
  20. oneinstack_dir=$(dirname "`readlink -f $0`")
  21. pushd ${oneinstack_dir} > /dev/null
  22. . ./versions.txt
  23. . ./options.conf
  24. . ./include/color.sh
  25. . ./include/check_os.sh
  26. . ./include/check_dir.sh
  27. . ./include/download.sh
  28. . ./include/get_char.sh
  29. dbrootpwd=`< /dev/urandom tr -dc A-Za-z0-9 | head -c8`
  30. dbpostgrespwd=`< /dev/urandom tr -dc A-Za-z0-9 | head -c8`
  31. dbmongopwd=`< /dev/urandom tr -dc A-Za-z0-9 | head -c8`
  32. xcachepwd=`< /dev/urandom tr -dc A-Za-z0-9 | head -c8`
  33. dbinstallmethod=1
  34. version() {
  35. echo "version: 2.6"
  36. echo "updated date: 2023-02-04"
  37. }
  38. Show_Help() {
  39. version
  40. echo "Usage: $0 command ...[parameters]....
  41. --help, -h Show this help message, More: https://oneinstack.com/auto
  42. --version, -v Show version info
  43. --nginx_option [1-4] Install Nginx server version
  44. --apache Install Apache
  45. --apache_mode_option [1-2] Apache2.4 mode, 1(default): php-fpm, 2: mod_php
  46. --apache_mpm_option [1-3] Apache2.4 MPM, 1(default): event, 2: prefork, 3: worker
  47. --php_option [1-13] Install PHP version
  48. --mphp_ver [53~83] Install another PHP version (PATH: ${php_install_dir}\${mphp_ver})
  49. --mphp_addons Only install another PHP addons
  50. --phpcache_option [1-4] Install PHP opcode cache, default: 1 opcache
  51. --php_extensions [ext name] Install PHP extensions, include zendguardloader,ioncube,
  52. sourceguardian,imagick,gmagick,fileinfo,imap,ldap,calendar,phalcon,
  53. yaf,yar,redis,memcached,memcache,mongodb,swoole,xdebug
  54. --nodejs Install Nodejs
  55. --tomcat_option [1-6] Install Tomcat version
  56. --jdk_option [1-3] Install JDK version
  57. --db_option [1-14] Install DB version
  58. --dbinstallmethod [1-2] DB install method, default: 1 binary install
  59. --dbrootpwd [password] DB super password
  60. --pureftpd Install Pure-Ftpd
  61. --redis Install Redis
  62. --memcached Install Memcached
  63. --phpmyadmin Install phpMyAdmin
  64. --ssh_port [No.] SSH port
  65. --firewall Enable firewall
  66. --md5sum Check md5sum
  67. --reboot Restart the server after installation
  68. "
  69. }
  70. ARG_NUM=$#
  71. TEMP=`getopt -o hvV --long help,version,nginx_option:,apache,apache_mode_option:,apache_mpm_option:,php_option:,mphp_ver:,mphp_addons,phpcache_option:,php_extensions:,nodejs,tomcat_option:,jdk_option:,db_option:,dbrootpwd:,dbinstallmethod:,pureftpd,redis,memcached,phpmyadmin,ssh_port:,firewall,md5sum,reboot -- "$@" 2>/dev/null`
  72. [ $? != 0 ] && echo "${CWARNING}ERROR: unknown argument! ${CEND}" && Show_Help && exit 1
  73. eval set -- "${TEMP}"
  74. while :; do
  75. [ -z "$1" ] && break;
  76. case "$1" in
  77. -h | --help)
  78. Show_Help
  79. exit 0
  80. ;;
  81. -v | -V | --version)
  82. version
  83. exit 0
  84. ;;
  85. --nginx_option)
  86. nginx_option=$2
  87. shift 2
  88. [[ ! ${nginx_option} =~ ^[1-4]$ ]] && {
  89. echo "${CWARNING}nginx_option input error! Please only input number 1~5${CEND}"
  90. exit 1
  91. }
  92. [ -e "${nginx_install_dir}/sbin/nginx" ] && {
  93. echo "${CWARNING}Nginx already installed! ${CEND}"
  94. unset nginx_option
  95. }
  96. [ -e "${tengine_install_dir}/sbin/nginx" ] && {
  97. echo "${CWARNING}Tengine already installed! ${CEND}"
  98. unset nginx_option
  99. }
  100. [ -e "${openresty_install_dir}/nginx/sbin/nginx" ] && {
  101. echo "${CWARNING}OpenResty already installed! ${CEND}"
  102. unset nginx_option
  103. }
  104. [ -e "${caddy_install_dir}/bin/caddy" ] && {
  105. echo "${CWARNING}Caddy already installed! ${CEND}"
  106. unset nginx_option
  107. }
  108. ;;
  109. --apache)
  110. apache_flag=y
  111. shift 1
  112. [ -e "${apache_install_dir}/bin/httpd" ] && {
  113. echo "${CWARNING}Aapche already installed! ${CEND}"
  114. unset apache_flag
  115. }
  116. ;;
  117. --apache_mode_option)
  118. apache_mode_option=$2
  119. shift 2
  120. [[ ! ${apache_mode_option} =~ ^[1-2]$ ]] && {
  121. echo "${CWARNING}apache_mode_option input error! Please only input number 1~2${CEND}"
  122. exit 1
  123. }
  124. ;;
  125. --apache_mpm_option)
  126. apache_mpm_option=$2
  127. shift 2
  128. [[ ! ${apache_mpm_option} =~ ^[1-3]$ ]] && {
  129. echo "${CWARNING}apache_mpm_option input error! Please only input number 1~3${CEND}"
  130. exit 1
  131. }
  132. ;;
  133. --php_option)
  134. php_option=$2
  135. shift 2
  136. [[ ! ${php_option} =~ ^[1-9]$|^1[0-4]$ ]] && {
  137. echo "${CWARNING}php_option input error! Please only input number 1~14${CEND}"
  138. exit 1
  139. }
  140. [ -e "${php_install_dir}/bin/phpize" ] && {
  141. echo "${CWARNING}PHP already installed! ${CEND}"
  142. unset php_option
  143. }
  144. ;;
  145. --mphp_ver)
  146. mphp_ver=$2
  147. mphp_flag=y
  148. shift 2
  149. [[ ! "${mphp_ver}" =~ ^5[3-6]$|^7[0-4]$|^8[0-3]$ ]] && {
  150. echo "${CWARNING}mphp_ver input error! Please only input number 53~82${CEND}"
  151. exit 1
  152. }
  153. ;;
  154. --mphp_addons)
  155. mphp_addons_flag=y
  156. shift 1
  157. ;;
  158. --phpcache_option)
  159. phpcache_option=$2
  160. shift 2
  161. ;;
  162. --php_extensions)
  163. php_extensions=$2
  164. shift 2
  165. [ -n "$(echo ${php_extensions} | grep -w zendguardloader)" ] && pecl_zendguardloader=1
  166. [ -n "$(echo ${php_extensions} | grep -w ioncube)" ] && pecl_ioncube=1
  167. [ -n "$(echo ${php_extensions} | grep -w sourceguardian)" ] && pecl_sourceguardian=1
  168. [ -n "$(echo ${php_extensions} | grep -w imagick)" ] && pecl_imagick=1
  169. [ -n "$(echo ${php_extensions} | grep -w gmagick)" ] && pecl_gmagick=1
  170. [ -n "$(echo ${php_extensions} | grep -w fileinfo)" ] && pecl_fileinfo=1
  171. [ -n "$(echo ${php_extensions} | grep -w imap)" ] && pecl_imap=1
  172. [ -n "$(echo ${php_extensions} | grep -w ldap)" ] && pecl_ldap=1
  173. [ -n "$(echo ${php_extensions} | grep -w calendar)" ] && pecl_calendar=1
  174. [ -n "$(echo ${php_extensions} | grep -w phalcon)" ] && pecl_phalcon=1
  175. [ -n "$(echo ${php_extensions} | grep -w yaf)" ] && pecl_yaf=1
  176. [ -n "$(echo ${php_extensions} | grep -w yar)" ] && pecl_yar=1
  177. [ -n "$(echo ${php_extensions} | grep -w redis)" ] && pecl_redis=1
  178. [ -n "$(echo ${php_extensions} | grep -w memcached)" ] && pecl_memcached=1
  179. [ -n "$(echo ${php_extensions} | grep -w memcache)" ] && pecl_memcache=1
  180. [ -n "$(echo ${php_extensions} | grep -w mongodb)" ] && pecl_mongodb=1
  181. [ -n "$(echo ${php_extensions} | grep -w swoole)" ] && pecl_swoole=1
  182. [ -n "$(echo ${php_extensions} | grep -w xdebug)" ] && pecl_xdebug=1
  183. ;;
  184. --nodejs)
  185. nodejs_flag=y
  186. shift 1
  187. [ -e "${nodejs_install_dir}/bin/node" ] && {
  188. echo "${CWARNING}Nodejs already installed! ${CEND}"
  189. unset nodejs_flag
  190. }
  191. ;;
  192. --tomcat_option)
  193. tomcat_option=$2
  194. shift 2
  195. [[ ! ${tomcat_option} =~ ^[1-6]$ ]] && {
  196. echo "${CWARNING}tomcat_option input error! Please only input number 1~6${CEND}"
  197. exit 1
  198. }
  199. [ -e "$tomcat_install_dir/conf/server.xml" ] && {
  200. echo "${CWARNING}Tomcat already installed! ${CEND}"
  201. unset tomcat_option
  202. }
  203. ;;
  204. --jdk_option)
  205. jdk_option=$2
  206. shift 2
  207. [[ ! ${jdk_option} =~ ^[1-4]$ ]] && {
  208. echo "${CWARNING}jdk_option input error! Please only input number 1~4${CEND}"
  209. exit 1
  210. }
  211. ;;
  212. --db_option)
  213. db_option=$2
  214. shift 2
  215. if [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]]; then
  216. [ -d "${db_install_dir}/support-files" ] && {
  217. echo "${CWARNING}MySQL already installed! ${CEND}"
  218. unset db_option
  219. }
  220. elif [ "${db_option}" == '13' ]; then
  221. [ -e "${pgsql_install_dir}/bin/psql" ] && {
  222. echo "${CWARNING}PostgreSQL already installed! ${CEND}"
  223. unset db_option
  224. }
  225. elif [ "${db_option}" == '14' ]; then
  226. [ -e "${mongo_install_dir}/bin/mongo" ] && {
  227. echo "${CWARNING}MongoDB already installed! ${CEND}"
  228. unset db_option
  229. }
  230. else
  231. echo "${CWARNING}db_option input error! Please only input number 1~14${CEND}"
  232. exit 1
  233. fi
  234. ;;
  235. --dbrootpwd)
  236. dbrootpwd=$2
  237. shift 2
  238. dbpostgrespwd="${dbrootpwd}"
  239. dbmongopwd="${dbrootpwd}"
  240. ;;
  241. --dbinstallmethod)
  242. dbinstallmethod=$2
  243. shift 2
  244. [[ ! ${dbinstallmethod} =~ ^[1-2]$ ]] && {
  245. echo "${CWARNING}dbinstallmethod input error! Please only input number 1~2${CEND}"
  246. exit 1
  247. }
  248. ;;
  249. --pureftpd)
  250. pureftpd_flag=y
  251. shift 1
  252. [ -e "${pureftpd_install_dir}/sbin/pure-ftpwho" ] && {
  253. echo "${CWARNING}Pure-FTPd already installed! ${CEND}"
  254. unset pureftpd_flag
  255. }
  256. ;;
  257. --redis)
  258. redis_flag=y
  259. shift 1
  260. [ -e "${redis_install_dir}/bin/redis-server" ] && {
  261. echo "${CWARNING}redis-server already installed! ${CEND}"
  262. unset redis_flag
  263. }
  264. ;;
  265. --memcached)
  266. memcached_flag=y
  267. shift 1
  268. [ -e "${memcached_install_dir}/bin/memcached" ] && {
  269. echo "${CWARNING}memcached-server already installed! ${CEND}"
  270. unset memcached_flag
  271. }
  272. ;;
  273. --phpmyadmin)
  274. phpmyadmin_flag=y
  275. shift 1
  276. [ -d "${wwwroot_dir}/default/phpMyAdmin" ] && {
  277. echo "${CWARNING}phpMyAdmin already installed! ${CEND}"
  278. unset phpmyadmin_flag
  279. }
  280. ;;
  281. --ssh_port)
  282. ssh_port=$2
  283. shift 2
  284. ;;
  285. --firewall)
  286. firewall_flag=y
  287. shift 1
  288. ;;
  289. --md5sum)
  290. md5sum_flag=y; shift 1
  291. ;;
  292. --reboot)
  293. reboot_flag=y
  294. shift 1
  295. ;;
  296. --)
  297. shift
  298. ;;
  299. *)
  300. echo "${CWARNING}ERROR: unknown argument! ${CEND}" && Show_Help && exit 1
  301. ;;
  302. esac
  303. done
  304. # Check md5sum
  305. if [ ${ARG_NUM} == 0 ] && [ ! -e ~/.oneinstack ]; then
  306. # Check md5sum
  307. while :; do echo
  308. read -e -p "Do you want to check md5sum? [y/n]: " md5sum_flag
  309. if [[ ! ${md5sum_flag} =~ ^[y,n]$ ]]; then
  310. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  311. else
  312. break
  313. fi
  314. done
  315. fi
  316. if [ "${md5sum_flag}" == 'y' ]; then
  317. [ -e "${oneinstack_dir}.tar.gz" ] && oneinstack_file=${oneinstack_dir}.tar.gz
  318. [ -e "${oneinstack_dir}-full.tar.gz" ] && oneinstack_file=${oneinstack_dir}-full.tar.gz
  319. oneinstack_tgz=${oneinstack_file##*/}
  320. if [ -e "${oneinstack_file}" ]; then
  321. now_oneinstack_md5=$(md5sum ${oneinstack_file} | awk '{print $1}')
  322. latest_oneinStack_md5=$(curl --connect-timeout 3 -m 5 -s ${mirror_link}/md5sum.txt | grep ${oneinstack_tgz} | awk '{print $1}')
  323. if [ "${now_oneinstack_md5}" != "${latest_oneinStack_md5}" ]; then
  324. echo "${CFAILURE}Error: The md5 value of the installation package does not match the official website, please download again, url: ${mirror_link}/${oneinstack_tgz}${CEND}"
  325. exit 1
  326. fi
  327. else
  328. echo "${CFAILURE}Error: ${oneinstack_file} does not exist${CEND}"
  329. exit 1
  330. fi
  331. fi
  332. # Use default SSH port 22. If you use another SSH port on your server
  333. if [ -e "/etc/ssh/sshd_config" ]; then
  334. [ -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`
  335. while :; do echo
  336. [ ${ARG_NUM} == 0 ] && read -e -p "Please input SSH port(Default: ${now_ssh_port}): " ssh_port
  337. ssh_port=${ssh_port:-${now_ssh_port}}
  338. if [ ${ssh_port} -eq 22 >/dev/null 2>&1 -o ${ssh_port} -gt 1024 >/dev/null 2>&1 -a ${ssh_port} -lt 65535 >/dev/null 2>&1 ]; then
  339. break
  340. else
  341. echo "${CWARNING}input error! Input range: 22,1025~65534${CEND}"
  342. exit 1
  343. fi
  344. done
  345. if [ -z "`grep ^Port /etc/ssh/sshd_config`" -a "${ssh_port}" != '22' ]; then
  346. sed -i "s@^#Port.*@&\nPort ${ssh_port}@" /etc/ssh/sshd_config
  347. elif [ -n "`grep ^Port /etc/ssh/sshd_config`" ]; then
  348. sed -i "s@^Port.*@Port ${ssh_port}@" /etc/ssh/sshd_config
  349. fi
  350. fi
  351. if [ ${ARG_NUM} == 0 ]; then
  352. if [ ! -e ~/.oneinstack ]; then
  353. # check firewall
  354. while :; do echo
  355. read -e -p "Do you want to enable firewall? [y/n]: " firewall_flag
  356. if [[ ! ${firewall_flag} =~ ^[y,n]$ ]]; then
  357. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  358. else
  359. break
  360. fi
  361. done
  362. fi
  363. # check Web server
  364. while :; do echo
  365. read -e -p "Do you want to install Web server? [y/n]: " web_flag
  366. if [[ ! ${web_flag} =~ ^[y,n]$ ]]; then
  367. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  368. else
  369. if [ "${web_flag}" == 'y' ]; then
  370. # Nginx/Tegine/OpenResty
  371. while :; do
  372. echo
  373. echo 'Please select Web server type:'
  374. echo -e "\t${CMSG}1${CEND}. Install Nginx"
  375. echo -e "\t${CMSG}2${CEND}. Install Tengine"
  376. echo -e "\t${CMSG}3${CEND}. Install OpenResty"
  377. echo -e "\t${CMSG}4${CEND}. Install Caddy"
  378. echo -e "\t${CMSG}5${CEND}. Do not install"
  379. read -e -p "Please input a number:(Default 1 press Enter) " nginx_option
  380. nginx_option=${nginx_option:-1}
  381. if [[ ! ${nginx_option} =~ ^[1-5]$ ]]; then
  382. echo "${CWARNING}input error! Please only input number 1~5${CEND}"
  383. else
  384. [ "${nginx_option}" != '5' -a -e "${nginx_install_dir}/sbin/nginx" ] && {
  385. echo "${CWARNING}Nginx already installed! ${CEND}"
  386. unset nginx_option
  387. }
  388. [ "${nginx_option}" != '5' -a -e "${tengine_install_dir}/sbin/nginx" ] && {
  389. echo "${CWARNING}Tengine already installed! ${CEND}"
  390. unset nginx_option
  391. }
  392. [ "${nginx_option}" != '5' -a -e "${openresty_install_dir}/nginx/sbin/nginx" ] && {
  393. echo "${CWARNING}OpenResty already installed! ${CEND}"
  394. unset nginx_option
  395. }
  396. [ "${nginx_option}" != '5' -a -e "${caddy_install_dir}/bin/caddy" ] && {
  397. echo "${CWARNING}Caddy already installed! ${CEND}"
  398. unset nginx_option
  399. }
  400. break
  401. fi
  402. done
  403. if [[ ${nginx_option} =~ ^[1-3]$ ]]; then
  404. # Apache
  405. while :; do
  406. echo
  407. read -e -p "Do you want to install Apache? [y/n]: " apache_flag
  408. if [[ ! ${apache_flag} =~ ^[y,n]$ ]]; then
  409. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  410. else
  411. [ "${apache_flag}" == 'y' -a -e "${apache_install_dir}/bin/httpd" ] && {
  412. echo "${CWARNING}Aapche already installed! ${CEND}"
  413. unset apache_flag
  414. }
  415. break
  416. fi
  417. done
  418. # Apache2.4 mode and Apache2.4 MPM
  419. if [ "${apache_flag}" == 'y' -o -e "${apache_install_dir}/bin/httpd" ]; then
  420. while :; do
  421. echo
  422. echo 'Please select Apache mode:'
  423. echo -e "\t${CMSG}1${CEND}. php-fpm"
  424. echo -e "\t${CMSG}2${CEND}. mod_php"
  425. read -e -p "Please input a number:(Default 1 press Enter) " apache_mode_option
  426. apache_mode_option=${apache_mode_option:-1}
  427. if [[ ! ${apache_mode_option} =~ ^[1-2]$ ]]; then
  428. echo "${CWARNING}input error! Please only input number 1~2${CEND}"
  429. else
  430. break
  431. fi
  432. done
  433. while :; do
  434. echo
  435. echo 'Please select Apache MPM:'
  436. echo -e "\t${CMSG}1${CEND}. event"
  437. echo -e "\t${CMSG}2${CEND}. prefork"
  438. echo -e "\t${CMSG}3${CEND}. worker"
  439. read -e -p "Please input a number:(Default 1 press Enter) " apache_mpm_option
  440. apache_mpm_option=${apache_mpm_option:-1}
  441. if [[ ! ${apache_mpm_option} =~ ^[1-3]$ ]]; then
  442. echo "${CWARNING}input error! Please only input number 1~3${CEND}"
  443. else
  444. break
  445. fi
  446. done
  447. fi
  448. # Tomcat
  449. while :; do
  450. echo
  451. echo 'Please select tomcat server:'
  452. echo -e "\t${CMSG}1${CEND}. Install Tomcat-11"
  453. echo -e "\t${CMSG}2${CEND}. Install Tomcat-10"
  454. echo -e "\t${CMSG}3${CEND}. Install Tomcat-9"
  455. echo -e "\t${CMSG}4${CEND}. Install Tomcat-8"
  456. echo -e "\t${CMSG}5${CEND}. Install Tomcat-7"
  457. echo -e "\t${CMSG}6${CEND}. Install Tomcat-6"
  458. echo -e "\t${CMSG}7${CEND}. Do not install"
  459. read -e -p "Please input a number:(Default 7 press Enter) " tomcat_option
  460. tomcat_option=${tomcat_option:-7}
  461. if [[ ! ${tomcat_option} =~ ^[1-7]$ ]]; then
  462. echo "${CWARNING}input error! Please only input number 1~7${CEND}"
  463. else
  464. [ "${tomcat_option}" != '7' -a -e "$tomcat_install_dir/conf/server.xml" ] && {
  465. echo "${CWARNING}Tomcat already installed! ${CEND}"
  466. unset tomcat_option
  467. }
  468. if [[ "${tomcat_option}" =~ ^1$ ]]; then
  469. while :; do
  470. echo
  471. echo 'Please select JDK version:'
  472. echo -e "\t${CMSG}1${CEND}. Install openjdk-8-jdk"
  473. echo -e "\t${CMSG}2${CEND}. Install openjdk-11-jdk"
  474. echo -e "\t${CMSG}3${CEND}. Install openjdk-17-jdk"
  475. echo -e "\t${CMSG}4${CEND}. Install openjdk-18-jdk"
  476. read -e -p "Please input a number:(Default 1 press Enter) " jdk_option
  477. jdk_option=${jdk_option:-1}
  478. if [[ ! ${jdk_option} =~ ^[1-4]$ ]]; then
  479. echo "${CWARNING}input error! Please only input number 1~4${CEND}"
  480. else
  481. break
  482. fi
  483. done
  484. elif [[ "${tomcat_option}" =~ ^[2-3]$ ]]; then
  485. while :; do
  486. echo
  487. echo 'Please select JDK version:'
  488. echo -e "\t${CMSG}1${CEND}. Install openjdk-8-jdk"
  489. echo -e "\t${CMSG}2${CEND}. Install openjdk-11-jdk"
  490. echo -e "\t${CMSG}3${CEND}. Install openjdk-17-jdk"
  491. read -e -p "Please input a number:(Default 1 press Enter) " jdk_option
  492. jdk_option=${jdk_option:-1}
  493. if [[ ! ${jdk_option} =~ ^[1-3]$ ]]; then
  494. echo "${CWARNING}input error! Please only input number 1~3${CEND}"
  495. else
  496. break
  497. fi
  498. done
  499. elif [ "${tomcat_option}" == '4' ]; then
  500. while :; do
  501. echo
  502. echo 'Please select JDK version:'
  503. echo -e "\t${CMSG}1${CEND}. Install openjdk-8-jdk"
  504. read -e -p "Please input a number:(Default 1 press Enter) " jdk_option
  505. jdk_option=${jdk_option:-1}
  506. if [[ ! ${jdk_option} =~ ^1$ ]]; then
  507. echo "${CWARNING}input error! Please only input number 1${CEND}"
  508. else
  509. break
  510. fi
  511. done
  512. fi
  513. break
  514. fi
  515. done
  516. elif [ "${nginx_option}" == '4' ]; then
  517. # Caddy
  518. while :; do
  519. echo
  520. read -e -p "Do you want to install Caddy? [y/n]: " caddy_flag
  521. if [[ ! ${caddy_flag} =~ ^[y,n]$ ]]; then
  522. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  523. else
  524. [ "${caddy_flag}" == 'y' -a -e "${caddy_install_dir}/bin/caddy" ] && {
  525. echo "${CWARNING}Caddy already installed! ${CEND}"
  526. unset caddy_flag
  527. }
  528. break
  529. fi
  530. done
  531. fi
  532. fi
  533. break
  534. fi
  535. done
  536. # choice database
  537. while :; do
  538. echo
  539. read -e -p "Do you want to install Database? [y/n]: " db_flag
  540. if [[ ! ${db_flag} =~ ^[y,n]$ ]]; then
  541. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  542. else
  543. if [ "${db_flag}" == 'y' ]; then
  544. while :; do
  545. echo
  546. echo 'Please select a version of the Database:'
  547. echo -e "\t${CMSG} 0${CEND}. Install MySQL-8.2"
  548. echo -e "\t${CMSG} 1${CEND}. Install MySQL-8.0"
  549. echo -e "\t${CMSG} 2${CEND}. Install MySQL-5.7"
  550. echo -e "\t${CMSG} 3${CEND}. Install MySQL-5.6"
  551. echo -e "\t${CMSG} 4${CEND}. Install MySQL-5.5"
  552. echo -e "\t${CMSG} 5${CEND}. Install MariaDB-10.11"
  553. echo -e "\t${CMSG} 6${CEND}. Install MariaDB-10.5"
  554. echo -e "\t${CMSG} 7${CEND}. Install MariaDB-10.4"
  555. echo -e "\t${CMSG} 8${CEND}. Install MariaDB-5.5"
  556. echo -e "\t${CMSG} 9${CEND}. Install Percona-8.0"
  557. echo -e "\t${CMSG}10${CEND}. Install Percona-5.7"
  558. echo -e "\t${CMSG}11${CEND}. Install Percona-5.6"
  559. echo -e "\t${CMSG}12${CEND}. Install Percona-5.5"
  560. echo -e "\t${CMSG}13${CEND}. Install PostgreSQL"
  561. echo -e "\t${CMSG}14${CEND}. Install MongoDB"
  562. read -e -p "Please input a number:(Default 2 press Enter) " db_option
  563. db_option=${db_option:-2}
  564. if [[ "${db_option}" =~ ^[0-9]$|^1[0-4]$ ]]; then
  565. if [ "${db_option}" == '13' ]; then
  566. [ -e "${pgsql_install_dir}/bin/psql" ] && { echo "${CWARNING}PostgreSQL already installed! ${CEND}"; unset db_option; break; }
  567. elif [ "${db_option}" == '14' ]; then
  568. [ -e "${mongo_install_dir}/bin/mongo" ] && { echo "${CWARNING}MongoDB already installed! ${CEND}"; unset db_option; break; }
  569. else
  570. [ -d "${db_install_dir}/support-files" ] && { echo "${CWARNING}MySQL already installed! ${CEND}"; unset db_option; break; }
  571. fi
  572. while :; do
  573. if [ "${db_option}" == '13' ]; then
  574. read -e -p "Please input the postgres password of PostgreSQL(default: ${dbpostgrespwd}): " dbpwd
  575. dbpwd=${dbpwd:-${dbpostgrespwd}}
  576. elif [ "${db_option}" == '14' ]; then
  577. read -e -p "Please input the root password of MongoDB(default: ${dbmongopwd}): " dbpwd
  578. dbpwd=${dbpwd:-${dbmongopwd}}
  579. else
  580. read -e -p "Please input the root password of MySQL(default: ${dbrootpwd}): " dbpwd
  581. dbpwd=${dbpwd:-${dbrootpwd}}
  582. fi
  583. [ -n "`echo ${dbpwd} | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; }
  584. if (( ${#dbpwd} >= 5 )); then
  585. if [ "${db_option}" == '13' ]; then
  586. dbpostgrespwd=${dbpwd}
  587. elif [ "${db_option}" == '14' ]; then
  588. dbmongopwd=${dbpwd}
  589. else
  590. dbrootpwd=${dbpwd}
  591. fi
  592. break
  593. else
  594. echo "${CWARNING}password least 5 characters! ${CEND}"
  595. fi
  596. done
  597. # choose install methods
  598. if [[ "${db_option}" =~ ^[0-9]$|^1[0-4]$ ]]; then
  599. while :; do echo
  600. echo "Please choose installation of the database:"
  601. echo -e "\t${CMSG}1${CEND}. Install database from binary package."
  602. echo -e "\t${CMSG}2${CEND}. Install database from source package."
  603. read -e -p "Please input a number:(Default 1 press Enter) " dbinstallmethod
  604. dbinstallmethod=${dbinstallmethod:-1}
  605. if [[ ! ${dbinstallmethod} =~ ^[1-2]$ ]]; then
  606. echo "${CWARNING}input error! Please only input number 1~2${CEND}"
  607. else
  608. break
  609. fi
  610. done
  611. fi
  612. break
  613. else
  614. echo "${CWARNING}input error! Please only input number 1~14${CEND}"
  615. fi
  616. done
  617. fi
  618. break
  619. fi
  620. done
  621. # choice php
  622. while :; do echo
  623. read -e -p "Do you want to install PHP? [y/n]: " php_flag
  624. if [[ ! ${php_flag} =~ ^[y,n]$ ]]; then
  625. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  626. else
  627. if [ "${php_flag}" == 'y' ]; then
  628. [ -e "${php_install_dir}/bin/phpize" ] && { echo "${CWARNING}PHP already installed! ${CEND}"; unset php_option; break; }
  629. while :; do echo
  630. echo 'Please select a version of the PHP:'
  631. echo -e "\t${CMSG} 1${CEND}. Install php-5.3"
  632. echo -e "\t${CMSG} 2${CEND}. Install php-5.4"
  633. echo -e "\t${CMSG} 3${CEND}. Install php-5.5"
  634. echo -e "\t${CMSG} 4${CEND}. Install php-5.6"
  635. echo -e "\t${CMSG} 5${CEND}. Install php-7.0"
  636. echo -e "\t${CMSG} 6${CEND}. Install php-7.1"
  637. echo -e "\t${CMSG} 7${CEND}. Install php-7.2"
  638. echo -e "\t${CMSG} 8${CEND}. Install php-7.3"
  639. echo -e "\t${CMSG} 9${CEND}. Install php-7.4"
  640. echo -e "\t${CMSG}10${CEND}. Install php-8.0"
  641. echo -e "\t${CMSG}11${CEND}. Install php-8.1"
  642. echo -e "\t${CMSG}12${CEND}. Install php-8.2"
  643. echo -e "\t${CMSG}13${CEND}. Install php-8.3"
  644. echo -e "\t${CMSG}14${CEND}. Install php-8.4"
  645. read -e -p "Please input a number:(Default 7 press Enter) " php_option
  646. php_option=${php_option:-7}
  647. if [[ ! ${php_option} =~ ^[1-9]$|^1[0-4]$ ]]; then
  648. echo "${CWARNING}input error! Please only input number 1~14${CEND}"
  649. else
  650. break
  651. fi
  652. done
  653. fi
  654. break
  655. fi
  656. done
  657. # check php ver
  658. if [ -e "${php_install_dir}/bin/phpize" ]; then
  659. PHP_detail_ver=$(${php_install_dir}/bin/php-config --version)
  660. PHP_main_ver=${PHP_detail_ver%.*}
  661. fi
  662. # PHP opcode cache and extensions
  663. if [[ ${php_option} =~ ^[1-9]$|^1[0-3]$ ]] || [ -e "${php_install_dir}/bin/phpize" ]; then
  664. while :; do echo
  665. read -e -p "Do you want to install opcode cache of the PHP? [y/n]: " phpcache_flag
  666. if [[ ! ${phpcache_flag} =~ ^[y,n]$ ]]; then
  667. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  668. else
  669. if [ "${phpcache_flag}" == 'y' ]; then
  670. if [ "${php_option}" == '1' -o "${PHP_main_ver}" == '5.3' ]; then
  671. while :; do
  672. echo 'Please select a opcode cache of the PHP:'
  673. echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
  674. echo -e "\t${CMSG}2${CEND}. Install APCU"
  675. echo -e "\t${CMSG}3${CEND}. Install XCache"
  676. echo -e "\t${CMSG}4${CEND}. Install eAccelerator-0.9"
  677. read -e -p "Please input a number:(Default 1 press Enter) " phpcache_option
  678. phpcache_option=${phpcache_option:-1}
  679. if [[ ! ${phpcache_option} =~ ^[1-4]$ ]]; then
  680. echo "${CWARNING}input error! Please only input number 1~4${CEND}"
  681. else
  682. break
  683. fi
  684. done
  685. fi
  686. if [ "${php_option}" == '2' -o "${PHP_main_ver}" == '5.4' ]; then
  687. while :; do
  688. echo 'Please select a opcode cache of the PHP:'
  689. echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
  690. echo -e "\t${CMSG}2${CEND}. Install APCU"
  691. echo -e "\t${CMSG}3${CEND}. Install XCache"
  692. echo -e "\t${CMSG}4${CEND}. Install eAccelerator-1.0-dev"
  693. read -e -p "Please input a number:(Default 1 press Enter) " phpcache_option
  694. phpcache_option=${phpcache_option:-1}
  695. if [[ ! ${phpcache_option} =~ ^[1-4]$ ]]; then
  696. echo "${CWARNING}input error! Please only input number 1~4${CEND}"
  697. else
  698. break
  699. fi
  700. done
  701. fi
  702. if [ "${php_option}" == '3' -o "${PHP_main_ver}" == '5.5' ]; then
  703. while :; do
  704. echo 'Please select a opcode cache of the PHP:'
  705. echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
  706. echo -e "\t${CMSG}2${CEND}. Install APCU"
  707. echo -e "\t${CMSG}3${CEND}. Install XCache"
  708. read -e -p "Please input a number:(Default 1 press Enter) " phpcache_option
  709. phpcache_option=${phpcache_option:-1}
  710. if [[ ! ${phpcache_option} =~ ^[1-3]$ ]]; then
  711. echo "${CWARNING}input error! Please only input number 1~3${CEND}"
  712. else
  713. break
  714. fi
  715. done
  716. fi
  717. if [ "${php_option}" == '4' -o "${PHP_main_ver}" == '5.6' ]; then
  718. while :; do
  719. echo 'Please select a opcode cache of the PHP:'
  720. echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
  721. echo -e "\t${CMSG}2${CEND}. Install APCU"
  722. echo -e "\t${CMSG}3${CEND}. Install XCache"
  723. read -e -p "Please input a number:(Default 1 press Enter) " phpcache_option
  724. phpcache_option=${phpcache_option:-1}
  725. if [[ ! ${phpcache_option} =~ ^[1-3]$ ]]; then
  726. echo "${CWARNING}input error! Please only input number 1~3${CEND}"
  727. else
  728. break
  729. fi
  730. done
  731. fi
  732. if [[ ${php_option} =~ ^[5-9]$|^1[0-3]$ ]] || [[ "${PHP_main_ver}" =~ ^7.[0-4]$|^8.[0-3]$ ]]; then
  733. while :; do
  734. echo 'Please select a opcode cache of the PHP:'
  735. echo -e "\t${CMSG}1${CEND}. Install Zend OPcache"
  736. echo -e "\t${CMSG}2${CEND}. Install APCU"
  737. read -e -p "Please input a number:(Default 1 press Enter) " phpcache_option
  738. phpcache_option=${phpcache_option:-1}
  739. if [[ ! ${phpcache_option} =~ ^[1-2]$ ]]; then
  740. echo "${CWARNING}input error! Please only input number 1~2${CEND}"
  741. else
  742. break
  743. fi
  744. done
  745. fi
  746. fi
  747. break
  748. fi
  749. done
  750. # set xcache passwd
  751. if [ "${phpcache_option}" == '3' ]; then
  752. while :; do
  753. read -e -p "Please input xcache admin password: " xcachepwd
  754. (( ${#xcachepwd} >= 5 )) && { xcachepwd_md5=$(echo -n "${xcachepwd}" | md5sum | awk '{print $1}') ; break ; } || echo "${CFAILURE}xcache admin password least 5 characters! ${CEND}"
  755. done
  756. fi
  757. # PHP extension
  758. while :; do
  759. echo
  760. echo 'Please select PHP extensions:'
  761. echo -e "\t${CMSG} 0${CEND}. Do not install"
  762. echo -e "\t${CMSG} 1${CEND}. Install zendguardloader(PHP<=5.6)"
  763. echo -e "\t${CMSG} 2${CEND}. Install ioncube"
  764. echo -e "\t${CMSG} 3${CEND}. Install sourceguardian(PHP<=7.2)"
  765. echo -e "\t${CMSG} 4${CEND}. Install imagick"
  766. echo -e "\t${CMSG} 5${CEND}. Install gmagick"
  767. echo -e "\t${CMSG} 6${CEND}. Install fileinfo"
  768. echo -e "\t${CMSG} 7${CEND}. Install imap"
  769. echo -e "\t${CMSG} 8${CEND}. Install ldap"
  770. echo -e "\t${CMSG} 9${CEND}. Install phalcon(PHP>=5.5)"
  771. echo -e "\t${CMSG}10${CEND}. Install yaf(PHP>=7.0)"
  772. echo -e "\t${CMSG}11${CEND}. Install redis"
  773. echo -e "\t${CMSG}12${CEND}. Install memcached"
  774. echo -e "\t${CMSG}13${CEND}. Install memcache"
  775. echo -e "\t${CMSG}14${CEND}. Install mongodb"
  776. echo -e "\t${CMSG}15${CEND}. Install swoole"
  777. echo -e "\t${CMSG}16${CEND}. Install xdebug(PHP>=5.5)"
  778. read -e -p "Please input numbers:(Default '4 11 12' press Enter) " phpext_option
  779. phpext_option=${phpext_option:-'4 11 12'}
  780. [ "${phpext_option}" == '0' ] && break
  781. array_phpext=(${phpext_option})
  782. array_all=(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16)
  783. for v in ${array_phpext[@]}
  784. do
  785. [ -z "`echo ${array_all[@]} | grep -w ${v}`" ] && phpext_flag=1
  786. done
  787. if [ "${phpext_flag}" == '1' ]; then
  788. unset phpext_flag
  789. echo; echo "${CWARNING}input error! Please only input number 4 11 12 and so on${CEND}"; echo
  790. continue
  791. else
  792. [ -n "`echo ${array_phpext[@]} | grep -w 1`" ] && pecl_zendguardloader=1
  793. [ -n "`echo ${array_phpext[@]} | grep -w 2`" ] && pecl_ioncube=1
  794. [ -n "`echo ${array_phpext[@]} | grep -w 3`" ] && pecl_sourceguardian=1
  795. [ -n "`echo ${array_phpext[@]} | grep -w 4`" ] && pecl_imagick=1
  796. [ -n "`echo ${array_phpext[@]} | grep -w 5`" ] && pecl_gmagick=1
  797. [ -n "`echo ${array_phpext[@]} | grep -w 6`" ] && pecl_fileinfo=1
  798. [ -n "`echo ${array_phpext[@]} | grep -w 7`" ] && pecl_imap=1
  799. [ -n "`echo ${array_phpext[@]} | grep -w 8`" ] && pecl_ldap=1
  800. [ -n "`echo ${array_phpext[@]} | grep -w 9`" ] && pecl_phalcon=1
  801. [ -n "`echo ${array_phpext[@]} | grep -w 10`" ] && pecl_yaf=1
  802. [ -n "`echo ${array_phpext[@]} | grep -w 11`" ] && pecl_redis=1
  803. [ -n "`echo ${array_phpext[@]} | grep -w 12`" ] && pecl_memcached=1
  804. [ -n "`echo ${array_phpext[@]} | grep -w 13`" ] && pecl_memcache=1
  805. [ -n "`echo ${array_phpext[@]} | grep -w 14`" ] && pecl_mongodb=1
  806. [ -n "`echo ${array_phpext[@]} | grep -w 15`" ] && pecl_swoole=1
  807. [ -n "`echo ${array_phpext[@]} | grep -w 16`" ] && pecl_xdebug=1
  808. break
  809. fi
  810. done
  811. fi
  812. # check Nodejs
  813. while :; do echo
  814. read -e -p "Do you want to install Nodejs? [y/n]: " nodejs_flag
  815. if [[ ! ${nodejs_flag} =~ ^[y,n]$ ]]; then
  816. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  817. else
  818. [ "${nodejs_flag}" == 'y' -a -e "${nodejs_install_dir}/bin/node" ] && { echo "${CWARNING}Nodejs already installed! ${CEND}"; unset nodejs_flag; }
  819. break
  820. fi
  821. done
  822. # check Pureftpd
  823. while :; do echo
  824. read -e -p "Do you want to install Pure-FTPd? [y/n]: " pureftpd_flag
  825. if [[ ! ${pureftpd_flag} =~ ^[y,n]$ ]]; then
  826. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  827. else
  828. [ "${pureftpd_flag}" == 'y' -a -e "${pureftpd_install_dir}/sbin/pure-ftpwho" ] && { echo "${CWARNING}Pure-FTPd already installed! ${CEND}"; unset pureftpd_flag; }
  829. break
  830. fi
  831. done
  832. # check phpMyAdmin
  833. if [[ ${php_option} =~ ^[1-9]$|^1[0-3]$ ]] || [ -e "${php_install_dir}/bin/phpize" ]; then
  834. while :; do echo
  835. read -e -p "Do you want to install phpMyAdmin? [y/n]: " phpmyadmin_flag
  836. if [[ ! ${phpmyadmin_flag} =~ ^[y,n]$ ]]; then
  837. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  838. else
  839. [ "${phpmyadmin_flag}" == 'y' -a -d "${wwwroot_dir}/default/phpMyAdmin" ] && { echo "${CWARNING}phpMyAdmin already installed! ${CEND}"; unset phpmyadmin_flag; }
  840. break
  841. fi
  842. done
  843. fi
  844. # check redis
  845. while :; do echo
  846. read -e -p "Do you want to install redis-server? [y/n]: " redis_flag
  847. if [[ ! ${redis_flag} =~ ^[y,n]$ ]]; then
  848. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  849. else
  850. [ "${redis_flag}" == 'y' -a -e "${redis_install_dir}/bin/redis-server" ] && { echo "${CWARNING}redis-server already installed! ${CEND}"; unset redis_flag; }
  851. break
  852. fi
  853. done
  854. # check memcached
  855. while :; do echo
  856. read -e -p "Do you want to install memcached-server? [y/n]: " memcached_flag
  857. if [[ ! ${memcached_flag} =~ ^[y,n]$ ]]; then
  858. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  859. else
  860. [ "${memcached_flag}" == 'y' -a -e "${memcached_install_dir}/bin/memcached" ] && { echo "${CWARNING}memcached-server already installed! ${CEND}"; unset memcached_flag; }
  861. break
  862. fi
  863. done
  864. fi
  865. if [[ ${nginx_option} =~ ^[1-4]$ ]] || [ "${apache_flag}" == 'y' ] || [ "${caddy_flag}" == 'y' ] || [[ ${tomcat_option} =~ ^[1-6]$ ]]; then
  866. [ ! -d ${wwwroot_dir}/default ] && mkdir -p ${wwwroot_dir}/default
  867. [ ! -d ${wwwlogs_dir} ] && mkdir -p ${wwwlogs_dir}
  868. fi
  869. [ -d /data ] && chmod 755 /data
  870. # install wget gcc curl
  871. if [ ! -e ~/.oneinstack ]; then
  872. downloadDepsSrc=1
  873. [ "${PM}" == 'apt-get' ] && apt-get -y update > /dev/null
  874. [ "${PM}" == 'yum' ] && yum clean all > /dev/null
  875. ${PM} -y install wget gcc curl > /dev/null
  876. fi
  877. # get the IP information
  878. IPADDR=$(./include/ois.${ARCH} ip_local)
  879. OUTIP_STATE=$(./include/ois.${ARCH} ip_state)
  880. # openSSL
  881. . ./include/openssl.sh
  882. # Check download source packages
  883. . ./include/check_download.sh
  884. [ "${armplatform}" == "y" ] && dbinstallmethod=2
  885. checkDownload 2>&1 | tee -a ${oneinstack_dir}/install.log
  886. # get OS Memory
  887. . ./include/memory.sh
  888. if [ ! -e ~/.oneinstack ]; then
  889. # Check binary dependencies packages
  890. . ./include/check_sw.sh
  891. case "${Family}" in
  892. "rhel")
  893. installDepsRHEL 2>&1 | tee ${oneinstack_dir}/install.log
  894. . include/init_RHEL.sh 2>&1 | tee -a ${oneinstack_dir}/install.log
  895. ;;
  896. "debian")
  897. installDepsDebian 2>&1 | tee ${oneinstack_dir}/install.log
  898. . include/init_Debian.sh 2>&1 | tee -a ${oneinstack_dir}/install.log
  899. ;;
  900. "ubuntu")
  901. installDepsUbuntu 2>&1 | tee ${oneinstack_dir}/install.log
  902. . include/init_Ubuntu.sh 2>&1 | tee -a ${oneinstack_dir}/install.log
  903. ;;
  904. esac
  905. # Install dependencies from source package
  906. installDepsBySrc 2>&1 | tee -a ${oneinstack_dir}/install.log
  907. fi
  908. # start Time
  909. startTime=`date +%s`
  910. # openSSL
  911. Install_openSSL | tee -a ${oneinstack_dir}/install.log
  912. # Jemalloc
  913. if [[ ${nginx_option} =~ ^[1-3]$ ]] || [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]]; then
  914. . include/jemalloc.sh
  915. Install_Jemalloc | tee -a ${oneinstack_dir}/install.log
  916. fi
  917. # Database
  918. case "${db_option}" in
  919. 0)
  920. . include/mysql-8.2.sh
  921. Install_MySQL82 2>&1 | tee -a ${oneinstack_dir}/install.log
  922. ;;
  923. 1)
  924. . include/mysql-8.0.sh
  925. Install_MySQL80 2>&1 | tee -a ${oneinstack_dir}/install.log
  926. ;;
  927. 2)
  928. . include/mysql-5.7.sh
  929. Install_MySQL57 2>&1 | tee -a ${oneinstack_dir}/install.log
  930. ;;
  931. 3)
  932. . include/mysql-5.6.sh
  933. Install_MySQL56 2>&1 | tee -a ${oneinstack_dir}/install.log
  934. ;;
  935. 4)
  936. . include/mysql-5.5.sh
  937. Install_MySQL55 2>&1 | tee -a ${oneinstack_dir}/install.log
  938. ;;
  939. 5)
  940. . include/mariadb-10.11.sh
  941. Install_MariaDB1011 2>&1 | tee -a ${oneinstack_dir}/install.log
  942. ;;
  943. 6)
  944. . include/mariadb-10.5.sh
  945. Install_MariaDB105 2>&1 | tee -a ${oneinstack_dir}/install.log
  946. ;;
  947. 7)
  948. . include/mariadb-10.4.sh
  949. Install_MariaDB104 2>&1 | tee -a ${oneinstack_dir}/install.log
  950. ;;
  951. 8)
  952. . include/mariadb-5.5.sh
  953. Install_MariaDB55 2>&1 | tee -a ${oneinstack_dir}/install.log
  954. ;;
  955. 9)
  956. [ "${Family}" == 'rhel' ] && [ "${RHEL_ver}" == '8' ] && dbinstallmethod=2 && checkDownload
  957. . include/percona-8.0.sh
  958. Install_Percona80 2>&1 | tee -a ${oneinstack_dir}/install.log
  959. ;;
  960. 10)
  961. . include/percona-5.7.sh
  962. Install_Percona57 2>&1 | tee -a ${oneinstack_dir}/install.log
  963. ;;
  964. 11)
  965. . include/percona-5.6.sh
  966. Install_Percona56 2>&1 | tee -a ${oneinstack_dir}/install.log
  967. ;;
  968. 12)
  969. . include/percona-5.5.sh
  970. Install_Percona55 2>&1 | tee -a ${oneinstack_dir}/install.log
  971. ;;
  972. 13)
  973. . include/postgresql.sh
  974. Install_PostgreSQL 2>&1 | tee -a ${oneinstack_dir}/install.log
  975. ;;
  976. 14)
  977. . include/mongodb.sh
  978. Install_MongoDB 2>&1 | tee -a ${oneinstack_dir}/install.log
  979. ;;
  980. esac
  981. # Nginx server
  982. case "${nginx_option}" in
  983. 1)
  984. . include/nginx.sh
  985. Install_Nginx 2>&1 | tee -a ${oneinstack_dir}/install.log
  986. ;;
  987. 2)
  988. . include/tengine.sh
  989. Install_Tengine 2>&1 | tee -a ${oneinstack_dir}/install.log
  990. ;;
  991. 3)
  992. . include/openresty.sh
  993. Install_OpenResty 2>&1 | tee -a ${oneinstack_dir}/install.log
  994. ;;
  995. 4)
  996. . include/caddy.sh
  997. Install_Caddy 2>&1 | tee -a ${oneinstack_dir}/install.log
  998. caddy_flag='y'
  999. ;;
  1000. esac
  1001. # Apache
  1002. if [ "${apache_flag}" == 'y' ]; then
  1003. apache_mode_option=${apache_mode_option:-1}
  1004. apache_mpm_option=${apache_mpm_option:-1}
  1005. . include/apache.sh
  1006. Install_Apache 2>&1 | tee -a ${oneinstack_dir}/install.log
  1007. fi
  1008. # PHP
  1009. case "${php_option}" in
  1010. 1)
  1011. . include/php-5.3.sh
  1012. Install_PHP53 2>&1 | tee -a ${oneinstack_dir}/install.log
  1013. ;;
  1014. 2)
  1015. . include/php-5.4.sh
  1016. Install_PHP54 2>&1 | tee -a ${oneinstack_dir}/install.log
  1017. ;;
  1018. 3)
  1019. . include/php-5.5.sh
  1020. Install_PHP55 2>&1 | tee -a ${oneinstack_dir}/install.log
  1021. ;;
  1022. 4)
  1023. . include/php-5.6.sh
  1024. Install_PHP56 2>&1 | tee -a ${oneinstack_dir}/install.log
  1025. ;;
  1026. 5)
  1027. . include/php-7.0.sh
  1028. Install_PHP70 2>&1 | tee -a ${oneinstack_dir}/install.log
  1029. ;;
  1030. 6)
  1031. . include/php-7.1.sh
  1032. Install_PHP71 2>&1 | tee -a ${oneinstack_dir}/install.log
  1033. ;;
  1034. 7)
  1035. . include/php-7.2.sh
  1036. Install_PHP72 2>&1 | tee -a ${oneinstack_dir}/install.log
  1037. ;;
  1038. 8)
  1039. . include/php-7.3.sh
  1040. Install_PHP73 2>&1 | tee -a ${oneinstack_dir}/install.log
  1041. ;;
  1042. 9)
  1043. . include/php-7.4.sh
  1044. Install_PHP74 2>&1 | tee -a ${oneinstack_dir}/install.log
  1045. ;;
  1046. 10)
  1047. . include/php-8.0.sh
  1048. Install_PHP80 2>&1 | tee -a ${oneinstack_dir}/install.log
  1049. ;;
  1050. 11)
  1051. . include/php-8.1.sh
  1052. Install_PHP81 2>&1 | tee -a ${oneinstack_dir}/install.log
  1053. ;;
  1054. 12)
  1055. . include/php-8.2.sh
  1056. Install_PHP82 2>&1 | tee -a ${oneinstack_dir}/install.log
  1057. ;;
  1058. 13)
  1059. . include/php-8.3.sh
  1060. Install_PHP83 2>&1 | tee -a ${oneinstack_dir}/install.log
  1061. ;;
  1062. 14)
  1063. . include/php-8.4.sh
  1064. Install_PHP84 2>&1 | tee -a ${oneinstack_dir}/install.log
  1065. ;;
  1066. esac
  1067. PHP_addons() {
  1068. # PHP opcode cache
  1069. case "${phpcache_option}" in
  1070. 1)
  1071. . include/zendopcache.sh
  1072. Install_ZendOPcache 2>&1 | tee -a ${oneinstack_dir}/install.log
  1073. ;;
  1074. 2)
  1075. . include/apcu.sh
  1076. Install_APCU 2>&1 | tee -a ${oneinstack_dir}/install.log
  1077. ;;
  1078. 3)
  1079. . include/xcache.sh
  1080. Install_XCache 2>&1 | tee -a ${oneinstack_dir}/install.log
  1081. ;;
  1082. 4)
  1083. . include/eaccelerator.sh
  1084. Install_eAccelerator 2>&1 | tee -a ${oneinstack_dir}/install.log
  1085. ;;
  1086. esac
  1087. # ZendGuardLoader
  1088. if [ "${pecl_zendguardloader}" == '1' ]; then
  1089. . include/ZendGuardLoader.sh
  1090. Install_ZendGuardLoader 2>&1 | tee -a ${oneinstack_dir}/install.log
  1091. fi
  1092. # ioncube
  1093. if [ "${pecl_ioncube}" == '1' ]; then
  1094. . include/ioncube.sh
  1095. Install_ionCube 2>&1 | tee -a ${oneinstack_dir}/install.log
  1096. fi
  1097. # SourceGuardian
  1098. if [ "${pecl_sourceguardian}" == '1' ]; then
  1099. . include/sourceguardian.sh
  1100. Install_SourceGuardian 2>&1 | tee -a ${oneinstack_dir}/install.log
  1101. fi
  1102. # imagick
  1103. if [ "${pecl_imagick}" == '1' ]; then
  1104. . include/ImageMagick.sh
  1105. Install_ImageMagick 2>&1 | tee -a ${oneinstack_dir}/install.log
  1106. Install_pecl_imagick 2>&1 | tee -a ${oneinstack_dir}/install.log
  1107. fi
  1108. # gmagick
  1109. if [ "${pecl_gmagick}" == '1' ]; then
  1110. . include/GraphicsMagick.sh
  1111. Install_GraphicsMagick 2>&1 | tee -a ${oneinstack_dir}/install.log
  1112. Install_pecl_gmagick 2>&1 | tee -a ${oneinstack_dir}/install.log
  1113. fi
  1114. # fileinfo
  1115. if [ "${pecl_fileinfo}" == '1' ]; then
  1116. . include/pecl_fileinfo.sh
  1117. Install_pecl_fileinfo 2>&1 | tee -a ${oneinstack_dir}/install.log
  1118. fi
  1119. # imap
  1120. if [ "${pecl_imap}" == '1' ]; then
  1121. . include/pecl_imap.sh
  1122. Install_pecl_imap 2>&1 | tee -a ${oneinstack_dir}/install.log
  1123. fi
  1124. # ldap
  1125. if [ "${pecl_ldap}" == '1' ]; then
  1126. . include/pecl_ldap.sh
  1127. Install_pecl_ldap 2>&1 | tee -a ${oneinstack_dir}/install.log
  1128. fi
  1129. # calendar
  1130. if [ "${pecl_calendar}" == '1' ]; then
  1131. . include/pecl_calendar.sh
  1132. Install_pecl_calendar 2>&1 | tee -a ${oneinstack_dir}/install.log
  1133. fi
  1134. # phalcon
  1135. if [ "${pecl_phalcon}" == '1' ]; then
  1136. . include/pecl_phalcon.sh
  1137. Install_pecl_phalcon 2>&1 | tee -a ${oneinstack_dir}/install.log
  1138. fi
  1139. # yaf
  1140. if [ "${pecl_yaf}" == '1' ]; then
  1141. . include/pecl_yaf.sh
  1142. Install_pecl_yaf 2>&1 | tee -a ${oneinstack_dir}/install.log
  1143. fi
  1144. # yar
  1145. if [ "${pecl_yar}" == '1' ]; then
  1146. . include/pecl_yar.sh
  1147. Install_pecl_yar 2>&1 | tee -a ${oneinstack_dir}/install.log
  1148. fi
  1149. # pecl_memcached
  1150. if [ "${pecl_memcached}" == '1' ]; then
  1151. . include/memcached.sh
  1152. Install_pecl_memcached 2>&1 | tee -a ${oneinstack_dir}/install.log
  1153. fi
  1154. # pecl_memcache
  1155. if [ "${pecl_memcache}" == '1' ]; then
  1156. . include/memcached.sh
  1157. Install_pecl_memcache 2>&1 | tee -a ${oneinstack_dir}/install.log
  1158. fi
  1159. # pecl_redis
  1160. if [ "${pecl_redis}" == '1' ]; then
  1161. . include/redis.sh
  1162. Install_pecl_redis 2>&1 | tee -a ${oneinstack_dir}/install.log
  1163. fi
  1164. # pecl_mongodb
  1165. if [ "${pecl_mongodb}" == '1' ]; then
  1166. . include/pecl_mongodb.sh
  1167. Install_pecl_mongodb 2>&1 | tee -a ${oneinstack_dir}/install.log
  1168. fi
  1169. # swoole
  1170. if [ "${pecl_swoole}" == '1' ]; then
  1171. . include/pecl_swoole.sh
  1172. Install_pecl_swoole 2>&1 | tee -a ${oneinstack_dir}/install.log
  1173. fi
  1174. # xdebug
  1175. if [ "${pecl_xdebug}" == '1' ]; then
  1176. . include/pecl_xdebug.sh
  1177. Install_pecl_xdebug 2>&1 | tee -a ${oneinstack_dir}/install.log
  1178. fi
  1179. # pecl_pgsql
  1180. if [ -e "${pgsql_install_dir}/bin/psql" ]; then
  1181. . include/pecl_pgsql.sh
  1182. Install_pecl_pgsql 2>&1 | tee -a ${oneinstack_dir}/install.log
  1183. fi
  1184. }
  1185. [ "${mphp_addons_flag}" != 'y' ] && PHP_addons
  1186. if [ "${mphp_flag}" == 'y' ]; then
  1187. . include/mphp.sh
  1188. Install_MPHP 2>&1 | tee -a ${oneinstack_dir}/install.log
  1189. php_install_dir=${php_install_dir}${mphp_ver}
  1190. PHP_addons
  1191. fi
  1192. # JDK
  1193. case "${jdk_option}" in
  1194. 1)
  1195. . include/openjdk-8.sh
  1196. Install_OpenJDK8 2>&1 | tee -a ${oneinstack_dir}/install.log
  1197. ;;
  1198. 2)
  1199. . include/openjdk-11.sh
  1200. Install_OpenJDK11 2>&1 | tee -a ${oneinstack_dir}/install.log
  1201. ;;
  1202. 3)
  1203. . include/openjdk-17.sh
  1204. Install_OpenJDK17 2>&1 | tee -a ${oneinstack_dir}/install.log
  1205. ;;
  1206. 4)
  1207. . include/openjdk-18.sh
  1208. Install_OpenJDK18 2>&1 | tee -a ${oneinstack_dir}/install.log
  1209. ;;
  1210. esac
  1211. case "${tomcat_option}" in
  1212. 1)
  1213. . include/tomcat-11.sh
  1214. Install_Tomcat11 2>&1 | tee -a ${oneinstack_dir}/install.log
  1215. ;;
  1216. 2)
  1217. . include/tomcat-10.sh
  1218. Install_Tomcat10 2>&1 | tee -a ${oneinstack_dir}/install.log
  1219. ;;
  1220. 3)
  1221. . include/tomcat-9.sh
  1222. Install_Tomcat9 2>&1 | tee -a ${oneinstack_dir}/install.log
  1223. ;;
  1224. 4)
  1225. . include/tomcat-8.sh
  1226. Install_Tomcat8 2>&1 | tee -a ${oneinstack_dir}/install.log
  1227. ;;
  1228. 5)
  1229. . include/tomcat-7.sh
  1230. Install_Tomcat7 2>&1 | tee -a ${oneinstack_dir}/install.log
  1231. ;;
  1232. 6)
  1233. . include/tomcat-6.sh
  1234. Install_Tomcat6 2>&1 | tee -a ${oneinstack_dir}/install.log
  1235. ;;
  1236. esac
  1237. # Nodejs
  1238. if [ "${nodejs_flag}" == 'y' ]; then
  1239. . include/nodejs.sh
  1240. Install_Nodejs 2>&1 | tee -a ${oneinstack_dir}/install.log
  1241. fi
  1242. # Pure-FTPd
  1243. if [ "${pureftpd_flag}" == 'y' ]; then
  1244. . include/pureftpd.sh
  1245. Install_PureFTPd 2>&1 | tee -a ${oneinstack_dir}/install.log
  1246. fi
  1247. # phpMyAdmin
  1248. if [ "${phpmyadmin_flag}" == 'y' ]; then
  1249. . include/phpmyadmin.sh
  1250. Install_phpMyAdmin 2>&1 | tee -a ${oneinstack_dir}/install.log
  1251. fi
  1252. # redis
  1253. if [ "${redis_flag}" == 'y' ]; then
  1254. . include/redis.sh
  1255. Install_redis_server 2>&1 | tee -a ${oneinstack_dir}/install.log
  1256. fi
  1257. # memcached
  1258. if [ "${memcached_flag}" == 'y' ]; then
  1259. . include/memcached.sh
  1260. Install_memcached_server 2>&1 | tee -a ${oneinstack_dir}/install.log
  1261. fi
  1262. # index example
  1263. if [ -d "${wwwroot_dir}/default" ]; then
  1264. . include/demo.sh
  1265. DEMO 2>&1 | tee -a ${oneinstack_dir}/install.log
  1266. fi
  1267. # get web_install_dir and db_install_dir
  1268. . include/check_dir.sh
  1269. # Starting DB
  1270. [ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}
  1271. [ -d "${db_install_dir}/support-files" ] && [ -z "`ps -ef | grep mysqld_safe | grep -v grep`" ] && service mysqld start
  1272. # reload php
  1273. [ -e "${php_install_dir}/sbin/php-fpm" ] && { [ -e "/bin/systemctl" ] && systemctl reload php-fpm || service php-fpm reload; }
  1274. [ -n "${mphp_ver}" -a -e "${php_install_dir}${mphp_ver}/sbin/php-fpm" ] && { [ -e "/bin/systemctl" ] && systemctl reload php${mphp_ver}-fpm || service php${mphp_ver}-fpm reload; }
  1275. [ -e "${apache_install_dir}/bin/apachectl" ] && ${apache_install_dir}/bin/apachectl -k graceful
  1276. endTime=`date +%s`
  1277. ((installTime=($endTime-$startTime)/60))
  1278. echo "####################Congratulations########################"
  1279. echo "Total OneinStack Install Time: ${CQUESTION}${installTime}${CEND} minutes"
  1280. [[ "${nginx_option}" =~ ^[1-3]$ ]] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}"
  1281. [ "${apache_flag}" == 'y' ] && echo -e "\n$(printf "%-32s" "Apache install dir":)${CMSG}${apache_install_dir}${CEND}"
  1282. [ "${caddy_flag}" == 'y' ] && echo -e "\n$(printf "%-32s" "Caddy install dir":)${CMSG}${caddy_install_dir}${CEND}"
  1283. [[ "${tomcat_option}" =~ ^[1-6]$ ]] && echo -e "\n$(printf "%-32s" "Tomcat install dir":)${CMSG}${tomcat_install_dir}${CEND}"
  1284. [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]] && echo -e "\n$(printf "%-32s" "Database install dir:")${CMSG}${db_install_dir}${CEND}"
  1285. [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]] && echo "$(printf "%-32s" "Database data dir:")${CMSG}${db_data_dir}${CEND}"
  1286. [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]] && echo "$(printf "%-32s" "Database user:")${CMSG}root${CEND}"
  1287. [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]] && echo "$(printf "%-32s" "Database password:")${CMSG}${dbrootpwd}${CEND}"
  1288. [ "${db_option}" == '13' ] && echo -e "\n$(printf "%-32s" "PostgreSQL install dir:")${CMSG}${pgsql_install_dir}${CEND}"
  1289. [ "${db_option}" == '13' ] && echo "$(printf "%-32s" "PostgreSQL data dir:")${CMSG}${pgsql_data_dir}${CEND}"
  1290. [ "${db_option}" == '13' ] && echo "$(printf "%-32s" "PostgreSQL user:")${CMSG}postgres${CEND}"
  1291. [ "${db_option}" == '13' ] && echo "$(printf "%-32s" "postgres password:")${CMSG}${dbpostgrespwd}${CEND}"
  1292. [ "${db_option}" == '14' ] && echo -e "\n$(printf "%-32s" "MongoDB install dir:")${CMSG}${mongo_install_dir}${CEND}"
  1293. [ "${db_option}" == '14' ] && echo "$(printf "%-32s" "MongoDB data dir:")${CMSG}${mongo_data_dir}${CEND}"
  1294. [ "${db_option}" == '14' ] && echo "$(printf "%-32s" "MongoDB user:")${CMSG}root${CEND}"
  1295. [ "${db_option}" == '14' ] && echo "$(printf "%-32s" "MongoDB password:")${CMSG}${dbmongopwd}${CEND}"
  1296. [[ "${php_option}" =~ ^[1-9]$|^1[0-2]$ ]] && echo -e "\n$(printf "%-32s" "PHP install dir:")${CMSG}${php_install_dir}${CEND}"
  1297. [ "${phpcache_option}" == '1' ] && echo "$(printf "%-32s" "Opcache Control Panel URL:")${CMSG}http://${IPADDR}/ocp.php${CEND}"
  1298. [ "${phpcache_option}" == '2' ] && echo "$(printf "%-32s" "APC Control Panel URL:")${CMSG}http://${IPADDR}/apc.php${CEND}"
  1299. [ "${phpcache_option}" == '3' -a -e "${php_install_dir}/etc/php.d/04-xcache.ini" ] && echo "$(printf "%-32s" "xcache Control Panel URL:")${CMSG}http://${IPADDR}/xcache${CEND}"
  1300. [ "${phpcache_option}" == '3' -a -e "${php_install_dir}/etc/php.d/04-xcache.ini" ] && echo "$(printf "%-32s" "xcache user:")${CMSG}admin${CEND}"
  1301. [ "${phpcache_option}" == '3' -a -e "${php_install_dir}/etc/php.d/04-xcache.ini" ] && echo "$(printf "%-32s" "xcache password:")${CMSG}${xcachepwd}${CEND}"
  1302. [ "${phpcache_option}" == '4' -a -e "${php_install_dir}/etc/php.d/02-eaccelerator.ini" ] && echo "$(printf "%-32s" "eAccelerator Control Panel URL:")${CMSG}http://${IPADDR}/control.php${CEND}"
  1303. [ "${phpcache_option}" == '4' -a -e "${php_install_dir}/etc/php.d/02-eaccelerator.ini" ] && echo "$(printf "%-32s" "eAccelerator user:")${CMSG}admin${CEND}"
  1304. [ "${phpcache_option}" == '4' -a -e "${php_install_dir}/etc/php.d/02-eaccelerator.ini" ] && echo "$(printf "%-32s" "eAccelerator password:")${CMSG}eAccelerator${CEND}"
  1305. [ "${pureftpd_flag}" == 'y' ] && echo -e "\n$(printf "%-32s" "Pure-FTPd install dir:")${CMSG}${pureftpd_install_dir}${CEND}"
  1306. [ "${pureftpd_flag}" == 'y' ] && echo "$(printf "%-32s" "Create FTP virtual script:")${CMSG}./pureftpd_vhost.sh${CEND}"
  1307. [ "${phpmyadmin_flag}" == 'y' ] && echo -e "\n$(printf "%-32s" "phpMyAdmin dir:")${CMSG}${wwwroot_dir}/default/phpMyAdmin${CEND}"
  1308. [ "${phpmyadmin_flag}" == 'y' ] && echo "$(printf "%-32s" "phpMyAdmin Control Panel URL:")${CMSG}http://${IPADDR}/phpMyAdmin${CEND}"
  1309. [ "${redis_flag}" == 'y' ] && echo -e "\n$(printf "%-32s" "redis install dir:")${CMSG}${redis_install_dir}${CEND}"
  1310. [ "${memcached_flag}" == 'y' ] && echo -e "\n$(printf "%-32s" "memcached install dir:")${CMSG}${memcached_install_dir}${CEND}"
  1311. if [[ ${nginx_option} =~ ^[1-4]$ ]] || [ "${apache_flag}" == 'y' ] || [[ ${tomcat_option} =~ ^[1-6]$ ]]; then
  1312. echo -e "\n$(printf "%-32s" "Index URL:")${CMSG}http://${IPADDR}/${CEND}"
  1313. fi
  1314. if [ ${ARG_NUM} == 0 ]; then
  1315. while :; do echo
  1316. echo "${CMSG}Please restart the server and see if the services start up fine.${CEND}"
  1317. read -e -p "Do you want to restart OS ? [y/n]: " reboot_flag
  1318. if [[ ! "${reboot_flag}" =~ ^[y,n]$ ]]; then
  1319. echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
  1320. else
  1321. break
  1322. fi
  1323. done
  1324. fi
  1325. [ "${reboot_flag}" == 'y' ] && reboot