====== How to upgrade Lucy from 4.2 to 4.3 without having to configure a new server ====== :!: **Caution. This article is only applicable to the [[wp>Docker]]-based installation** The following guide will help you upgrade your version of Lucy 4.2 installed in the [[installing_lucy_on_linux|Docker container]] to the new version 4.3.\\ :!: If you do not know what type of installation is used in your system, please contact our technical support service by e-mail . For other types of installation, please follow the instructions in [[upgrade_to_43|this article]].\\ ==== Upgrading involves the following steps: ==== - Exporting the necessary data using the Migration Tool; - Transfer of the archive with data to the host system; - Saving the current container as an image of the system with the subsequent removal of the container; - Installation of a new version of Lucy 4.3 in a new container; - Restoring the data using Migration Tool. ===== Required steps before beginning the upgrade ===== - Update the initial server to the latest patch for Lucy 4.2. The latest version of Lucy 4.2 is 4.2.16 (February, 2019). Refer to [[updating_lucy|this page]] on how to update Lucy;\\ - Make sure that you have at least 50% of available disk space on the server See [[https://opensource.com/article/18/7/how-check-free-disk-space-linux|here]] how;\\ :!: **Caution:** All campaigns must be stopped before the update. ===== Step 1. Export data ===== - Log in to your server with Lucy 4.2 and navigate to the __Support__ menu → __Migration Tool__;\\ - Select only those parameters that need to be migrated:\\ {{ migrationtool_optionstoexport.png }} **Warning:** Exporting templates (scenario, report, awareness) can take quite a long time and consume a huge amount of disk space. If you have not created your own custom templates, do not select these options for export. You can download all new templates again through the [[download_templates|Download Templates]] page.\\ \\ - Click on the "**Create**" button to start the export;\\ - You will be forwarded to the "__Backups__" page to monitor the status of the export:\\ {{ migrationtool_backupinprogress.png }} \\ Be patient, this procedure can take from several minutes to several hours, depending on the number of options you have chosen to export.\\ - When the process is completed, you can download the archive by clicking on the link in the "__Time__" column:\\ {{ migrationtool_downloadbackupfile.png }} **Note:** It is recommended to transfer large archives to the host system and later restore it through the terminal rather then web-console: * Find your backup file in **/opt/phishing/files/backups**\\ * Run the command below:\\ docker cp lucy:/opt/phishing/files/backups//backup.tar.gz /srv/backup.tar.gz where,\\ **** is an identification number of the backup (can be found in the link to the file).\\ or use the command below to automatically find and copy the last created backup (simply copy and paste the command to the terminal):\\ docker cp lucy:/opt/phishing/files/backups/`ls -tr /opt/phishing/files/backups | tail -1`/backup.tar.gz /srv/backup.tar.gz ===== Step 2. Save the image of the old Lucy container ===== In order to create an image based on the current container with Lucy 4.2 please run the following command terminal:\\ docker commit lucy lucysecurity/lucy:4.2 **Note.** It may take from several minutes to several hours to execute this command, depending on the size of the container. It is extremely important to have at least 50% free disk space. Please be patient, do not interrupt the process. After the process is complete, check for saved images by running the command (it must be displayed with 4.2 TAG): docker images {{ migrationtool_dockerimages.png }} If the image was successfully saved, you should remove the current container to prepare for the installation of the new version of Lucy. To do this, please follow the steps: docker stop lucy docker ps -a docker container rm where,\\ **** is an identification number of the container with Lucy 4.2.\\ {{ migrationtool_containerrm.png }} :!: **Warning:** DO NOT REMOVE the old container without making sure that the image was successfully created. **If you are not sure about your actions, please contact our technical support.** ===== Step 3. Installing Lucy 4.3 ===== - Download the installation file of Lucy 4.3 from our download location: \\ **cd /srv** \\ **wget http://download.phishing-server.com/dl/lucy-latest/install.sh** \\ - Type chmod +x install.sh to make the file executable: \\ **chmod +x install.sh** \\ - Type ./install.sh.sh to execute the file: \\ **./install.sh** \\ - You will be asked if you want to install LUCY (Install LUCY (y/n)?) Please type "**y**" and press enter. During the installation LUCY will connect to our centralized custom repository to download the necessary packages.\\ - As soon as the installation is finished, the [[setup_script_tutorial|automatic setup script]] should start. Only basic setup and automatic configuration are required.\\ ===== Step 4. Import data ===== - Log in to the system using your server IP address (eg. https://1.2.3.4/admin) with the login\password provided on the previous step;\\ - Install all latest updates: go to the __Support menu__ → __Update__. The latest version is 4.3.14 (November 8th, 2018);\\ - Restart the server after the update;\\ - Restore the system from backup (do either a) or b)): - via the terminal run the following commands: \\ **docker cp /srv/backup.tar.gz lucy:/srv/backup.tar.gz** \\ **docker exec -it lucy /bin/bash** \\ **cd /opt/phishing/current/web/protected** \\ **./yiic restore ** \\ - via web-console: * Navigate to the __Support__ menu → __Migration Tool__ → go to "Import" tab;\\ * Select the file you downloaded in Step 1 and wait for the process to complete (this can take a long time);\\ ===== Post migration steps ===== - (optional) Update and install all new available templates: go to the __Support__ menu → __Download Templates__;\\ - Change\update system domain via the [[https://www.lucysecurity.com/PS/doc/dokuwiki/doku.php?id=setup_script_tutorial|Setup Script]]\\