SonarQube Installation on EC2

KALPESH MOHANTAKALPESH MOHANTA
1 min read

Install SonarQube in the /opt directory on Ubuntu, follow these steps:

  1. Update Package List and Install Dependencies:

     sudo apt update -y
     sudo apt install openjdk-11-jdk wget unzip
    
  2. Download SonarQube: Visit the SonarQube download page to get the latest version URL or use the command below for a specific version. For example:

     wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-9.6.1.62043.zip
    
  3. Extract the Downloaded File:

     sudo unzip sonarqube-9.6.1.62043.zip -d /opt
    
  4. Create a SonarQube User (Optional but recommended for security):

     sudo useradd --system --home /opt/sonarqube --shell /bin/false sonarqube
    
  5. Change Ownership of the SonarQube Directory:

     sudo chown -R sonarqube:sonarqube /opt/sonarqube-9.6.1.62043
    
  6. Configure SonarQube: Edit the sonar.properties file to set up SonarQube (e.g., database configuration, web server ports, user & passwd):

     sudo vi /opt/sonarqube-9.6.1.62043/conf/sonar.properties
    
  7. Create a Systemd Service File: Create a service file for SonarQube to manage it as a systemd service:

     sudo vi /etc/systemd/system/sonarqube.service
    

    Add the following content:

     [Unit]
     Description=SonarQube
     After=syslog.target network.target
    
     [Service]
     Type=forking
     User=sonarqube
     Group=sonarqube
     ExecStart=/opt/sonarqube-9.6.1.62043/bin/linux-x86-64/sonar.sh start
     ExecStop=/opt/sonarqube-9.6.1.62043/bin/linux-x86-64/sonar.sh stop
     LimitNOFILE=65536
     LimitNPROC=8192
     Restart=always
    
     [Install]
     WantedBy=multi-user.target
    
  8. Reload Systemd and Start SonarQube:

     bashCopy codesudo systemctl daemon-reload
     sudo systemctl start sonarqube
     sudo systemctl enable sonarqube
    
  9. Access SonarQube at http://<public IP>:9000

Feel free to share and spread the knowledge! ๐ŸŒŸ๐Ÿ˜Š Enjoy Learning! ๐Ÿ˜Š

0
Subscribe to my newsletter

Read articles from KALPESH MOHANTA directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

KALPESH MOHANTA
KALPESH MOHANTA

๐Ÿ‘‹ Hi there! Welcome to my DevOps adventure! ๐Ÿš€ I'm Kalpesh, a DevOps Engineer, and I'm thrilled to share my journey in the dynamic world of DevOps and Cloud Technologies. ๐ŸŒ ๐Ÿ”ง Tech Arsenal: CI/CD Automation: Streamlining workflows for seamless deployments. Containers & Orchestration: Docker & Kubernetes. Cloud Platforms: Azure, AWS. Version Control: Git. Configuration Management: YAML, Linux commands. ๐Ÿš€ My Journey: I've had the privilege to work on diverse projects, including a notable deployment for PepsiCo. My expertise spans CI/CD automation, containerization, cloud services, and scripting to enhance system performance and reliability. ๐Ÿ’ก Why Follow Me? Join me as I delve into: Cutting-edge DevOps practices. Automation techniques. Cloud innovations. Tips & tricks for aspiring DevOps professionals. ๐Ÿค Connect & Collaborate: Let's build, learn, and innovate together. Whether you're a fellow tech enthusiast, a professional looking to share insights, or someone eager to learn, let's connect and grow in this vibrant community. ๐Ÿ“ข Follow my LinkedIn & Hashnode blog for insights, tutorials, and updates. Together, we'll embrace the ever-evolving DevOps landscape!