Linux serverNETWORK ADMINISTRATIONS

How to Create And Execute BashScript File with Deploy One Website – DevOps with AWS

How to Create And Execute BashScript File with Deploy One Website – DevOps with AWS

#DevOps #AWS #BashScripting #BashScript #Scripting #Linux #Centos7 #Vagrant #OracleVMVirtualBox #GitBash

mkdir /e/classes/centos7
cd /e/classes/centos7
1. vagrant up
2. vagrant ssh
3. sudo -i
4. mkdir /opt/bashscripts
5. cd /opt/bashscripts/
6. yum install vim -y
# vim is an editor tool
7. vim firstscriptfile.sh (if it exists, it will be open, otherwise create and opening file)
8. press i for insert
9. #!/bin/bash
echo “Hi welcome to DevOps with AWS YouTube Channel.”
echo
echo “I am glad you choose me.”
Esc+:wq ( for saving and quit)
10. ls -l
11. chmod +x firstscriptfile.sh
12. ls -l
13. ./firstscriptfile.sh # for relative path
/opt/bashscripts/firscript.sh # for absolute path
14. chmod -x firstscriptfile.sh
15. ls -l
16. chmod -x firstscriptfile.sh
17. /bin/bash firstscript.sh
18. SKILL=”DevOps” #for variable declaration
19. echo $SKILL #for showing the output of variable
20. AGE=27
21. echo $AGE
22. vim websetupfile.sh
press i for insert
23. #!/bin/bash
echo “Installing Dependencies.”
yum install httpd wget unzip -y
echo “Start And Enable Service.”
systemctl start httpd
systemctl enable httpd
echo “Download And Deploy Artifact”
mkdir -p /tmp/.webfiles
cd /tmp/.webfiles
wget https://www.tooplate.com/zip-templates/2119_gymso_fitness.zip
unzip -o 2119_gymso_fitness.zip # -o for incase overrite is occured it will automatically taking as overrite
cp -r 2119_gymso_fitness/* /var/www/html/
echo “Restart Service.”
systemctl restart httpd
echo “Deployment Completed Successfully.”
echo
echo “Removing temp files”
rm -rf /tmp/.webfiles
24. Esc+:wq
25. chmod +x websetupfile.sh
26. ls -l
27. ./websetupfile.sh
/opt/bashscripting/websetup.sh
28. ifconfig
copy public IPv4 and paste it in your browser and see the output
29. vim websetupfile.sh
#!/bin/bash

### Setting up website from toolplate.com ###

date

# Installing dependecies

echo “#########################”

echo “Installing Dependencies.”

echo “#########################”

echo

yum install httpd wget unzip -y greaterthan symbol /dev/null

# Start & Enable Service

echo “#########################”

echo “Start & Enable Service”

echo “#########################”

echo

systemctl start httpd

systemctl enable httpd

# Deployment

echo “#########################”

echo “Download and Deploy Artifact”

echo “#########################”

echo

mkdir -p /tmp/.webfiles

cd /tmp/.webfiles

wget https://www.tooplate.com/zip-templates/2119_gymso_fitness.zip greaterthangreaterthan /dev/null

unzip -o 2119_gymso_fitness.zip greaterthan /dev/null

cp -r 2119_gymso_fitness/* /var/www/html

echo “#########################”

echo “Restart Service.”

echo “#########################”

echo

systemctl restart httpd

echo “#########################”

echo “Deployment completed successfully.”

echo “#########################”

echo

# Cleaning

echo “#########################”

echo “Removing temp files”

echo “#########################”

rm -rf /tmp/.webfiles

date

30. Esc+:wq
31. ./websetupfile.sh
/opt/bashscripting/websetup.sh
32. ifconfig
copy public IPv4 and paste it in your browser and see the output

Related videos

How to Launch Instance in EC2 AWS Service And How to Attach Template to That Instance
===============================
|| https://youtu.be/GeAYb9S_cLU ||
===============================

source

centos 7

Leave a Reply

Your email address will not be published. Required fields are marked *