Howto change the folder "owncloud" to "nextcloud" after upgrading?

Is there an easy way to get the owncloud folder renamed to nextcloud without destroying everything? The main goal should be that the client does not redownload all the data stored in the folder owncloud/data.

secons question is: Is it a good idea to move the data folder out of the …cloud folder? and if how?

Wouldn’t it be better and simpler to do a fresh install of NC in /nextcloud/ and then copy /data/, /themes/ and /config.php from the old /owncloud/ directory?

I don’t think that would negate the OC client trying to download everything as it’s a new server path once changed to nextcloud

Not all path’s in the database are relative to the /owncloud/ directory.
Some have /owncloud/ in their path.

  • oc_activity
  • oc_cards
  • oc_contacts_cards
  • oc_contacts_cards_properties
  • oc_news_items
  • oc_properties
  • oc_storages

so just copying data to a new nextcloud directory and restoring the database should’t work propper.

1 Like

I stand corrected. Thanks for the heads-up @Soko

After renaming the owncloud directory to nextcloud and changing the config.php accordingly my installation still works as expected.

I don’t know how this affects something. I have for example under oc_storages:

local::/var/www/localhost/htdocs/owncloud/data/

but can still access my files.

These are experiments, I wouldn’t dare to try on a productive system…

Btw: What’s the benefit of changing the foldername from owncloud to nextcloud?

I agree, but I tried this on a test system.

Well, for me it’s simply an aesthetic benefit. It’s nextcloud, so it should be in a nextcloud directory :wink:

Hi,

I thought the same. Nextcloud should be Nextcloud …

Regards,
Andreas

And as I’m on gentoo and gentoo installs web-applications and updates in directories according to the name of the application, I had to rename it anyway :slight_smile:

I renamed my folder and update its data path, it’s working fine.

i renamed it as well. works for me

Doesn’t mean that you can’t get problems later:

The problems from owncloud probably still apply, therefore I raised a topic on github:

1 Like

yeah, there is a risk with older systems. You only will run in problems when you have a ownCloud instance from 6.0 or older that you upgraded to Nextcloud. If you installed ownCloud 7, 8.x or later, you can just adjust the folder in your config.php file and you’re good. You could also create a link from ownCloud to Nextcloud, that is what I did - not sure if it fixes it but I haven’t had any issues and my install is from before oC 6.0 :wink:

Maybe make this an option during migrations?

I did renaming during my upgrade from OC 9.1.3 to 10.0.3, after that I upgraded to 11.0.1.

I based my steps on those two guides:
https://bscable.info/migrate-from-owncloud-9-1-1-to-nextcloud-10-0-2/
https://bscable.info/upgrade-nextcloud-from-version-10-0-2-to-11-0-0/

Here’s what I did:

  1. move owncloud directory (there will be no access, so no changes)

  2. copy db_owncloud to db_nextcloud (using phpmyadmin and logging in MariaDB root account)

  3. rename all table prefixes to tbl_ (instead of oc_) (because tbl is generic, in case of more name changes; this step takes the most time)

  4. rename user of the old owncloud database using SQL (phpmyadmin):
    RENAME USER ‘oc_admin’@’%’ TO ‘nc_admin’@’%’;
    RENAME USER ‘oc_admin’@‘localhost’ TO ‘nc_admin’@‘localhost’;

  5. Grant this renamed user privileges on new database using SQL (phpmyadmin):
    GRANT ALL PRIVILEGES ON db_nextcloud.* TO ‘nc_admin’@’%’;

  6. move owncloud data directory to new name
    i.e. /opt/owncloud to /opt/nextcloud

  7. downloaded nextcloud version 10.0.3 and checked md5

  8. installed at location of old owncloud directory (step 1) with nextcloud as name and set the rights (chown -R)

  9. got the old config.php copied to the new directory and changed accordingly, i.e.:
    ‘datadirectory’ => ‘/opt/nextcloud/data’,
    ‘dbname’ => ‘db_nextcloud’,
    ‘dbhost’ => ‘localhost’,
    ‘dbtableprefix’ => ‘tbl_’,
    ‘dbuser’ => ‘nc_admin’,

For migration to 11.0.1:

  1. move nextclouddirectory (there will be no access, so no changes)
  2. downloaded nextcloud version 11.0.1 and checked md5
  3. installed at location of old nextcloud directory and set the rights (chown -R)
  4. got the old config.php copied to the new directory

When everything is working, remove the old owncloud packages and any other traces like the backupped folders.

1 Like

I changed my folder name to nextcloud now, would it be possible to set a soft link that keep old client settings working?
drwxr-xr-x 15 root www-data 4,0K Mai 7 09:30 nextcloud
lrwxrwxrwx 1 root root 9 Mai 7 09:24 owncloud -> nextcloud

I tried to do the same today, changing my symlink from /oc to /nc, but after this change I was not able to log in.
As far as I remember I changed paths in NC config.php and paths in my Apache config files. Anything else to change?
The error in NC log is this:

{“reqId”:“m1E81YlJIQ8QkrwX8C1N”,“level”:3,“time”:“2018-05-14T08:38:43+00:00”,“remoteAddr”:“192.168.100.201”,“user”:"–",“app”:“index”,“method”:“GET”,“url”:"/nc/index.php",“message”:“Exception: {“Exception”:“Exception”,“Message”:“The requested uri(\/nc\/login) cannot be processed by the script ‘\/oc\/index.php’)”,“Code”:0,“Trace”:”#0 \/var\/www\/nc13.0.2\/lib\/base.php(951): OC\\AppFramework\\Http\\Request->getRawPathInfo()\n#1 \/var\/www\/nc13.0.2\/index.php(37): OC::handleRequest()\n#2 {main}",“File”:"\/var\/www\/nc13.0.2\/lib\/private\/AppFramework\/Http\/Request.php",“Line”:733}",“userAgent”:“Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0”,“version”:“13.0.2.1”}

Did you change the Nextcloud data directory or Nextcloud installation directory? I assume from the error message, you changed the installation directory from /var/www/oc to /var/www/nc?

Please post the content of your Nextcloud Apache config/vhost and /var/www/nc/config/config.php here, but be sure to anonymize and replace all domain, password and secret strings :wink:.

As within the error message old and new path infos seem to be mixed, there could be simply a browser cache issue: <ctrl>+<F5> to reload the page while dropping cache is at least worth to try first :slightly_smiling_face:.

Thanks for your response.
My data directory is already outside the NC installation directory. I always install NC in a separate directory in /var/www and I point symlink /var/www/oc to it, not sure if it’s good or bad practice, but worked fine so far. Now I want to use /var/www/nc instead of /var/www/oc.

In Apache config I basically created a new nextcloud.conf by copy/pasting what I have for /oc and that works. But I also left the owncloud.conf in place as well, that should not be a problem right?

Apache nextcloud.conf:

Alias /nc "/var/www/nc/"

<Directory /var/www/nc/>
  Options +FollowSymlinks
  AllowOverride All

 <IfModule mod_dav.c>
  Dav off
 </IfModule>

 SetEnv HOME /var/www/nc
 SetEnv HTTP_HOME /var/www/nc

</Directory>

In Nextcloud config.php I changed all /oc to /nc, I restarted Apache several times and also deleted cookies from my web browser and also tried web browser private mode, so should not be a browser issue.