diff --git a/1.amazon.sh b/1.amazon.sh new file mode 100644 index 00000000..07783d65 --- /dev/null +++ b/1.amazon.sh @@ -0,0 +1,8 @@ +#! /bin/bash +sudo -i +apt update +apt install apache2 git -y +git clone https://github.com/Ironhack-Archive/online-clone-amazon.git +mv online-clone-amazon/* /var/www/html/ + + diff --git a/2023mysql.sh b/2023mysql.sh new file mode 100644 index 00000000..bd6a29ca --- /dev/null +++ b/2023mysql.sh @@ -0,0 +1,5 @@ +sudo wget https://dev.mysql.com/get/mysql80-community-release-el9-1.noarch.rpm +sudo dnf install mysql80-community-release-el9-1.noarch.rpm -y +sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023 +sudo dnf install mysql-community-client -y +sudo dnf install mysql-community-server -y diff --git a/alertmanager.sh b/alertmanager.sh new file mode 100644 index 00000000..acf3561c --- /dev/null +++ b/alertmanager.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +set -e + +# Variables +VERSION="0.18.0" +USER="alertmanager" +INSTALL_DIR="/usr/local/bin" +CONFIG_DIR="/etc/alertmanager" +DATA_DIR="/data/alertmanager" + +# Download Alertmanager +cd /tmp +wget https://github.com/prometheus/alertmanager/releases/download/v${VERSION}/alertmanager-${VERSION}.linux-amd64.tar.gz + +# Extract +tar -xvzf alertmanager-${VERSION}.linux-amd64.tar.gz + +# Move binaries +sudo mv alertmanager-${VERSION}.linux-amd64/alertmanager ${INSTALL_DIR}/ +sudo mv alertmanager-${VERSION}.linux-amd64/amtool ${INSTALL_DIR}/ + +# Create user (if not exists) +sudo useradd alertmanager +id -u ${USER} &>/dev/null || sudo useradd -rs /bin/false ${USER} + +# Create directories +sudo mkdir -p ${CONFIG_DIR} +sudo mkdir -p ${DATA_DIR} + +# Create basic config (edit later for email/slack) +sudo tee ${CONFIG_DIR}/alertmanager.yml > /dev/null </dev/null || true +sudo systemctl disable alertmanager 2>/dev/null || true +sudo systemctl unmask alertmanager 2>/dev/null || true +sudo rm -f /etc/systemd/system/alertmanager.service +sudo rm -f /lib/systemd/system/alertmanager.service + +# Create systemd service (CORRECT LOCATION) +sudo tee /etc/systemd/system/alertmanager.service > /dev/null <:9093" diff --git a/amazon.sh b/amazon.sh new file mode 100644 index 00000000..9ad1c817 --- /dev/null +++ b/amazon.sh @@ -0,0 +1,8 @@ +#! /bin/bash +yum install httpd git -y +systemctl start httpd +systemctl status httpd +cd /var/www/html +git clone https://github.com/Ironhack-Archive/online-clone-amazon.git +mv online-clone-amazon/* . +tail -f /var/log/httpd/access_log diff --git a/argocd-n.sh b/argocd-n.sh new file mode 100644 index 00000000..defd7e58 --- /dev/null +++ b/argocd-n.sh @@ -0,0 +1,20 @@ +#! /bin/bash + +sudo apt update && sudo apt upgrade -y +sudo apt install -y curl wget git apt-transport-https ca-certificates gnupg lsb-release +sudo swapoff -a +sudo sed -i '/swap/d' /etc/fstab +curl -sfL https://get.k3s.io | sh - +sudo kubectl get nodes +mkdir -p ~/.kube +sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config +sudo chown $USER:$USER ~/.kube/config +kubectl get pods -A + +sleep 10 + +kubectl create namespace argocd +kubectl apply -n argocd --server-side --force-conflicts -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml +kubectl get pods -n argocd +kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort"}}' +kubectl get svc argocd-server -n argocd diff --git a/argocd.sh b/argocd.sh new file mode 100644 index 00000000..75145a34 --- /dev/null +++ b/argocd.sh @@ -0,0 +1,20 @@ +#INSTALL HELM: +curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 +chmod 700 get_helm.sh +./get_helm.sh +helm version + +#INSTALL ARGO CD USING HELM +helm repo add argo-cd https://argoproj.github.io/argo-helm +helm repo update +kubectl create namespace argocd +helm install argocd argo-cd/argo-cd -n argocd +kubectl get all -n argocd + + + +#EXPOSE ARGOCD SERVER: +kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}' +kubectl get svc -n argocd + +kubectl -n argocd get secret argocd-initial-admin-secret | base64 -d; echo diff --git a/docker-compose.sh b/docker-compose.sh index b7a5d488..682cc067 100644 --- a/docker-compose.sh +++ b/docker-compose.sh @@ -1,5 +1,4 @@ -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 -ls /usr/local/bin/ +curl -SL https://github.com/docker/compose/releases/download/v2.40.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose +chmod +x /usr/local/bin/docker-compose sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose -sudo chmod +x /usr/local/bin/docker-compose docker-compose version diff --git a/eks.sh b/eks.sh new file mode 100644 index 00000000..669ea789 --- /dev/null +++ b/eks.sh @@ -0,0 +1,48 @@ +SETUP: TAKE UBUNTU AMI M7I-FLEX.LARGE AND 30 GB EBS FOR THIS CONCEPT + +#STEP-1: UPDATE + +sudo -i +apt update && apt install unzip -y + +#STEP-2: AWS CLI INSTALLATION & EKS & KUBECTL + +curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" +unzip awscliv2.zip +sudo ./aws/install +aws configure + +curl -LO https://dl.k8s.io/release/v1.35.0/bin/linux/amd64/kubectl +chmod +x kubectl +mv kubectl /usr/local/bin/kubectl + + +sudo wget https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz +sudo tar -xzvf eksctl_$(uname -s)_amd64.tar.gz -C /usr/local/bin +eksctl version + + +#STEP-3: CREATE CLUSTER +eksctl create cluster --name=raham-cluster --version 1.32 --zones=ap-south-1a,ap-south-1b,ap-south-1c --without-nodegroup + + +kubectl cluster-info +kubectl cluster-info dump + +eksctl utils associate-iam-oidc-provider --region ap-south-1 --cluster raham-cluster --approve + +#STEP-4: CREATE NODEGROUP +eksctl create nodegroup --cluster=raham-cluster --region=ap-south-1 \ +--name=raham-cluster-ng-1 --node-type=t2.medium \ +--nodes=2 --nodes-min=2 --nodes-max=4 --node-volume-size=20 \ +--ssh-access --ssh-public-key=Mac \ +--managed --asg-access --external-dns-access --full-ecr-access \ +--appmesh-access --alb-ingress-access + + +eksctl get clusters +eksctl get nodegroup --cluster raham-cluster + +#STEP-5: DELETE RESOURCES +eksctl delete nodegroup --cluster raham-cluster --name raham-cluster-ng-1 +eksctl delete cluster --name=raham-cluster diff --git a/helm-Pegion b/helm-Pegion new file mode 100644 index 00000000..8970deb0 --- /dev/null +++ b/helm-Pegion @@ -0,0 +1,56 @@ +INSTALLATION OF HELM: +curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 +chmod 700 get_helm.sh +./get_helm.sh +helm version + + +INSTALLATION OF METRIC SERVER: +kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability-1.21+.yaml + +CHARTS WEBSITE LINK: https://artifacthub.io/ + +DOWNLOADING CHARTS PROMETHEUS & GRAFANA: +helm repo add prometheus-community https://prometheus-community.github.io/helm-charts +helm repo add grafana https://grafana.github.io/helm-charts + + +UPDATE HELM CHART REPOS: +helm repo update +helm repo list + +CREATE PROMETHEUS NAMESPACE: +kubectl create namespace prometheus +kubectl get ns + +INSTALL PROMETHEUS: +helm template prometheus-community/prometheus + +helm install prometheus prometheus-community/prometheus --namespace prometheus --set alertmanager.persistentVolume.storageClass="gp2" --set server.persistentVolume.storageClass="gp2" +kubectl get all -n prometheus + +CREATE GRAFANA NAMESPACE: +kubectl create namespace grafana + +INSTALL GRAFANA: +helm template grafana grafana/grafana +helm install grafana grafana/grafana --namespace grafana --set persistence.storageClassName="gp2" --set persistence.enabled=true --set adminPassword='RahamDevOps' --set service.type=LoadBalancer +kubectl get all -n grafana + + +#use for kubeadm/killerkoda +helm install grafana grafana/grafana --namespace grafana --set adminPassword='RahamDevOps' --set service.type=NodePort + + +NOTE: ALLOW PORTS ON SG + +Copy the EXTERNAL-IP and paste in browser + +Go to Grafana Dashboard → Add the Datasource → Select the Prometheus +add the below url in Connection and save and test +http://prometheus-server.prometheus.svc.cluster.local/ + + +Import Grafana dashboard from Grafana Labs +grafana dashboard → new → Import → 6417 → load → select prometheus → import + diff --git a/helm-tools.sh b/helm-tools.sh new file mode 100644 index 00000000..9b6cad6e --- /dev/null +++ b/helm-tools.sh @@ -0,0 +1,90 @@ +#PROMETHEUS GRAFANA + +INSTALLATION OF HELM: +curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 +chmod 700 get_helm.sh +./get_helm.sh +helm version + + +INSTALLATION OF METRIC SERVER: +kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability-1.21+.yaml + +CHARTS WEBSITE LINK: https://artifacthub.io/ + +DOWNLOADING CHARTS PROMETHEUS & GRAFANA: +helm repo add prometheus-community https://prometheus-community.github.io/helm-charts +helm repo add grafana https://grafana.github.io/helm-charts + + +UPDATE HELM CHART REPOS: +helm repo update +helm repo list + +CREATE PROMETHEUS NAMESPACE: +kubectl create namespace prometheus +kubectl create namespace grafana +kubectl get ns + +INSTALL PROMETHEUS: + +helm install prometheus prometheus-community/prometheus --namespace prometheus --set alertmanager.persistentVolume.storageClass="gp2" --set server.persistentVolume.storageClass="gp2" +kubectl get all -n prometheus + +INSTALL GRAFANA: + +helm install grafana grafana/grafana --namespace grafana --set adminPassword='RahamDevOps' --set service.type=NodePort +kubectl get all -n grafana +kubectl get svc -n grafana + +NOTE: ALLOW PORTS ON SG + +Copy the EXTERNAL-IP and paste in browser + +Go to Grafana Dashboard → Add the Datasource → Select the Prometheus +add the below url in Connection and save and test +http://prometheus-server.prometheus.svc.cluster.local/ + +Import Grafana dashboard from Grafana Labs +grafana dashboard → new → Import → 15757 → load → select prometheus → import + + +#ARGOCD INSTALLATION + + +STEP-1: INSTALL ARGO CD USING HELM +helm repo add argo-cd https://argoproj.github.io/argo-helm +helm repo update +kubectl create namespace argocd +helm install argocd argo-cd/argo-cd -n argocd +kubectl get all -n argocd + + +EXPOSE ARGOCD SERVER: +kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}' +kubectl get all -n argocd +NOTE: GIVE OR CHECK SG FOR PORTS + +COPY PASTE DNS TO BROWSER -- > ADVANCE -- > LOGIN PAGE + +username: admin +passowd: + +TO GET ARGO CD PASSWORD: + +kubectl -n argocd get secret argocd-initial-admin-secret -o yaml +decode the above secret (echo -n "data" | base64 -d) + + +The above command to provide password to access argo cd + +# DEPLOYMENT +NEW APP +NAME: APP1 +PROJECT NAME: default +Sync Policy: Manual +REPO: https://github.com/devopsbyraham/argocd.git +PATH: ./ +CLUSTER URL: https://kubernetes.default.svc +NAMESPACE: default +CREATE diff --git a/jenkins.sh b/jenkins.sh index 951bcd70..7ed488e4 100644 --- a/jenkins.sh +++ b/jenkins.sh @@ -1,15 +1,11 @@ -#STEP-1: INSTALLING GIT JAVA-1.8.0 MAVEN -yum install git java-1.8.0-openjdk maven -y -#STEP-2: GETTING THE REPO (jenkins.io --> download -- > redhat) -sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo +#! /bin/bash +sudo wget -O /etc/yum.repos.d/jenkins.repo \ + https://pkg.jenkins.io/redhat-stable/jenkins.repo sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key - -#STEP-3: DOWNLOAD JAVA11 AND JENKINS -amazon-linux-extras install java-openjdk11 -y -yum install jenkins -y -update-alternatives --config java - -#STEP-4: RESTARTING JENKINS (when we download service it will on stopped state) -systemctl start jenkins.service -systemctl status jenkins.service +sudo yum upgrade +# Add required dependencies for the jenkins package +sudo yum install java-21-amazon-corretto +sudo yum install jenkins -y +sudo systemctl restart jenkins +sudo systemctl daemon-reload diff --git a/jfrog.sh b/jfrog.sh index a43ecdcf..3e492a39 100644 --- a/jfrog.sh +++ b/jfrog.sh @@ -1,7 +1,7 @@ #! /bin/bash -wget https://releases.jfrog.io/artifactory/artifactory-rpms/artifactory-rpms.repo -O jfrog-artifactory-rpms.repo -mv jfrog-artifactory-rpms.repo /etc/yum.repos.d/ -yum update -y -yum install jfrog-artifactory-oss -y -systemctl start artifactory.service -systemctl status artifactory.service +sudo yum update -y +sudo yum install java-1.8* -y +sudo wget https://jfrog.bintray.com/artifactory/jfrog-artifactory-oss-6.9.6.zip +sudo yum install unzip -y +sudo unzip jfrog-artifactory-oss-6.9.6.zip +sudo sh jfrog-artifactory-oss-6.9.6/bin/artifactory.sh start diff --git a/k8s-class b/k8s-class new file mode 100644 index 00000000..17f4d489 --- /dev/null +++ b/k8s-class @@ -0,0 +1,40 @@ +STEP-0: CREATE EC2 AND S3 BUCKET ON SAME REGION (bucket name: -----------.k8s.local) + +STEP-1: INSTALL CLI & GIVING PERMISSIONS (IAM) + +KOps Is a third party tool if it want to create infrastructure on aws +aws need to give permission for it so we can use IAM user to allocate permission for the kops tool + +IAM -- > USER -- > CREATE USER -- > NAME: KOPS -- > Attach Polocies Directly -- > AdministratorAccess -- > NEXT -- > CREATE USER +USER -- > SECURTITY CREDENTIALS -- > CREATE ACCESS KEYS -- > CLI -- > CHECKBOX -- > CREATE ACCESS KEYS -- > DOWNLOAD + +GIVING THE KEYS + +apt update -y && apt install unzip -y +curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" +unzip awscliv2.zip +sudo ./aws/install +aws configure (run this command on server) + +SETP-2: INSTALL KUBECTL AND KOPS + + +curl -LO https://dl.k8s.io/release/v1.35.0/bin/linux/amd64/kubectl +wget https://github.com/kubernetes/kops/releases/download/v1.25.0/kops-linux-amd64 + +chmod +x kops-linux-amd64 kubectl +mv kubectl /usr/local/bin/kubectl +mv kops-linux-amd64 /usr/local/bin/kops + + + +export KOPS_STATE_STORE=s3://give your bucket name + +SETP-5: CREATING THE CLUSTER + +kops create cluster --name rahamss.k8s.local --zones us-east-1a --master-image ami-0360c520857e3138f --master-count 1 --master-size c7i-flex.large --node-image ami-0360c520857e3138f --node-count=2 --node-size c7i-flex.large + + +kops update cluster --name rahams.k8s.local --yes --admin + +kops validate cluster --wait 10m diff --git a/kops.sh b/kops.sh index 55b015d2..053f65dd 100644 --- a/kops.sh +++ b/kops.sh @@ -1,18 +1,12 @@ -#vim .bashrc -#export PATH=$PATH:/usr/local/bin/ -#source .bashrc - - #! /bin/bash aws configure curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -wget https://github.com/kubernetes/kops/releases/download/v1.25.0/kops-linux-amd64 +wget https://github.com/kubernetes/kops/releases/download/v1.33.0/kops-linux-amd64 chmod +x kops-linux-amd64 kubectl mv kubectl /usr/local/bin/kubectl mv kops-linux-amd64 /usr/local/bin/kops +echo "export PATH=$PATH:/usr/local/bin/" >> source .bashrc -aws s3api create-bucket --bucket cloudanddevopsbyraham0073456.k8s.local --region us-east-1 -aws s3api put-bucket-versioning --bucket cloudanddevopsbyraham0073456.k8s.local --region us-east-1 --versioning-configuration Status=Enabled export KOPS_STATE_STORE=s3://cloudanddevopsbyraham0073456.k8s.local -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 -kops update cluster --name rahams.k8s.local --yes --admin +kops create cluster --name rahamss.k8s.local --zones ap-south-1a --control-plane-image ami-02b8269d5e85954ef --control-plane-count=1 --control-plane-size c7i-flex.large --image ami-02b8269d5e85954ef --node-count=2 --node-size c7i-flex.large +kops update cluster --name rahamss.k8s.local --yes --admin diff --git a/master-slave b/master-slave new file mode 100644 index 00000000..08bdf31f --- /dev/null +++ b/master-slave @@ -0,0 +1,118 @@ + +MASTER AND SLAVE: +it is used to distribute the builds. +it reduce the load on jenkins server. +communication blw master and slave is ssh. +Here we need to install agent (java). +SLAVE IS your instance. +slave can use any platform. +label = way of assigning work for slave. + +TIP-: + +SETUP: +#STEP-1 : Create a server and install JAVA-1.8.0 maven +sudo apt update +sudo apt install -y wget gnupg +wget -qO - https://repos.azul.com/azul-repo.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/azul.gpg +echo "deb https://repos.azul.com/zulu/deb stable main" | sudo tee /etc/apt/sources.list.d/zulu.list +sudo apt update +sudo apt install -y zulu8-jdk +sudo apt install -y maven + + +sudo apt install -y openjdk-17-jdk +update-alternatives --config java +set java to version17 + +#STEP-2: SETUP THE SLAVE SERVER +Dashboard -- > Manage Jenkins -- > Nodes -- > New node -- > nodename: abc -- > permanent agent -- > save + +CONFIGURATION OF SALVE: + +Number of executors : 3 #Number of Parallel builds +Remote root directory : /tmp #The place where our output is stored on slave sever. +Labels : one #place the op in a particular slave +useage: last option +Launch method : last option +Host: (your privte ip) +Credentials -- > add -- >jenkins -- > Kind : ssh username with privatekey -- > username: ec2-user +privatekey : pemfile of server -- > save -- > +Host Key Verification Strategy: last option + +DASHBOARD -- > JOB -- > CONFIGURE -- > RESTRTICT WHERE THIS JOB RUN -- > LABEL: SLAVE1 -- > SAVE + +BUILD FAILS -- > WHY -- > WE NEED TO INSTALL PACKAGES + +TOMCAT: + +WEBSITE: FRONTEND -- > DB IS OPT +WEBAPP: FRONTEND + BACKEND -- > DB IS MANDATORY + +WEB APPLICATION SERVER/APPLICATION SERVER/APP SERVER = TOMCAT + +ITS A WEB APPLICATION SERVER USED TO DEPLOY JAVA APPLICATIONS. +IT IS WRITTEN ON JAVA LANGUAGE. +AGENT: JAVA +PORT: 8080 +WE CAN DEPLOY OUR ARTIFACTS. +ITS FREE AND OPENSOURCE. +Its Platform Independent. +YEAR: 1999 + +war : tomcat/webapps +jar : tomcat/lib + +ALTERNATIVES: NGINX, IIS, WEBSPHERE, JBOSS, GLASSFISH, WEBLOGIC + +NOTE: USE SLAVE AS TOMCAT FOR TEMP +SETUP: CREATE A NEW SERVER +INSTALL JAVA: sudo apt install -y openjdk-17-jdk + + + +STEP-1: DOWNLOAD TOMCAT (dlcdn.apache.org) +wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.107/bin/apache-tomcat-9.0.108.tar.gz + +STEP-2: EXTRACT THE FILES +tar -zxvf apache-tomcat-9.0.108.tar.gz + +STEP-3: CONFIGURE USER, PASSWORD & ROLES +vim apache-tomcat-9.0.108/conf/tomcat-users.xml + + 56 + 57 + 58 + +STEP-4: DELETE LINE 21 AND 22 +vim apache-tomcat-9.0.108/webapps/manager/META-INF/context.xml + +STEP-5: STARTING TOMCAT +sh apache-tomcat-9.0.108/bin/startup.sh + +CONNECTION: +COPY PUBLIC IP:8080 +manager apps -- > username: tomcat & password: raham123 + +SCRIPT: + +wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.107/bin/apache-tomcat-9.0.107.tar.gz +tar -zxvf apache-tomcat-9.0.107.tar.gz +sed -i '56 a\' apache-tomcat-9.0.107/conf/tomcat-users.xml +sed -i '57 a\' apache-tomcat-9.0.107/conf/tomcat-users.xml +sed -i '58 a\' apache-tomcat-9.0.107/conf/tomcat-users.xml +sed -i '59 a\' apache-tomcat-9.0.107/conf/tomcat-users.xml +sed -i '56d' apache-tomcat-9.0.107/conf/tomcat-users.xml +sed -i '21d' apache-tomcat-9.0.107/webapps/manager/META-INF/context.xml +sed -i '22d' apache-tomcat-9.0.107/webapps/manager/META-INF/context.xml +sh apache-tomcat-9.0.107/bin/startup.sh + + +DEPLOYING THE APP: +WORKSPACE IN JENKINS DASHBOARD +TARGET +CLICK ON +NETFLIX-1.2.2.war + +GO TO TOMCAT +CLICK ON WAR file to deploy - > CHOOSE FILE -- > UPLOAD NETFLIX WAR -- > DEPLOY diff --git a/nexus.sh b/nexus.sh index 544998ac..57023601 100644 --- a/nexus.sh +++ b/nexus.sh @@ -1,35 +1,8 @@ #create amazonlinux ec2 with t2.micro and 30 gb of ebs with port 8081 -sudo yum update -y -sudo yum install wget -y -sudo yum install java-17-amazon-corretto-jmods -y -sudo mkdir /app && cd /app -sudo wget -O nexus.tar.gz https://download.sonatype.com/nexus/3/latest-unix.tar.gz -sudo tar -xvf nexus.tar.gz -sudo mv nexus-3* nexus -sudo adduser nexus -sudo chown -R nexus:nexus /app/nexus -sudo chown -R nexus:nexus /app/sonatype-work -sudo echo "run_as_user="nexus"" > /app/nexus/bin/nexus.rc -sudo tee /etc/systemd/system/nexus.service > /dev/null << EOL -[Unit] -Description=nexus service -After=network.target - -[Service] -Type=forking -LimitNOFILE=65536 -User=nexus -Group=nexus -ExecStart=/app/nexus/bin/nexus start -ExecStop=/app/nexus/bin/nexus stop -User=nexus -Restart=on-abort - -[Install] -WantedBy=multi-user.target -EOL -sudo chkconfig nexus on -sudo systemctl start nexus -sudo systemctl status nexus - +wget https://download.sonatype.com/nexus/3/nexus-unix-x86-64-3.79.0-09.tar.gz\ +tar -zxvf nexus-unix-x86-64-3.79.0-09.tar.gz +yum install java-21-amazon-corretto -y +sudo useradd nexus +chown -R nexus:nexus nexus-3.79.0-09 +sudo sh nexus-3.79.0-09/bin/nexus start diff --git a/opentofu.sh b/opentofu.sh new file mode 100644 index 00000000..ca51164a --- /dev/null +++ b/opentofu.sh @@ -0,0 +1,4 @@ +wget https://github.com/opentofu/opentofu/releases/download/v1.6.0-alpha3/tofu_1.6.0-alpha_linux_amd64.zip +unzip tofu_1.6.0-alpha3_linux_amd64.zip +mv tofu /usr/local/bin/tofu +tofu version diff --git a/portainer b/portainer new file mode 100644 index 00000000..cfb08cc3 --- /dev/null +++ b/portainer @@ -0,0 +1,12 @@ +PORTAINER: +it is a container organizer, designed to make tasks easier, whether they are clustered or not. +abel to connect multiple clusters, access the containers, migrate stacks between clusters +it is not a testing environment mainly used for production routines in large companies. +Portainer consists of two elements, the Portainer Server and the Portainer Agent. +Both elements run as lightweight Docker containers on a Docker engine + +Must have swarm mode and all ports enable with docker engine +curl -L https://downloads.portainer.io/ce2-16/portainer-agent-stack.yml -o portainer-agent-stack.yml +docker stack deploy -c portainer-agent-stack.yml portainer + docker ps +public-ip of swamr master:9000 diff --git a/swiggy.sh b/swiggy.sh index 83a86299..5d83c9bc 100644 --- a/swiggy.sh +++ b/swiggy.sh @@ -1,3 +1,4 @@ +#! /bin/bash yum install httpd git -y systemctl start httpd systemctl status httpd diff --git a/terraformer b/terraformer new file mode 100644 index 00000000..577130a2 --- /dev/null +++ b/terraformer @@ -0,0 +1,11 @@ +wget https://github.com/GoogleCloudPlatform/terraformer/releases/download/0.8.24/terraformer-all-linux-amd64 +chmod +x terraformer-all-linux-amd64 +sudo mv terraformer-all-linux-amd64 /usr/local/bin/terraformer +terraformer --version + +COMMAND: terraformer import aws --resources=sg,ec2_instance,elb --regions=us-east-1 +UPDATE PROVIDERS IN STATE FILE: +terraform state replace-provider -- -/aws hashicorp/aws +terraform init +terraform plan +terraform apply diff --git a/tomcat.sh b/tomcat.sh index d92bcc69..6c52e827 100644 --- a/tomcat.sh +++ b/tomcat.sh @@ -1,11 +1,11 @@ -amazon-linux-extras install java-openjdk11 -y -wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.91/bin/apache-tomcat-9.0.91.tar.gz -tar -zxvf apache-tomcat-9.0.91.tar.gz -sed -i '56 a\' apache-tomcat-9.0.91/conf/tomcat-users.xml -sed -i '57 a\' apache-tomcat-9.0.91/conf/tomcat-users.xml -sed -i '58 a\' apache-tomcat-9.0.91/conf/tomcat-users.xml -sed -i '59 a\' apache-tomcat-9.0.91/conf/tomcat-users.xml -sed -i '56d' apache-tomcat-9.0.91/conf/tomcat-users.xml -sed -i '21d' apache-tomcat-9.0.91/webapps/manager/META-INF/context.xml -sed -i '22d' apache-tomcat-9.0.91/webapps/manager/META-INF/context.xml -sh apache-tomcat-9.0.91/bin/startup.sh +sudo yum install java-17-amazon-corretto -y +wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.115/bin/apache-tomcat-9.0.115.tar.gz +tar -zxvf apache-tomcat-9.0.115.tar.gz +sed -i '56 a\' apache-tomcat-9.0.115/conf/tomcat-users.xml +sed -i '57 a\' apache-tomcat-9.0.115/conf/tomcat-users.xml +sed -i '58 a\' apache-tomcat-9.0.115/conf/tomcat-users.xml +sed -i '59 a\' apache-tomcat-9.0.115/conf/tomcat-users.xml +sed -i '56d' apache-tomcat-9.0.115/conf/tomcat-users.xml +sed -i '21d' apache-tomcat-9.0.115/webapps/manager/META-INF/context.xml +sed -i '22d' apache-tomcat-9.0.115/webapps/manager/META-INF/context.xml +sh apache-tomcat-9.0.115/bin/startup.sh diff --git a/tomcat.yml b/tomcat.yml index 0a210290..00a3dcdd 100644 --- a/tomcat.yml +++ b/tomcat.yml @@ -2,15 +2,15 @@ tasks: - name: download tomcat from dlcdn get_url: - url: "https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.87/bin/apache-tomcat-9.0.87.tar.gz" + url: "https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.117/bin/apache-tomcat-9.0.117.tar.gz" dest: "/root/" - name: untar the apache file - command: tar -zxvf apache-tomcat-9.0.87.tar.gz + command: tar -zxvf apache-tomcat-9.0.117.tar.gz - name: rename the tomcat - command: mv apache-tomcat-9.0.87 tomcat + command: mv apache-tomcat-9.0.117 tomcat tags: abc - name: install java diff --git a/trivy.sh b/trivy.sh new file mode 100644 index 00000000..8432fcff --- /dev/null +++ b/trivy.sh @@ -0,0 +1,5 @@ +wget https://github.com/aquasecurity/trivy/releases/download/v0.18.3/trivy_0.18.3_Linux-64bit.tar.gz +tar zxvf trivy_0.18.3_Linux-64bit.tar.gz +sudo mv trivy /usr/local/bin/ +echo "export PATH=$PATH:/usr/local/bin/" >> .bashrc +source .bashrc diff --git a/ubuntu-awscli b/ubuntu-awscli new file mode 100644 index 00000000..21e6b32a --- /dev/null +++ b/ubuntu-awscli @@ -0,0 +1,4 @@ +curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" +apt install unzip curl -y +unzip awscliv2.zip +sudo ./aws/install diff --git a/ubuntu-jenkins.sh b/ubuntu-jenkins.sh new file mode 100644 index 00000000..bb8d0ea9 --- /dev/null +++ b/ubuntu-jenkins.sh @@ -0,0 +1,15 @@ +#! /bin/bash +sudo apt update +sudo apt install fontconfig openjdk-21-jre -y +java -version + +sudo wget -O /etc/apt/keyrings/jenkins-keyring.asc \ + https://pkg.jenkins.io/debian-stable/jenkins.io-2026.key +echo "deb [signed-by=/etc/apt/keyrings/jenkins-keyring.asc]" \ + https://pkg.jenkins.io/debian-stable binary/ | sudo tee \ + /etc/apt/sources.list.d/jenkins.list > /dev/null +sudo apt update +sudo apt install jenkins -y + +sudo systemctl start jenkins +sudo systemctl status jenkins diff --git a/ubuntu-kops.sh b/ubuntu-kops.sh index 2e43af6e..42b35bf3 100644 --- a/ubuntu-kops.sh +++ b/ubuntu-kops.sh @@ -4,18 +4,19 @@ #! /bin/bash -apt update -y -apt upgrade -y -apt install awscli -y +apt update -y && apt install unzip -y +curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" +unzip awscliv2.zip +sudo ./aws/install aws configure curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -wget https://github.com/kubernetes/kops/releases/download/v1.25.0/kops-linux-amd64 +wget https://github.com/kubernetes/kops/releases/download/v1.33.0/kops-linux-amd64 chmod +x kops-linux-amd64 kubectl mv kubectl /usr/local/bin/kubectl mv kops-linux-amd64 /usr/local/bin/kops -aws s3api create-bucket --bucket cloudanddevopsbyraham007899123.k8s.local --region us-east-1 -aws s3api put-bucket-versioning --bucket cloudanddevopsbyraham007899123.k8s.local --region us-east-1 --versioning-configuration Status=Enabled -export KOPS_STATE_STORE=s3://cloudanddevopsbyraham007899123.k8s.local -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 +aws s3api create-bucket --bucket deploysscloudanddevopsbyraham007899123mnbvcxz.k8s.local --region us-east-1 +aws s3api put-bucket-versioning --bucket deploysscloudanddevopsbyraham007899123mnbvcxz.k8s.local --region us-east-1 --versioning-configuration Status=Enabled +export KOPS_STATE_STORE=s3://deploysscloudanddevopsbyraham007899123mnbvcxz.k8s.local +kops create cluster --name rahamss.k8s.local --zones us-east-1a --control-plane-image ami-0360c520857e3138f --control-plane-count=1 --control-plane-size t2.large --image ami-0360c520857e3138f --node-count=2 --node-size t2.medium kops update cluster --name rahams.k8s.local --yes --admin diff --git a/ubuntu-nexus.sh b/ubuntu-nexus.sh new file mode 100644 index 00000000..bdc289b9 --- /dev/null +++ b/ubuntu-nexus.sh @@ -0,0 +1,8 @@ +#! /bin/bash +wget https://download.sonatype.com/nexus/3/nexus-unix-x86-64-3.79.0-09.tar.gz +tar -zxvf nexus-unix-x86-64-3.79.0-09.tar.gz +sudo apt update -y +sudo apt install -y openjdk-17-jdk +sudo useradd nexus +chown -R nexus:nexus nexus-3.79.0-09 +sudo sh nexus-3.79.0-09/bin/nexus start diff --git a/pegion-ubuntu.sh b/ubuntu-pegion.sh similarity index 92% rename from pegion-ubuntu.sh rename to ubuntu-pegion.sh index 3d58edcd..fa18c183 100644 --- a/pegion-ubuntu.sh +++ b/ubuntu-pegion.sh @@ -19,14 +19,10 @@ global: scrape_interval: 10s scrape_configs: - - job_name: 'prometheus_metrics' + - job_name: 'metrics' scrape_interval: 5s static_configs: - - targets: ['localhost:9090'] - - job_name: 'node_exporter_metrics' - scrape_interval: 5s - static_configs: - - targets: ['localhost:9100','worker-1:9100','worker-2:9100'] + - targets: [''] EOF diff --git a/ubuntu-tomcat.sh b/ubuntu-tomcat.sh new file mode 100644 index 00000000..f6c24ada --- /dev/null +++ b/ubuntu-tomcat.sh @@ -0,0 +1,15 @@ +#! /bin/bash +sudo apt update +apt install openjdk-17-jre-headless -y +wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.118/bin/apache-tomcat-9.0.118.tar.gz +tar -zxvf apache-tomcat-9.0.118.tar.gz +sed -i '56 a\' apache-tomcat-9.0.118/conf/tomcat-users.xml +sed -i '57 a\' apache-tomcat-9.0.118/conf/tomcat-users.xml +sed -i '58 a\' apache-tomcat-9.0.118/conf/tomcat-users.xml +sed -i '59 a\' apache-tomcat-9.0.118/conf/tomcat-users.xml +sed -i '56d' apache-tomcat-9.0.118/conf/tomcat-users.xml +sed -i '21d' apache-tomcat-9.0.118/webapps/manager/META-INF/context.xml +sed -i '22d' apache-tomcat-9.0.118/webapps/manager/META-INF/context.xml +sh apache-tomcat-9.0.118/bin/startup.sh + + diff --git a/whatsapp.sh b/whatsapp.sh new file mode 100644 index 00000000..bdc9a449 --- /dev/null +++ b/whatsapp.sh @@ -0,0 +1,9 @@ +#! /bin/bash +yum install httpd git -y +systemctl start httpd +systemctl status httpd +chkconfig httpd on +cd /var/www/html +git clone https://github.com/hamsahmedansari/axiom-whatsapp-ui-homePage.git +mv axiom-whatsapp-ui-homePage/* . +tail -100f /var/log/httpd/access_log