awssonarqube

Upgrade SonarQube

It is strongly recommended that you create a backup before starting the update process. If you have important data, it is advisable that you try to create and restore a backup to ensure that everything works properly.

  • Log in to the server console.

  • Create a directory to save all the data you need to backup.

     $ mkdir ~/sonarqube-backup
     $ mkdir ~/sonarqube-backup/httpd
     $ mkdir ~/sonarqube-backup/httpd-ssl
     $ mkdir ~/sonarqube-backup/sonarqube
    
  • Back up the bitnami_sonarqube database as described on the PostgreSQL page.

  • Copy the SonarQube configuration directory to your backup directory:

     $ sudo cp -rf /opt/bitnami/sonarqube/conf/* ~/sonarqube-backup/sonarqube
    
  • Compress the backup directory.

     $ tar cfz sonarqube-backup.tar.gz ~/sonarqube-backup
    
  • Download the backup files sonarqube-backup.tar.gz and backup.sql using SFTP. Refer to the FAQ for more information on this.

  • Launch a new SonarQube server.

  • Upload via SFTP the backups files sonarqube-backup.tar.gz and backup.sql to the new server. Refer to the FAQ for more information on this.

  • Log in to the server console.

  • Restore the database backup as described on the PostgreSQL page.

  • Update the contents of the sonar.properties and wrapper.conf configuration files inside the SonarQube /opt/bitnami/sonarqube/conf directory, with the settings of the related files in the sonarqube-backup/sonarqube backup directory. To do so, use an editor to modify them with the old settings (Web server URL, database, LDAP settings, …).

    IMPORTANT: Edit the settings files manually. Do not copy-paste the old files.

  • Check if the plugins installed on the old stack are compatible with the new version of SonarQube by consulting the SonarQube compatibility Matrix. If any of them are incompatible, you will need to install the latest version of these plugins manually as described in the Manual Plugins installation instructions.

  • Restart SonarQube:

     $ sudo /opt/bitnami/ctlscript.sh restart sonarqube
    
  • Browse to http://SERVER-IP/setup and follow the setup instructions (SERVER-IP is a placeholder that you should replace with the actual domain name or IP address of your SonarQube server).

  • Analyze your projects (and compute your Views if you are the owner of the governance product) to get fresh data.

Upgrade only SonarQube in the Bitnami package for SonarQube™

Download the new version of SonarQube

  • Log in to the server console.

  • Browse to https://www.sonarqube.org/downloads/ and find the link for the latest version of SonarQube.

  • Download the latest version using the link obtained in the previous step. For example (for version 9.0.0), run the commands below:

      $ wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-9.0.0.45539.zip
      $ unzip sonarqube-9.0.0.45539.zip
    

Backup the current SonarQube installation

  • Backup your current SonarQube installation. To do that, use the command:

      $ sudo mv /opt/bitnami/sonarqube /opt/bitnami/sonarqube-backup
    
  • Substitute your old installation with the new version. To do so, execute the following command:

      $ sudo mv ~/sonarqube-9.0.0.45539/ /opt/bitnami/sonarqube
    
  • Update the contents of the /opt/bitnami/sonarqube/conf/sonar.properties and /opt/bitnami/sonarqube/conf/wrapper.conf files with the settings of the related files in the /opt/bitnami/sonarqube-backup/conf backup directory. To do so, use an editor to modify them with the old settings (web server URL, database, LDAP settings, etc.).

    IMPORTANT: Edit the settings files manually. Do not copy-paste the old files.

  • Restore the permissions.

      $ sudo chown -R sonarqube:root /opt/bitnami/sonarqube
    

Check that the upgrade succeeded

  • Check if the plugins installed on the old stack are compatible with the new version of SonarQube by consulting the SonarQube compatibility Matrix. If any of them are incompatible, you need to install manually the latest version of these plugins as described in the Manual Plugins installation instructions.

  • Restart SonarQube:

     $ sudo /opt/bitnami/ctlscript.sh restart sonarqube
    
  • Browse to http://SERVER-IP/setup and follow the setup instructions (SERVER-IP is a placeholder that you should replace with the actual domain name or IP address of your SonarQube server).

  • Analyze your projects (and compute your Views if you own the Governance product) to get fresh data.

Last modification February 9, 2023