Thursday, 15 April 2021

Installing Nexus for respository

 How To Install Latest Sonatype Nexus 3 on Linux (Redhat/Centos/ec2) (devopscube.com)


Download the software here: Download (sonatype.com)

Force kill a VM in EXSi

2 commands refer: Unable to Power off a Virtual Machine in an ESXi host (1014165) (vmware.com)


Using the ESXi esxcli command to power off a virtual machine

The esxcli command can be used locally or remotely to power off a virtual machine running on ESXi 5.x or later.

  1. Get a list of running virtual machines, identified by World ID, UUID, Display Name, and path to the .vmx configuration file by running this command:

    esxcli vm process list
     
  2. Power off the virtual machine from the list by running this command:

    esxcli vm process kill --type= [soft,hard,force] --world-id= WorldNumber

    Notes:
    • Three power-off methods are available. Soft is the most graceful, hard performs an immediate shutdown, and force should be used as a last resort.
  3. Repeat Step 2 and validate that the virtual machine is no longer running.

 


[root@ESXi01:~] esxcli vm process list

pfSense

   World ID: 1051128

   Process ID: 0

   VMX Cartel ID: 1051127

   UUID: 56 4d df ac 10 5b db 2f-ac b1 35 b6 0e 8f 27 94

   Display Name: pfSense

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/pfSense/pfSens                                                                                                                                                             e.vmx


okd4-control-plane-1

   World ID: 1051325

   Process ID: 0

   VMX Cartel ID: 1051319

   UUID: 56 4d d7 00 05 94 43 e6-20 49 b7 0d cd 1f d4 91

   Display Name: okd4-control-plane-1

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-control-p                                                                                                                                                             lane-1/okd4-control-plane-1.vmx


okd4-control-plane-2

   World ID: 1051326

   Process ID: 0

   VMX Cartel ID: 1051320

   UUID: 56 4d 47 7f ff 36 07 68-9b 88 17 5a f7 53 d5 80

   Display Name: okd4-control-plane-2

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-control-p                                                                                                                                                             lane-2/okd4-control-plane-2.vmx


okd4-services

   World ID: 1051330

   Process ID: 0

   VMX Cartel ID: 1051317

   UUID: 56 4d 98 40 1a ac 88 ff-f0 4d e8 84 29 31 04 1c

   Display Name: okd4-services

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-services/                                                                                                                                                             okd4-services.vmx


okd4-control-plane-3

   World ID: 1051331

   Process ID: 0

   VMX Cartel ID: 1051318

   UUID: 56 4d 48 7c 89 01 58 9a-12 44 bf 54 a0 4a 61 2d

   Display Name: okd4-control-plane-3

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-control-p                                                                                                                                                             lane-3/okd4-control-plane-3.vmx


okd4-compute-1

   World ID: 1051332

   Process ID: 0

   VMX Cartel ID: 1051321

   UUID: 56 4d 61 ba 77 36 bb 6f-ec 88 25 ee 69 be 0c 22

   Display Name: okd4-compute-1

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-compute-1                                                                                                                                                             /okd4-compute-1.vmx


database

   World ID: 1051551

   Process ID: 0

   VMX Cartel ID: 1051550

   UUID: 56 4d 57 81 ce 26 3c d9-26 18 b8 1f 79 f7 d1 a3

   Display Name: database

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/database/datab                                                                                                                                                             ase.vmx


okd4-compute-2

   World ID: 1155186

   Process ID: 0

   VMX Cartel ID: 1155185

   UUID: 56 4d 1a 5c ce ef ea d0-8d eb 37 8a bb d6 1b 9f

   Display Name: okd4-compute-2

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-compute-2                                                                                                                                                             /okd4-compute-2.vmx

[root@ESXi01:~] esxcli vm process list

pfSense

   World ID: 1051128

   Process ID: 0

   VMX Cartel ID: 1051127

   UUID: 56 4d df ac 10 5b db 2f-ac b1 35 b6 0e 8f 27 94

   Display Name: pfSense

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/pfSense/pfSense.vmx


okd4-control-plane-1

   World ID: 1051325

   Process ID: 0

   VMX Cartel ID: 1051319

   UUID: 56 4d d7 00 05 94 43 e6-20 49 b7 0d cd 1f d4 91

   Display Name: okd4-control-plane-1

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-control-plane-1/okd4-control-plane-1.vmx


okd4-control-plane-2

   World ID: 1051326

   Process ID: 0

   VMX Cartel ID: 1051320

   UUID: 56 4d 47 7f ff 36 07 68-9b 88 17 5a f7 53 d5 80

   Display Name: okd4-control-plane-2

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-control-plane-2/okd4-control-plane-2.vmx


okd4-services

   World ID: 1051330

   Process ID: 0

   VMX Cartel ID: 1051317

   UUID: 56 4d 98 40 1a ac 88 ff-f0 4d e8 84 29 31 04 1c

   Display Name: okd4-services

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-services/okd4-services.vmx


okd4-control-plane-3

   World ID: 1051331

   Process ID: 0

   VMX Cartel ID: 1051318

   UUID: 56 4d 48 7c 89 01 58 9a-12 44 bf 54 a0 4a 61 2d

   Display Name: okd4-control-plane-3

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-control-plane-3/okd4-control-plane-3.vmx


okd4-compute-1

   World ID: 1051332

   Process ID: 0

   VMX Cartel ID: 1051321

   UUID: 56 4d 61 ba 77 36 bb 6f-ec 88 25 ee 69 be 0c 22

   Display Name: okd4-compute-1

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-compute-1/okd4-compute-1.vmx


database

   World ID: 1051551

   Process ID: 0

   VMX Cartel ID: 1051550

   UUID: 56 4d 57 81 ce 26 3c d9-26 18 b8 1f 79 f7 d1 a3

   Display Name: database

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/database/database.vmx


okd4-compute-2

   World ID: 1155186

   Process ID: 0

   VMX Cartel ID: 1155185

   UUID: 56 4d 1a 5c ce ef ea d0-8d eb 37 8a bb d6 1b 9f

   Display Name: okd4-compute-2

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-compute-2/okd4-compute-2.vmx

[root@ESXi01:~] esxcli vm process kill --type=force --world-id=1051551

[root@ESXi01:~] esxcli vm process list

pfSense

   World ID: 1051128

   Process ID: 0

   VMX Cartel ID: 1051127

   UUID: 56 4d df ac 10 5b db 2f-ac b1 35 b6 0e 8f 27 94

   Display Name: pfSense

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/pfSense/pfSense.vmx


okd4-control-plane-1

   World ID: 1051325

   Process ID: 0

   VMX Cartel ID: 1051319

   UUID: 56 4d d7 00 05 94 43 e6-20 49 b7 0d cd 1f d4 91

   Display Name: okd4-control-plane-1

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-control-plane-1/okd4-control-plane-1.vmx


okd4-control-plane-2

   World ID: 1051326

   Process ID: 0

   VMX Cartel ID: 1051320

   UUID: 56 4d 47 7f ff 36 07 68-9b 88 17 5a f7 53 d5 80

   Display Name: okd4-control-plane-2

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-control-plane-2/okd4-control-plane-2.vmx


okd4-services

   World ID: 1051330

   Process ID: 0

   VMX Cartel ID: 1051317

   UUID: 56 4d 98 40 1a ac 88 ff-f0 4d e8 84 29 31 04 1c

   Display Name: okd4-services

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-services/okd4-services.vmx


okd4-control-plane-3

   World ID: 1051331

   Process ID: 0

   VMX Cartel ID: 1051318

   UUID: 56 4d 48 7c 89 01 58 9a-12 44 bf 54 a0 4a 61 2d

   Display Name: okd4-control-plane-3

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-control-plane-3/okd4-control-plane-3.vmx


okd4-compute-1

   World ID: 1051332

   Process ID: 0

   VMX Cartel ID: 1051321

   UUID: 56 4d 61 ba 77 36 bb 6f-ec 88 25 ee 69 be 0c 22

   Display Name: okd4-compute-1

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-compute-1/okd4-compute-1.vmx


okd4-compute-2

   World ID: 1155186

   Process ID: 0

   VMX Cartel ID: 1155185

   UUID: 56 4d 1a 5c ce ef ea d0-8d eb 37 8a bb d6 1b 9f

   Display Name: okd4-compute-2

   Config File: /vmfs/volumes/5f1c7304-77d00f04-ad0f-1c697a6ba3e5/okd4-compute-2/okd4-compute-2.vmx


Configure Jenkins Agent

 Firstly, there are alot of confusing articles out there.

Here is what worked for me:

Configure ssh between the server: http://www.linuxproblem.org/art_9.html

First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:

a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa): 
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A

Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine):

a@A:~> ssh b@B mkdir -p .ssh
b@B's password: 

Finally append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last time:

a@A:~> cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
b@B's password: 

From now on you can log into B as b from A as a without password:

a@A:~> ssh b@B

A note from one of our readers: Depending on your version of SSH you might also have to do the following changes:

  • Put the public key in .ssh/authorized_keys2
  • Change the permissions of .ssh to 700
  • Change the permissions of .ssh/authorized_keys2 to 640


You need add entries to known_hosts as well.

After that, configure the agent, paste the private key from server A in the credentials in Step 5 from this: https://acloudguru.com/blog/engineering/adding-a-jenkins-agent-node

That's all!

Tuesday, 13 April 2021

Public key for jenkins-2.287-1.1.noarch.rpm is not installed

 

Reference: https://www.jenkins.io/blog/2020/07/27/repository-signing-keys-changing/


[root@database ~]# dnf install jenkins java-devel

Last metadata expiration check: 0:23:34 ago on Wed 14 Apr 2021 01:23:29 AM +08.

Dependencies resolved.

======================================================================================================================================================================================================================

 Package                                                     Architecture                              Version                                                     Repository                                    Size

======================================================================================================================================================================================================================

Installing:

 java-1.8.0-openjdk-devel                                    x86_64                                    1:1.8.0.282.b08-2.el8_3                                     appstream                                    9.8 M

 jenkins                                                     noarch                                    2.287-1.1                                                   jenkins                                       71 M

Installing dependencies:

 java-1.8.0-openjdk                                          x86_64                                    1:1.8.0.282.b08-2.el8_3                                     appstream                                    333 k

 ttmkfdir                                                    x86_64                                    3.0.9-54.el8                                                appstream                                     62 k

 xorg-x11-fonts-Type1                                        noarch                                    7.5-19.el8                                                  appstream                                    522 k


Transaction Summary

======================================================================================================================================================================================================================

Install  5 Packages


Total download size: 81 M

Installed size: 113 M

Is this ok [y/N]: y

Downloading Packages:

(1/5): ttmkfdir-3.0.9-54.el8.x86_64.rpm                                                                                                                                               1.7 MB/s |  62 kB     00:00

(2/5): java-1.8.0-openjdk-1.8.0.282.b08-2.el8_3.x86_64.rpm                                                                                                                            2.1 MB/s | 333 kB     00:00

(3/5): xorg-x11-fonts-Type1-7.5-19.el8.noarch.rpm                                                                                                                                     3.7 MB/s | 522 kB     00:00

(4/5): java-1.8.0-openjdk-devel-1.8.0.282.b08-2.el8_3.x86_64.rpm                                                                                                                      9.6 MB/s | 9.8 MB     00:01

(5/5): jenkins-2.287-1.1.noarch.rpm                                                                                                                                                   2.3 MB/s |  71 MB     00:30

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                                                                 2.6 MB/s |  81 MB     00:31

warning: /var/cache/dnf/jenkins-93d3f0abc3d47743/packages/jenkins-2.287-1.1.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 45f2c3d5: NOKEY

Public key for jenkins-2.287-1.1.noarch.rpm is not installed

The downloaded packages were saved in cache until the next successful transaction.

You can remove cached packages by executing 'dnf clean packages'.

Error: GPG check FAILED

[root@database ~]# systemctl start jenkins

Failed to start jenkins.service: Unit jenkins.service not found.

[root@database ~]# rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

[root@database ~]# systemctl start jenkins

Failed to start jenkins.service: Unit jenkins.service not found.

[root@database ~]# dnf install jenkins java-devel

Last metadata expiration check: 1:38:12 ago on Wed 14 Apr 2021 01:23:29 AM +08.

Dependencies resolved.

======================================================================================================================================================================================================================

 Package                                                     Architecture                              Version                                                     Repository                                    Size

======================================================================================================================================================================================================================

Installing:

 java-1.8.0-openjdk-devel                                    x86_64                                    1:1.8.0.282.b08-2.el8_3                                     appstream                                    9.8 M

 jenkins                                                     noarch                                    2.287-1.1                                                   jenkins                                       71 M

Installing dependencies:

 java-1.8.0-openjdk                                          x86_64                                    1:1.8.0.282.b08-2.el8_3                                     appstream                                    333 k

 ttmkfdir                                                    x86_64                                    3.0.9-54.el8                                                appstream                                     62 k

 xorg-x11-fonts-Type1                                        noarch                                    7.5-19.el8                                                  appstream                                    522 k


Transaction Summary

======================================================================================================================================================================================================================

Install  5 Packages


Total size: 81 M

Installed size: 113 M

Is this ok [y/N]: y

Downloading Packages:

[SKIPPED] java-1.8.0-openjdk-1.8.0.282.b08-2.el8_3.x86_64.rpm: Already downloaded

[SKIPPED] java-1.8.0-openjdk-devel-1.8.0.282.b08-2.el8_3.x86_64.rpm: Already downloaded

[SKIPPED] ttmkfdir-3.0.9-54.el8.x86_64.rpm: Already downloaded

[SKIPPED] xorg-x11-fonts-Type1-7.5-19.el8.noarch.rpm: Already downloaded

[SKIPPED] jenkins-2.287-1.1.noarch.rpm: Already downloaded

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                                                                                                              1/1

  Installing       : ttmkfdir-3.0.9-54.el8.x86_64                                                                                                                                                                 1/5

  Installing       : xorg-x11-fonts-Type1-7.5-19.el8.noarch                                                                                                                                                       2/5

  Running scriptlet: xorg-x11-fonts-Type1-7.5-19.el8.noarch                                                                                                                                                       2/5

  Installing       : java-1.8.0-openjdk-1:1.8.0.282.b08-2.el8_3.x86_64                                                                                                                                            3/5

  Running scriptlet: java-1.8.0-openjdk-1:1.8.0.282.b08-2.el8_3.x86_64                                                                                                                                            3/5

  Installing       : java-1.8.0-openjdk-devel-1:1.8.0.282.b08-2.el8_3.x86_64                                                                                                                                      4/5

  Running scriptlet: java-1.8.0-openjdk-devel-1:1.8.0.282.b08-2.el8_3.x86_64                                                                                                                                      4/5

  Running scriptlet: jenkins-2.287-1.1.noarch                                                                                                                                                                     5/5

  Installing       : jenkins-2.287-1.1.noarch                                                                                                                                                                     5/5

  Running scriptlet: jenkins-2.287-1.1.noarch                                                                                                                                                                     5/5

  Running scriptlet: java-1.8.0-openjdk-1:1.8.0.282.b08-2.el8_3.x86_64                                                                                                                                            5/5

  Running scriptlet: java-1.8.0-openjdk-devel-1:1.8.0.282.b08-2.el8_3.x86_64                                                                                                                                      5/5

  Running scriptlet: jenkins-2.287-1.1.noarch                                                                                                                                                                     5/5

  Verifying        : java-1.8.0-openjdk-1:1.8.0.282.b08-2.el8_3.x86_64                                                                                                                                            1/5

  Verifying        : java-1.8.0-openjdk-devel-1:1.8.0.282.b08-2.el8_3.x86_64                                                                                                                                      2/5

  Verifying        : ttmkfdir-3.0.9-54.el8.x86_64                                                                                                                                                                 3/5

  Verifying        : xorg-x11-fonts-Type1-7.5-19.el8.noarch                                                                                                                                                       4/5

  Verifying        : jenkins-2.287-1.1.noarch                                                                                                                                                                     5/5

Installed products updated.


Installed:

  java-1.8.0-openjdk-1:1.8.0.282.b08-2.el8_3.x86_64   java-1.8.0-openjdk-devel-1:1.8.0.282.b08-2.el8_3.x86_64   jenkins-2.287-1.1.noarch   ttmkfdir-3.0.9-54.el8.x86_64   xorg-x11-fonts-Type1-7.5-19.el8.noarch


Complete!

[root@database ~]# systemctl start jenkins





[root@database ~]# systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
   Loaded: loaded (/etc/rc.d/init.d/jenkins; generated)
   Active: active (running) since Wed 2021-04-14 03:01:55 +08; 22min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3803953 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)
    Tasks: 38 (limit: 49477)
   Memory: 986.4M
   CGroup: /system.slice/jenkins.service
           └─3803979 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --web>

Apr 14 03:01:54 database.localdomain systemd[1]: Starting LSB: Jenkins Automation Server...
Apr 14 03:01:54 database.localdomain runuser[3803960]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
Apr 14 03:01:55 database.localdomain runuser[3803960]: pam_unix(runuser:session): session closed for user jenkins
Apr 14 03:01:55 database.localdomain jenkins[3803953]: Starting Jenkins [  OK  ]
Apr 14 03:01:55 database.localdomain systemd[1]: Started LSB: Jenkins Automation Server.

Friday, 9 April 2021

CICD: Jenkins

 Getting started with the Guided Tour (jenkins.io)

Installing Jenkins



sudo wget -O /etc/yum.repos.d/jenkins.repo \
    http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo dnf upgrade
sudo dnf install jenkins java-devel


Start Jenkins

You can start the Jenkins service with the command:

sudo systemctl start jenkins

You can check the status of the Jenkins service using the command:

sudo systemctl status jenkins

If everything has been set up correctly, you should see an output like this:

Loaded: loaded (/etc/rc.d/init.d/jenkins; generated)
Active: active (running) since Tue 2018-11-13 16:19:01 +03; 4min 57s ago

If you have a firewall installed, you must add Jenkins as an exception. You must change YOURPORT in the script below to the port you want to use. Port 8080 is the most common.

YOURPORT=8080
PERM="--permanent"
SERV="$PERM --service=jenkins"

firewall-cmd $PERM --new-service=jenkins
firewall-cmd $SERV --set-short="Jenkins ports"
firewall-cmd $SERV --set-description="Jenkins port exceptions"
firewall-cmd $SERV --add-port=$YOURPORT/tcp
firewall-cmd $PERM --add-service=jenkins
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload


CICD: Nexus?

 Planning to learn Jenkins, Nexus and Bitbucket :-)

https://blog.sonatype.com/how-to-use-nexus-repository-and-helm-for-ci/cd

https://medium.com/@abhisheknanarkar/configure-nexus-repository-with-ci-cd-ab5b8ee61f6b


https://medium.com/@abhisheknanarkar/nexus-repository-manager-53fc29bfa592

Saturday, 3 April 2021

Stuck in Dell R710 System Services

 Enter into idract (ctrl-e) and then choose cancel system services