Uptime

This blog site is hosted at OCI on an ARM64 processor host with 6GB memory. It has been very stable. I do maintain it occasionally by executing sudo yum update -y && sudo yum upgrade -y but other than that I haven’t had to do much with the host to serve my blog contents. Here is how long the host has been running without a reboot.

23:07:52 up 62 days, 55 min,  1 user,  load average: 0.00, 0.10, 0.08

Surely, this blog site is light on traffic, so there is not much going on so that helps but when I imagine if this host was a Windows server, it would probably need a few reboots per month. I don’t know… Windows server might have improved. It’s been a few years since I dealt with Windows server machines.

Recovering SSH Key

I stupidly reinstalled Ubuntu on my desktop on which I had Linux Mint just because I wanted to try it but I ended up with going back to Linux Mint again. I’m writing this blog from my Linux Mint. I casually formatted the hard drive and did a little distro hopping. When I tried to SSH into my blog host on OCI, I realized that I lost the SSH key and no other host can access the blog host. Crap!

However, I was able to recover it relatively quickly. Here is the list of what I did.

  1. Cloned the existing boot volume.
  2. Created an instance out of the cloned boot volume. When I created the instance, I had a chance to enter public key.
  3. Since it was a cloned volume, everything was already on it. Since it’s got a different public IP, I just changed the DNS A Record to point to the new instance.

It’s all back up and I am able to SSH into the host again.

Experiment with Azure

I remember doing some experiment with Ansible on Azure sometime in January for about 2 weeks. I just got charged $12.16. Azure charges come to my as surprise… Hmm I didn’t think it was costing that much, kind of surprise. I should have monitored the cost as I was using it but I provisioned just one small VM, so I didn’t think it was going to be $12.

I went head and did some analysis. Here is the details of the cost.

  • VM License: $7.43
  • Storage: $2.50
  • VM: $0.77

Oh, I was paying to a VM license… I wondered what I provisioned… If I remember correctly, it was Oracle Linux. When you use Oracle Linux on Azure, it costs about $0.019/h. I had it a little more than 2 weeks so it makes sense. However, as far as I know, Oracle does not charge anything for its license if you provision Oracle Linux on Oracle Cloud Infrastructure (OCI), so if you want to use Oracle Linux, OCI is a good choice.

I see people posting question like “Which distro is good other than CentOS?”. I’d say Oracle Linux is a very good choice. It is 100% compatible with RedHat Linux and it’s free. As far as I know, Oracle Linux is very well maintained by Oracle very often and as long as Oracle is in business, it will continue to be distributed for free. RedHat dropped the ball on CentOS because it didn’t make business sense to RedHat but Oracle uses Oracle Linux for their production a lot so I don’t see them dropping the ball anytime soon.

Migrated to Oracle Linux 8

I just migrated my blog to Oracle Linux 8 on Oracle Cloud Infrastructure. Here is the spec.

  • VM Shape: VM.Standard.A1.Flex
  • OS: Oracle Linux 8
  • CPU: AMPERE Arm64 1 CPU
  • Memory: 6GB
  • Boot Volume: 100GB
  • Docker Containers: WordPress, MariaDB, NGINX and phpMyAdmin

I will probably keep this machine running for the foreseeable future. Configuring a new VM was a breeze because of the Ansible project I worked on.

Full WordPress Site within 10 Mins

I pretty much finished writing the Ansible code to configure an Oracle Linux 8 machine from scratch to the point where it runs a full WordPress site on ARM64 processor. It took just about 10 mins. This is a milestone for me. It used to take at least a few hours for me to set it up when I didn’t have Ansible automation while I search for the information I blogged here.

I will probably polish the code to the point where I can share with the community sometime this week or next week.

MySQL 8 Community Edition on Vagrant VM

As I mentioned in my previous blog, I have been working on a personal project that allows us to provision a test Vagrant VM that has MySQL 8 Community Edition installed. The combination between Vagrant and Ansible made this possible.

I put the code up in GitHub for your consumption and feedback.

When you do vagrant init [url], it creates Vagrantfile. The Vagrantfile has the configuration of the Vagrant VM. You can have Ansible file in the Vagrant file to automatically execute when the Vagrant VM starts.

So yeah, please read the README file to start to use it. Any feedback and pull requests are welcome! 🙂

How to Install Docker Compose 2 on ARM Processor Linux Host (OL7)

I have provisioned Oracle Linux 7 on ARM processor on OCI. In an attempt to get my blog site to work on the host, I have installed Docker engine and now I want to install Docker Compose 2. Here are the steps.

  1. Create a directory.
    mkdir -p ~/.docker/cli-plugins/
  2. Download the Docker Compose 2 binary for ARM64.
    curl -SL https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-linux-armv7 -o ~/.docker/cli-plugins/docker-compose
  3. Give the binary file execute permission.
    chmod +x ~/.docker/cli-plugins/docker-compose
  4. Check if the binary has been installed successfully.
    docker compose version

How to Create Jenkins Slave on Linux

Most of the articles I find on creating a permanent Jenkins slave on Linux requires the slave node to be exposed to public Internet. I want the Linux slave to be pinging Jenkins master just like Windows service. Here is the way I came up with.

Install Prerequisites

  • Java (sudo dnf install java-11-openjdk.x86_64)
    • Check if the Java has been installed. (java -version)
      Result:
openjdk version "11.0.12" 2021-07-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7-LTS, mixed mode, sharing)

Add a Permanent Node

Login to Jenkins master and click Manage Jenkins -> Manage Nodes and Clouds. Click New Node. And then give the node a name (like linux-node), select Permanent Agent and click OK.

And then, click Save button. If you navigate to the node that you just created, you should see something like…

We will take copy this line.

java -jar agent.jar -jnlpUrl https://jenkins.hayato-iriumi.net/computer/linux%2Dnode/jenkins-agent.jnlp -secret 136fa14dcc4013727e24c9f1a9b84127d7c7ca0cfa15e22c1e1d4e0140122529 -workDir ""

Now, we’ll have to download agent.jar from the Jenkins master and upload the file to the slave machine. Just click on the agent.jar link to download it.

I have the agent.jar file in Downloads directory, so here is the command to upload the agent.jar file to the slave machine.

scp ./Downloads/agent.jar hiriumi@192.168.1.29:~

Now, ssh into the slave machine.

ssh hiriumi@192.169.1.29

Trust SSL Certificate

If your Jenkins master has SSL implemented, it’s a good practice to trust the SSL certificate. Here is how you can download the certificate on your slave machine.

openssl s_client -showcerts -connect jenkins.hayato-iriumi.net:443 < /dev/null | openssl x509 -outform DER > jenkins.hayato-iriumi.net.cer

Now use keytool to trust it.

sudo keytool -trustcacerts \
-keystore "/etc/java/java-11-openjdk/java-11-openjdk-11.0.12.0.7-0.el8_4.x86_64/lib/security/cacerts" \
-storepass changeit -alias jenkins -import -file \
"/home/hiriumi/jenkins.hayato-iriumi.net.cer"

Create a Script File and Execute

Paste the Java command you get from the node page in to slave.sh

java -jar agent.jar \
-jnlpUrl https://jenkins.hayato-iriumi.net/computer/linux%2Dnode/jenkins-agent.jnlp \
-secret 136fa14dcc4013727e24c9f1a9b84127d7c7ca0cfa15e22c1e1d4e0140122529 -workDir "./slave"

Make sure slave.sh is executable by adding execute flag on the file.

chmod +x slave.sh

If you execute the slave.sh file, it starts to communicate with the Jenkins master and starts to serve as one of the Jenkins slave.

./slave.sh

Once the connection is successful, you will see something like the following.

Now, this method does not survive restarting the slave machine. Now that the communication is successful, I will look into making this script a daemon.

How to Install VLC on Oracle Linux 8

VLC is an essential software to play any video files. I use it on all the computers that I use. Oracle Linux 8 does not have VLC by default, so here is the way to install VLC.

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
sudo dnf install vlc

Enjoy!

Installing JetBrains Products on Oracle Linux 8

I am trying to configure Oracle Linux 8 as my spare laptop. I need to install JetBrains products on it. I tried to install JetBrains Toolbox but it wouldn’t work. It’s packaged as AppImage file, so it should be pretty easy but when I execute it, a blank white window shows up and disappears.

So I looked for an alternative way to install JetBrains products. I installed snapd on it with the following command.

sudo dnf install snapd

Then, I searched for the JetBrains products like the following.

snap search jetbrains

Result:

Name                       Version   Publisher   Notes    Summary
pycharm-community          2021.2.2  jetbrainsâś“  classic  PyCharm Community Edition
phpstorm                   2021.2.3  jetbrainsâś“  classic  PhpStorm
pycharm-professional       2021.2.2  jetbrainsâś“  classic  PyCharm Professional Edition
intellij-idea-community    2021.2.3  jetbrainsâś“  classic  Capable & Ergonomic Java IDE
intellij-idea-ultimate     2021.2.3  jetbrainsâś“  classic  Capable & Ergonomic Java IDE for Enterprise, Web & Mobile Development
webstorm                   2021.2.2  jetbrainsâś“  classic  WebStorm
datagrip                   2021.2.4  jetbrainsâś“  classic  DataGrip
clion                      2021.2.3  jetbrainsâś“  classic  A cross-platform IDE for C and C++
pycharm-educational        2021.2.2  jetbrainsâś“  classic  Easy and Professional Tool to Learn & Teach Programming with Python
rubymine                   2021.2.3  jetbrainsâś“  classic  The Most Intelligent Ruby and Rails IDE
space                      2021.2.0  jetbrainsâś“  -        Desktop Application for JetBrains Space
rider                      2021.2.2  jetbrainsâś“  classic  A fast & powerful cross-platform .NET IDE
goland                     2021.2.3  jetbrainsâś“  classic  GoLand
intellij-idea-educational  2021.2.2  jetbrainsâś“  classic  IntelliJ IDEA Educational Edition
kotlin                     1.5.31    jetbrainsâś“  classic  Command line Kotlin compiler

The first application I want to install is PyCharm, so I ran the following command to install it.

snap install pycharm-professional

If you search pycharm in your GNOME UI, you will be able to start to use it.

I still would like to use JetBrains’ Toolbox so I posted my question in their support forum to resolve

Before I posted it, I did a fair bit of research. Toolbox is packaged as AppImage, so you can check the command options like the following.

./jetbrains-toolbox --appimage-help

I learned that you can even extract files from the image like the following.

./jetbrains-toolbox --appimage-extract

I did digging into the extracted files but I could not find a solution for it. Oh well, I can use JetBrains’ products anyway, so I’m happy for now.