Sunday, May 12, 2024

Azure Tools in Linux

In Linux/WSL2, configuring azure swa and cli tools for deployment of Single-Web-App.

Installing swa-cli and env-cmd commands:

$ sudo npm install -g @azure/static-web-apps-cli
$ sudo npm install -g env-cmd

$ swa login --no-use-keychain 
$ export SWA_CLI_DEPLOYMENT_TOKEN=xxxyyyzzz
$ swa deploy ./build --env production --no-use-keychain

 

Installing Azure CLI tools, source Install the Azure CLI on Linux:

$ curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash 

$ az login

Sunday, January 14, 2024

RPi - raspberry pi

 add wifi network:

$ sudo iwlist wlan0 scan

$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

 network={
  ssid="wifiName"
  psk="wifiPassword"
}

 

 

Tuesday, September 12, 2023

NodeJS

 Installing nodejs 18 in Ubuntu/Debian.


$ vim install_node.sh
 
sudo apt-get update && sudo apt-get install -y ca-certificates curl gnupg
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=18
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg]  https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update && sudo apt-get install nodejs=18.17.1-1nodesource1 -y
 

Saturday, June 17, 2023

SSH Agent

To Start the ssh-agent on opening new terminal (Linux or WSL2).

Add following lines to ~/.bash_aliases

 
export SSH_AUTH_SOCK="${HOME}/.ssh/ssh-agent.sock"
ssh-add ~/keys/git-rsa
 
if [ $? -ge 2 ];then
    ssh-agent -a ${SSH_AUTH_SOCK}
    ssh-add ~/keys/git-rsa
fi

It will start the ssh-agent if it is not already running or else connect to existing ssh-agent for new terminal.

 

Tuesday, January 17, 2023

Podman in WSL2

For Debian 11 distro in WSL2, following are the commands to install podman (v3.0.1) and configuring it in order to avoid error during execution of podman commands. As in WSL2 there is no systemd so need to update 'cgroup_manager' and 'event_logger'.

 

$ sudo apt-get install podman

$ sudo vim /etc/containers/registries.conf

unqualified-search-registries = ["docker.io"]

 

$ sudo cp /usr/share/containers/containers.conf ${HOME}/.config/containers/libpod.conf 

[engine]
cgroup_manager = "cgroupfs"
events_logger = "file"
 

$ sudo cp ${HOME}/.config/containers/libpod.conf /etc/containers/containers.conf

 

For running Flask application in container, use tiangolo/uwsgi-nginx:python3.8 as base image hosted on docker.io

 

$ podman build -t test02

$ podman run --rm --name tester -p 8080:80 localhost/test02

 

Since by default, podman is not allowed to run container on privileged ports like 80, in above example running it on 8080 or else need to edit sysctl.conf

 

$ sudo vim /etc/sysctl.conf

net.ipv4.ip_unprivileged_port_start=0

$ sudo sysctl -p    # to apply changes


It can be accessed from web-browser on host as http://localhost:8080

 

For error "/" is not shared mount:

$ findmnt -o PROPAGATION /
PROPAGATION
private
$ uname -r
5.10.16.3-microsoft-standard-WSL2 
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:        22.04
Codename:       jammy
 
# add in /etc/rc.local or /etc/rc.conf 
$ sudo mount --make-rshared / 

 

$ sudo usermod --add-subuids 10000-75535 USERNAME
$ sudo usermod --add-subgids 10000-75535 USERNAME 

 

Tuesday, July 5, 2022

gEdit via rdesktop

 gedit via rdesktop unable to change the preference, this is valid if installed in wsl2 on Windows 11 (that support WSLg).

In such cases we can change the gEdit settings via terminal using gsettings command. Following command will output all the available keys in all schemas.


for example,

gsettings list-recursively | grep 'org.gnome.gedit.preferences.editor'

  • schema:  org.gnome.gedit.preferences.editor
  • key      :  insert-spaces
  • value   :  true

It is useful to quickly set up gedit on newly installed machine by keeping settings in a bash shell scrip and execute it. Here is my custom gedit settings.

Sunday, February 7, 2021

VPN: OpenConnect

For connecting to vpn using openconnect command, we need to install three packages:

  • openvpn
  • easy-rsa
  • openconnect

 

In RedHat or CentOS based Linux system:

  • $ sudo yum install epel-release                            
  • $ sudo yum install -y openvpn easy-rsa
  • $ sudo yum install -y openconnect

 

In Debian based Linux system:

  • $ sudo apt install -y openvpn easy-rsa
  • $ sudo apt install -y openconnect

 

Before connecting to vpn, create tunneling device using openvpn command and make it active. If 'ip' command is not available (on older system) use "sudo ifconfig tun1 up" in step 2

  • $ sudo openvpn --mktun --dev tun1
  • $ sudo ip link set tun1 up
  • $ sudo openconnect <IP-Address> --interface=tun1

Once done, remove the tun1 using following commands:

  • $ sudo ip link set tun1 down
  • $ sudo openvpn --rmtun --dev tun1