Guest User

Untitled

a guest
Jul 19th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. #cloud-config
  2.  
  3. package_update: true
  4. package_upgrade: false
  5.  
  6. packages:
  7. - ca-certificates
  8. - epel-release
  9. - httpd
  10. - mariadb
  11. - mariadb-server
  12. - unzip
  13.  
  14. installlamp:
  15. - &install_lamp |
  16. rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
  17. rpm -Uvh http://repo.mysql.com/mysql-community-release-el7-7.noarch.rpm
  18. yum --enablerepo=remi-php72 install php php-fpm php-mysql php-mcrypt php-mbstring php-json php-imap php-intl php-gd php-curl php-xml -y
  19.  
  20. configapache:
  21. - &config_apache |
  22. cat > /etc/httpd/conf.d/microweber.conf <<EOF
  23. NameVirtualHost *:80
  24. <VirtualHost *:80>
  25. UseCanonicalName off
  26. Options All
  27. DocumentRoot /var/www/microweber
  28. <Directory /var/www/microweber>
  29. AllowOverride All
  30. </Directory>
  31. ErrorLog /var/log/microweber-error.log
  32. LogLevel warn
  33. CustomLog /var/log/microweber-access.log combined
  34. </VirtualHost>
  35. EOF
  36.  
  37. configmysql:
  38. - &config_mysql |
  39. echo $(openssl rand -base64 12) > /tmp/mysqlpass
  40. mysql -e "CREATE DATABASE microweber /*\!40100 DEFAULT CHARACTER SET utf8 */;"
  41. mysql -e "CREATE USER microweber@localhost IDENTIFIED BY '$(</tmp/mysqlpass)';"
  42. mysql -e "GRANT ALL PRIVILEGES ON microweber.* TO 'microweber'@'localhost';"
  43. mysql -e "FLUSH PRIVILEGES;"
  44. systemctl enable mariadb
  45.  
  46.  
  47. restartapache:
  48. - &restart_apache |
  49. service httpd restart
  50. systemctl enable httpd
  51.  
  52.  
  53. downloadcms:
  54. - &download_cms |
  55. mkdir /var/www/microweber
  56. wget -q http://download.microweberapi.com/ready/core/microweber-latest.zip -O /tmp/microweber-latest.zip
  57. unzip -qq /tmp/microweber-latest.zip -d /var/www/microweber
  58. wget -q https://members.microweber.com/_partners/csigma/userfiles.zip -O /tmp/userfiles.zip
  59. unzip -qq /tmp/userfiles.zip -d /var/www/microweber
  60. wget -q https://microweber.com/download.php?templates_key=T3fOU5Zfw11%3Ac%21 -O /tmp/userfiles.zip
  61. unzip -qq /tmp/userfiles.zip -d /var/www/microweber
  62. php /var/www/microweber/artisan cache:clear
  63. php /var/www/microweber/artisan microweber:install admin@site.com admin password 127.0.0.1 microweber microweber $(</tmp/mysqlpass) -p site_ -t dream -d 1 -c 1
  64. chown -R apache:apache /var/www/microweber
  65. chmod -R 755 /var/www/microweber
  66. chcon -R --type=httpd_sys_rw_content_t /var/www/microweber
  67.  
  68. makeauths:
  69. - &make_auths |
  70. echo 'sh /usr/bin/cschpw/global.sh' >> /etc/rc.d/rc.local
  71. chmod +x /etc/rc.d/rc.local
  72. service sshd restart
  73.  
  74.  
  75. setupfirewall:
  76. - &setup_firewall |
  77. firewall-offline-cmd --zone=public --add-port=80/tcp
  78. firewall-offline-cmd --zone=public --add-port=443/tcp
  79. service firewalld restart
  80. systemctl enable firewalld
  81.  
  82. runcmd:
  83. - [ sh, -c, *install_lamp ]
  84. - touch /tmp/done1
  85. - [ sh, -c, *config_mysql ]
  86. - touch /tmp/done2
  87. - [ sh, -c, *download_cms ]
  88. - touch /tmp/done3
  89. - [ sh, -c, *config_apache ]
  90. - touch /tmp/done4
  91. - [ sh, -c, *restart_apache ]
  92. - touch /tmp/done5
  93. - [ sh, -c, *make_auths ]
  94. - touch /tmp/done6
  95. - [ sh, -c, *setup_firewall ]
  96. # - [ sh, -c, /usr/bin/cschpw/global.sh ]
  97. - touch /tmp/done7
  98. - touch /tmp/done8
  99. # - echo 'su /usr/bin/cschpw/ssh_meta.sh' >> /etc/rc.d/rc.local
  100. # - echo 'su /usr/bin/cschpw/global.sh' >> /etc/rc.d/rc.local
  101. # - service sshd restart
  102. - touch /tmp/done9
Add Comment
Please, Sign In to add comment