Question
How to input info into the form to install wordpress automatically?
I have write an onekey installation script in bash,it is tested .
DEBIANFRONTEND=noninteractive DEBIANPRIORITY=critical
mysqlword=“xyzzy”
echo mysql-server mysql-server/rootpassword password $mysqlword | debconf-set-selections
echo mysql-server mysql-server/rootpassword_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 http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
file=“/root/wordpress/wp-config.php”
d1=“define('DBNAME’, 'databasenamehere’);”
d2=“define('DBUSER’, 'usernamehere’);”
d3=“define('DBPASSWORD’, 'passwordhere’);”
s1=“define('DBNAME’, 'wpdatabase’);”
s2=“define('DBUSER’, 'wpuser’);”
s3=“define('DBPASSWORD’, '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.
The last step remain,you can input info by hand,how can i do that automatically with bash? or with python?
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.
×