How To Deploy WordPress Through Google App Engine

gcp-wordpress

WordPress is a free and open-source content management system (CMS) based on PHP and MySQL. You can use wordpress to launch your blog or any kind of website. This tutorial will give you steps to install wordpress on google app engine.

Step 1. Open Google Cloud Services & Click Product & Services at the top left most part of the page.

GC instance creation gc main page

Step 2. Now Click on Compute Engine which is available at the Service Panel of the page.

app engine service panel page

Step 3. Now Login into your Instance terminal on which you want to Create App Engine and Update packages.

# apt-get update

Update packages

Step 4. Create Directory for WordPress Deployment and move into that directory.

# mkdir /opt/wordpress
# cd /opt/wordpress

wordpress folder creation pic

Step 5. Now you have to Install App Engine SDK, PHP and WordPress for your App Engine.

#  apt-get install vim unzip libgcrypt11-dev zlib1g-dev bzip2  gcc libmysqlclient-dev libxml2-dev make git -y

Packages installation

Step 6. Download the packages for Google App Engine.

# wget https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.38.zip

google app engine package wget pic

Step 7. Unzip Google App Engine Package.

# unzip google_appengine_1.9.38.zip

Google app engine unzip pic

Step 8. Download Package for WordPress.

# git clone –recursive https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project.git

Wordpress and php packages pic

Step 9. Move appengine-php-wordpress-starter-project to friendly name.

# mv appengine-php-wordpress-starter-project appengine-php-wordpress

Wordpress and php packages friendly name pic

Step 10. Install Mysql-Server in your Machine by running bellow command from your terminal.

# apt-get install mysql-server -y

mysql server password picSpecify New password for Mysql root user.

mysql server password pic 1
Note: Confirm Password for Mysql root user.

Step 11. Download php-5.4 for wordpress.

# wget –trust-server-names http://us2.php.net/get/php-5.4.25.tar.bz2/from/us1.php.net/mirror

php package wget pic

Step 12. Extract php-5.4.25 diretory.

# tar vxjf php-5.4.25.tar.bz2

php 5.4 untar folder

Step 13. Move to php-5.4.25 directory.Configure & install php by below command.

# cd php-5.4.25
# ./configure –prefix=$PWD/installdir –enable-bcmath –with-mysql –with-zlib
# make install

Note: Now you have to make a database on sql cloud.If you dont know that how to create database in Sql cloud then click on below link.

http://cloudneer.com/academy/?kbe_knowledgebase=how-to-create-sql-in-google-cloud

Step 14. Now Login into your SQL Cloud Instance to create a Database for your WordPress by below command.

# mysql –host=INSTANCE_IP (just for cloud SQL) –user=root –password
> create database wordpress_db;
> exit;

cloud sql login page

Step 15. Now Move to appengine-php-wordpress directory and putting files at the right place with the help of below command.

# cd /opt/wordpress/appengine-php-wordpress
# chmod +x move_files_after_editing.sh
# ./move_files_after_editing.sh


Step 16.
Now move to WordPress directory and open wp-config.php and edit below lines.

# cd /opt/wordpress/appengine-php-wordpress/wordpress
# vim wp-config.php
define(‘DB_HOST’, ‘Your Cloud sql Ip’);
define(‘DB_USER’, ‘Cloudsql User’);
define(‘DB_PASSWORD’, ‘Cloudsql User Password’);

wordpress config file

Step 17. Now fire below command to run your appengine.

# /opt/wordpress/google_appengine/dev_appserver.py –host=0.0.0.0 –php_executable_path=/opt/wordpress/php-5.4.25/installdir/bin/php-cgi /opt/wordpress/appengine-php-wordpress

appengine running pic

Step 18. Open your browser and run WordPress.

http://CloudSqlIp/:8080/wp-admin/install.php

Step 19. Now specify wordpress details as per your requirement then click on Install wordpress.

wordpress install page pic

Step 20. Now click on Login.

wordpress login pic

Step 21. Now Enter your Username and Password for login into wordpress then click on Log In.

wordpress login pic

Step 22. Now you are successfully Login in your Wordpress account.

wordpress dashboard pic