Project

General

Profile

Moving Nextcloud to a New Server » History » Revision 3

Revision 2 (Gareth Eaton, 10/16/2023 12:47 AM) → Revision 3/8 (Gareth Eaton, 10/16/2023 12:57 AM)

h1. Moving Nextcloud to a New Server 

 Step 1: 1. Backup the Old Nextcloud Data Folder old nextcloud data folder I use filebrowser for https://filebrowser.org 

 1.1. Use FileBrowser to access your server. If you don't have FileBrowser installed, you can get it using the following commands: 

 <pre> 
 curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash 
 </pre> 

 1.2. Login to FileBrowser using this command: 

 
 
 The login  
 <pre> 
 filebrowser -a 192.168.*.* -p 8080 
 </pre> 

 Replace Login to it using your web browser http://192.168.*.*:8080 NOTE: change the 192.168.*.* with your server's you IP address. Access FileBrowser via your web browser at http://192.168.*.*:8080. 

 1.3. Download the Nextcloud Data folder. Nextcloud/Data folder 

 Step 2: Backup Your MySQL Database 

 Back 2. In the CLI back up your MySQL database using this command: 

 <pre> 
 mysql database, mysql -u your_mysql_username -p your_database_name < your_backup_file.sql 
  in my case 
 </pre> 

 In my case, it might look like this: 

 <pre> 
 mysql -u nextcloud -p nextcloud < nextcloud-sqlbkp.bak 
 </pre> 

 Step 3: Install 


 3. install a New Copy of Ubuntu and Nextcloud 

 3.1. Install a new copy of Ubuntu ubuntu 20.04 on your new server. Update the system server, update and follow the instructions in stall instinstrushion for a new copy of nextcloud, when you get to install Nextcloud. add user call it nextcloud-admin 

 3.2. During put the Nextcloud installation, create a user named "nextcloud-admin." install in to sudo -u www-data php occ maintenance:mode --on 

 3.3. Put Nextcloud into maintenance mode using this command: 
 <pre> 
 sudo -u www-data php occ maintenance:mode --on 
 </pre> 

 Step 4: Upload Database and Data Folder 

 4.1. Using FileZilla, 4. now using fileziller upload the database and data folder to the new server. 

 Step 5: Move Data server 
 5. use rsyne to mv the Nextcloud/Data Folder 

 Use rsync to move the data to the Nextcloud data folder: 


 nexcloud/data folder 
 <pre> 
 sudo rsync -avP source_directory/ /var/www/html/nextcloud/data/ 
 </pre> 

 Step 6: Restore 6. restore the Database 

 Restore the database using this command: 

 <pre> 
 data base, mysql -u your_mysql_username -p your_database_name < your_backup_file.sql 
 </pre> 

 For example: 

 <pre> 
 mysql -u nextcloud -p nextcloud < nextcloud-sqlbkp.bak 
 </pre> 

 Step 7: Verify Access and Data 

 You 7. now you should now be able to access accsess, check your Nextcloud. Verify that your users userers and files file are intact. good. 

 8. delete the data file and data base you uploaded