π― Level: Beginner-friendly
π Project Repo: https://github.com/SAFI-ULLAHSAFEER/Shell-Script
π οΈ Why Shell Script Automation?
Automating application deployments saves time and reduces human errors. In this blog, Iβll walk you through deploying a Spring Boot WAR app inside a Vagrant-managed Ubuntu machine using a Shell Script. All actions are visualized step-by-step with real screenshots. Perfect for beginners in DevOps, scripting, or system setup!
π¦ Prerequisites
Installed: Git, Vagrant, VirtualBox
Basic knowledge of Linux terminal
A Spring Boot WAR file (included in the GitHub repo)
π Step 1: Clone the Project
Open the VS code
Type the following command git clone https://github.com/SAFI-ULLAHSAFEER/Shell-Script
π Step 4: Navigate to Your Spring Boot App Directory
Start the Vagrant Box
π οΈ This command will automatically create and configure a virtual Linux machine for you, .This command logs you into the virtual Ubuntu machine where everything will run.
As you can see the black console screen only we called it as a multi-user.target in linux.
Now Next Step is SSH Into the Machine
After that Navigate to Your Spring Boot App Directory
By default, Vagrant shares your local directory under /vagrant.
After that next step is Create setup.sh Script
Now the next step is to Make the Script Executable and Run
chmod +x setup.sh
sudo ./setup.sh
This will:
Update packages
Install Java and Tomcat
Deploy your WAR file
Restart Tomcat
Now the NeXT Step is Check the IP Address by running command:
ip a
The following ip address of machine will appear
Now the next Step is Access Your App in the Browser
then press enter and the following screen will appear
π Congratulations! If everything workedβyouβll see your Spring Boot app live!
Exit and Destroy the Vagrant Machine (Cleanup)
After verifying the app in the browser, clean up your VM:
exit
vagrant destroy
This command:
Logs out of the VM
Prompts you to confirm destroying the environment
Frees up system resources
Final Thoughts β€οΈ
This hands-on guide is your stepping stone into automation with shell scripting. Share this with your peers and drop your questions below. Happy scripting!
Top comments (1)
Very well defined each step definitely trying on weekend ππ