Project

General

Profile

Feature #701

Fix a Magento Install From The Command Line

Added by Daniel Curtis about 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
11/27/2015
Due date:
% Done:

100%

Estimated time:
1.50 h
Spent time:

Description

I recently had to fix Magento after a hung update happened. After looking around online I found that Magento can be update directly from the command line. This is a guide for doing so.

  • Make sure sudo is installed:
    pkg install sudo
    
  • Make the mage script executable:
    chmod u+x /usr/local/www/sites/magento.example.com/mage
    
  • Change into the magento install directory:
    cd /usr/local/www/sites/magento.example.com
    
  • Set the maintenance.flag file:
    touch /usr/local/www/sites/magento.example.com/maintenance.flag
    
  • Show the list of installed Magento packages:
    sudo -u www sh /usr/local/www/sites/magento.example.com/mage list-installed
    
  • Upgrade any other packages:
    sudo -u www sh /usr/local/www/sites/magento.example.com/mage upgrade-all --force
    
  • Force the reinstallation of the Mage_All_Latest package:
    sudo -u www sh /usr/local/www/sites/magento.example.com/mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force
    
  • Reindex everything:
    php shell/indexer.php reindexall
    
  • Set the correct permissions:
    chmod -R 644 /usr/local/www/sites/magento.example.com/*
    find /usr/local/www/sites/magento.example.com -type d -exec chmod 755 {} \;
    chmod 550 /usr/local/www/sites/magento.example.com/mage
    
  • Flush all cache and sessions:
    rm -rf /usr/local/www/sites/magento.example.com/var/{cache,session}/*
    
    • NOTE: For some reason I also needed to remove the old pkginfo/Mage_All_Latest.txt directory:
      rm -rf /usr/local/www/sites/magento.example.com/pkginfo/Mage_All_Latest.txt
      
  • Remove the maintenance.flag file:
    rm /usr/local/www/sites/magento.example.com/maintenance.flag
    

Resources

Also available in: Atom PDF