Run a Linux server on GCP

I wanted to do what I used to do with my Linux machine on a GCP (google cloud platform) server, so I created a Linux machine as a VM on GCP and even ran the program. I've done it to the minimum, so it's a memo.


Basically a blog post -GCP (GCE) starting from now on, safely use the free tier -Start a Linux server using GCP Compute Engine

By following the above, I think that it is okay for those who are accustomed to it. I read this and followed it, but I couldn't log in to the VM I created because I was creating a new project but I wasn't setting it in the new project where I was using local gcloud. Also, I don't know the price well. It is a memo in the state.

How to check the project and settings

View the current project.

> gcloud config list
account = [email protected]
disable_usage_reporting = True
project = myproject-000000

Your active configuration is: [default]

Switch to the created project.

> gcloud auth login
> gcloud config set project myproject-000000

Check if there is an instance created. At first, I noticed that the project settings were incorrect because the VM I should have created here was not an instance.

 > gcloud compute instances list
 myinstance  us-west1-b  n1-standard-1       RUNNING

If you have an instance, log in with gcloud ssh. Is it okay if I haven't created any VM accounts? I thought, but when I typed this command, Putty started up, asked for the pass phrase setting, pressed the return key (no setting), and entered the terminal where I logged in.

> gcloud compute ssh myinstance --zone=us-west1-b

After logging in, it felt like it could be used normally, so there are no problems so far. Many thanks.

Create a Linux machine as an instance of a VM

The order is reversed, but it is a memo until the virtual machine is created. This was done at Suppose you are in a project.

(1) Select a VM instance from Compute Engine.


(2) Select "Create" for the VM instance.


The rest is written in various articles, but you can select the region, OS, etc. I didn't know which one was better, so I chose the one that was written in the blog. After all, I don't know for now if it's free. (The cost was listed as $ 24 per month, but it may be free with a deposit for one year, but I'm not sure, so ignore this part of my article.) Ubuntu 19, 30G , I chose US Oregon. The result is an instance.

20191215-VM4.PNG And, as I wrote earlier, I logged in with gcloud.

Original purpose (memo)

This is to keep the previously written Indoor Humidity Log. We have now moved the machine running the python script that we receive as an MQTT client and save to a file into a virtual machine. I know there is a smarter solution, but I would like to improve it little by little.

From now on, I would like to put the public key over there so that I can ssh normally from here. In the first place, I want to save it directly to Container using Google's pub / sub. .. ..

Recommended Posts

Run a Linux server on GCP
Run TensorFlow2 on a VPS server
Build a simple WebDAV server on Linux
Build a Samba server on Arch Linux
Run Jupyter notebook on a remote server
Run FreeBSD on Linux + qemu
[Part 2] Let's build a web server on EC2 Linux
[Part 1] Let's set up a Minecraft server on Linux
How to run Django on IIS on a Windows server
Install Arch Linux on DeskMini A300
Run Matplotlib on a Docker container
Create a Linux environment on Windows 10
Run headless-chrome on a Debian-based image
[Note] Run Django on Amazon Linux 2
Run docker-compose on Amazon Linux2 on ARM64
A story about a GCP beginner building a Minecraft server on GCE
Run cron on Amazon Linux (set on Linux)
Host the network library Mirror for Unity on a Linux server
What I stumbled upon when using CodeIgniter on a Linux server
Build a Pypi cache server on QNAP
Run TensorFlow on a GPU instance on AWS
Run a local script on a remote host
Build an NFS server on Arch Linux
Make Unity Accelerator a service on Linux
Install and Configure TigerVNC server on Linux
Run bootgen on Debian GNU / Linux, Ubuntu
Dockerfile: Install Docker on your Linux server
Run Keycloak on Amazon Linux 2 without Docker
Build a web server on your Chromebook
Run Python code on A2019 Community Edition
Create a Linux virtual machine on Windows
Run matplotlib on a Windows Docker container
Run Linux on ARM architecture with QEMU
Run python wsgi server on NGINX Unit
Linux server command
I measured the run queue wait time of a process on Linux
Run a batch of Python 2.7 with nohup on Amazon Linux AMI on EC2
Verification of how to periodically execute a script on a Linux server on Windows
Rock-paper-scissors with Python Let's run on a Windows local server for beginners
Install Python3 and Django on Amazon Linux (EC2) and run your web server
Run Debian (Linux) & LXQt on Athlon 200GE (AMD)
Periodically run a python program on AWS Lambda
Run the task in the background on the sshed server
Install Windows 10 from a Linux server with PXE
Open a ZIP created on Windows in Linux
Start a process with a scheduling policy on Linux
Try to create a new command on linux
Mount a directory on another server with sshfs
Building a Python environment on a Sakura VPS server
Run Laravel-admin on Golang PHP application server RoadRunner
Until you install Python with pythonbrew and run Flask on a WSGI server
Source compile Apache2.4 (httpd 2.4.43) + PHP7.4 on Linux and build a Web server ―― 1. Apache introduction
Source compile Apache2.4 (httpd 2.4.43) + PHP7.4 on Linux and build a Web server --2 PHP introduction
Daemonizing processes on Linux
Run Kali Linux on Windows with GUI (without VirtualBox)
Set up a simple local server on your Mac
jblas on Arch Linux
Build a server on Linux and local network with Raspberry Pi NextCloud and desktop sharing
Linux (WSL) on Windows
NAT router on Linux
Create a QR code for the URL on Linux