ociespocrm

Upgrade EspoCRM

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 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 conf/ and htdocs/data directories to your backup directory. Use the commands below:

    $ cp -rf /opt/bitnami/apps/conf/ ~/espocrm-backup/conf/
    $ cp -rf /opt/bitnami/apps/htdocs/data ~/espocrm-backup/data
    
  • 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
    $ sudo cp -rf ~/espocrm-backup/data/.data /opt/bitnami/apps/espocrm/htdocs/data/.data
    $ sudo cp -rf ~/espocrm-backup/data/cache /opt/bitnami/apps/espocrm/htdocs/data/cache
    
  • Update the passwordSalt and the cryptKey properties of the /opt/bitnami/apps/espocrm/htdocs/data/config.php 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/apps/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/apps/espocrm/htdocs/data/config.php
    
  • Restore the permissions:

    $ sudo chown -R bitnami:daemon /opt/bitnami/apps/espocrm/htdocs/data/
    $ sudo chown -R daemon:daemon /opt/bitnami/apps/espocrm/htdocs/data/cache /opt/bitnami/apps/espocrm/htdocs/data/config.php
    
  • Restore the Apache configuration files in the new EspoCRM stack. Use the command below:

    $ sudo cp -rf ~/espocrm-backup/conf/ /opt/bitnami/apps/espocrm/conf/
    
  • 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

  • Log in to the server console via SSH.
  • Backup the previous EspoCRM files and modify the permissions:

    $ cd /opt/bitnami/apps/espocrm
    $ sudo cp -a htdocs/ htdocs_backup
    $ sudo chown -R daemon:daemon htdocs/
    
  • Browse to the EspoCRM SourceForge page and download the latest version of EspoCRM upgrade pack.

  • Log in to the EspoCRM Dashboard.

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

  • Under the Administration menu, click on “Upgrade”.

  • Upload the upgrade pack and follow the wizard to upgrade your EspoCRM installation.

  • Once the upgrade finishes, log in to the EspoCRM Dashboard again.

  • 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.

  • Once the upgrade is confirmed, log in again to the server console through SSH and restore the permissions by running the commands below:

    $ cd /opt/bitnami/apps/espocrm
    $ sudo chown -R bitnami:daemon htdocs/
    $ sudo chown -R daemon:daemon htdocs/data
    $ sudo chown -R daemon:daemon htdocs/custom
    $ sudo chown -R daemon:daemon htdocs/client/custom
    $ sudo find htdocs/ -type d -exec chmod 755 {} + && sudo find htdocs/ -type f -exec chmod 644 {} +;
    $ sudo find htdocs/data htdocs/custom -type d -exec chmod 775 {} + && sudo find htdocs/data htdocs/custom -type f -exec chmod 664 {} +;
    $ chmod 775 htdocs/application/Espo/Modules
    $ chmod 775 htdocs/client/modules
    
  • Delete the htdocs_old directory that was created for backup purposes:

    $ sudo rm -rf htdocs_old
    

That’s it! You updated the application!