├── TRIVY.txt ├── ansible ├── arango.sh ├── context.xml ├── docker-compose.sh ├── grafana.sh ├── helm.sh ├── jenkins.sh ├── jfrog.sh ├── kops.sh ├── kubecolor ├── loki & promtail ├── metric-server.sh ├── mini-al.sh ├── mysql.sh ├── nagioscore.sh ├── nagiosplugin.sh ├── netflix.sh ├── netflix.yml ├── nexus.sh ├── nginx-ip-block ├── nodeexporter.sh ├── pegion-ubuntu.sh ├── pegion.sh ├── portainer.sh ├── prometheus.sh ├── sonar.sh ├── swiggy.sh ├── terraform.sh ├── terraformer ├── terrform-ubuntu ├── tomcat-users.xml ├── tomcat.sh ├── tomcat.yml ├── trivy ├── ubuntu-docker.sh ├── ubuntu-kops.sh └── ubuntu-minikube.sh /TRIVY.txt: -------------------------------------------------------------------------------- 1 | TRIVY INSTALLATION: 2 | 3 | wget https://github.com/aquasecurity/trivy/releases/download/v0.18.3/trivy_0.18.3_Linux-64bit.tar.gz 4 | tar zxvf trivy_0.18.3_Linux-64bit.tar.gz 5 | sudo mv trivy /usr/local/bin/ 6 | vim .bashrc 7 | export PATH=$PATH:/usr/local/bin/ 8 | source .bashrc 9 | -------------------------------------------------------------------------------- /ansible: -------------------------------------------------------------------------------- 1 | SETUP: 2 | Create 5 servers (1=ansible 2=dev 2=test) 3 | Connect all servers to mobaxterm 4 | 5 | ALL SERVERS: 6 | sudo -i 7 | 1. hostnamectl set-hostname ansible/dev-1/dev-2/test-1/test-2 8 | sudo -i 9 | 10 | 2. passwd root 11 | 3. vim /etc/ssh/sshd_config (uncomment: 38 , no=yes: 63) 12 | 4. systemctl restart sshd 13 | 5. systemctl status sshd 14 | 15 | ANSIBLE SERVER: 16 | amazon-linux-extras install ansible2 -y 17 | yum install python python-pip python-dlevel -y 18 | vim /etc/ansible/hosts (inventory file) (below: 12 th line) 19 | 20 | [dev] 21 | 172.31.81.244 22 | 172.31.93.180 23 | 24 | [test] 25 | 172.31.91.255 26 | 172.31.93.101 27 | 28 | vim /etc/ansible/ansible.cfg (uncomment 14, 22) 29 | 30 | ssh-keygen -- > enter 4 times 31 | ssh-copy-id root@private_ip of dev-1 -- > yes -- > password 32 | ssh private_ip of dev-1 33 | ctrl + d 34 | 35 | ssh-copy-id root@private_ip of dev-2 -- > yes -- > password 36 | ssh private_ip of dev-2 37 | ctrl + d 38 | 39 | ssh-copy-id root@private_ip of test-1 -- > yes -- > password 40 | ssh private_ip of test-1 41 | ctrl + d 42 | 43 | ssh-copy-id root@private_ip of test-2 -- > yes -- > password 44 | ssh private_ip of test-2 45 | ctrl + d 46 | -------------------------------------------------------------------------------- /arango.sh: -------------------------------------------------------------------------------- 1 | echo 'deb https://download.arangodb.com/arangodb34/DEBIAN/ /' | sudo tee /etc/apt/sources.list.d/arangodb.list 2 | wget -q https://download.arangodb.com/arangodb34/DEBIAN/Release.key -O- | sudo apt-key add - 3 | sudo apt update -y 4 | sudo apt -y install apt-transport-https 5 | sudo apt -y install arangodb3 6 | sudo systemctl start arangodb3 7 | sudo systemctl status arangodb3 8 | sudo arangosh 9 | -------------------------------------------------------------------------------- /context.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /docker-compose.sh: -------------------------------------------------------------------------------- 1 | sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose 2 | ls /usr/local/bin/ 3 | sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose 4 | sudo chmod +x /usr/local/bin/docker-compose 5 | docker-compose version 6 | -------------------------------------------------------------------------------- /grafana.sh: -------------------------------------------------------------------------------- 1 | sudo apt-get install -y adduser libfontconfig1 2 | wget https://dl.grafana.com/enterprise/release/grafana-enterprise_9.4.7_amd64.deb 3 | sudo dpkg -i grafana-enterprise_9.4.7_amd64.deb 4 | sudo /bin/systemctl daemon-reload 5 | sudo /bin/systemctl enable grafana-server 6 | sudo /bin/systemctl start grafana-server 7 | sudo /bin/systemctl status grafana-server --no-pager 8 | -------------------------------------------------------------------------------- /helm.sh: -------------------------------------------------------------------------------- 1 | curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 2 | chmod 700 get_helm.sh 3 | ./get_helm.sh 4 | helm version 5 | -------------------------------------------------------------------------------- /jenkins.sh: -------------------------------------------------------------------------------- 1 | #STEP-1: INSTALLING GIT 2 | yum install git -y 3 | 4 | #STEP-2: GETTING THE REPO (jenkins.io --> download -- > redhat) 5 | sudo wget -O /etc/yum.repos.d/jenkins.repo \ 6 | https://pkg.jenkins.io/redhat-stable/jenkins.repo 7 | sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key 8 | 9 | #STEP-3: DOWNLOAD JAVA11 AND JENKINS 10 | yum install java-17-amazon-corretto -y 11 | yum install jenkins -y 12 | 13 | #STEP-4: RESTARTING JENKINS (when we download service it will on stopped state) 14 | systemctl start jenkins.service 15 | systemctl enable jenkins.service 16 | systemctl status jenkins.service 17 | -------------------------------------------------------------------------------- /jfrog.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | wget https://releases.jfrog.io/artifactory/artifactory-rpms/artifactory-rpms.repo -O jfrog-artifactory-rpms.repo 3 | mv jfrog-artifactory-rpms.repo /etc/yum.repos.d/ 4 | yum update -y 5 | yum install jfrog-artifactory-oss -y 6 | systemctl start artifactory.service 7 | systemctl status artifactory.service 8 | -------------------------------------------------------------------------------- /kops.sh: -------------------------------------------------------------------------------- 1 | #vim .bashrc 2 | #export PATH=$PATH:/usr/local/bin/ 3 | #source .bashrc 4 | 5 | 6 | #! /bin/bash 7 | aws configure 8 | curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" 9 | wget https://github.com/kubernetes/kops/releases/download/v1.25.0/kops-linux-amd64 10 | chmod +x kops-linux-amd64 kubectl 11 | mv kubectl /usr/local/bin/kubectl 12 | mv kops-linux-amd64 /usr/local/bin/kops 13 | 14 | aws s3api create-bucket --bucket cloudanddevopsbyraham0073456.k8s.local --region us-east-1 15 | aws s3api put-bucket-versioning --bucket cloudanddevopsbyraham0073456.k8s.local --region us-east-1 --versioning-configuration Status=Enabled 16 | export KOPS_STATE_STORE=s3://cloudanddevopsbyraham0073456.k8s.local 17 | kops create cluster --name rahams.k8s.local --zones us-east-1a --master-count=1 --master-size t2.medium --node-count=2 --node-size t2.medium 18 | kops update cluster --name rahams.k8s.local --yes --admin 19 | -------------------------------------------------------------------------------- /kubecolor: -------------------------------------------------------------------------------- 1 | wget https://github.com/hidetatz/kubecolor/releases/download/v0.0.25/kubecolor_0.0.25_Linux_x86_64.tar.gz 2 | tar -zxvf kubecolor_0.0.25_Linux_x86_64.tar.gz 3 | ./kubecolor 4 | chmod +x kubecolor 5 | mv kubecolor /usr/local/bin/ 6 | kubecolor get po 7 | -------------------------------------------------------------------------------- /loki & promtail: -------------------------------------------------------------------------------- 1 | wget https://raw.githubusercontent.com/grafana/loki/v2.8.0/cmd/loki/loki-local-config.yaml -O loki-config.yaml 2 | docker run -itd --name loki -v /root/:/mnt/config -p 3100:3100 grafana/loki:2.8.0 3 | pblicip:3100/ready 4 | 5 | wget https://raw.githubusercontent.com/grafana/loki/v2.8.0/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml 6 | docker run -itd --name promtail -v $(pwd):/mnt/config -v /var/log:/var/log --link loki grafana/promtail:2.8.0 --config.file=/mnt/config/promtail-config.yaml 7 | 8 | datasource -- > add -- > loki -- > http://52.90.35.175:3100 -- > save and test 9 | explore view 10 | -------------------------------------------------------------------------------- /metric-server.sh: -------------------------------------------------------------------------------- 1 | FOR MINIKUBE: 2 | kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml 3 | minikube addons enable metrics-server #(only for minikube) 4 | 5 | kubectl top nodes 6 | kubectl top pods 7 | 8 | FOR KOPS: 9 | kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability-1.21+.yaml 10 | -------------------------------------------------------------------------------- /mini-al.sh: -------------------------------------------------------------------------------- 1 | #vim .bashrc 2 | #export PATH=$PATH:/usr/local/bin 3 | #source .bashrc 4 | 5 | yum install docker -y 6 | systemctl start docker 7 | systemctl status docker 8 | curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" 9 | sudo mv kubectl /usr/local/bin/kubectl 10 | sudo chmod +x /usr/local/bin/kubectl 11 | curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 12 | sudo install minikube-linux-amd64 /usr/local/bin/minikube 13 | sudo yum install iptables -y 14 | yum install conntrack -y 15 | minikube start --driver=docker --force 16 | minikube status 17 | -------------------------------------------------------------------------------- /mysql.sh: -------------------------------------------------------------------------------- 1 | wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb 2 | sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb 3 | percona-release setup ps80 4 | sudo apt install percona-server-server -y 5 | mysql -u root -p 6 | -------------------------------------------------------------------------------- /nagioscore.sh: -------------------------------------------------------------------------------- 1 | #INSTALLING PREREQUISTES 2 | apt install wget unzip vim curl gcc openssl build-essential libgd-dev libssl-dev libapache2-mod-php php-gd php apache2 -y 3 | 4 | #INSTALL NAGIOS CORE: 5 | export VER="4.4.6" 6 | curl -SL https://github.com/NagiosEnterprises/nagioscore/releases/download/nagios-$VER/nagios-$VER.tar.gz | tar -xzf - 7 | cd /root/nagios-4.4.6/ 8 | 9 | #TO COMPILE: 10 | 11 | ./configure 12 | 13 | make all 14 | make install-groups-users 15 | usermod -a -G nagios nagios 16 | make install 17 | make install-init 18 | make install-config 19 | make install-commandmode 20 | make install-webconf 21 | 22 | a2enmod rewrite cgi 23 | systemctl restart apache2 24 | 25 | make install-exfoliation 26 | make install-classicui 27 | -------------------------------------------------------------------------------- /nagiosplugin.sh: -------------------------------------------------------------------------------- 1 | VER="2.3.3" 2 | #TO GET NAGIOS PLUGINS: 3 | curl -SL https://github.com/nagios-plugins/nagios-plugins/releases/download/release-$VER/nagios-plugins-$VER.tar.gz | tar -xzf - 4 | cd nagios-plugins-2.3.3/ 5 | ./configure 6 | make install 7 | #Create a nagiosadmin account for logging into the Nagios web interface. Note the password you need it while login to Nagios web console. 8 | sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin 9 | sudo service apache2 restart 10 | sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 11 | systemctl enable --now nagios 12 | systemctl status nagios 13 | ~ 14 | -------------------------------------------------------------------------------- /netflix.sh: -------------------------------------------------------------------------------- 1 | yum install httpd git -y 2 | systemctl start httpd 3 | systemctl status httpd 4 | chkconfig httpd on 5 | cd /var/www/html 6 | git clone https://github.com/CleverProgrammers/pwj-netflix-clone.git 7 | mv pwj-netflix-clone/* . 8 | tail -100f /var/log/httpd/access_log 9 | -------------------------------------------------------------------------------- /netflix.yml: -------------------------------------------------------------------------------- 1 | - hosts: test 2 | tasks: 3 | - name: installing apache server 4 | yum: name=httpd state=present 5 | 6 | - name: activating apache server 7 | service: name=httpd state=started 8 | 9 | - name: installing git 10 | yum: name=git state=present 11 | 12 | - name: git checkout 13 | git: 14 | repo: "https://github.com/CleverProgrammers/pwj-netflix-clone.git" 15 | dest: "/var/www/html" 16 | -------------------------------------------------------------------------------- /nexus.sh: -------------------------------------------------------------------------------- 1 | sudo yum update -y 2 | sudo yum install wget -y 3 | sudo yum install java-17-amazon-corretto-jmods -y 4 | sudo mkdir /app && cd /app 5 | sudo wget https://download.sonatype.com/nexus/3/nexus-3.79.1-04-linux-x86_64.tar.gz 6 | sudo tar -xvf nexus-3.79.1-04-linux-x86_64.tar.gz 7 | sudo mv nexus-3.79.1-04 nexus 8 | sudo adduser nexus 9 | sudo chown -R nexus:nexus /app/nexus 10 | sudo chown -R nexus:nexus /app/sonatype* 11 | sudo sed -i '27 run_as_user="nexus"' /app/nexus/bin/nexus 12 | sudo tee /etc/systemd/system/nexus.service > /dev/null << EOL 13 | [Unit] 14 | Description=nexus service 15 | After=network.target 16 | 17 | [Service] 18 | Type=forking 19 | LimitNOFILE=65536 20 | User=nexus 21 | Group=nexus 22 | ExecStart=/app/nexus/bin/nexus start 23 | ExecStop=/app/nexus/bin/nexus stop 24 | User=nexus 25 | Restart=on-abort 26 | 27 | [Install] 28 | WantedBy=multi-user.target 29 | EOL 30 | sudo chkconfig nexus on 31 | sudo systemctl start nexus 32 | sudo systemctl enable nexus 33 | sudo systemctl status nexus 34 | -------------------------------------------------------------------------------- /nginx-ip-block: -------------------------------------------------------------------------------- 1 | #app deployment script 2 | 3 | apt update -y 4 | apt install nginx git -y 5 | systemctl start nginx 6 | git clone https://github.com/devops0014/static-cycle-website-jenkins-docker-.git 7 | cd static-cycle-website-jenkins-docker-.git 8 | cp -r * /var/www/html/ 9 | 10 | #Get the ip: 11 | tail -f /var/log/nginx/access.log | awk '{print $1}' 12 | 13 | 14 | 15 | #blockip script 16 | echo "Enter IP to block:" 17 | read abc 18 | 19 | # Basic IP validation 20 | sed -i "14i deny $abc/32;" /etc/nginx/nginx.conf 21 | systemctl restart nginx 22 | echo "IP $abc blocked." 23 | -------------------------------------------------------------------------------- /nodeexporter.sh: -------------------------------------------------------------------------------- 1 | wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz 2 | tar -xf node_exporter-1.5.0.linux-amd64.tar.gz 3 | sudo mv node_exporter-1.5.0.linux-amd64/node_exporter /usr/local/bin 4 | rm -rv node_exporter-1.5.0.linux-amd64* 5 | sudo useradd -rs /bin/false node_exporter 6 | 7 | sudo cat < 2 | 18 | 22 | 38 | 42 | 49 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /tomcat.sh: -------------------------------------------------------------------------------- 1 | yum install java-17-amazon-corretto -y 2 | wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.104/bin/apache-tomcat-9.0.104.tar.gz 3 | tar -zxvf apache-tomcat-9.0.104.tar.gz 4 | sed -i '56 a\' apache-tomcat-9.0.104/conf/tomcat-users.xml 5 | sed -i '57 a\' apache-tomcat-9.0.104/conf/tomcat-users.xml 6 | sed -i '58 a\' apache-tomcat-9.0.104/conf/tomcat-users.xml 7 | sed -i '59 a\' apache-tomcat-9.0.104/conf/tomcat-users.xml 8 | sed -i '56d' apache-tomcat-9.0.104/conf/tomcat-users.xml 9 | sed -i '21d' apache-tomcat-9.0.104/webapps/manager/META-INF/context.xml 10 | sed -i '22d' apache-tomcat-9.0.104/webapps/manager/META-INF/context.xml 11 | sh apache-tomcat-9.0.104/bin/startup.sh 12 | -------------------------------------------------------------------------------- /tomcat.yml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | tasks: 3 | - name: download tomcat from dlcdn 4 | get_url: 5 | url: "https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.87/bin/apache-tomcat-9.0.87.tar.gz" 6 | dest: "/root/" 7 | 8 | - name: untar the apache file 9 | command: tar -zxvf apache-tomcat-9.0.87.tar.gz 10 | 11 | 12 | - name: rename the tomcat 13 | command: mv apache-tomcat-9.0.87 tomcat 14 | tags: abc 15 | 16 | - name: install java 17 | command: yum install java-1.8.0-openjdk -y 18 | 19 | - name: setting the roles in tomcat-user.xml file 20 | template: 21 | src: tomcat-users.xml 22 | dest: /root/tomcat/conf/tomcat-users.xml 23 | 24 | - name: delete two lines in context.xml 25 | template: 26 | src: context.xml 27 | dest: /root/tomcat/webapps/manager/META-INF/context.xml 28 | 29 | - name: start the tomcat 30 | shell: nohup /root/tomcat/bin/startup.sh 31 | -------------------------------------------------------------------------------- /trivy: -------------------------------------------------------------------------------- 1 | wget https://github.com/aquasecurity/trivy/releases/download/v0.18.3/trivy_0.18.3_Linux-64bit.tar.gz 2 | tar zxvf trivy_0.18.3_Linux-64bit.tar.gz 3 | sudo mv trivy /usr/local/bin/ 4 | vim .bashrc 5 | export PATH=$PATH:/usr/local/bin/ 6 | source .bashrc 7 | -------------------------------------------------------------------------------- /ubuntu-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Update the system 4 | apt-get update 5 | apt-get upgrade -y 6 | 7 | # Install Docker dependencies 8 | apt-get install -y apt-transport-https ca-certificates curl software-properties-common 9 | 10 | # Add Docker's official GPG key 11 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg 12 | 13 | # Add Docker repository 14 | echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 15 | 16 | # Update package information and install Docker 17 | apt-get update 18 | apt-get install -y docker-ce docker-ce-cli containerd.io 19 | 20 | # Start Docker service 21 | systemctl start docker 22 | 23 | # Enable Docker to start on system boot 24 | systemctl enable docker 25 | -------------------------------------------------------------------------------- /ubuntu-kops.sh: -------------------------------------------------------------------------------- 1 | #vim .bashrc 2 | #export PATH=$PATH:/usr/local/bin/ 3 | #source .bashrc 4 | 5 | 6 | #! /bin/bash 7 | apt update -y 8 | apt upgrade -y 9 | apt install awscli -y 10 | aws configure 11 | curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" 12 | wget https://github.com/kubernetes/kops/releases/download/v1.25.0/kops-linux-amd64 13 | chmod +x kops-linux-amd64 kubectl 14 | mv kubectl /usr/local/bin/kubectl 15 | mv kops-linux-amd64 /usr/local/bin/kops 16 | 17 | aws s3api create-bucket --bucket cloudanddevopsbyraham007899123.k8s.local --region us-east-1 18 | aws s3api put-bucket-versioning --bucket cloudanddevopsbyraham007899123.k8s.local --region us-east-1 --versioning-configuration Status=Enabled 19 | export KOPS_STATE_STORE=s3://cloudanddevopsbyraham007899123.k8s.local 20 | kops create cluster --name rahams.k8s.local --zones us-east-1a --master-count=1 --master-size t2.medium --node-count=2 --node-size t2.micro 21 | kops update cluster --name rahams.k8s.local --yes --admin 22 | -------------------------------------------------------------------------------- /ubuntu-minikube.sh: -------------------------------------------------------------------------------- 1 | sudo apt update -y 2 | sudo apt upgrade -y 3 | sudo apt install curl wget apt-transport-https -y 4 | sudo curl -fsSL https://get.docker.com -o get-docker.sh 5 | sudo sh get-docker.sh 6 | sudo curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 7 | sudo mv minikube-linux-amd64 /usr/local/bin/minikube 8 | sudo chmod +x /usr/local/bin/minikube 9 | sudo minikube version 10 | sudo curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" 11 | sudo curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256" 12 | sudo echo "$(cat kubectl.sha256) kubectl" | sha256sum --check 13 | sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl 14 | sudo minikube start --driver=docker --force 15 | --------------------------------------------------------------------------------