đž Archived View for alaskalinuxuser.ddns.net âş 2021-07-23_7.gmi captured on 2024-09-29 at 00:07:57. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
">
024w, https://alaskalinuxuser3.ddns.net/wp-content/uploads/2021/02/nextcloud-1-
300x176.png 300w, https://alaskalinuxuser3.ddns.net/wp-content/uploads/2021/02/
nextcloud-1-768x450.png 768w, https://alaskalinuxuser3.ddns.net/wp-content/
uploads/2021/02/nextcloud-1-1536x901.png 1536w, https://
alaskalinuxuser3.ddns.net/wp-content/uploads/2021/02/nextcloud-1.png 1671w"
sizes="(max-width: 1024px) 100vw, 1024px" />
It was a particularly sunny day, both in the real world and in the world of IT.
There was no cause for alarm, no foreshadowing of pending doom. Yet, it
happened. For reasons that I will not get into, there is a way (perhaps by
overzealous children playing in the bathtub, or not properly sealed plumbing
air vents, or something along that line â not trying to place any blame) that a
huge torrential downpour of water will come through the sheetrock in the
ceiling of the room housing my server, and there is a way that all of that
water can get dumped right into the server itself, since it is on the top shelf
and closest to the water. Either way, servers donât run that well when they are
full of water, and a Dell PowerEdge 1950 just isnât waterproof.
After drying it out, I was able to get it to boot again. It sometimes would
work, sometime not. At times it would run like a champ, and others it would
give up and quit. The only consistent thing was the internal fan speeds were
now set to maximum, because the speed sensor didnât work for them anymore. So,
it was time to get a new server.
A very good and generous buddy of mine donated a Dell PowerEdge R520 to me,
completely free of charge, with dual Xeon 2.4GHz processors, 32GB of RAM, and
over 4TB of disk storage. It was a gold mine indeed! He felt it was old, but
compared to the PowerEdge 1950 I was running, this was a real powerhouse and a
great gift!
Now I just had to put it to work.
First order of business was moving my Nextcloud instance from the old server to
the new. That shouldnât be too hard, since Nextcloud_made_a_straightforward_six
step_write-up_on_how_to_do_just_that. Unfortunately, it didnât work when I
tried it.
So, per step 1, I installed my preferred OS, in this case Ubuntu 20.04 onto the
R520, and proceeded to follow my own write-up for installing LAMP, and followed
the new_install_guide_for_Nextcloud to make sure I properly installed PHP and
setup the MariaDB. Set up Apache2 web server with all my Letâs encrypt certs,
etc. All seemed to be going well here.
Step 2 was to activate maintenance mode on your old Nextcloud instance, so on
the 1950, I edited the nextcloud/config/config.php file and changed the line
with âmaintenanceâ from false to true. Again, everything seemed to be going
well here.
Step 3 and 4 instructed me to make a backup of the data and database and copy
it to the new machine. Fortunately, they were a little more specific with the
instructions_under_the_âbackupâ_section. But essentially, I used rsync to
transfer the files from the 1950 to the R520. And then I made a backup of the
MariaDB per the instructions. More on that in a minute, as this was where,
unbeknownst to me, the problem started. It shows and example, like this:
mysqldump --single-transaction -h [server] -u [username] -p[password] [db_name]
nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
I named it much simpler, no need for the date here. The later half of the
fourth step was to restore the MariaDB, which I did, like the instructions say:
mysql -h [server] -u [username] -p[password] [db_name] < nextcloud-sqlbkp.bak
This did indeed restore the database from MariaDB on the other machine. I even
checked, my database was there. Everything seemed fine.
From here, steps 5 is to test it, and steps 6 is to change your dns record to
point to the new server. But I failed at step 5. I couldnât get the Nextcloud
to work. In fact, the only thing I saw was an error like this:
âÂÂInternal Server Error
The server was unable to complete your request.
If this happens again, please send the technical details below to the server
administrator.
More details can be found in the server log.âÂÂ
But there were no technical details. I tried to check the Nextcloud log, but it
wasnât showing any current information. The site was so down, it wouldnât work
enough to even log anything, I guess. So, I started shooting in the dark. What
was the problem? How could I deduce the issue without logs? Well, I did some
web searching and every instance of this seemed to be sql related.
So, I gave up for a while. Then, while doing something else, it hit me, like an
epiphany. I restored the database, but not the users of the database! DUH! I
jumped online to do a little research, and came across a great_article_on_how
to_do_just_that,_at_bitnami.com. This helped me do a full backup of the
database data (not just Nextcloud) like so:
mysqldump -A -u root -p > backup.sql\n\n And restore it on the other
machine like this:\n\nmysql -u root -p < backup.sql
Then I found this great_write-up_from_wisdmlabs.com on how to migrate the users
from one to another, like so:
FROM user WHERE user != 'debian-sys-maint' AND user != 'root' AND user != ''"
mysql > mysql_all_users.txt\n# while read line; do mysql -B -N -uroot -
p<put_password_here> -e "SHOW GRANTS FOR $line"; done < mysql_all_users.txt >
mysql_all_users_sql.sql\n# sed -i 's/$/;/' mysql_all_users_sql.sql
Now I had the file with all users and their permissions! I copied that over to
the R520 and imported it with this simple line:
mysql -u root -p < mysql_all_users_sql.sql
And, praise God, after all that, my Nextcloud started working! I was really
starting to get worried that Iâd have to start over from scratch!
So, if you plan to migrate your Nextcloud from one server to another, keep in
mind that the instructions tell you how to back up the data from your MariaDB/
SQL database, but they donât mention that you need your user information as
well. Or that you will need to add said users after the fact. You all probably
knew that already, but for a new to Nextcloud guy like me, this step was really
important!
Linux â keep it simple.