Script Application 13: Install the WordPress site

Source: Internet
Author: User
Tags install wordpress

role: automatically install wordpress site

use: Modify the relevant variables before use, note the database password settings (if you have not previously installed Mysql-server, the script does not need to be modified, the password will be set to "Rootroot"; default download of the specified version of WordPress, You can modify the download link or upgrade after the installation is complete.


Demonstrate:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7F/0F/wKiom1cRqHfCWrJfAACBi7rCy5M202.png "title=" 1.png " alt= "Wkiom1crqhfcwrjfaacbi7rcy5m202.png"/>


650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7F/0D/wKioL1cRqjjxxnOuAAFFFmcDR_M806.png "title=" 2.png " alt= "Wkiol1crqjjxxnouaafffmcdr_m806.png"/>

Code area:

#/bin/bash  #  ly#  ------------------#  copyright 2016.04.16  LingYi  ([email protected])  QQ:1519952564#   "Install wordpress service "Databaseuser= ' root ' databasepwd= ' #the  password will bedatabasedefpwd= ' rootroot ' DataBaseName= ' WordPress ' webrootpath= '/var/www/html ' echo -e  "\033[1;32minstall software ....\033[0m" yum  install -y httpd mysql-server php php-mysqlyum install -y php-gd  php-imap php-ldap php-odbc php-pear php-xml php-xmlrpcyum install -y  wget  unzip expectecho -ne  "\033[1;32mset httpd and mysql  run on start-up ... \033[0m "if chkconfig httpd on &&  chkconfig mysqld on &>/dev/null; then echo -e  "\033[1;32m [  ok ]\033[0m "Elseecho -e  "\033[1;31m [ fail ]\033[0m"  exit 10fiecho -e  "\033[1; 32mget wordpress ... \033[0m "If ! wget http://cn.wordpress.org/wordpress-3.9-zh_ cn.zip; thenecho -e  "\033[1;31m can not get wordpress !!! \033[0m "exit 11fiecho -e " \033[1;32munzip wordpress ... \033[0m "if !  unzip wordpress-3.9-zh_cn.zip &>/dev/null; thenecho -e  "\033[1;31m Can  not unzip wordpress !!! \033[0m "exit 12fiecho -e " \033[1;32mmodify wordpress configuration file   ... \033[0m "sed -i " s/database_name_here/$DataBaseName/" wordpress/ wp-config-sample.phpsed -i  "s/username_here/$DataBaseUser/"  wordpress/wp-config-sample.phpsed  -i  "s/password_here/${databasepwd:-$DataBaseDefPwd}/"  wordpress/wp-config-sample.phpmv  wordpress/wp-config-sample.php  wordpress/wp-config.phpecho -e  "\033[1;32mcoping wordpress  files to web root directory  ... \033[0m "if cp -a  wordpress/*    $WebRootPath; thenrm -fr wordpress*elseecho -e  "\033[1; 31m copy files failed !!! \033[0m "fiif ! service httpd status &>/dev/null; then usermod - d  $WebRootPath  apache &>/dev/nullelseservice httpd stop &>/dev/ null && usermod -d  $WebRootPath  apachefiecho -e  "\033[1;32mmodify  permissions of wordpress files ... \033[0m "If ! chown apache: apache -r  $WebRootPath; thenecho echo -e  "\033[1;31m [ fail ]\033 [0m "exit 12fiecho -ne " \033[1;32MSTARTING HTTP AND MYSQL ...  \033[0m "if service httpd start &>/dev/null && service  mysqld start &>/dev/null; thenecho -e  "\033[1;32m [ ok ]\033[0m "elseecho -e " \033[1;31m [ fail ]\033[0m "exit 13fiecho -ne " \033[1; 32moperating mysql ... \033[0m "if [[ -z  $DataBasePwd  ]];  thendatabasepwd= $DataBaseDefPwdmysqladmin  -u  $DataBaseUser  flush-privileges password  "$DATABASEPWD"  &>/dev/nullfiexpect -c  "spawn mysql -u  $DataBaseUser   -P "$DataBasePwd" expect {\ "mysql>\" {                send \ "Create database wordpress;\r\" send \ "Quit;\r\"                   interact}} "  &>/dev/nullif [[ $? -eq 0 ]]; thenecho -e  "\033[1;32m [ ok ]\033[0m"   elseecho -e  "\033[1;31m [ fail ]\033[0m" fi



Accessories Download Source Code



This article is from "retrograde person" blog, declined reprint!

Script Application 13: Install the WordPress site

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.