Monday, 30 August 2021

Azure CLI commands

Get what version of the CLI you have

az --version

Get help

az help


Logging to Azure portal

Login with web

az login

Login in CLI

az login -u myemail@address.com

List accounts

az account list

Set subscription

az account set --subscription "xxx"


Listing locations and resources / general

List all locations

az account list-locations

List all my resource groups

az resource list


Creating a basic VM / Resource Group / Storage Account

Get all available VM sizes

az vm list-sizes --location eastus

Get all available VM images for Windows and Linux

az vm image list --output table

Create a Resource group

az group create --name demo-rg --location eastus2

Create a Linux VM

az vm create --resource-group demo-rg --name myvmfordemo --image ubuntults --admin-username adminazure

Create a Windows VM

az vm create --resource-group demo-rg --name mywindowsvmfordemo  --image win2016datacenter   --admin-username adminazure

Create a Storage account.

az storage account create -g demo-rg -n mystorageaccount -l eastus2 --sku Standard_LRS


DELETING A RESOURCE GROUP

Permanetly deletes a resource group

az group delete --name demo-rg


Managing VM's

List your VMs

az vm list

Start a VM

az vm start --resource-group myResourceGroup --name myVM

Stop a VM

az vm stop --resource-group myResourceGroup --name myVM

Deallocate a VM

az vm deallocate --resource-group myResourceGroup --name myVM

Restart a VM

az vm restart --resource-group myResourceGroup --name myVM

Redeploy a VM

az vm redeploy --resource-group myResourceGroup --name myVM

Delete a VM

az vm delete --resource-group myResourceGroup --name myVM

Create image of a VM

az image create --resource-group myResourceGroup --source myVM --name myImage

Create VM from image

az vm create --resource-group myResourceGroup --name myNewVM --image myImage

List VM extensions

az vm extension list --resource-group azure-playground-resources --vm-name azure-playground-vm

Delete VM extensions

az vm extension delete --resource-group azure-playground-resources --vm-name azure-playground-vm --name bootstrapper

Sunday, 1 August 2021

Apache Tomcat 9 Installation on Centos 8

Pre-Requirement:

Update repo details
sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*

sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

Please Follow below instructions to install and configure Tomcat on CentOS 8 machine

1)  Install epel-release.

sudo yum install epel-release -y
2) Install open-jdk
sudo yum install java-11-openjdk -y
3)  Download Apache Tomcat 
  cd /opt/        sudo wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.50/bin/apache-tomcat-9.0.50.tar.gz
  sudo tar -zxvf apache-tomcat-9.0.50.tar.gz   sudo mv apache-tomcat-9.0.50 tomcat
  sudo chmod -R 777 tomcat
  sudo chown -R vagrant:vagrant tomcat
4) Configure Apache Tomcat 9 as system service. 
    Create tomcat service file and add below content.

    sudo vi /etc/systemd/system/tomcat.service


[Unit]
Description=Tomcat 9
After=network.target

[Service]
Type=forking

User=vagrant
Group=vagrant

Environment="JAVA_HOME=/usr/lib/jvm/jre"
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom"
Environment="CATALINA_BASE=/opt/tomcat"
Environment="CATALINA_HOME=/opt/tomcat"
Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid"

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

[Install]
WantedBy=multi-user.target
  
5) Start tomcat service
sudo systemctl start tomcat
6) Enable tomcat service
sudo systemctl enable tomcat