1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
#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 WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # 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" |
WordPress – Simple Blog Installation in Ubuntu – PHP, Apache, MySQL
Installation
References
1. Home : http://wordpress.org/
1. ... Read more