virtualMachineespocrm

Upgrade EspoCRM

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

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.

Approach A (Bitnami installations using system packages)

  • Log in to the server console via SSH.
  • Create a directory to save all the data you need to backup:

    $ mkdir ~/espocrm-backup
    
  • Back up the bitnami_espocrm database as described on the MySQL documentation page.

  • Copy the data directory to your backup directory. Use the command below:

    $ cp -rf /opt/bitnami/espocrm/data/ ~/espocrm-backup/
    
  • Compress the backup directory:

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

  • Launch a new EspoCRM server with the latest version.

  • Upload via SFTP the backup files espocrm-backup.tar.gz and backup.sql to the new server.

  • Log in to the new server console via SSH.

  • Restore the database backup as described on the MySQL documentation page.

  • Uncompress the backup file espocrm-backup.tar.gz and restore the the data directory. Use the commands below:

    $ tar xfz espocrm-backup.tar.gz
    
  • Restore the data folder:

    $ sudo cp -rf ~/espocrm-backup/data /opt/bitnami/espocrm/
    
  • Update the passwordSalt and the cryptKey properties of the configuration file with the value in the ~/espocrm-backup/data/config.php file. To do so, you can use an editor to modify it manually or use the commands below:

    $ sudo cat ~/espocrm-backup/data/config.php | grep -oP "(?<='passwordSalt' => )('.*')" | xargs -I % sed -e "s/'passwordSalt' => '.*'/'passwordSalt' => '%'/g" -i */opt/bitnami/espocrm/data/config.php*
    $ sudo cat ~/espocrm-backup/data/config.php | grep -oP "(?<='cryptKey' => )('.*')" | xargs -I % sed -e "s/'cryptKey' => '.*'/'cryptKey' => '%'/g" -i */opt/bitnami/espocrm/data/config.php*
    
  • Restore the permissions in the data folder:

    $ sudo chown -R daemon:daemon /opt/bitnami/espocrm/data
    
  • Restart Apache:

    $ sudo /opt/bitnami/ctlscript.sh restart apache
    
  • Log in to the EspoCRM Dashboard.

  • Under the dropdown menu in the upper right corner, click on “Administration -> Rebuild”.

  • Under the dropdown menu in the upper right corner, click on “About”. Refresh the page and confirm the upgrade from the version shown.

That’s it! You updated the whole stack. Test the new server and, if everything is fine, delete the old server.

Approach B (Self-contained Bitnami installations)

  • Log in to the server console via SSH.
  • Create a directory to save all the data you need to backup:

    $ mkdir ~/espocrm-backup
    
  • Back up the bitnami_espocrm database as described on the MySQL documentation page.

  • Copy the data directory to your backup directory. Use the command:

    $ cp -rf /opt/bitnami/espocrm/htdocs/data/ ~/espocrm-backup/
    
  • Compress the backup directory:

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

  • Launch a new EspoCRM server with the latest version.

  • Upload via SFTP the backup files espocrm-backup.tar.gz and backup.sql to the new server.

  • Log in to the new server console via SSH.

  • Restore the database backup as described on the MySQL documentation page.

  • Uncompress the backup file espocrm-backup.tar.gz and restore the the data directory. Use the commands below:

    $ tar xfz espocrm-backup.tar.gz
    
  • Restore the data folder:

    $ sudo cp -rf ~/espocrm-backup/data /opt/bitnami/espocrm/htdocs/
    
  • Update the passwordSalt and the cryptKey properties of the configuration file with the value in the ~/espocrm-backup/data/config.php file. To do so, you can use an editor to modify it manually or use the commands below:

    $ sudo cat ~/espocrm-backup/data/config.php | grep -oP "(?<='passwordSalt' => )('.*')" | xargs -I % sed -e "s/'passwordSalt' => '.*'/'passwordSalt' => '%'/g" -i /opt/bitnami/espocrm/htdocs/data/config.php
    $ sudo cat ~/espocrm-backup/data/config.php | grep -oP "(?<='cryptKey' => )('.*')" | xargs -I % sed -e "s/'cryptKey' => '.*'/'cryptKey' => '%'/g" -i /opt/bitnami/espocrm/htdocs/data/config.php
    
  • Restore the permissions in the data folder:

    $ sudo chown -R daemon:daemon /opt/bitnami/espocrm/htdocs/data/
    
  • Restart Apache:

    $ sudo /opt/bitnami/ctlscript.sh restart apache
    
  • Log in to the EspoCRM Dashboard.

  • Under the dropdown menu in the upper right corner, click on “Administration -> Rebuild”.

  • Under the dropdown menu in the upper right corner, click on “About”. Refresh the page and confirm the upgrade from the version shown.

That’s it! You updated the whole stack. Test the new server and, if everything is fine, delete the old server.

Upgrade only EspoCRM in the Bitnami EspoCRM Stack

Approach A (Bitnami installations using system packages)

  • Log in to the server console via SSH.
  • Backup the previous application files:

    $ sudo cp -a htdocs/ htdocs_backup
    
  • Run the upgrade command from the installation folder:

    $ php command.php upgrade
    
  • Delete the htdocs_old directory that was created for backup purposes:

    $ sudo rm -rf htdocs_old
    

That’s it! You updated the application!

Approach B (Self-contained Bitnami installations)

  • Log in to the server console via SSH.
  • Backup the previous application files:

    $ sudo cp -a htdocs/ htdocs_backup
    
  • Run the upgrade command from the installation folder:

    $ php command.php upgrade
    
  • Delete the htdocs_old directory that was created for backup purposes:

    $ sudo rm -rf htdocs_old
    

That’s it! You updated the application!

Last modification October 6, 2020