mattgadient.com

Quick Guide – Installing “Clear Linux” on GCE (Google Compute Engine)

Intel’s documentation for actually *installing* Clear Linux is somewhat sparse. There aren’t a whole lot of generic “how to” guides out there for Clear Linux either. Anyway, I muddled through installing it on GCE earlier today using the web interface for everything, so here we go!

Step 1 – Download the latest GCE build for Clear Linux

Head to https://download.clearlinux.org/current/ and grab clear-xxxxx-gce.tar.gz .

Easy enough!

Step 2 – Upload it to Google Cloud Storage

Don’t decompress the file or anything (leave it as .tar.gz).

If logged in, the Cloud Storage area can be found at https://console.cloud.google.com/storage/ .

You’ll have to make a bucket and upload it. Pretty easy to do via the interface. Once it’s uploaded you’ll want to know/remember the path (mybucket/somedirectory/clear-xxxxx-gce.tar.gz ) but otherwise don’t have to do anything else here, so on to…

Step 3 – Create an image through Google Compute

If logged in, the Images area of compute can be found at https://console.cloud.google.com/compute/images .

  • Hit the Create Image button near the top.
  • In the new section that appears, change Source to Cloud Storage.
  • It’ll ask for the path to the file in your bucket (from Step 2). Plunk that in, name the image to something clear-linuxey, and hit “Create”!

Step 4 – Create your new VM instance

If logged in, the VM Instances area of compute can be found at https://console.cloud.google.com/compute/instances .

  • Hit the Create Instance button near the top.
  • Under the Boot Disk setting, hit Change and then select your Clear Linux image from the Custom Images section.
  • Configure other stuff you might want, but don’t create the instance just yet.

The next bit is a little messier.

Normally GCE images let you do priviledge escalation via “sudo su root”. However, this doesn’t work with the Clear Linux image. Thus you need to tweak things so you can log in via SSH as root.

  • Expand the Management, disk, networking, SSH keys section (below the Firewall section).
  • Under SSH Keys you’ll have to paste a key for root. If you’ve dealt with SSH keys before on linux/mac, chances are you’ve already got a public key on your local computer at ~/.ssh/id_rsa.pub . If not, you’ll have to do a quick google search for generating an SSH key (likely using “ssh-keygen” or similar).
  • When your key has been generated and you’ve copied it to the clipboard, paste it into the box but change the last part to root@whateveryouwant.com .

An example that you might paste in (replacing the blue text with your actual long key) would be this:

ssh-rsa AAAABADalkdak235/adf2kj2 root@ilikeugoogle.com

Step 5 – Create the VM and log in!

Once the VM has been created and is running, you can pop in from your local machine (where you grabbed the SSH key from) via your ssh client. Make sure you log in as root! Example from a Mac/Linux terminal: ssh root@123.45.6.78 . Obviously, use the IP address of your VM.

On first login it’ll make you change the root password.

Other bits and notes…

Being logged in as root all the time is either “highly convenient” or “an accident waiting to happen” depending on who you ask. Either way you may want to consider setting up a user account with a password and sudo privileges (whether password or password-less sudo). I’ll leave that for another time though.

Note that you can remove the clear-xxxxx-gce.tar.gz file from Cloud Storage now (you still have the one created in Compute Images which you can use if you need to create a new instance).

If you’ve used Clear Linux in the past, you’re probably good to go now. If not, a final tidbit that might help get you started:

The base install is really small which is great in terms of disk space used. However, it’s missing a lot of common tools. A couple things you may want to consider running:

  1. swupd bundle-add network-basic (will give you some network tools like “ifconfig”).
  2. swupd bundle-add sysadmin-basic (will give you basic things like “top”).
  3. swupd search someprogram (will search for someprogram and tell you what bundle it’s found in).

Note that Clear Linux takes a very minimalistic approach, as evidenced by the very tiny amount of stuff in /etc . This means that if you say… install nginx (swupd bundle-add web-server-basic)… nginx won’t actually run until you create an /etc/nginx/nginx.conf file.

If anyone runs into any hiccups, feel free to leave a comment below.

1 Comment

 | Leave a Comment
  1. Hi Matt, Congrats on your work, very thorough. The 150W “Smart IC” driverless led COB @ 110v AC is what brought me to your site. Interesting findings and info on many of your projects.
    I purchased 10 30watts led fixtures from Ebay (china). All of them only had 2 screws holding the led module. ground wires not connected, 5 out 10 not operational ( I have not yet taken the time to determine, led or driver fault) however seller reimbursed those and I got to keep them so will be experimenting. One of my pet peeves about those LED fixture is the widespread RF interference wiping out FM band radio signal. I’ve not checked out VHF or UHF ham bands but will do so in the near future. I’ve got ferrite beads on order to try to snuff that out. My question is have you tried to see if the ‘smart IC’ driverless cob emits any interference. Thanks

Leave a Comment

You can use an alias and fake email. However, if you choose to use a real email, "gravatars" are supported. You can check the privacy policy for more details.

To reduce spam, I manually approve all comments, so don't panic if your comment doesn't show up immediately.