Installation
#php sudo apt-get install -y php5 #php5 with apache2 sudo apt-get install -y libapache2-mod-php5 #optional: execute standalone php scripts sudo apt-get install -y php5-cli #mysql driver for PHP5 sudo apt-get install -y php5-mysql #unzip sudo apt-get install -y unzip # mysql sudo apt-get install -y mysql # apache webserver sudo apt-get install -y apache2 # create download directory mkdir -p ~/build/wordpress cd ~/build/wordpress # download wget http://wordpress.org/latest.zip unzip -qo latest.zip cd wordpress # create .htaccess file for nice URL cat > .htaccess <<"_EOF_" # BEGIN WordPressRewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress _EOF_ # check .htaccess contents #cat ./wordpress/.htaccess #ls -l /var/www/ # create wp config file cp wp-config-sample.php wp-config.php #database credentials wp_database="wpzdb" wp_user="wpz" wp_password="wpzpassword" # create user - inline in bash echo " CREATE DATABASE IF NOT EXISTS $wp_database; CREATE USER '$wp_user'@'localhost' IDENTIFIED BY '$wp_password'; CREATE USER '$wp_user'@'127.0.0.1' IDENTIFIED BY '$wp_password'; GRANT ALL ON $wp_database.* TO '$wp_user'@'localhost' IDENTIFIED BY '$wp_password'; GRANT ALL ON $wp_database.* TO '$wp_user'@'127.0.0.1' IDENTIFIED BY '$wp_password'; "|mysql -u root --password=root #set database credentials in wp-config.php sed -i "s/define('DB_NAME', 'database_name_here');/define('DB_NAME', '$wp_database');/ig" wp-config.php sed -i "s/define('DB_USER', 'username_here');/define('DB_USER', '$wp_user');/ig" wp-config.php sed -i "s/define('DB_PASSWORD', 'password_here');/define('DB_PASSWORD', '$wp_password');/ig" wp-config.php #copy wordpress files to the /var/www directory cd .. sudo cp -r wordpress/* /var/www/ sudo chown www-data:www-data -R /var/www # Go to http://localhost to finish up installation #in case of errors, check if the apache webserver and mysql are running ps -ef|grep -E "apache2|mysql"
References
1. Home : http://wordpress.org/
1. PHP 5 Installation: https://help.ubuntu.com/12.10/serverguide/php5.html