Updating server components
Posted by Wesley on
A little hiccup this morning... I was updating some of the server components. To make sure I don't mess up anything next time I do this, I'll write down the procedures.
1. phpBB
Straightforward, actually. Go to phpBB downloads section, and get the latest 'Changed Files Only' version. Decompressing it will give you a bunch of 'version x to version y' zip files, with common files on their own.
1. phpBB
Straightforward, actually. Go to phpBB downloads section, and get the latest 'Changed Files Only' version. Decompressing it will give you a bunch of 'version x to version y' zip files, with common files on their own.
Pick the right 'version x' package and decompress. You'll get the folders and files that need patching. Now, open up the folder where you installed phpBB on your web server (very default location would be /Library/WebServer/Documents/phpBB).
I think it's a good idea to shut down the web server at this point.
System Preferences > Sharing > Personal Web Sharing > Stop
Okay, we need to overwrite the old files with the new files we got. Don't drag everything into the folder, though. This is because Finder will 'replace' the folders, not 'merge', so you'll end up with only the updated files in the folders and other 'not needing updates' files will be gone. I'm sure the old Mac users know this, but Switchers from Microsoft Windows world don't.
So basically, drag only the files into the folder. For the folders that need updating, open up both folders (the one with updated files and the one on your installation) and drag the updated files into the folder to replace the old ones. Repeat as necessary.
After finishing the 'version x to version y' folder updating, go up a folder to update the common files. Do the same thing as mentioned above - open up the equivalent folders and drag the updated files into them. There are two folders that don't exist on your installation - 'contrib' and 'install' - and these can simply be dragged to your installation folder.
After updating all the files, you need to run an update script. Start your web server again. From your web browser, type
(your website)/(phpBB install folder)/install/update_to_latest.php
on the address bar. This should update the database appropriately. After this is done, remove the 'contrib' and 'install' folders. phpBB will tell you anyway, so you should do it sooner than later.
Check that everything is working correctly and you're done.
2. MySQL
It's a good thing to back up your database before doing any updates. This way, if the update goes horribly wrong at least you know that your data is safe. I think I'll write up about using phpMyAdmin to do this at one point. But anyway...
Get the latest installer from MySQL downloads section. As usual, Mac OS X installer is buried deep down. Download the dmg image file and open it.
At this point I think you should stop the MySQL server from running.
System Preferences > MySQL > Stop MySQL Server
Run the installer and do the update.
Now the tricky part... the database still stays with the previous version's installation folder because the Mac OS X installer can't properly migrate stuff to the new install. It's sad, but the official documentation mentions this. So we need to copy the database from the old installation to the new installation.
Open Terminal (here we go again...) and type something like this:
cd /usr/local/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc
The 'mysql-standard-4.1.12-apple-darwin7.9.0-powerpc' part is supposed to be named exactly the same as the older installer file (without the .dmg extension), so don't fry your brain out trying to type all that. Instead, type up to 'cd /usr/local/' and copy the name from the older installer file and paste into Terminal.
If you successfully change to the folder, you might see that only 'data' folder exists by typing 'ls' into Terminal. This is the data folder for your database (obviously) and this is what needs to be copied to the new installation. To copy, type:
sudo cp -R data ../mysql
Type in password when asked. After a momentary pause the folder should be done copying.
We're done copying so it's a-okay, right? Unfortunately not. Because root owns the 'data' folder at this point, MySQL daemon can't access it. If you just start MySQL now, the daemon will fail to load because of this and you'll be getting nowhere. So we need to change the owner to mysql. Type this:
cd ../mysql
sudo chown -R mysql data
After this, the daemon will be able to start. Go to the System Preference and start MySQL server. It should start without problems. Check that your website and stuff depending on the database runs properly. After this, you can delete the previous installation of MySQL entirely. Type this:
cd ..
sudo rm -R mysql-standard-4.1.12-apple-darwin7.9.0-powerpc
Again, the very long folder name should be changed appropriately. You can also delete the installation receipt, which is found under /Library/Receipts. The file name is (you guessed it) something like 'mysql-standard-4.1.12-apple-darwin7.9.0-powerpc.pkg' - the name of the older installer, but with .pkg extension. Throw that into trash and clean it out.
And now you should be back on your feet again.