Tuesday, 23 September 2025

Common use of Function key F1 to F12 in Laptop keyboard

 Common use of function key F1 to F12 in Laptop :-






KeyDefault Action in Windows / Apps
F1Opens Help (in most apps)
F2Renames selected file/folder
F3Opens search (File Explorer, browsers)
F4Alt + F4 closes current window
F5Refreshes page or window
F6Moves cursor to address bar (in browsers)
F7Spell check in Word, caret browsing in browsers
F8Safe Mode (during boot, older systems)
F9Refreshes Word document, Outlook send/receive
F10Activates menu bar in apps
F11Full-screen mode in browsers
F12Opens Developer Tools in browsers

Thursday, 11 September 2025

How can you configure the Linux Server to use the 'Asia/Kolkata' timezone

 

Using Red Hat Enterprise Linux 9 (RHEL 9), how can you configure the system to use the 'Asia/Kolkata' timezone?


"In RHEL 9, set the timezone to 'Asia/Kolkata' using timedatectl. First, find the timezone with timedatectl list-timezones | grep Asia/Kolkata. Then, execute sudo timedatectl set-timezone Asia/Kolkata. This updates the system's timezone, taking effect immediately and persisting after reboots. timedatectl replaces older commands, offering a straightforward method for time management in Linux environments."


[root@DockerServer ~]# timedatectl
               Local time: Thu 2025-09-11 06:05:30 EDT
           Universal time: Thu 2025-09-11 10:05:30 UTC
                 RTC time: Thu 2025-09-11 10:05:30
                Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

[root@DockerServer ~]# timedatectl list-timezones | grep -i Asia/Kolkata
Asia/Kolkata

[root@DockerServer ~]# date
Thu Sep 11 06:06:00 EDT 2025

[root@DockerServer ~]# timedatectl set-timezone Asia/Kolkata
[root@DockerServer ~]#
[root@DockerServer ~]#

[root@DockerServer ~]# timedatectl
               Local time: Thu 2025-09-11 15:36:37 IST
           Universal time: Thu 2025-09-11 10:06:37 UTC
                 RTC time: Thu 2025-09-11 10:06:36
                Time zone: Asia/Kolkata (IST, +0530)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

[root@DockerServer ~]# date
Thu Sep 11 15:36:47 IST 2025
[root@DockerServer ~]#




Monday, 8 September 2025

Core Git Commands for DevOps in Production

 

1. Cloning Repositories


rgupta99@LIN-5CG2217BB4 MINGW64 ~/Desktop/Raj
$ git clone https://github.com/rajkumargupta14/hello-world-1.git
Cloning into 'hello-world-1'...
remote: Enumerating objects: 345, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 345 (delta 3), reused 2 (delta 2), pack-reused 339 (from 2)
Receiving objects: 100% (345/345), 48.93 KiB | 1.40 MiB/s, done.
Resolving deltas: 100% (78/78), done.

2.  Do the required changes in code like in below case done changes in index.jsp file

rgupta99@LIN-5CG2217BB4 MINGW64 ~/Desktop/Raj/hello-world-1/webapp/src/main (master)
$ cd webapp/

rgupta99@LIN-5CG2217BB4 MINGW64 ~/Desktop/Raj/hello-world-1/webapp/src/main/webapp (master)
$ ls
WEB-INF/  index.jsp
rgupta99@LIN-5CG2217BB4 MINGW64 ~/Desktop/Raj/hello-world-1/webapp/src/main/webapp (master)
$ vi index.jsp


3.  Check the git status

rgupta99@LIN-5CG2217BB4 MINGW64 ~/Desktop/Raj/hello-world-1/webapp/src/main/webapp (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   index.jsp

no changes added to commit (use "git add" and/or "git commit -a")

4.  Add all changes to local repo

rgupta99@LIN-5CG2217BB4 MINGW64 ~/Desktop/Raj/hello-world-1/webapp/src/main/webapp (master)
$ git add .

rgupta99@LIN-5CG2217BB4 MINGW64 ~/Desktop/Raj/hello-world-1/webapp/src/main/webapp (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   index.jsp



5. Saves changes to the local repository with a message.:-


rgupta99@LIN-5CG2217BB4 MINGW64 ~/Desktop/Raj/hello-world-1/webapp/src/main/webapp (master)
$ git commit -m "Updated the index file"
[master b81dd6a] Updated the index file
 Committer: Gupta <raj.f.gupta@capgemini.com>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 1 insertion(+), 1 deletion(-)

rgupta99@LIN-5CG2217BB4 MINGW64 ~/Desktop/Raj/hello-world-1/webapp/src/main/webapp (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean


6. Commit to remote repo it will open browser to  validate with your GitHub account after verification it will merge the code:-


rgupta99@LIN-5CG2217BB4 MINGW64 ~/Desktop/Raj/hello-world-1/webapp/src/main/webapp (master)
$ git push origin master
info: please complete authentication in your browser...
Enumerating objects: 13, done.
Counting objects: 100% (13/13), done.
Delta compression using up to 12 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (7/7), 548 bytes | 78.00 KiB/s, done.
Total 7 (delta 2), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/rajkumargupta14/hello-world-1.git
   53817e9..b81dd6a  master -> master

rgupta99@LIN-5CG2217BB4 MINGW64 ~/Desktop/Raj/hello-world-1/webapp/src/main/webapp (master)
$






Sunday, 7 September 2025

Integrate Tomcat with Jenkins and Deploy Java app on a Tomcat server


  1. Install 'deploy to container' plugin. This plugin needs to deploy on tomcat server.
  • Install 'deploy to container' plugin without restart
    • Manage Jenkins > Jenkins Plugins > available > deploy to container





  1. Jenkins should need access to the tomcat server to deploy build artifacts. setup credentials to enable this process. use credentials option on Jenkins home page.
  • setup credentials
    • credentials > jenkins > Global credentials > add credentials
      • Username : deployer
      • Password : deployer
      • id : deployer
      • Description: user to deploy on tomcat server




Enter an item name: JavaApp

  • Source Code Management:

    • Repository: https://github.com/rajkumargupta14/hello-world-1
    • Branches to build : */master
  • Poll SCM : - * * * *

  • Build:

    • Root POM:pom.xml
    • Goals and options: clean install package
  • Post-build Actions

    • Deploy war/ear to container
      • WAR/EAR files : **/*.war
      • Containers : Tomcat 8.x
        • Credentials: deployer (user created on above)
        • Tomcat URL : http://<PUBLIC_IP>:8080
















Save and run the job now. Once done access by using Public IP and port number 8080



Saturday, 6 September 2025

Tomcat Server installation on EC2 instance to run Java App


Install Apache Tomcat , You must have EC2 server with JAVA install on that:-


[root@WebServer ~]# cd /opt/

[root@WebServer opt]# yum install wget

[root@WebServer opt]# wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.109/bin/apache-tomcat-9.0.109.tar.gz

[root@WebServer opt]# tar -xvzf apache-tomcat-9.0.109.tar.gz

[root@WebServer opt]# mv apache-tomcat-9.0.109 tomcat

give executing permissions to startup.sh and shutdown.sh which are under bin.

chmod +x /opt/apache-tomcat-<version>/bin/startup.sh 
chmod +x /opt/apache-tomcat-<version>/bin/shutdown.sh

create link files for tomcat startup.sh and shutdown.sh

ln -s /opt/tomcat/bin/startup.sh /usr/local/bin/tomcatup
ln -s /opt/tomcat/bin/shutdown.sh /usr/local/bin/tomcatdown


Add /usr/local/bin to your $PATH (if missing)


Check your current $PATH:

echo $PATH

If /usr/local/bin is missing, add it temporarily:

export PATH=$PATH:/usr/local/bin

To make it permanent for root, add the line to /root/.bashrc or /root/.bash_profile:

echo 'export PATH=$PATH:/usr/local/bin' >> /root/.bashrc
source /root/.bashrc

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

[root@WebServer tomcat]# find / -name context.xml

/opt/tomcat/conf/context.xml

/opt/tomcat/webapps/docs/META-INF/context.xml

/opt/tomcat/webapps/examples/META-INF/context.xml

/opt/tomcat/webapps/host-manager/META-INF/context.xml

/opt/tomcat/webapps/manager/META-INF/context.xml

[root@WebServer tomcat]# vi /opt/tomcat/webapps/host-manager/META-INF/context.xml

[root@WebServer tomcat]# vi /opt/tomcat/webapps/manager/META-INF/context.xml



And comment below line in both files by adding

<!-- and at end -->






Add below line in this file at the end:- 

[root@WebServer tomcat]# vi /opt/tomcat/conf/tomcat-users.xml


 <role rolename="manager-gui"/>
 <role rolename="manager-script"/>
 <role rolename="manager-jmx"/>
 <role rolename="manager-status"/>
 <user username="admin" password="admin" roles="manager-gui, manager-script, manager-jmx, manager-status"/>
 <user username="deployer" password="deployer" roles="manager-script"/>
 <user username="tomcat" password="s3cret" roles="manager-gui"/>



Now access by using public ip and port 8080 after stopping and starting tomcat server by using below command:-

tomcatdown

tomcatup






Using unique ports for each application is a best practice in an environment. But tomcat and Jenkins runs on ports number 8080. Hence lets change tomcat port number to 8090. Change port number in conf/server.xml file under tomcat home


cd /opt/apache-tomcat-<version>/conf
# update port number in the "connecter port" field in server.xml
# restart tomcat after configuration update
tomcatdown
tomcatup