Moving Nextcloud to a New Server » History » Revision 3
« Previous |
Revision 3/8
(diff)
| Next »
Gareth Eaton, 10/16/2023 12:57 AM
Moving Nextcloud to a New Server¶
Step 1: Backup the Old Nextcloud Data Folder
1.1. Use FileBrowser to access your server. If you don't have FileBrowser installed, you can get it using the following commands:
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
1.2. Login to FileBrowser using this command:
filebrowser -a 192.168.*.* -p 8080
Replace 192.168.*.* with your server's IP address. Access FileBrowser via your web browser at http://192.168.*.*:8080.
1.3. Download the Nextcloud Data folder.
Step 2: Backup Your MySQL Database
Back up your MySQL database using this command:
mysql -u your_mysql_username -p your_database_name < your_backup_file.sql
In my case, it might look like this:
mysql -u nextcloud -p nextcloud < nextcloud-sqlbkp.bak
Step 3: Install a New Copy of Ubuntu and Nextcloud
3.1. Install a new copy of Ubuntu 20.04 on your new server. Update the system and follow the instructions to install Nextcloud.
3.2. During the Nextcloud installation, create a user named "nextcloud-admin."
3.3. Put Nextcloud into maintenance mode using this command:
sudo -u www-data php occ maintenance:mode --on
Step 4: Upload Database and Data Folder
4.1. Using FileZilla, upload the database and data folder to the new server.
Step 5: Move Data to the Nextcloud/Data Folder
Use rsync to move the data to the Nextcloud data folder:
sudo rsync -avP source_directory/ /var/www/html/nextcloud/data/
Step 6: Restore the Database
Restore the database using this command:
mysql -u your_mysql_username -p your_database_name < your_backup_file.sql
For example:
mysql -u nextcloud -p nextcloud < nextcloud-sqlbkp.bak
Step 7: Verify Access and Data
You should now be able to access your Nextcloud. Verify that your users and files are intact.
Updated by Gareth Eaton about 1 year ago · 3 revisions