Tutorial Google Cloud Server Instructions (free for 1 year) & settings

lagiosman

SN Confirmed Member
Here is the instructions by me ;) to get your own Google Cloud Server with $ 300 free to spend, a gift from Google.

What is Virtual Private Server or VPS?

Think of every ad you see on the internet for free or very cheap website hosting (of your site's files), 90% of all these services have to do with a shared hosting server, the same server hosts other clients inside, not only you.

The reasons that many choose this simple hosting are:
1. It's very easy to use it
2. It's all preinstalled (email, ftp, databases etc)
3. It is very cheap compared to a Virtual Private Server

But if we want to see reality with another eye:
1. You use the same IP with other 100+ clients, meaning you have the following dangers: hacking, ddos attacks, blacklist ip, slow operation, resulting in the server dropping each time, etc.
2. It may be all preinstalled, but how many times have you tried to pass an add-on to wordpress to import 1000+ products in your e-shop and suddenly stuck everything up? Almost always happens when the add-on asks for more resources, memory, and more that many times depending on the hosting company you need to ask if they want to give you, usually not.
3. The myth that Shared Hosting is inexpensive does not apply, because of restrictions you are usually forced to get a Gold Package and that means you will give at least $ 10- $ 14 month, $ 120-168 $

That's why, slowly or quickly, it's time to start searching for the famous VPS.

In the past VPS was costing a lot, but today we have a lot of choices and because I don't want to waste more of your time, you can see the history of VPS on Google with a search.

One of the options for VPS is the Google Cloud Platform (Compute Engine), where Google as a gift introduces $ 300 trial to use wherever you want.

I will enrich this post with more and more corrected (easier) steps in the future, as well as uploading a video with the whole process. For the moment I quote that I've been working on my free time and as always, feel free to ask;)

01. Go to console.cloud.google.com
02. register with your gmail and add your credit/debit card
03. go to console.cloud.google.com > Compute Engine > VM Instances
04. if it ask hit Enable (payments profile, something like that)
05. Inside VM Instances hit "Create Ιnstance"
06. Write:
a) Name: Whatever you want
b) Zone: us-central1-c
c) Machine Type: 1 vCPU (3.75 GB memory)
d) On Boot Disk hit "Change" button and choose "Ubuntu 17.10 and below 50GB"
e) Don't touch the Service account
f) On Access scopes choose the middle "Allow full access"
g) On firewall check both (http & https)
h) Click on "Management"
i) Choose the tab Networking
j) On default Network Interface right click on the pen to edit its settings
k) So in his options go to IP Forwarding and change it to ON and hit DONE
l) Finally click Create and wait until it's ready.
07. Once it's ready, prepare a document and start writing in that information you'll need for the future, for example, External IP you'll need to have it in a document to connect faster.
08. Click on SSH and open a new window with the server's command console
09. Congratulations, you've connected to your server.
10. To setup the ability to host websites:
(for each write I'm telling you you will write and press Enter)
(if he asks you with Yes-> y or No-> n, you will press y and Enter)
(where he asks you for a code, always put the same and store it in the document you made before to not forget him)
a) write: sudo su -
b) write: apt-get update && apt-get dist-upgrade && apt-get autoremove
c) write: apt-get install apache2
d) write: apt-get install mysql-server mysql-client
e) write: apt-get install php7.0 libapache2-mod-php7.0 php7.0-mysql
f) write: apt-get install zip unzip
g) write: apt-get install phpmyadmin
(will ask you to automatically reconfigure Web server, click Space on the keyboard to check apache2 and then enter)
(for a code when it asks you, put the same you used before)
h) write: echo " " > /etc/php/7.0/cli/php.ini
i) write: nano /etc/php/7.0/cli/php.ini
go here: and copy everything there ando in console window press CTRL + V to paste
click on the keyboard, press the Ctrl + X button, then press Y and finally press Enter
(if you want the full version of php.ini, go there: )
j) write: echo " " > /etc/php/7.0/apache2/php.ini
k) write: nano /etc/php/7.0/apache2/php.ini
(do exactly the same as the previous one)
11. link your domain:
(change tositesou.com with your actual site address)
a) Create folder of your site, write: mkdir -p /var/www/html/tositesou.com
b) Write: chown -R www-data:www-data /var/www/html/tositesou.com
(later when you upload your files to your site give the following commands:
b1: chown -R www-data:www-data /var/www/html/tositesou.com/*
b2: chown -R www-data:www-data /var/www/html/tositesou.com)
c) Write: chmod -R 755 /var/www
(this command is for one time, do not repeat if you upload a second site)
d) Write: cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/tositesou.com.conf
e) Write: nano /etc/apache2/sites-available/tositesou.com.conf
delete everything and paste the following: f) at the end on your keyboard, press Ctrl+X , after that press Υ and final press Enter
g) Write: a2ensite tositesou.com.conf
h) Write: sudo service apache2 restart
i) Write: nano /etc/hosts
j) go to DNS Settings of your domain, and you will find the provider you buy your domain (eg godaddy.com etc)
and add or change: Type-> A | Name-> tositesou.com | Value: external ip of your server
(see the picture: dns.JPG)
k) write in your console: sudo service apache2 restart
l) Check if working, open your browser and visit your domain, tositesou.com, you will see a message "Forbiden".
12. To upload your website eg Wordpress:
a) write: cd /var/www/html/tositesou.com
b) write: wget https://wordpress.org/latest.zip
c) write: unzip latest.zip
d) write: cd wordpress
mv * ..
cd ..
rm -r wordpress
e) write: chown -R www-data:www-data /var/www/html/tositesou.com
f) after that visit phpmyadmin http://tositesou.com/phpmyadmin login and create a new database
and then visit your domain to setup wordpress for the first time
g) Finally visit your wordpress admin panel and install the following plugin: File Manager
with this plugin you can upload and edit from now on
h) Here some console commands you may find usefull:
13. To have email function:
a) Go to Mailgun , register there
press Add New Domains
write mailgun.tositesou.com
go to dns settings fo your domain, and add the records of mailgun
as soon as you do it find the option and press it "Check DNS Records Now"
b) Go to your wordpress admin panel and install mailgun plugin
 
Last edited:
Top