Google has decided to compete with Amazon Web Serices and has put forward a service with similar specifications and performance. We can now run our infrastructure in Google’s servers at a similar price and with similar services. A very interesting point is that for new registers in Google Cloud Platform, a credit of $300 is offered for 12 months to test run the services of the platform. This credit is large enough to enjoy a high performance VPS during that time.
To make use of these services we need to access Google Cloud Platform with our Google credentials (Gmail, Google+, YouTube or any other Google service’s credentials will work). In further entries we will take a look at how to make full use of all of Google’s services, but for now we will focus on simpler tasks, like starting up an instance of Ubuntu 16.04 with LAMP and WordPress installed.
The services needed for this are:
- Compute Engine: Allows creating and managing our instances and assign them resources. We can also manage our credentials and access keys.
- Red VPC: Reserves static IP addresses and firewall rules to control access to our instances.
- Web Services: If we want to make use of Google’s DNS service we can manage this from here. We can also create and manage our own CDN.
If you would like to set up your first instance in Google Cloud, you can download a detailed guide here. The guide contains instructions on how to create an Ubuntu 16 instance and how to gain access from a Windows PC. A short summary of the steps to take is following:
- Create the instance in “VM Instances=> Create Instance”. We can pick between preconfigured images and lists to work with a wide selection of installed software.
- Assign a static IP to the instance and if necessary adjust firewall rules in “VPC Web”. If we have our domain we can register the corresponding entry in DNS if we want to use the servers.
- Generate our pair of keys to connect by SSH. I recommend using PuTTY y/o WinSCP
- Register our public key in “VM Instances => Metadata”.
- Set up our client and we now have full access to our instance.
- Start a terminal session and install MySQL, Apache and PHP:
- sudo apt-get updatesudo apt-get upgrade
- Install MySQL: sudo apt-get install mysql-server mysql-clientsudo mysql_secure_installation
- Create the database: mysql -u root –p, DATABASE <nombre>;
- Install Apache 2: sudo apt-get install apache2
- Install PHP and Apache support: sudo apt-get install php7.0 libapache2-mod-php7.0
- Add support for MySQL and other regular modules in PHP: sudo apt-get -y install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext
- Restart the web service: sudo service apache2 restart
- Create the necessary folders for the web: sudo /var/www/dominiosudo mkdir /var/www/dominio/htmlsudo mkdir /var/www/dominio/logs
- Set up the new site in Apache, activate and restart the server: sudo nano /etc/apache2/sites-available/dominio.confsudo a2ensite dominio.confsudo a2enmod rewritesudo service apache2 reload
- Upload WordPress installation folders
- Adjust its permissions, making the web server the owner of the folders: sudo chown -R www-data:www-data /var/www/dominiosudo chmod g+rwx /var/www/dominio -R
- Proceed to installing WordPress as usual.