After you installing the owncloud in the previous article, you may to see this article to migrate your database from windows server 2008 r2 to ubuntu server 14.04.

1. Backup your data in windows server 2008 r2.
   - /owncloud/data (leave your log if the size is to large)
   - /owncloud/config
   - sql database, go to your mysql (localhost/phpmyadmin), export the table to .sql.

2. Backup original data in ubuntu server
   - Just in case, copy your original data to another folder
      #mkdir /var/www/html/owncloud/backup
      #cp -R /var/www/html/owncloud/config /var/www/html/owncloud/backup
      #cp -R /var/www/html/owncloud/data /var/www/html/owncloud/backup

3. Copying /data
      #cp -R /(your_config_directory) /var/www/html/owncloud

      #cp -R /(your_data_directory) /var/www/html/owncloud

4. Ensure the permission
    -  If the permission is not www-data for config and data directory, you should change the permission to with this command:
      #sudo chown -R www-data:www-data /var/www/html/owncloud/config
      #sudo chown -R www-data:www-data /var/www/html/owncloud/data
    - Check again:
      #ls -la

5. Upload .sql
    - Login to Mysql and import:
       mysql -h [server] -u [username] -p[password] [db_name] < owncloud-sqlbkp.bak
    - If SQLite
       rm data/owncloud.db
       sqlite3 data/owncloud.db < owncloud-sqlbkp.bak

    - If Postgre SQL
      PGPASSWORD="password" pg_restore -c -d owncloud -h [server] -U [username] owncloud-sqlbkp.bak

6.  Check the webserver from client

Post a Comment