Wordpress : one command local installation (wp-cli needed)

This tool does

  • download and install last WP core version in de_DE or fr_FR
  • create a DB (utf8) to your local MySQL
  • remove some Themes/Plugins
  • add some Themes/Plugins

This tool does't

  • add an host entry in your system, please do it manually
  • make coffee

 

Go to -/Sites

cd ~/Sites/

 

clone the project repo

git clone https://github.com/fujo/wpinstall.git

 

Edit your bash_profile

nano  ~/.bash_profile

 

Add an alias

alias wpinstall='sh ~/Sites/wpinstall/wpinstall.sh'

 

Save your bash_profile and reload it with

source  ~/.bash_profile

 

Start installer with

wpinstall

 

 

 

---------------------------------------------------------------

below this line you find the old way

 

 

install wordpress locally with one command line.

Edit your bash_profile

nano  ~/.bash_profile

Add the magic function

export PATH=$PATH:/Applications/MAMP/Library/bin/ # to fix a OSX El Cap issue
wplocal() {
        # create and open new dir
        mkdir "$@";
        cd "$@";
        # mysql and create a new db
        mysql --host=localhost -uroot -proot -e "CREATE DATABASE IF NOT EXISTS ${@} CHARACTER SET utf8 COLLATE utf8_general_ci";
        echo "db created"
        # wp-cli cmd
        wp core download;
        wp core config --dbname="$@" --dbuser=root --dbpass=root;
        wp core install --url="$@".local --title="$@" --admin_user=admin --admin_password=admin --admin_email=admin@admin.com
}

Save your bash_profile and reload it with

source  ~/.bash_profile

Go to /Sites (where you put your web project) and execute :

wplocal {projectname}

Configure your host with {projectname}.local in mamp and that's it.

Go to {projectname}.local/wp-admin

log in with admin -> admin