Skip to content

Instantly share code, notes, and snippets.

@spy86
Last active June 7, 2022 15:58
Show Gist options
  • Save spy86/1dc4ffec020f6386c0f84e667a4e37d2 to your computer and use it in GitHub Desktop.
Save spy86/1dc4ffec020f6386c0f84e667a4e37d2 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "DOCKER and DOCKER-COMPOSE"
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
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
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
##################################################################
echo "ANSIBLE"
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible -y
sudo apt-get install python python3-pip -y
sudo sed -i 's|[#]*PasswordAuthentication no|PasswordAuthentication yes|g' /etc/ssh/sshd_config
sudo sed -i 's|[#]PermitRootLogin prohibit-password|PermitRootLogin yes|g' /etc/ssh/sshd_config
sudo echo "[Servers]" >> /etc/ansible/hosts
sudo echo "127.0.0.1" >> /etc/ansible/hosts
sudo pip3 install docker docker-compose
service ssh restart
##################################################################
echo "MAVEN"
sudo apt-get install maven -y
##################################################################
echo 'NODEJS'
sudo apt install curl -y
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs
sudo apt-get install gcc g++ make
dpkg -l | grep nodejs
node -v
npm -v
##################################################################
echo 'JENKINS'
sudo wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install openjdk-11-jdk jenkins -y
sudo systemctl enable jenkins
sudo systemctl start jenkins
sudo usermod -a -G docker jenkins
##################################################################
echo 'SONARQUBE'
sudo apt-get install  
sudo apt-get install unzip zip -y
sudo wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-9.4.0.54424.zip
sudo unzip sonarqube-9.4.0.54424.zip
sudo mv sonarqube-9.4.0.54424 /opt/sonarqube
sudo groupadd sonar
sudo useradd -d /opt/sonarqube -g sonar sonar
sudo chown sonar:sonar /opt/sonarqube -R
sudo sed -i 's|[#]RUN_AS_USER=|RUN_AS_USER=sonar|g' /opt/sonarqube/bin/linux-x86-64/sonar.sh
sudo echo "[Unit]" > /etc/systemd/system/sonar.service
sudo echo "Description=SonarQube service" >> /etc/systemd/system/sonar.service
sudo echo "After=syslog.target network.target" >> /etc/systemd/system/sonar.service
sudo echo "" >> /etc/systemd/system/sonar.service
sudo echo "[Service]" >> /etc/systemd/system/sonar.service
sudo echo "Type=forking" >> /etc/systemd/system/sonar.service
sudo echo "" >> /etc/systemd/system/sonar.service
sudo echo "ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start" >> /etc/systemd/system/sonar.service
sudo echo "ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop" >> /etc/systemd/system/sonar.service
sudo echo "User=sonar" >> /etc/systemd/system/sonar.service
sudo echo "Group=sonar" >> /etc/systemd/system/sonar.service
sudo echo "Restart=always" >> /etc/systemd/system/sonar.service
sudo echo "" >> /etc/systemd/system/sonar.service
sudo echo "LimitNOFILE=65536" >> /etc/systemd/system/sonar.service
sudo echo "LimitNPROC=4096" >> /etc/systemd/system/sonar.service
sudo echo "" >> /etc/systemd/system/sonar.service
sudo echo "[Install]" >> /etc/systemd/system/sonar.service
sudo echo "WantedBy=multi-user.target" >> /etc/systemd/system/sonar.service
sudo systemctl enable sonar
sudo systemctl start sonar
sudo rm -rf sonarqube-9.4.0.54424.zip
##################################################################
echo 'SONAR-SCANNER'
sudo wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip
sudo unzip sonar-scanner-cli-4.7.0.2747-linux.zip
sudo mv sonar-scanner-4.7.0.2747-linux /opt/sonar-scanner
sudo sed -i 's|[#]sonar.host.url=http://localhost:9000|sonar.host.url=http://localhost:9000|g' /opt/sonar-scanner/conf/sonar-scanner.properties
sudo sed -i 's|[#]sonar.sourceEncoding=UTF-8|sonar.sourceEncoding=UTF-8|g' /opt/sonar-scanner/conf/sonar-scanner.properties
sudo chmod -R 755 /opt/sonar-scanner
sudo rm -rf sonar-scanner-cli-4.7.0.2747-linux.zip
##################################################################
echo '#########################END SCRIPT#########################'
echo '######## JENKINS : http://127.0.0.1:8080 ########'
echo '######## SONARQUBE : http://127.0.0.1:9000 ########'
echo '############################################################'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment