How to input info into the form to install wordpress automatically?

  • Posted on October 27, 2014
  • rebuildAsked by rebuild

I have write an onekey installation script in bash,it is tested .

DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical mysqlword=“xyzzy” echo mysql-server mysql-server/root_password password $mysqlword | debconf-set-selections echo mysql-server mysql-server/root_password_again password $mysqlword | debconf-set-selections apt-get -q -y install apache2 mysql-server php5 php-pear php5-mysql php5-gd

mysql -u root -p$mysqlword -e"CREATE DATABASE wpdatabase;" mysql -u root -p$mysqlword -e"use wpdatabase;"
mysql -u root -p$mysqlword -e"CREATE USER wpuser@localhost;"
mysql -u root -p$mysqlword -e"SET PASSWORD FOR wpuser@localhost= PASSWORD(‘dbpassword’);" mysql -u root -p$mysqlword -e"GRANT ALL PRIVILEGES ON wpdatabase.* TO wpuser@localhost IDENTIFIED BY ‘dbpassword’;" mysql -u root -p$mysqlword -e"FLUSH PRIVILEGES;"

wget tar -xzvf latest.tar.gz cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php

file=“/root/wordpress/wp-config.php” d1=“define(‘DB_NAME’, ‘database_name_here’);” d2=“define(‘DB_USER’, ‘username_here’);” d3=“define(‘DB_PASSWORD’, ‘password_here’);” s1=“define(‘DB_NAME’, ‘wpdatabase’);” s2=“define(‘DB_USER’, ‘wpuser’);” s3=“define(‘DB_PASSWORD’, ‘dbpassword’);” sed -i “s/$d1/$s1/g” $file sed -i “s/$d2/$s2/g” $file sed -i “s/$d3/$s3/g” $file

mv /root/wordpress/* /var/www/

Now when i input my serverip, there is the wordpress installatioin web. alt text The last step remain,you can input info by hand,how can i do that automatically with bash? or with python?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

You could try and detect changes made by the installation process and use those to automate.

There might be changes in the file system that you can catch if you create a repository and commit the fresh WordPress before you install it. After installation you can check the difference.

It will definitely make changes in the database that you can catch almost the same way. Dump the database before installation and commit it into a repository. Dump it after installation and check the difference.

The pre-installed wordpress is 14.04, it means that pre-installed wordpress can only build on ubunt os ,how about debian? I find that you can select just one method in image when to create droplet ,if you select bebian os ,no pre-installed wordpress in it ; if you select pre-installed wordpress ,no debian. it is necessary for me to create the wheel to meet my need : debian + wordpress automatically one-click bash script. I DO NOT like ubuntu ,debian is more stable than ubuntu.

You seem to be trying to re-invent the wheel. With digital ocean, you can deploy a droplet with WordPress pre-installed. When creating your new droplet, just select application tab in the image section and choose the wordpress option.

Hope this helps.