1#!/bin/Bash2 #3 Echo "Close SELinux ..."4 sed-I.'s/enforcing/disabled/'/etc/sysconfig/SELinux5source/etc/sysconfig/SELinux6 reboot7 Echo "Empty iptables ..."8Iptables-F9 Echo "Create Workdir"Ten mkdir/root/Wpconfigdir One Echo "Switch to Workdir" Acd/root/Wpconfigdir - Echo "start to download wordpress packages ..." - wgetHttps//Cn.wordpress.org/wordpress-4.7.4-zh_cn.zip theWpsize= 'ls-l/root/wpconfigdir/|grepWordPress |awk-F' ' '{print $}'` - Echo "whether WordPress download successfully ..." - if[-f/root/wpconfigdir/wordpress-4.7.4-zh_cn.Zip] && ["$wpsize"="9245300"]; Then - Echo "Download successfully ..."; + Else - Echo "No Such files...download failed ..."; + fi A Echo "installing HTTPD server ..." at Yum Install-y httpd - Echo "start httpd service ..." - Service httpd Start - Echo "installing MySQL server application ..." - Yum Install-y MySQL mysql-server mysql-devel - Echo "start mysqld service ..." in Service mysqld Start - Echo "set password for root ..." to/usr/bin/mysqladmin-u Root Password'admin123' + Echo "Restart Mysqld service ..." - Service mysqld Restart the Echo "Create WordPress Database ..." *Mysql-uroot-padmin123-e"CREATE database WordPress;" $ if[$?-eq0]; ThenPanax Notoginseng Echo "WordPress Create successfully" - Else the Echo "Create failed" + fi A Echo "Grant privileges to Wpuser ..." theMysql-uroot-padmin123-e"Grant all privileges the wordpress.* to ' wpuser ' @ ' localhost ' identified by ' admin123 ';" +Mysql-uroot-padmin123-e"Grant all privileges the wordpress.* to ' wpuser ' @ ' 127.0.0.1 ' identified by ' admin123 ';" -Mysql-uroot-padmin123-e"Grant all privileges the wordpress.* to ' wpuser ' @ ' 192.168.% ' identified by ' admin123 ';" $Mysql-uroot-padmin123-e"flush Privileges;" $ Echo "uncompress WordPress Packages ..." - Unzipwordpress-4.7.4-zh_cn.Zip - Echo "move WordPress to/directory ..." the MVWordpress/*/var/www/html/ - echo "Installing PHP packages ..."Wuyi Yum install-y php php-devel php-mysql php-mbstring the echo "Backup httpd config file ..." - Cp/etc/httpd/conf/httpd.conf{,.bak} Wu echo "Add PHP index files ..." - sed-i ' S/directoryindex.*/& index.php/'/etc/httpd/conf/httpd.conf About Echo "backup wordpress config files ..." $ CP/var/www/html/wp-config-Sample.php{,.bak} - MV/var/www/html/wp-config-sample.php/var/www/html/wp-config.php - Echo "start Configure WordPress infomations to connect mysqlserevr loacl ..." - sed-I.'s/database_name_here/wordpress/'/var/www/html/wp-config.php A sed-I.'s/username_here/wpuser/'/var/www/html/wp-config.php + sed-I.'s/password_here/admin123/'/var/www/html/wp-config.php the sed-I.'/put your unique phrase here/d'/var/www/html/wp-config.php - mkdirWpconfigdir;Touch/root/wpconfigdir/Salt; $Curl https://api.wordpress.org/secret-key/1.1/salt >/root/wpconfigdir/salt the Cat/root/wpconfigdir/salt >>/var/www/html/wp-config.php the#curl https://Api.wordpress.org/secret-key/1.1/salt >>/var/www/html/wp-config.php the Echo "Restart httpd service ..."
[Bash]http SEREVR deployment WordPress