Use c9 in Google Cloud Platform

Caio Gomes
3 min readSep 22, 2019

--

C9 environment running

Hello! Have you ever used Cloud9 IDE?

If you did use Cloud9 then you probably hadn't found a good alternative to their service after AWS bought it. As someone that doesn't like the AWS interface (and also someone that has some free credits in GCP), I really wanted to use Cloud9 in any other cloud provider such as GCP or Azure or anything other than AWS. So after some effort, I found out that Cloud9 is open source and they have a GitHub repository that if there are any good gods, it will keep the Open Source for a really long time.

So let's go to the tutorial, that is pretty simple. First, let's get started by creating a VM in Google Cloud Compute Engine.

After creating the instance then you should start and after those steps then you will have something like this:

Ok, now that you created that instance, then you should connect into it. I prefer to connect through gcloud, but you can use any ssh method, and if it takes too long to connect it's important that you check if the network that you are using allow ssh traffic, at least before instantiating Cloud9.

After login through ssh you should see the terminal screen with a fresh install of linux ubuntu. So in order to install Cloud9 requirements present in the ssh server requirements repository. We must run the following script in our ssh instance:

sudo apt-get install build-essential gitcurl -L https://raw.githubusercontent.com/c9/install/master/install.sh | bash

Then you must proceed with some yes until install everything. Now we will install and setup nvm and after that install nodejs:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash

After installing nvm we must close and open again the terminal, a simple exit of the ssh session should work. Now we install the last node version:

nvm install --latest-npm
source ~/.bashrc

After installing this basic setup, then we must install the Cloud9 itself:

cd ~
git clone https://github.com/c9/core.git c9sdk
cd c9sdk
scripts/install-sdk.sh

After that, you just need to wait for the process to finish. After finishing you must run the server of the cloud9, we are going to host the server in the port 8080 because it's a common port to use at all, so, in order to allow the stuff to work properly you must run:

mkdir ~/workspace
screen node ~/c9sdk/server.js -p 8080 -w ~/workspace -a : --listen 0.0.0.0 --collab true

But in order to access the server from your computer or any other local of the internet, you must enable the traffic in the port 8080 for your network. So, create a firewall rule for your virtual machine opening the port 8080 and any other port you intend to use as your server and it may work fine.

So if you liked let some claps that I pretend to keep posting useful content such as this one. If you have any comments or questions let me know! So thanks and bye bye!

--

--

Caio Gomes

sou um app developer que tenta construir os melhores produtos possíveis tanto tecnologicamente quanto na experiência de usuário