Installing GO (Golang) v1.17.1 on Z-Linux (s390x)

7/16/2022 0 Comments

Please follow the given steps for installing Golang v1.17.1 on zLinux (s390x):

1. From your home directory execute:                 wget https://storage.googleapis.com/golang/go1.17.1.linux-s390x.tar.gz

2. Execute: chmod ugo+r go1.17.1.linux-s390x.tar.gz

3. Extract using: sudo tar -C /usr/local -xzf go1.17.1.linux-s390x.tar.gz

4. Define a symlink /usr/bin/go pointing to -> /usr/local/go/bin/go using the command: sudo ln -s /usr/local/go/bin/go /usr/bin/go (The directory /usr/bin must be specified in your PATH env variable. Else add it to the PATH)

5. Verify that go is installed with: go version

0 comments:

Installing Grafana v8.1.7 from source code on zLinux (s390x)

7/16/2022 0 Comments

In this article we see how to install Grafana v8.1.7 from source code on zLinux (s390x). By obtaining from source code we can do customizations to Grafana such as adding more themes, behaviors etc. Even though this article says zLinux the below steps should generally work for all flavors of Linux such as Ubuntu, Redhat,  CentOS etc. Also it is important to note that these instructions work only till Grafana v8.2.7 specifically in zLinux because after Grafana v3 and above some breaking changes have been made to the build process and as of writing this article these breaking changes have not been fixed for zLinux. Other distributions just work fine.

Build the Grafana Server

PRE-REQUISITES

  1. Create a working directory (hereafter called <work_dir>) for Grafana (In this example it is in ~/software/grafana_v8)
  2. Ensure make is installed by executing: make --version. If make is not installed please install it.
  3. GoLang Compiler (v1.17.1 or later): Ensure go is installed by executing: go version (If not installed follow this article to install GoLang v1.17.1 to folder /usr/local/go)
  4. Specify the following 'env' variables:
    export GO111MODULE=on
    export GOPATH=~/software/go-path (create this directory if required)
    export GOROOT=/usr/local/go (assuming go is installed here)
    export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
  5. NodeJS (v16.15.1) and Yarn (v1.22.19):  Ensure NodeJS and Yarn are installed by executing: node --version && yarn --version  (If not installed follow this article to install NodeJS v16.15.1)
  6. Execute the following:
    1. export PATH=$PATH:~/software/<node_install_dir>/bin
    2. export NODE_OPTIONS="--max-old-space-size=8192"

GET THE SOURCE CODE and INSTALL THE SERVER

From the <work_dir> download the source code of Grafana v8.1.7 using: 

wget https://github.com/grafana/grafana/archive/refs/tags/v8.1.7.tar.gz

Extract it to the current directory (hereafter referred to as <grafana_root>) with:

sudo tar -C . -xzf v8.1.7.tar.gz

- Go to the path: <grafana_root> and execute: make run (this will install server)
- Once the server starts at port 3000, stop the server (press Cntrl+C) and proceed to next step

INSTALL AND START CLIENT

From the directory <grafana_root> execute the following (this might take a while to complete say a few minutes):
yarn install --pure-lockfile - this will install client dependencies
yarn start - this will build the client and start it. Once the client has started stop it (press Cntrl+C) and proceed to next step.

START THE SERVER

  • (Optional Step) If you want to change the default Grafana port (3000), edit <grafana_root>/conf/default.ini and change the <http_port> value.
  • Change directory to <grafana_root>/bin directory and execute: ./grafana-server - This will run the server at port <http_port> (default 3000). 
  • DONE!!! Open http://<server>:<port> in a browser to see the Grafana login screen. The default username, pwd is admin, admin respectively.

Thank you and happy metrics visualization!!!

0 comments:

Useful Linux Commands

7/01/2022 0 Comments

We are all familiar with basic Linux commands such as pwd, ls, cd etc. Other than that given below are a few more commands that we might find useful in our day to day work.

1. Unzip a compressed file (.zip, .tar.xz, .tar.gz)

In Linux compressed files (zip files) come in different formats such as .zip, .tar.xz, .tar.gz etc. Here are some useful commands to unzip these files.

> Unzip a .zip file

    Command: unzip file.zip -d /path-to-unzip/

    Example: unzip myfile.zip -d /dest/bin

> Unzip a .tar.xz file

    Command: tar -C /dest/ -xf file.tar.xz

    Example: tar -C /usr/local -xf node-v16.15.1-linux-s390x.tar.xz 

> Unzip a .tar.gz file

    Command: tar -C /dest/ -xzf file.tar.gz

    Example: tar -C /usr/local -xzf go1.18.3.linux-amd64.tar.gz

2. Download a file from a URL

In order to download a file from a specific URL execute the wget command with the url as the parameter as:

    Command: wget <download-url>

    Example: wget https://go.dev/dl/go1.17.11.linux-s390x.tar.gz

3. Create a symbolic link (symlink) to a file

A symbolic link is similar to a Windows shortcut that points to another file or folder. In order to create a symlink refer the below example:

Command: ln -s <path-to-file-or-folder> <location>/<symlink-name> 

Example: ln -s /usr/local/nodejs/bin/node /usr/bin/node 

The above command creates a symlink called node in the directory /usr/bin/ which points to the executable file node in directory /usr/local/nodejs/bin/

4. Search for a file with specific criteria

We can use the find command to search for files with different criteria. 

Criteria: Search for a file named .gitignore in the current directory

Command: find . -name ".gitignore" -type f 

Criteria: Search for all files containing text "RMF" in the current directory

Command: grep -Ril "RMF" .

Here: 

  • R stands for recursive.
  • i stands for ignore case (optional).
  • l stands for "show the file name, not the result itself".
  • . stands for current directory


5. Executing a command from the history

Do you know that you can retrieve and execute previously executed commands in your terminal with the history command?

Command: history
Displays a list of commands we have executed in our terminal


To execute a specific command just type the character ! with the line number
Example: !7 prints the current working directory







0 comments:

Blog Archive