Installing wordpress with one command

There is an issue that you may want to create a quick instantace of WordPress as test something, i’m using wp-cli to download a new wordpress core easily and fast, like wp core download

i wanted to created an alias and passing to it the parameter only for the database, like wpnew wordpressdev ,

this will create a new wordpress install with wordpressdev name and database wordpressdev and adding a the user and password from the command easily

here is the alias to use

alias wpnew='function install_wordpress(){ 
 mkdir $1;
 echo "created directory";
 cd $1;
 echo "moved to this directory";
 wp core download; 
 echo "Downloaded wordpress";
 /Applications/MAMP/Library/bin/mysql -uroot -proot -e "create database $1;"
 wp core config --dbname=$1 --dbuser=root --dbpass=root
 echo "created database";
 wp core install --url=http://localhost/$1 --title=wordpress --admin_user=admin --admin_password=admin --admin_email=test@test.com
 echo "installed database";
 echo "finished, thanks OS OS";
};
install_wordpress'
Advertisements
Previous Post
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: