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 .
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 email@example.com .
An example that you might paste in (replacing the blue text with your actual long key) would be this:
ssh-rsa AAAABADalkdak235/adf2kj2 firstname.lastname@example.org
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 email@example.com . 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:
- swupd bundle-add network-basic (will give you some network tools like “ifconfig”).
- swupd bundle-add sysadmin-basic (will give you basic things like “top”).
- 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.