Wednesday, November 3, 2021

How to Login AWS EC2 instance without using (.ppk or PEM key) Key Pair

Pre-Requisite: 1. You need to have  AWS Console account 

                         2. We have EC2 instance created if not How to Create an EC2 instance

Step 1: Copy Public IPAddress of an EC2 instance from AWS Console 

Step 2: Launch Putty and paste the IP Address and  Select "Auth" from SSH under category and browse for ".ppk" and click on Open 

Step 3: Click on "Yes" to Accept the trust connection with EC2 instance from host
Step 4: Login with "ec2-user" details 
Step 5: Setup the password for "root" user account 
Step 6:  Navigate to sshd_config using sudo vi /etc/ssh/sshd_config and  change the values to following properties 
                6.1 PasswordAuthentication Yes (default value is No)
                6.2 PermitRootLogin yes (Remove the # )

Press "Esc" or "ctrl+c" from keyboard then type ":wq!" to Save and exit from the file 

Step 7: Restart the sshd service 

               systemctl restart sshd.service (To Apply the modified changes)
               systemctl status sshd.service (To Check the sshd running status)

Step 8: Now Launch new Putty / terminal to access the Linux Instance machine and login with root user by entering the password




We have logged in AWS EC2 instance successfully !!! without using keypair


             






 









Thursday, July 1, 2021

Install Docker & Docker-Compose on Linux distro`s & Windows (offline / without internet)

 

Install Docker & Docker-Compose on Linux distro`s (offline / without internet)

This method can help if systems are not having internet connections.

Make sure uninstall or remove the older version of docker, if installed already.

Uninstallation Steps:

Step 1: dpkg -l | grep -i docker

Step2:  sudo apt-get purge -y docker-engine docker docker.io docker-ce

Step3:  sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce

Step4:  sudo rm -rf /var/lib/docker /etc/docker

Step5:  sudo rm /etc/apparmor.d/docker

Step6:  sudo groupdel docker

Step7: sudo rm -rf /var/run/docker.sock

Step8: sudo snap remove docker

Step9: sudo docker -v (optional)

 

Docker Offline installation steps:

Below commands will help us to get the Linux distro versions & Names:

cat /proc/version

        
 


 

cat /etc/*release




Click the below link to navigate the docker Linux distribution list.

https://download.docker.com/linux/

Click the below link to navigate the docker Windows.

Index of win/ (docker.com)

Download the latest version zip file.

Index of win/static/stable/x86_64/ (docker.com)

Here we have selected Ubuntu Linux distribution

 



Download the respective os packages from the below links

For Ubuntu:

http://docker-release-yellow-prod.s3-website-us-east-1.amazonaws.com/linux/ubuntu/dists/focal/pool/stable/amd64/

Download the highlighted or latest version packages to your system.



For CentOS:

http://docker-release-yellow-prod.s3-website-us-east-1.amazonaws.com/linux/centos/8/x86_64/stable/Packages/

 



 

 

Copy the downloaded packages to the system which you wanted to install the docker

If you downloaded the packages in Linux (CentOS / Ubuntu ) & want to copy to another Linux.

sudo cp -rf *.deb /path/to/package/directory/of/the/destination/system

eg: sudo cp -rf packages_directory/*.deb  /home/Certscan/packages

We must follow the sequence while proceed with docker installation.

1.      sudo dpkg -i containerd.io_1.4.6-1_amd64.deb

2.      sudo dpkg -i docker-ce-cli_20.10.7~3-0~ubuntu-focal_amd64.deb

3.      sudo dpkg -i docker-ce_20.10.7~3-0~ubuntu-focal_amd64.deb

Validate the docker installation by using the below command.

                         $ sudo docker -v

                         $ sudo docker run hello-world

 

Install Docker Compose Offline

Step1: Download the package on a system which has internet connectivity.

From Browser: https://github.com/docker/compose/releases/download/1.24.0/docker-compose-Linux-x86_64

From Linux Terminal:

Open Terminal and run the below command.

wget https://github.com/docker/compose/releases/download/1.24.0/docker-compose-Linux-x86_64

if wget not installed in your Linux

Ubuntu: sudo apt-get install wget -y

CentOS / RHEL: sudo yum install wget -y

Step2: Rename the downloaded package in Linux.

 mv docker-compose-Linux-x86_64 docker-compose

Step3: Copy the renamed file into destination machine using SCP or Winscp.

From Windows PowerShell to Linux:

scp -r localmachine/path_to_the_directory/ username@server_ip:/path_to_remote_directory/

Ex: scp -r C:\Users\gd\Downloads\docker-compose test@10.204.211.118:/home/test/

From Linux to Linux:

sudo cp -rf docker-compose test@10.204.211.118:/home/test

Step4: Make the copied docker compose package with Executable permissions.

sudo mv docker-compose /usr/local/bin/

sudo chmod +x /usr/local/bin/docker-compose

Step5: verify the docker-compose version.

sudo docker-compose -v

 

 

 

 

Monday, September 28, 2020

How to Configure AWS CLI for Ceph Object Gateway Storage

 How can I configure AWS s3 CLI for Ceph Storage?. The Ceph Object Gateway is an object storage interface built on top of librados to provide applications with a RESTful gateway to Ceph Storage Clusters. The Ceph Object Gateway daemon (radosgw) is an HTTP server for interacting with a Ceph Storage Cluster. It provides interfaces compatible with both OpenStack Swift and Amazon S3 and has embedded user management.


Ceph Object Storage has support for two interfaces.

  1. S3-compatible: Provides object storage functionality with an interface that is compatible with a large subset of the Amazon S3 RESTful API.
  2. Swift-compatible: Provides object storage functionality with an interface that is compatible with a large subset of the OpenStack Swift API.

In this guide, we’ll focus on configuring Amazon S3 CLI to work with Ceph Object Storage cluster. This will be helpful for automated personal backups and pushing your Server data & configurations to Ceph Object store.

Step 1: Install AWS CLI

We need to install the AWS CLI on the server or machine where access to Ceph Object Gateway will be done.

Follow our guide below to install AWS CLI:

Verify installation: $ aws --version


Step 2: Create Object Store User for S3 Access

A user should be created on the Ceph Object Store backend. This will generate S3 API credentials that we’ll configure AWS S3 CLI to use.

Run the commands in one of your Ceph cluster nodes with access to the cluster for administration.


Where:

  • cephuser is the name of the user to be created.
  • ceph S3User is the user display names

This is the sample output from the command.

Take note of the access_key and the secret_key.

Step 3: Using AWS CLI for Accessing Ceph Object Storage

Before you can start using AWS CLI tool to interact with AWS services, you need to configure it by running the aws configure command.
Paste the access key and Secret key you copied in previous step. The credentials are written to file ~/.aws/credentials.


Configuration file is located in ~/.aws/config.


You need to have the IP address of one of your Rados Gateway nodes or equivalent DNS name configured. Get a list of rgw servers using the command:


In my setup, I have three rgw servers. I’ll use one of them – servera.rgw0, whose URL is http://10.9.204.225:8080


The command will create a bucket called test. The creation can be confirmed using the command radosgw-admin.

You can list the buckets created with the command:

Copy a test file to the bucket:


Confirm if the file has been uploaded.



You can confirm the same from the Ceph Dashboard under Object Gateway > Buckets section.




Saturday, July 18, 2020

How To Create And Use TestNG.Xml File and different Test Suite Level TestNG xml files

What Is TestNG.Xml?

TestNG.xml file is a configuration file that helps in organizing our tests. It allows testers to create and handle multiple test classes, define test suites and tests.
It makes a tester's job easier by controlling the execution of tests by putting all the test cases together and run it under one XML file. This is a beautiful concept, without which, it is difficult to work in TestNG.
How to create TestNg.xml file 
Step1: Right-click on the Project folder, go to New and select ‘File’ as shown in the below image.
Step 2: Add the file name as ‘TestNG.xml’ as shown in the below image and click on the Finish button.


Step 3: Now you can add the below XML code in your testng.xml file. You can choose your Test suite name and the Test name as per the requirements.
TestNG XML file @ Method Level 
<suite name="Test cases execution @ Method Level">
<test name="Method Level Test Suites">
<classes>
<class name="com.testng.pages.TestNgSuite">
<methods>
<include name="method1" />
<include name="method2" />
<include name="method3" />
<include name="method4" />
<exclude name="divisiblebyZero" />
</methods>
</class>
<class name="com.testng.tests.RetryLogicTest">
<methods>
<include name="retryTestMethod" />
<exclude name="retryTestMethod1" />
</methods>
</class>
</classes>
</test>
</suite>

TestNG XML file @ Package Level 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="Test cases execution @  Package Level">
<test name="Package Level Test Suites">
<packages>
<!-- <package name = "com.testng.pages"/> -->
<package name="com.testng.tests" />
</packages>
</test>
</suite>
TestNG XML file @ Class Level 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="TestNG Suite">
<test name="Sample Test">
<classes> <!-- Test cases will execute within specified class -->
<class name="com.testng.pages.TestNgSuite" />
</classes>
</test>
</suite>
TestNG XML file @ Groups Level 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Test cases execution @ Groups Level">
<test name="Groups Level Test Suites">
<groups>
<run>
<!-- <include name="smoke" /> -->
<include name="Testing Tools" />
</run>
</groups>
<classes>
<class name="com.testng.pages.TestNgSuite" />
</classes>
</test>
</suite>

Friday, July 17, 2020

How to Download & Install TestNG in Eclipse


TestNG is an open-source tool and is available with most of the IDEs as a plugin. To Install TestNG in eclipse follow below steps:
Step 1: Launch Eclipse.
Step 2: Click Help –> Install New Software.

Step 3: Click “Add” button in the below snapshot.
Step4: In Name field type “TestNG” and in Location field type https://dl.bintray.com/testng-team/testng-eclipse-release/6.14.3/ and Click OK.


Step 5:
  1. Select the "TestNG" checkbox
  2. Click on the "Next" button.
Step 6: It will give you a review of Items to be installed. Click on Next.
Step 7:
  1. Select the radio button "I accept the terms of the license agreement"
  2. Click on Finish.
Step 8: If you encounter a Security warning, just click "Install Anyway".
Step 9: Wait for the installation to finish. When Eclipse prompts you for a restart, click "Restart now."
Step 10: After the restart, verify if TestNG was indeed successfully installed. Click Window > Show View > Other.

Then open the Java directory and see if TestNG is included.


How to install and setup Kubernetes cluster using kOps in AWS environment

  Kops: Kops is also known as Kubernetes Operations, it is an open-source project which helps you to create, upgrade, destroy, and maintain ...