Advertisement
gnubyte

Misc Full

Jan 30th, 2018
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.58 KB | None | 0 0
  1. # @Title: 2SH2IDX_Setup
  2. # @Purpose: copy and paste-able instructions
  3. # @Date: 01-18-2018
  4. # @Author: Patrick Hastings
  5. # @Notes: Rinse and repeat for each Server.
  6. ############# Server Update and my text editor of personal choice #####
  7. sudo yum update -y
  8. sudo yum install nano -y && sudo yum update -y
  9.  
  10. # ------------------------------------------------------
  11. ############### RHEL SPLUNK INSTALL #####################
  12. wget -O splunk-7.0.1-2b5b15c4ee89-linux-2.6-x86_64.rpm 'https://www.splunk.com/bin/splunk/DownloadActivityServlet?architecture=x86_64&platform=linux&version=7.0.1&product=splunk&filename=splunk-7.0.1-2b5b15c4ee89-linux-2.6-x86_64.rpm&wget=true'
  13. sudo rpm -i splunk-
  14. export SPLUNK_HOME=/opt/splunk/
  15. sudo su
  16. chown -R splunk:splunk /opt/splunk
  17. # cd /opt/splunk/bin
  18. cd /opt/splunk/bin && ./splunk start --accept-license
  19. ./splunk edit user admin -password PASSWORD -role admin -auth admin:changeme
  20. /opt/splunk/bin/splunk enable boot-start -user splunk
  21. shutdown -r 0
  22.  
  23. # on search heads ONLY...If AWS, USE PRIVATE IP!
  24. sudo ./splunk add search-server <intended IDX1 | IDX2 ip>:8089 -auth admin:PASSWORD -remoteUsername admin -remotePassword PASSWORD
  25.  
  26. ############## Useful for reloading deploy and restarting splunk ##########
  27. /opt/splunk/bin/splunk restart
  28. /opt/splunk/bin/splunk reload deploy-server
  29. # add search-server adds search-peers (indexers) to search from
  30.  
  31. # ------------------------------------------------------
  32. ############### Verifying who is running Splunk ###############
  33. cd ~
  34. sudo su
  35. sudo su splunk
  36. #logging in as splunk...
  37. chown -R splunk:splunk /opt/splunk
  38. # ps reports a snapshot of the current processes
  39. # grep returns strings matching the param pattern(string in this case)
  40. ps -eaf | grep splunk
  41. # check for who is running splunk(what user)
  42.  
  43.  
  44. # ------------------------------------------------------
  45. ### IF PASSWORD NEED RESET FOR SPLUNK....
  46. # rename the password to passwd.bak for backup purposes....
  47. mv /opt/splunk/etc/passwd /opt/splunk/etc/passwd.BAK
  48. cd /opt/splunk/bin && ./splunk restart
  49. # restart splunk so it can check for that file and create a new passwd file
  50.  
  51. # ------------------------------------------------------
  52. ##### Other Useful Tidbits ######
  53.  
  54. cd /opt/splunk/bin && ./splunk restart
  55.  
  56.  
  57. # ---------------------
  58. # if same hostname because using AMI...
  59. # Changes hostname
  60.  
  61. #enter role and number
  62. sudo nano /etc/sysconfig/network
  63. sudo reboot
  64. hostname
  65. # confirm hostname value is different
  66.  
  67.  
  68. # Combining the dumb stuff I have to paste 4x times.....
  69. sudo su && cd/opt/splunk/bin
  70. hostname -v PH-Dist01.localhost.com
  71. sudo hostname -b PH-IDX02.local
  72. nano /opt/splunk/etc/system/local/server.conf
  73.  
  74. # ---------------------
  75. # Expanding the File system after EBS expansion
  76.  
  77.  
  78. sudo file -s /dev/xvd*
  79. # list file system data for analysis
  80.  
  81. lsblk
  82. # list the block devices attached to your instance
  83.  
  84. df -h
  85. # report existing disk space used
  86.  
  87. # recommended by AWS Team....but if using an AMI from them it automatically does this on reboot
  88. sudo growpart /dev/xvdf 1
  89.  
  90.  
  91. lsblk
  92. # confirm changes now
  93. df -h
  94. # ------------------------------------------------------
  95. ######### editing inputs for configuration to change HOST in Splunk ##########
  96. sudo su
  97. nano /opt/splunk/etc/system/local/inputs.conf
  98. # switch your ip from last known to current actual ip
  99.  
  100. # -------------------------------------------------------
  101. ######## Cleaning event data ###########
  102. cd /opt/splunk/bin/ && ./splunk stop
  103. ./splunk clean eventdata
  104. # fishbucket will error out, clean it the old fashioned way
  105. rm -r /opt/splunk/var/lib/splunk/fishbucket/.*
  106. shutdown -r 0
  107.  
  108.  
  109. ######## Environment variable ########
  110. export SPLUNK_HOME=/opt/splunk
  111. export PATH=$SPLUNK_HOME/bin:$PATH
  112. export -p
  113.  
  114. ######## Verifying groups ##########
  115. groups splunk
  116.  
  117.  
  118.  
  119. ######### Moving a file over SFTP ############
  120. scp -C -i FILE /Users/patrickhastings/Downloads/base_configurations/PH_all_deploymentclient.zip ec2-user@54.190.40.11:~
  121.  
  122.  
  123. ######### Once on server for deployment app run these commands ##########
  124.  
  125.  
  126.  
  127. ######### Removing coloring of ls command ###########
  128. unalias ls
  129.  
  130.  
  131.  
  132.  
  133. ########## See history of last commands run #############
  134. history
  135.  
  136.  
  137. ########### Follow file changes ###############
  138. tail -f /path/to/file/fileName.txtHere
  139. sudo tail -f /opt/splunk/var/log/splunk/splunkd.log
  140.  
  141. ########### Getting process information #########
  142. ps
  143. # ps is process status
  144. # -a is display information about other users processes including those without terminals
  145. # -e is i a tag for the same thing as A.
  146. # -f displays the UID, PID, parent PID, recent CPU usage, process start time, controlling tty, elapsed CPU usage, and associated command
  147.  
  148.  
  149. exit
  150. sudo su
  151. sudo su splunk
  152. sudo chown -R splunk:splunk /opt/splunk
  153. /opt/splunk/bin/splunk start
  154.  
  155.  
  156.  
  157. ########## Creating Deployment Server ##############
  158.  
  159. # 1. Move Deployment and Forwarder output files to deployment server
  160. scp -C -i FILE.pem /Users/patrickhastings/Temp/hw2/base_configurations\ 2/PH_all_deploymentclient.zip ec2-user@34.215.181.210:~
  161. scp -C -i FILE.pem /Users/patrickhastings/Temp/hw2/base_configurations\ 2/PH_all_forwarder_outputs.zip ec2-user@34.215.181.210:~
  162.  
  163. # 2. Move the apps, on the deployment server, to apps deployment
  164. unzip PH_all_deploymentclient && sudo mv PH_all_deploymentclient /opt/splunk/etc/apps
  165. unzip PH_all_forwarder_outputs
  166. sudo mv PH_all_deploymentclient /opt/splunk/etc/apps
  167. sudo su splunk
  168. /opt/splunk/bin/splunk restart
  169. sudo mv PH_all_forwarder_outputs /opt/splunk/etc/deployment-apps
  170. sudo mv PH_all_deploymentclient /opt/splunk/etc/deployment-apps
  171. sudo /opt/splunk/bin/splunk restart
  172. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement