wp_cli is a really good PHP script which helps installing the latest WordPress version in an htdocs.
Here is how to install it in a Linux system:
This will install wp_cli PHP script as /usr/local/bin/wp in the system.
(Logged in as root)
cd /tmp
wget https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod 755 wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp

To get the help screen:
/usr/local/bin/wp --allow-root
To get the info screen:
/usr/local/bin/wp --info --allow-root
Find more information on wp_cli at: http://wp-cli.org/

WARNING!! for the sake of simplicity and laziness I was logged in as root BUT I when you start using this script I recommend strongly to run it inside the intended htdocs as the Apache user. Normally this is the user which Apache runs under when running the php scripts in a suexec/fcgi configuration.

NOTE: Unfortunately from WordPress version 4.4 the older version of wp_cli will create the following error message which prevents wp_cli to automatically configure wp-config.php.
PHP Fatal error: Class 'WP_Widget' not found in
No big deal but you will have to spend an extra 30 sec. to configure WordPress in its web interface before being able to login.
Solution: Upgrade wp_cli to the latest version by simply re-running the initial installation steps.
See this link for more info: http://wp-cli.org/blog/versions-0.21.1-and-0.20.4.html