Friday 20 March 2015

Upgrading to Omeka 2.3 via the command line

Having got a nicely working omeka install I thought I'd see if I could break it by upgrading to the latest version. I'm glad to say it didn't, here's what I did:
  1. Make sure your system is fully patched

    sudo apt-get upgrade
     
  2. Backup your mysql database

    mysqldump -h localhost -u db_username -p omeka_db_name > omeka_backup_file.sql
     
  3. Deactivate any plugins you are using as per the official upgrade instructions

  4. copy db.ini somewhere safe (my omeka install is in /var/www)

    cd /var/www
    mkdir /home/username/omeka_backup
    sudo cp db.ini /home/username/omeka_backup/.
     
    if you've added any extra plugins you'll also need to back them up. It's a good idea to take a screenshot of the files listings so you remember the permissions.


  5. backup your omeka install just in case

    sudo tar -zcvf /home/username/omeka_backup/omeka_2.gz /var/www
    


  6. download the updated version of omeka

    cd /home/username
    wget http://omeka.org/files/omeka-2.3.zip
    unzip omeka-2.3.zip
    


  7. delete the old install - you only need to get rid of the subdirectories, in practice you will overwrite any existing files in the top level directory. Do not remove your files directory - this contains your content. If you have custom plugins or themes you may wish to leave these in place as well.

    cd /var/www
    sudo rm -rf install
    sudo rm -rf plugins
    sudo rm -rf themes
    sudo rm -rf admin
    sudo rm -rf application
    


  8. then copy the new release in place

    cd /home/username
    sudo mv omkea-2.3/* /var/www/
    sudo mv omeka-2.3/.htaccess /var/www/
    


  9. make sure that all the permissions are correct

    cd /var/www 
    sudo find . -type d | xargs sudo chmod 775
    sudo find . -type f | xargs sudo chmod 664
    sudo find files -type d | xargs sudo chmod 777
    sudo find files -type f | xargs sudo chmod 666
    


  10. copy back your db.ini file (and any extras you'd installed)

    cd /var/wwww
    sudo cp /home/username/omeka_backup/db.ini .
    


  11. restart apache
    sudo /etc/init.d/apache2 restart
    
Now point your web browser at your site. You may well get a message about the site being unavailable while the upgrade completes. Go to the admin page and click on the database upgrade button.

Once complete, your site should just work. As always your mileage may vary, but this procedure worked well on my test install.

No comments: