Showing posts with label CLOUD TECHNLOGIES(AWS/OCI/GCP/DEVOPS). Show all posts
Showing posts with label CLOUD TECHNLOGIES(AWS/OCI/GCP/DEVOPS). Show all posts

GIT/tree installation by chef cookbook

Install git and tree by using chef cook book

Note:yum/apt-get are resources in chef


first need to deploy server or use the chef server online create account(only for less than 5 nodes)

download chef repo after adding organization details






Then go to chef-repo and create cook book using the below commands(CMD PROMPT)

C:\Users\admin>cd C:\Users\admin\Desktop\chef-repo\cookbooks

C:\Users\admin\Desktop\chef-repo\cookbooks>chef generate cookbook linuxyum -b
C:/opscode/chefdk/embedded/lib/ruby/gems/2.6.0/gems/ffi-1.12.1-x64-mingw32/lib/ffi/struct.rb:207:in `layout': [DEPRECATION] Struct layout is already d
efined for class Windows::ServiceStructs::SERVICE_STATUS_PROCESS. Redefinition as in C:/opscode/chefdk/embedded/lib/ruby/gems/2.6.0/gems/win32-service
-2.1.4/lib/win32/windows/structs.rb:72:in `' will be disallowed in ffi-2.0. (StructuredWarnings::StandardWarning)
Generating cookbook linuxyum
- Ensuring correct cookbook content

Your cookbook is ready. Type `cd linuxyum` to enter it.

There are several commands you can run to get started locally developing and testing your cookbook.
Type `delivery local --help` to see a full list of local testing commands.

Why not start by writing an InSpec test? Tests for the default recipe are stored at:

test/integration/default/default_test.rb

If you'd prefer to dive right in, the default recipe can be found at:

recipes/default.rb






then save this file and upload to chef server by using the berks

C:\Users\admin\Desktop\chef-repo\cookbooks>berks install
No Berksfile or Berksfile.lock found at 'C:/Users/admin/Desktop/chef-repo/cookbooks'!

C:\Users\admin\Desktop\chef-repo\cookbooks>ls
TESTINGFIRSTPROJECT  chefignore  linuxyum  starter

C:\Users\admin\Desktop\chef-repo\cookbooks>cd li*

C:\Users\admin\Desktop\chef-repo\cookbooks\linuxyum>berks install
Resolving cookbook dependencies...
Fetching 'linuxyum' from source at .
Fetching cookbook index from https://supermarket.chef.io...
Using linuxyum (0.1.0) from source at .

C:\Users\admin\Desktop\chef-repo\cookbooks\linuxyum>berks upload
Uploaded linuxyum (0.1.0) to: 'https://api.chef.io/organizations/genpacts'

C:\Users\admin\Desktop\chef-repo\cookbooks\linuxyum>



Check  the cook book is uploaded in chef server then create runlist for the node(linux node)


After that we have to wait for convergence(default is 30mts),i dont want to wait and wanted to run the runlist manually

For that login to linux server and fire the below command

[ec2-user@ip-172-31-35-150 ~]$ sudo chef-client
Starting Chef Infra Client, version 15.8.23
resolving cookbooks for run list: ["linuxyum"]
Synchronizing Cookbooks:
  - linuxyum (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 2 resources
Recipe: linuxyum::default
  * yum_package[git] action install
    - install version 0:2.23.1-1.amzn2.0.1.x86_64 of package git
  * yum_package[tree] action install
    - install version 0:1.6.0-10.amzn2.0.1.x86_64 of package tree

Running handlers:
Running handlers complete
Chef Infra Client finished, 2/2 resources updated in 17 seconds
[ec2-user@ip-172-31-35-150 ~]$







Jenkins(2.204.3) install on EC2(AWS/ubuntu 18.04)

Using username "ubuntu".
Authenticating with public key "TEST"
Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-1060-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Mar  2 11:42:15 UTC 2020

  System load:  0.1               Processes:              93
  Usage of /:   49.0% of 7.69GB   Users logged in:        0
  Memory usage: 31%               IP address for eth0:    172.31.42.234
  Swap usage:   0%                IP address for docker0: 172.17.0.1

 * Multipass 1.0 is out! Get Ubuntu VMs on demand on your Linux, Windows or
   Mac. Supports cloud-init for fast, local, cloud devops simulation.

     https://multipass.run/

 * Latest Kubernetes 1.18 beta is now available for your laptop, NUC, cloud
   instance or Raspberry Pi, with automatic updates to the final GA release.

     sudo snap install microk8s --channel=1.18/beta --classic

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

2 packages can be updated.
0 updates are security updates.


Last login: Sun Mar  1 03:19:14 2020 from 157.44.232.28
ubuntu@kubernetes-worker:~$ wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
OK
ubuntu@kubernetes-worker:~$ ls
admin.conf  config  snap  temp  terraform-project
ubuntu@kubernetes-worker:~$ mkdir jenkings
ubuntu@kubernetes-worker:~$ cd jenkings
ubuntu@kubernetes-worker:~/jenkings$ ls
ubuntu@kubernetes-worker:~/jenkings$ wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
OK
ubuntu@kubernetes-worker:~/jenkings$ sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
ubuntu@kubernetes-worker:~/jenkings$ ls
ubuntu@kubernetes-worker:~/jenkings$ sudo apt update
Hit:1 https://download.docker.com/linux/ubuntu bionic InRelease
Hit:2 https://download.docker.com/linux/ubuntu xenial InRelease
Hit:3 http://ppa.launchpad.net/projectatomic/ppa/ubuntu bionic InRelease
Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:5 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease
Get:7 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Ign:8 http://pkg.jenkins.io/debian-stable binary/ InRelease
Get:9 http://pkg.jenkins.io/debian-stable binary/ Release [2044 B]
Hit:6 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
Get:10 http://pkg.jenkins.io/debian-stable binary/ Release.gpg [195 B]
Get:11 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:12 http://pkg.jenkins.io/debian-stable binary/ Packages [16.5 kB]
Fetched 271 kB in 1s (205 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
ubuntu@kubernetes-worker:~/jenkings$ sudo apt install jenkins
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  bridge-utils ubuntu-fan
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  daemon
The following NEW packages will be installed:
  daemon jenkins
0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
Need to get 63.9 MB of archives.
After this operation, 64.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic/universe amd64 daemon amd64 0.6.4-1build1 [99.5 kB]
Get:2 http://pkg.jenkins.io/debian-stable binary/ jenkins 2.204.3 [63.8 MB]
Fetched 63.9 MB in 39s (1620 kB/s)
Selecting previously unselected package daemon.
(Reading database ... 91044 files and directories currently installed.)
Preparing to unpack .../daemon_0.6.4-1build1_amd64.deb ...
Unpacking daemon (0.6.4-1build1) ...
Selecting previously unselected package jenkins.
Preparing to unpack .../jenkins_2.204.3_all.deb ...
Unpacking jenkins (2.204.3) ...
Setting up daemon (0.6.4-1build1) ...
Setting up jenkins (2.204.3) ...
Job for jenkins.service failed because the control process exited with error code.
See "systemctl status jenkins.service" and "journalctl -xe" for details.
invoke-rc.d: initscript jenkins, action "start" failed.
● jenkins.service - LSB: Start Jenkins at boot time
   Loaded: loaded (/etc/init.d/jenkins; generated)
   Active: failed (Result: exit-code) since Mon 2020-03-02 11:45:35 UTC; 10ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 17349 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)

Mar 02 11:45:35 kubernetes-worker systemd[1]: Starting LSB: Start Jenkins at boot time...
Mar 02 11:45:35 kubernetes-worker jenkins[17349]: ERROR: No Java executable found in current PATH: /bin:/usr/bin:/sbin:/usr/sbin
Mar 02 11:45:35 kubernetes-worker jenkins[17349]: If you actually have java installed on the system make sure the executable is in the aforementioned path and that 'type -p java' returns the java executable path
Mar 02 11:45:35 kubernetes-worker systemd[1]: jenkins.service: Control process exited, code=exited status=1
Mar 02 11:45:35 kubernetes-worker systemd[1]: jenkins.service: Failed with result 'exit-code'.
Mar 02 11:45:35 kubernetes-worker systemd[1]: Failed to start LSB: Start Jenkins at boot time.
dpkg: error processing package jenkins (--configure):
 installed jenkins package post-installation script subprocess returned error exit status 1
Processing triggers for systemd (237-3ubuntu10.39) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Errors were encountered while processing:
 jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
ubuntu@kubernetes-worker:~/jenkings$ java

Command 'java' not found, but can be installed with:

sudo apt install default-jre
sudo apt install openjdk-11-jre-headless
sudo apt install openjdk-8-jre-headless

ubuntu@kubernetes-worker:~/jenkings$ java -version

Command 'java' not found, but can be installed with:

sudo apt install default-jre
sudo apt install openjdk-11-jre-headless
sudo apt install openjdk-8-jre-headless

ubuntu@kubernetes-worker:~/jenkings$ sudo apt-get update
Hit:1 https://download.docker.com/linux/ubuntu bionic InRelease
Hit:2 https://download.docker.com/linux/ubuntu xenial InRelease
Hit:3 http://ppa.launchpad.net/projectatomic/ppa/ubuntu bionic InRelease
Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:5 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease
Ign:6 http://pkg.jenkins.io/debian-stable binary/ InRelease
Hit:7 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:9 http://pkg.jenkins.io/debian-stable binary/ Release
Hit:10 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:8 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
Reading package lists... Done
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
ubuntu@kubernetes-worker:~/jenkings$ java

Command 'java' not found, but can be installed with:

sudo apt install default-jre
sudo apt install openjdk-11-jre-headless
sudo apt install openjdk-8-jre-headless

ubuntu@kubernetes-worker:~/jenkings$ sudo apt-get install openjdk-8-jre-headless -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  bridge-utils ubuntu-fan
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  ca-certificates-java java-common libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libnspr4 libnss3 libpcsclite1 libxi6 libxtst6
Suggested packages:
  default-jre cups-common pcscd libnss-mdns fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei fonts-wqy-zenhei fonts-indic
The following NEW packages will be installed:
  ca-certificates-java java-common libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libnspr4 libnss3 libpcsclite1 libxi6 libxtst6
  openjdk-8-jre-headless
0 upgraded, 12 newly installed, 0 to remove and 2 not upgraded.
1 not fully installed or removed.
Need to get 29.1 MB of archives.
After this operation, 106 MB of additional disk space will be used.
Get:1 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 java-common all 0.68ubuntu1~18.04.1 [14.5 kB]
Get:2 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libavahi-common-data amd64 0.7-3.1ubuntu1.2 [22.1 kB]
Get:3 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libavahi-common3 amd64 0.7-3.1ubuntu1.2 [21.6 kB]
Get:4 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libavahi-client3 amd64 0.7-3.1ubuntu1.2 [25.2 kB]
Get:5 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcups2 amd64 2.2.7-1ubuntu2.7 [211 kB]
Get:6 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libnspr4 amd64 2:4.18-1ubuntu1 [112 kB]
Get:7 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libnss3 amd64 2:3.35-2ubuntu2.7 [1135 kB]
Get:8 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libpcsclite1 amd64 1.8.23-1 [21.3 kB]
Get:9 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libxi6 amd64 2:1.7.9-1 [29.2 kB]
Get:10 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libxtst6 amd64 2:1.2.3-1 [12.8 kB]
Get:11 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 openjdk-8-jre-headless amd64 8u242-b08-0ubuntu3~18.04 [27.5 MB]
Get:12 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 ca-certificates-java all 20180516ubuntu1~18.04.1 [12.2 kB]
Fetched 29.1 MB in 15s (1887 kB/s)
Selecting previously unselected package java-common.
(Reading database ... 91063 files and directories currently installed.)
Preparing to unpack .../00-java-common_0.68ubuntu1~18.04.1_all.deb ...
Unpacking java-common (0.68ubuntu1~18.04.1) ...
Selecting previously unselected package libavahi-common-data:amd64.
Preparing to unpack .../01-libavahi-common-data_0.7-3.1ubuntu1.2_amd64.deb ...
Unpacking libavahi-common-data:amd64 (0.7-3.1ubuntu1.2) ...
Selecting previously unselected package libavahi-common3:amd64.
Preparing to unpack .../02-libavahi-common3_0.7-3.1ubuntu1.2_amd64.deb ...
Unpacking libavahi-common3:amd64 (0.7-3.1ubuntu1.2) ...
Selecting previously unselected package libavahi-client3:amd64.
Preparing to unpack .../03-libavahi-client3_0.7-3.1ubuntu1.2_amd64.deb ...
Unpacking libavahi-client3:amd64 (0.7-3.1ubuntu1.2) ...
Selecting previously unselected package libcups2:amd64.
Preparing to unpack .../04-libcups2_2.2.7-1ubuntu2.7_amd64.deb ...
Unpacking libcups2:amd64 (2.2.7-1ubuntu2.7) ...
Selecting previously unselected package libnspr4:amd64.
Preparing to unpack .../05-libnspr4_2%3a4.18-1ubuntu1_amd64.deb ...
Unpacking libnspr4:amd64 (2:4.18-1ubuntu1) ...
Selecting previously unselected package libnss3:amd64.
Preparing to unpack .../06-libnss3_2%3a3.35-2ubuntu2.7_amd64.deb ...
Unpacking libnss3:amd64 (2:3.35-2ubuntu2.7) ...
Selecting previously unselected package libpcsclite1:amd64.
Preparing to unpack .../07-libpcsclite1_1.8.23-1_amd64.deb ...
Unpacking libpcsclite1:amd64 (1.8.23-1) ...
Selecting previously unselected package libxi6:amd64.
Preparing to unpack .../08-libxi6_2%3a1.7.9-1_amd64.deb ...
Unpacking libxi6:amd64 (2:1.7.9-1) ...
Selecting previously unselected package libxtst6:amd64.
Preparing to unpack .../09-libxtst6_2%3a1.2.3-1_amd64.deb ...
Unpacking libxtst6:amd64 (2:1.2.3-1) ...
Selecting previously unselected package openjdk-8-jre-headless:amd64.
Preparing to unpack .../10-openjdk-8-jre-headless_8u242-b08-0ubuntu3~18.04_amd64.deb ...
Unpacking openjdk-8-jre-headless:amd64 (8u242-b08-0ubuntu3~18.04) ...
Selecting previously unselected package ca-certificates-java.
Preparing to unpack .../11-ca-certificates-java_20180516ubuntu1~18.04.1_all.deb ...
Unpacking ca-certificates-java (20180516ubuntu1~18.04.1) ...
Setting up jenkins (2.204.3) ...
Job for jenkins.service failed because the control process exited with error code.
See "systemctl status jenkins.service" and "journalctl -xe" for details.
invoke-rc.d: initscript jenkins, action "start" failed.
● jenkins.service - LSB: Start Jenkins at boot time
   Loaded: loaded (/etc/init.d/jenkins; generated)
   Active: failed (Result: exit-code) since Mon 2020-03-02 11:48:38 UTC; 11ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 18959 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)

Mar 02 11:48:38 kubernetes-worker systemd[1]: Starting LSB: Start Jenkins at boot time...
Mar 02 11:48:38 kubernetes-worker jenkins[18959]: ERROR: No Java executable found in current PATH: /bin:/usr/bin:/sbin:/usr/sbin
Mar 02 11:48:38 kubernetes-worker jenkins[18959]: If you actually have java installed on the system make sure the executable is in the aforementioned path and that 'type -p java' returns the java executable path
Mar 02 11:48:38 kubernetes-worker systemd[1]: jenkins.service: Control process exited, code=exited status=1
Mar 02 11:48:38 kubernetes-worker systemd[1]: jenkins.service: Failed with result 'exit-code'.
Mar 02 11:48:38 kubernetes-worker systemd[1]: Failed to start LSB: Start Jenkins at boot time.
dpkg: error processing package jenkins (--configure):
 installed jenkins package post-installation script subprocess returned error exit status 1
Setting up libxi6:amd64 (2:1.7.9-1) ...
Setting up libpcsclite1:amd64 (1.8.23-1) ...
Setting up java-common (0.68ubuntu1~18.04.1) ...
Setting up libnspr4:amd64 (2:4.18-1ubuntu1) ...
Setting up libxtst6:amd64 (2:1.2.3-1) ...
Setting up libavahi-common-data:amd64 (0.7-3.1ubuntu1.2) ...
Setting up libnss3:amd64 (2:3.35-2ubuntu2.7) ...
Setting up libavahi-common3:amd64 (0.7-3.1ubuntu1.2) ...
Setting up libavahi-client3:amd64 (0.7-3.1ubuntu1.2) ...
Setting up libcups2:amd64 (2.2.7-1ubuntu2.7) ...
Setting up ca-certificates-java (20180516ubuntu1~18.04.1) ...
head: cannot open '/etc/ssl/certs/java/cacerts' for reading: No such file or directory
Adding debian:ACCVRAIZ1.pem
Adding debian:Atos_TrustedRoot_2011.pem
Adding debian:AC_RAIZ_FNMT-RCM.pem
Adding debian:DigiCert_Global_Root_CA.pem
Adding debian:SSL.com_Root_Certification_Authority_ECC.pem
Adding debian:GlobalSign_Root_CA_-_R3.pem
Adding debian:Certplus_Root_CA_G1.pem
Adding debian:D-TRUST_Root_Class_3_CA_2_EV_2009.pem
Adding debian:TÜRKTRUST_Elektronik_Sertifika_Hizmet_Sağlayıcısı_H5.pem
Adding debian:Network_Solutions_Certificate_Authority.pem
Adding debian:Visa_eCommerce_Root.pem
Adding debian:Hongkong_Post_Root_CA_1.pem
Adding debian:Cybertrust_Global_Root.pem
Adding debian:Chambers_of_Commerce_Root_-_2008.pem
Adding debian:COMODO_RSA_Certification_Authority.pem
Adding debian:Amazon_Root_CA_4.pem
Adding debian:thawte_Primary_Root_CA.pem
Adding debian:Microsec_e-Szigno_Root_CA_2009.pem
Adding debian:ISRG_Root_X1.pem
Adding debian:DigiCert_Assured_ID_Root_G2.pem
Adding debian:TUBITAK_Kamu_SM_SSL_Kok_Sertifikasi_-_Surum_1.pem
Adding debian:AffirmTrust_Premium_ECC.pem
Adding debian:IdenTrust_Public_Sector_Root_CA_1.pem
Adding debian:GlobalSign_Root_CA.pem
Adding debian:SwissSign_Gold_CA_-_G2.pem
Adding debian:Taiwan_GRCA.pem
Adding debian:GDCA_TrustAUTH_R5_ROOT.pem
Adding debian:DigiCert_High_Assurance_EV_Root_CA.pem
Adding debian:Amazon_Root_CA_2.pem
Adding debian:EC-ACC.pem
Adding debian:GeoTrust_Primary_Certification_Authority_-_G2.pem
Adding debian:IdenTrust_Commercial_Root_CA_1.pem
Adding debian:DigiCert_Global_Root_G2.pem
Adding debian:GeoTrust_Global_CA.pem
Adding debian:USERTrust_ECC_Certification_Authority.pem
Adding debian:T-TeleSec_GlobalRoot_Class_3.pem
Adding debian:thawte_Primary_Root_CA_-_G2.pem
Adding debian:CFCA_EV_ROOT.pem
Adding debian:SSL.com_Root_Certification_Authority_RSA.pem
Adding debian:AffirmTrust_Networking.pem
Adding debian:Certigna.pem
Adding debian:COMODO_ECC_Certification_Authority.pem
Adding debian:SecureSign_RootCA11.pem
Adding debian:GlobalSign_ECC_Root_CA_-_R5.pem
Adding debian:Entrust.net_Premium_2048_Secure_Server_CA.pem
Adding debian:Trustis_FPS_Root_CA.pem
Adding debian:Staat_der_Nederlanden_Root_CA_-_G2.pem
Adding debian:D-TRUST_Root_Class_3_CA_2_2009.pem
Adding debian:DigiCert_Trusted_Root_G4.pem
Adding debian:SSL.com_EV_Root_Certification_Authority_RSA_R2.pem
Adding debian:QuoVadis_Root_CA_1_G3.pem
Adding debian:DigiCert_Assured_ID_Root_CA.pem
Adding debian:Secure_Global_CA.pem
Adding debian:Deutsche_Telekom_Root_CA_2.pem
Adding debian:GeoTrust_Primary_Certification_Authority.pem
Adding debian:Verisign_Class_3_Public_Primary_Certification_Authority_-_G3.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_ECC_RootCA_2015.pem
Adding debian:COMODO_Certification_Authority.pem
Adding debian:Go_Daddy_Class_2_CA.pem
Adding debian:Entrust_Root_Certification_Authority_-_EC1.pem
Adding debian:OpenTrust_Root_CA_G2.pem
Adding debian:CA_Disig_Root_R2.pem
Adding debian:AffirmTrust_Commercial.pem
Adding debian:Amazon_Root_CA_1.pem
Adding debian:OISTE_WISeKey_Global_Root_GA_CA.pem
Adding debian:thawte_Primary_Root_CA_-_G3.pem
Adding debian:ePKI_Root_Certification_Authority.pem
Adding debian:DigiCert_Assured_ID_Root_G3.pem
Adding debian:certSIGN_ROOT_CA.pem
Adding debian:LuxTrust_Global_Root_2.pem
Adding debian:Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem
Adding debian:GeoTrust_Universal_CA_2.pem
Adding debian:SecureTrust_CA.pem
Adding debian:VeriSign_Universal_Root_Certification_Authority.pem
Adding debian:E-Tugra_Certification_Authority.pem
Adding debian:Security_Communication_RootCA2.pem
Adding debian:GlobalSign_ECC_Root_CA_-_R4.pem
Adding debian:SZAFIR_ROOT_CA2.pem
Adding debian:Buypass_Class_3_Root_CA.pem
Adding debian:Entrust_Root_Certification_Authority.pem
Adding debian:Starfield_Services_Root_Certificate_Authority_-_G2.pem
Adding debian:TeliaSonera_Root_CA_v1.pem
Adding debian:OpenTrust_Root_CA_G1.pem
Adding debian:TrustCor_RootCert_CA-1.pem
Adding debian:Starfield_Root_Certificate_Authority_-_G2.pem
Adding debian:Starfield_Class_2_CA.pem
Adding debian:Security_Communication_Root_CA.pem
Adding debian:TrustCor_ECA-1.pem
Adding debian:SSL.com_EV_Root_Certification_Authority_ECC.pem
Adding debian:Sonera_Class_2_Root_CA.pem
Adding debian:Izenpe.com.pem
Adding debian:DigiCert_Global_Root_G3.pem
Adding debian:QuoVadis_Root_CA_2.pem
Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem
Adding debian:QuoVadis_Root_CA_3_G3.pem
Adding debian:Certum_Trusted_Network_CA.pem
Adding debian:QuoVadis_Root_CA_3.pem
Adding debian:GeoTrust_Universal_CA.pem
Adding debian:Global_Chambersign_Root_-_2008.pem
Adding debian:NetLock_Arany_=Class_Gold=_Főtanúsítvány.pem
Adding debian:TWCA_Global_Root_CA.pem
Adding debian:Certplus_Root_CA_G2.pem
Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem
Adding debian:Amazon_Root_CA_3.pem
Adding debian:Go_Daddy_Root_Certificate_Authority_-_G2.pem
Adding debian:Comodo_AAA_Services_root.pem
Adding debian:Staat_der_Nederlanden_Root_CA_-_G3.pem
Adding debian:OpenTrust_Root_CA_G3.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2015.pem
Adding debian:AddTrust_External_Root.pem
Adding debian:TWCA_Root_Certification_Authority.pem
Adding debian:Staat_der_Nederlanden_EV_Root_CA.pem
Adding debian:T-TeleSec_GlobalRoot_Class_2.pem
Adding debian:USERTrust_RSA_Certification_Authority.pem
Adding debian:Certinomis_-_Root_CA.pem
Adding debian:Actalis_Authentication_Root_CA.pem
Adding debian:Baltimore_CyberTrust_Root.pem
Adding debian:SwissSign_Silver_CA_-_G2.pem
Adding debian:Certplus_Class_2_Primary_CA.pem
Adding debian:Certum_Trusted_Network_CA_2.pem
Adding debian:DST_Root_CA_X3.pem
Adding debian:GlobalSign_Root_CA_-_R2.pem
Adding debian:EE_Certification_Centre_Root_CA.pem
Adding debian:GeoTrust_Primary_Certification_Authority_-_G3.pem
Adding debian:QuoVadis_Root_CA.pem
Adding debian:TrustCor_RootCert_CA-2.pem
Adding debian:AffirmTrust_Premium.pem
Adding debian:Buypass_Class_2_Root_CA.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2011.pem
Adding debian:Entrust_Root_Certification_Authority_-_G2.pem
Adding debian:OISTE_WISeKey_Global_Root_GB_CA.pem
Adding debian:XRamp_Global_CA_Root.pem
Adding debian:QuoVadis_Root_CA_2_G3.pem
done.
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ca-certificates (20180409) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

done.
done.
Setting up openjdk-8-jre-headless:amd64 (8u242-b08-0ubuntu3~18.04) ...
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/jjs to provide /usr/bin/jjs (jjs) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode
Errors were encountered while processing:
 jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
ubuntu@kubernetes-worker:~/jenkings$ java
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32          use a 32-bit data model if available
    -d64          use a 64-bit data model if available
    -server       to select the "server" VM
    -zero         to select the "zero" VM
    -dcevm        to select the "dcevm" VM
                  The default VM is server.

    -cp
    -classpath
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D=
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:...|:]
    -enableassertions[:...|:]
                  enable assertions with specified granularity
    -da[:...|:]
    -disableassertions[:...|:]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:[=]
                  load native agent library , e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:[=]
                  load native agent library by full pathname
    -javaagent:[=]
                  load Java programming language agent, see java.lang.instrument
    -splash:
                  show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
ubuntu@kubernetes-worker:~/jenkings$ java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
ubuntu@kubernetes-worker:~/jenkings$ wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
OK
ubuntu@kubernetes-worker:~/jenkings$ sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
ubuntu@kubernetes-worker:~/jenkings$ sudo apt-get update
Hit:1 https://download.docker.com/linux/ubuntu bionic InRelease
Hit:2 https://download.docker.com/linux/ubuntu xenial InRelease
Get:3 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Hit:4 http://ppa.launchpad.net/projectatomic/ppa/ubuntu bionic InRelease
Ign:5 http://pkg.jenkins.io/debian-stable binary/ InRelease
Hit:7 http://pkg.jenkins.io/debian-stable binary/ Release
Hit:6 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
Hit:9 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:10 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:11 http://security.ubuntu.com/ubuntu bionic-security InRelease
Fetched 242 kB in 2s (111 kB/s)
Reading package lists... Done
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:57 and /etc/apt/sources.list.d/kubernetes.list:2
ubuntu@kubernetes-worker:~/jenkings$ sudo apt-get install jenkins -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
jenkins is already the newest version (2.204.3).
The following packages were automatically installed and are no longer required:
  bridge-utils ubuntu-fan
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up jenkins (2.204.3) ...
W: APT had planned for dpkg to do more than it reported back (0 vs 4).
   Affected packages: jenkins:amd64
ubuntu@kubernetes-worker:~/jenkings$ sudo jenkins service status
sudo: jenkins: command not found
ubuntu@kubernetes-worker:~/jenkings$ sudo jenkins service status
sudo: jenkins: command not found
ubuntu@kubernetes-worker:~/jenkings$ sudo systemctl start jenkins
ubuntu@kubernetes-worker:~/jenkings$ sudo systemctl status jenkins
● jenkins.service - LSB: Start Jenkins at boot time
   Loaded: loaded (/etc/init.d/jenkins; generated)
   Active: active (exited) since Mon 2020-03-02 11:50:13 UTC; 1min 14s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 21503 ExecStart=/etc/init.d/jenkins start (code=exited, status=0/SUCCESS)

Mar 02 11:50:12 kubernetes-worker systemd[1]: Starting LSB: Start Jenkins at boot time...
Mar 02 11:50:12 kubernetes-worker jenkins[21503]: Correct java version found
Mar 02 11:50:12 kubernetes-worker jenkins[21503]:  * Starting Jenkins Automation Server jenkins
Mar 02 11:50:12 kubernetes-worker su[21549]: Successful su for jenkins by root
Mar 02 11:50:12 kubernetes-worker su[21549]: + ??? root:jenkins
Mar 02 11:50:12 kubernetes-worker su[21549]: pam_unix(su:session): session opened for user jenkins by (uid=0)
Mar 02 11:50:12 kubernetes-worker su[21549]: pam_unix(su:session): session closed for user jenkins
Mar 02 11:50:13 kubernetes-worker jenkins[21503]:    ...done.
Mar 02 11:50:13 kubernetes-worker systemd[1]: Started LSB: Start Jenkins at boot time.
ubuntu@kubernetes-worker:~/jenkings$ sudo jenkins service status
sudo: jenkins: command not found
ubuntu@kubernetes-worker:~/jenkings$ hostname
kubernetes-worker
ubuntu@kubernetes-worker:~/jenkings$ ipconfig

Command 'ipconfig' not found, did you mean:

  command 'ifconfig' from deb net-tools
  command 'iwconfig' from deb wireless-tools
  command 'iconfig' from deb ipmiutil

Try: sudo apt install

ubuntu@kubernetes-worker:~/jenkings$ ifconfig
docker0: flags=4099  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:f6:6c:d0:af  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163  mtu 9001
        inet 172.31.42.234  netmask 255.255.240.0  broadcast 172.31.47.255
        inet6 fe80::2c:bcff:fe88:b222  prefixlen 64  scopeid 0x20
        ether 02:2c:bc:88:b2:22  txqueuelen 1000  (Ethernet)
        RX packets 553333  bytes 617299451 (617.2 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 223089  bytes 32260008 (32.2 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 5494  bytes 434865 (434.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5494  bytes 434865 (434.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ubuntu@kubernetes-worker:~/jenkings$ cat /etc/hosts
127.0.0.1 localhost
172.31.44.239   kubernetes-master
172.31.42.234   kubernetes-worker
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
ubuntu@kubernetes-worker:~/jenkings$ sudo ufw allow 8080
Rules updated
Rules updated (v6)
ubuntu@kubernetes-worker:~/jenkings$ sudo ufw status
Status: inactive
ubuntu@kubernetes-worker:~/jenkings$ sudo ufw allow OpenSSH
Rules updated
Rules updated (v6)
ubuntu@kubernetes-worker:~/jenkings$ sudo ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup
ubuntu@kubernetes-worker:~/jenkings$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
8080                       ALLOW       Anywhere
OpenSSH                    ALLOW       Anywhere
8080 (v6)                  ALLOW       Anywhere (v6)
OpenSSH (v6)               ALLOW       Anywhere (v6)

ubuntu@kubernetes-worker:~/jenkings$
Using username "ubuntu".
Authenticating with public key "TEST"
Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-1060-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Mar  2 12:03:38 UTC 2020

  System load:  0.01              Processes:              100
  Usage of /:   53.5% of 7.69GB   Users logged in:        1
  Memory usage: 51%               IP address for eth0:    172.31.42.234
  Swap usage:   0%                IP address for docker0: 172.17.0.1

 * Multipass 1.0 is out! Get Ubuntu VMs on demand on your Linux, Windows or
   Mac. Supports cloud-init for fast, local, cloud devops simulation.

     https://multipass.run/

 * Latest Kubernetes 1.18 beta is now available for your laptop, NUC, cloud
   instance or Raspberry Pi, with automatic updates to the final GA release.

     sudo snap install microk8s --channel=1.18/beta --classic

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

2 packages can be updated.
0 updates are security updates.


Last login: Mon Mar  2 11:42:16 2020 from 157.44.212.185
ubuntu@kubernetes-worker:~$ sudo systemctl status jenkins
● jenkins.service - LSB: Start Jenkins at boot time
   Loaded: loaded (/etc/init.d/jenkins; generated)
   Active: active (exited) since Mon 2020-03-02 11:50:13 UTC; 13min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 21503 ExecStart=/etc/init.d/jenkins start (code=exited, status=0/SUCCESS)

Mar 02 11:50:12 kubernetes-worker systemd[1]: Starting LSB: Start Jenkins at boot time...
Mar 02 11:50:12 kubernetes-worker jenkins[21503]: Correct java version found
Mar 02 11:50:12 kubernetes-worker jenkins[21503]:  * Starting Jenkins Automation Server jenkins
Mar 02 11:50:12 kubernetes-worker su[21549]: Successful su for jenkins by root
Mar 02 11:50:12 kubernetes-worker su[21549]: + ??? root:jenkins
Mar 02 11:50:12 kubernetes-worker su[21549]: pam_unix(su:session): session opened for user jenkins by (uid=0)
Mar 02 11:50:12 kubernetes-worker su[21549]: pam_unix(su:session): session closed for user jenkins
Mar 02 11:50:13 kubernetes-worker jenkins[21503]:    ...done.
Mar 02 11:50:13 kubernetes-worker systemd[1]: Started LSB: Start Jenkins at boot time.
ubuntu@kubernetes-worker:~$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
e78342f0ad7b4f83afadf7262ecada41
ubuntu@kubernetes-worker:~$

then logged into below url and unlocked the jenkins by using the initialAdminPassword
http://3.6.243.42:8080/

After that created admin user for jenkins along with new password

Now able to create the all jenkin jobs


######Enjoy Learning######




ISSUE:

after this got the error

Getting HTTP Error 504: Gateway Timeout


Fix:

changed the etnries in SG(secruityGroup)
inbound and outbound rules edited



Terraform


Terraform installation via wget

ubuntu@kubernetes-worker:~/terraform-project/terrformcfg/base/basevaribale$ wget https://releases.hashicorp.com/terraform/0.8.0/terraform_0.8.0_linux_amd64.zip

Then unzip the directory and update in bash profile.

you can strat with terraform version command to check version

ubuntu@kubernetes-worker:~/terraform-project/terrformcfg/base/basevaribale$ terraform version
Terraform v0.12.21



Installing via configuration management
There are also configuration management resources available for installing Terraform.
You can find:
• A Puppet module for Terraform.
• A Chef cookbook for Terraform.
• An Ansible role for Terraform.
• A Terraform Docker container.
Getting started


Terraform  (init/apply/plan/validate)
https://www.terraform.io/docs/providers/aws/r/instance.html

ubuntu@kubernetes-worker:~/terraform-project/terrformcfg/base$ ################INITILIZATION OF AWS IN TERRAFORM###################
ubuntu@kubernetes-worker:~/terraform-project/terrformcfg/base$ cat base.tf
provider "aws" {
region     = "ap-south-1"
access_key = "AKIAJCQWLV3LYUWPIQVQ"
secret_key = "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"
}

resource "aws_instance" "lava" {
  ami           = "ami-0d9462a653c34dab7"
  instance_type = "t2.micro"
  key_name      = "TEST"
}

resource "aws_eip" "lavaeip" {

instance = "aws_instance.lava.id"

  vpc = true


}




ubuntu@kubernetes-worker:~/terraform-project/terrformcfg/base$ terraform init

Initializing the backend...

Initializing provider plugins...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.aws: version = "~> 2.50"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
ubuntu@kubernetes-worker:~/terraform-project/terrformcfg/base$ terraform validate
Success! The configuration is valid.

ubuntu@kubernetes-worker:~/terraform-project/terrformcfg/base$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.


------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # aws_eip.lavaeip will be created
  + resource "aws_eip" "lavaeip" {
      + allocation_id     = (known after apply)
      + association_id    = (known after apply)
      + domain            = (known after apply)
      + id                = (known after apply)
      + instance          = "aws_instance.lava.id"
      + network_interface = (known after apply)
      + private_dns       = (known after apply)
      + private_ip        = (known after apply)
      + public_dns        = (known after apply)
      + public_ip         = (known after apply)
      + public_ipv4_pool  = (known after apply)
      + vpc               = true
    }

  # aws_instance.lava will be created
  + resource "aws_instance" "lava" {
      + ami                          = "ami-0d9462a653c34dab7"
      + arn                          = (known after apply)
      + associate_public_ip_address  = (known after apply)
      + availability_zone            = (known after apply)
      + cpu_core_count               = (known after apply)
      + cpu_threads_per_core         = (known after apply)
      + get_password_data            = false
      + host_id                      = (known after apply)
      + id                           = (known after apply)
      + instance_state               = (known after apply)
      + instance_type                = "t2.micro"
      + ipv6_address_count           = (known after apply)
      + ipv6_addresses               = (known after apply)
      + key_name                     = "TEST"
      + network_interface_id         = (known after apply)
      + password_data                = (known after apply)
      + placement_group              = (known after apply)
      + primary_network_interface_id = (known after apply)
      + private_dns                  = (known after apply)
      + private_ip                   = (known after apply)
      + public_dns                   = (known after apply)
      + public_ip                    = (known after apply)
      + security_groups              = (known after apply)
      + source_dest_check            = true
      + subnet_id                    = (known after apply)
      + tenancy                      = (known after apply)
      + volume_tags                  = (known after apply)
      + vpc_security_group_ids       = (known after apply)

      + ebs_block_device {
          + delete_on_termination = (known after apply)
          + device_name           = (known after apply)
          + encrypted             = (known after apply)
          + iops                  = (known after apply)
          + kms_key_id            = (known after apply)
          + snapshot_id           = (known after apply)
          + volume_id             = (known after apply)
          + volume_size           = (known after apply)
          + volume_type           = (known after apply)
        }

      + ephemeral_block_device {
          + device_name  = (known after apply)
          + no_device    = (known after apply)
          + virtual_name = (known after apply)
        }

      + network_interface {
          + delete_on_termination = (known after apply)
          + device_index          = (known after apply)
          + network_interface_id  = (known after apply)
        }

      + root_block_device {
          + delete_on_termination = (known after apply)
          + encrypted             = (known after apply)
          + iops                  = (known after apply)
          + kms_key_id            = (known after apply)
          + volume_id             = (known after apply)
          + volume_size           = (known after apply)
          + volume_type           = (known after apply)
        }
    }

Plan: 2 to add, 0 to change, 0 to destroy.

------------------------------------------------------------------------

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.

ubuntu@kubernetes-worker:~/terraform-project/terrformcfg/base$ terraform plan -out lava.plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.


------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # aws_eip.lavaeip will be created
  + resource "aws_eip" "lavaeip" {
      + allocation_id     = (known after apply)
      + association_id    = (known after apply)
      + domain            = (known after apply)
      + id                = (known after apply)
      + instance          = "aws_instance.lava.id"
      + network_interface = (known after apply)
      + private_dns       = (known after apply)
      + private_ip        = (known after apply)
      + public_dns        = (known after apply)
      + public_ip         = (known after apply)
      + public_ipv4_pool  = (known after apply)
      + vpc               = true
    }

  # aws_instance.lava will be created
  + resource "aws_instance" "lava" {
      + ami                          = "ami-0d9462a653c34dab7"
      + arn                          = (known after apply)
      + associate_public_ip_address  = (known after apply)
      + availability_zone            = (known after apply)
      + cpu_core_count               = (known after apply)
      + cpu_threads_per_core         = (known after apply)
      + get_password_data            = false
      + host_id                      = (known after apply)
      + id                           = (known after apply)
      + instance_state               = (known after apply)
      + instance_type                = "t2.micro"
      + ipv6_address_count           = (known after apply)
      + ipv6_addresses               = (known after apply)
      + key_name                     = "TEST"
      + network_interface_id         = (known after apply)
      + password_data                = (known after apply)
      + placement_group              = (known after apply)
      + primary_network_interface_id = (known after apply)
      + private_dns                  = (known after apply)
      + private_ip                   = (known after apply)
      + public_dns                   = (known after apply)
      + public_ip                    = (known after apply)
      + security_groups              = (known after apply)
      + source_dest_check            = true
      + subnet_id                    = (known after apply)
      + tenancy                      = (known after apply)
      + volume_tags                  = (known after apply)
      + vpc_security_group_ids       = (known after apply)

      + ebs_block_device {
          + delete_on_termination = (known after apply)
          + device_name           = (known after apply)
          + encrypted             = (known after apply)
          + iops                  = (known after apply)
          + kms_key_id            = (known after apply)
          + snapshot_id           = (known after apply)
          + volume_id             = (known after apply)
          + volume_size           = (known after apply)
          + volume_type           = (known after apply)
        }

      + ephemeral_block_device {
          + device_name  = (known after apply)
          + no_device    = (known after apply)
          + virtual_name = (known after apply)
        }

      + network_interface {
          + delete_on_termination = (known after apply)
          + device_index          = (known after apply)
          + network_interface_id  = (known after apply)
        }

      + root_block_device {
          + delete_on_termination = (known after apply)
          + encrypted             = (known after apply)
          + iops                  = (known after apply)
          + kms_key_id            = (known after apply)
          + volume_id             = (known after apply)
          + volume_size           = (known after apply)
          + volume_type           = (known after apply)
        }
    }

Plan: 2 to add, 0 to change, 0 to destroy.

------------------------------------------------------------------------

This plan was saved to: lava.plan

To perform exactly these actions, run the following command to apply:
    terraform apply "lava.plan"

ubuntu@kubernetes-worker:~/terraform-project/terrformcfg/base$


ubuntu@kubernetes-worker:~/terraform-project/terrformcfg/base/basevaribale$ ls -ltr
total 20
-rw-rw-r-- 1 ubuntu ubuntu 2044 Feb 29 10:00 basevar.plan
-rw-rw-r-- 1 ubuntu ubuntu 2876 Feb 29 10:15 terraform.tfstate.backup
-rw-rw-r-- 1 ubuntu ubuntu  157 Feb 29 10:27 terraform.tfstate
-rw-rw-r-- 1 ubuntu ubuntu  540 Feb 29 10:30 var.tf
-rw-rw-r-- 1 ubuntu ubuntu  206 Feb 29 10:49 basevar.tf


***terraform.tfstate file will be take backup automatically before we execute terraform apply***

To find out the terraform version?
ubuntu@kubernetes-worker:~/terraform-project/terrformcfg/base/basevaribale$ terraform version
Terraform v0.12.21
+ provider.aws v2.51.0

Set path in linux/ubuntu

ubuntu@kubernetes-worker:~$ cat .bash_profile
export PATH=${PATH}:/home/ubuntu/terraform-project

ubuntu@kubernetes-worker:~$


****Variable's Declaration method***
ubuntu@kubernetes-worker:~/terraform-project/terrformcfg/base/basevaribale$ cat basevar.tf
provider "aws" {
access_key = var.access_key
secret_key = var.secret_key
region = var.region
}
resource "aws_instance" "TESTING" {
ami = var.ami
instance_type=var.instype
security_groups = var.secgroup
}

*****Create variable file with extension of Tf***
Note:For default type of variables no need to provide type parameter seprately.
ubuntu@kubernetes-worker:~/terraform-project/terrformcfg/base/basevaribale$ cat var.tf
variable "access_key" {
description = "The AWS access key."
default="AKIAJCQWLV3LYUWPIQVQ"
}
variable "secret_key" {
description = "The AWS secret key."
default = "InkKtKGUkRKMD4eDMaXPcfNK1h6NpPu+3hwq8w6L"
}
variable "region" {
description = "The AWS region."
default = "ap-south-1"
}
variable "ami" {
description = " the required ami "
default = "ami-0d9462a653c34dab7"
}
variable "instype" {
description = " select the instancetype"
default = "t2.micro"
}
variable "secgroup" {
description = "select the tuflee secgroup"   
type = string  ###this will ask parameter value in run time####
}

Type constraint:

it is used restrict all unwanted values and allows the required value from variable which is declared in var.tf




Type constraints are created from a mixture of type keywords and type constructors. The supported type keywords are:
The type constructors allow you to specify complex types such as collections:




The name of a variable can be any valid identifier except the following:

AES S3 bucket integrate as mount in EC2 instance

NOTE:https://howto.lintel.in/how-to-mount-aws-s3-bucket-on-linux/

After creation Ec2 instance

yum -y install automake fuse fuse-devel gcc-c++ libcurl-devel libxml2-devel make openssl-dev
el


sudo yum install git

Complete!
[root@ip-172-31-41-86 ~]# git clone https://github.com/s3fs-fuse/s3fs-fuse.git
Cloning into 's3fs-fuse'...
remote: Enumerating objects: 37, done.
remote: Counting objects: 100% (37/37), done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 5876 (delta 16), reused 17 (delta 6), pack-reused 5839
Receiving objects: 100% (5876/5876), 3.53 MiB | 2.86 MiB/s, done.
Resolving deltas: 100% (4067/4067), done.
[root@ip-172-31-41-86 ~]# ^C
[root@ip-172-31-41-86 ~]# ls
s3fs-fuse
[root@ip-172-31-41-86 ~]# cd s*
[root@ip-172-31-41-86 s3fs-fuse]# ls
AUTHORS  autogen.sh  ChangeLog  COMPILATION.md  configure.ac  COPYING  doc  INSTALL  Makefile.am  README.md  src  test
[root@ip-172-31-41-86 s3fs-fuse]#  ./autogen.sh
--- Make commit hash file -------
--- Finished commit hash file ---
--- Start autotools -------------
configure.ac:26: installing './config.guess'
configure.ac:26: installing './config.sub'
configure.ac:27: installing './install-sh'
configure.ac:27: installing './missing'
src/Makefile.am: installing './depcomp'
parallel-tests: installing './test-driver'
--- Finished autotools ----------
[root@ip-172-31-41-86 s3fs-fuse]# ./configure
checking for sys/xattr.h... yes
checking attr/xattr.h usability... no
checking attr/xattr.h presence... no
checking for attr/xattr.h... no
checking sys/extattr.h usability... no
checking sys/extattr.h presence... no
checking for sys/extattr.h... no
checking s3fs build with nettle(GnuTLS)... no
checking s3fs build with OpenSSL... no
checking s3fs build with GnuTLS... no
checking s3fs build with NSS... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for common_lib_checking... yes
checking compile s3fs with... OpenSSL
checking for DEPS... no
configure: error: Package requirements (fuse >= 2.8.4 libcurl >= 7.0 libxml-2.0 >= 2.6 libcrypto >= 0.9 ) were not met:

No package 'libcrypto' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables DEPS_CFLAGS
and DEPS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
[root@ip-172-31-41-86 s3fs-fuse]# make**FAILED**

mkdir -p /var/s3fs-demo-fs
[root@ip-172-31-41-86 s3fs-fuse]#
[root@ip-172-31-41-86 s3fs-fuse]# aws s3 mb s3://s3fs-demobk
make_bucket: s3fs-demobk
[root@ip-172-31-41-86 s3fs-fuse]# s3fs s3fs-demobk /var/s3fs-demo-fs -o iam_role-ec2t
os3
-bash: s3fs: command not found
[root@ip-172-31-41-86 s3fs-fuse]# bash
[root@ip-172-31-41-86 s3fs-fuse]# s3fs
bash: s3fs: command not found

###FIX S3FS NOT FOUND###
yum install gcc libstdc++-devel gcc-c++ curl-devel libxml2-devel openssl-devel mailcap fuse fuse-devel
wget http://s3fs.googlecode.com/files/s3fs-1.61.tar.gz
tar xvzf s3fs-1.61.tar.gz
cd s3fs-1.61/
./configure --prefix=/usr
make
make install
vim  /etc/passwd-s3fs
chmod 640 /etc/passwd-s3fs
s3fs yourBucketNameHere /mnt


s3fs s3fs-demobk /var/s3fs-demo-fs -o iam_role_ec2tos3

to fix passwd-s3fs issue need to enter the accessid and key id


Access Key ID:AKIAJVTBI7PNBULL4XSA
Secret Access Key:OFKq1LcUkuBQ0BYF9oenCkZ/+EoQ8SrScwlD6Y2i

AKIAJVTBI7PNBULL4XSA:OFKq1LcUkuBQ0BYF9oenCkZ/+EoQ8SrScwlD6Y2i

s3fs s3fs-demobk /var/s3fs-demo-fs -o asswd_file=/etc/passwd-s3fs

syntax --->s3fs mybucketname /path/to/mountpoint -o passwd_file=/etc/passwd-s3fs