Quickly Upgrade xenForo If You Have Root Access [Deleted]

Brent W

Well-known member
BamaStangGuy submitted a new resource:

Quickly Upgrade xenForo If You Have Root Access - Uploading files via FTP is a pain. Bypass that with this guide.

I hate uploading xenForo files. There are thousands of them and it takes forever via ftp. I have come up with a system that saves me literally hours when upgrading xenForo. I will assume you know some basics when navigating your server via shell.

Process

  • Download the xenForo upgrade folder to your computer and upload the zip file to your server. I usually just open an ftp connection to one of my forums and upload it there.
  • Create a new directory in /usr/src/ for xenForo. I...

Read more about this resource...
 
Exactly how I do it.

Upload the .zip file using WinSCP
Log in via PuTTY
unzip xen<press tab key to autocomplete the file name> to extract the contents
cp -rf upload/* www/ to copy extracted contents

Perform the upgrade

Delete the files:
rm INSTALL-UPGRADE.txt
rm xen<press tab key to autocomplete the file name>
rm -r upload/ to delete upload directory

Takes about a minute all in.
 
I do nearly the same thing as Brogan.

Unzip the Xenforo zip file on the PC
Re-zip just the contents of the upload folder (not the upload folder itself though, just what's in it) and call it something like upgrade.zip
Upload the upgrade.zip file using WinSCP
Log in via PuTTY
unzip upgrade.zip to extract the contents, choosing to overwrite any existing files

Perform the upgrade

Delete the upgrade.zip file:
rm -r upgrade.zip
 
  • Open terminal command
  • Navigate to your directory where XenForo-Upgrade.zip reside
  • scp XenForo-Upgrade.zip <user>@<IP>:/home/site
  • ssh -p <port> user@IP
  • cd /home/site
  • unzip -o XenForo-Upgrade.zip
  • php /home/site/public_html/library/XenForo/Install/run-upgrade.php
  • rm XenForo-Upgrade.zip
 
Exactly how I do it.

Upload the .zip file using WinSCP
Log in via PuTTY
unzip xen<press tab key to autocomplete the file name> to extract the contents
cp -rf upload/* www/ to copy extracted contents

Perform the upgrade

Delete the files:
rm INSTALL-UPGRADE.txt
rm xen<press tab key to autocomplete the file name>
rm -r upload/ to delete upload directory

Takes about a minute all in.

What OS are you using? The -f flag doesn't work for me on Centos OS 6.3. Have to use the \ to kill it.
 
What do you have in your bashrc file for root?

I suspect you have the alias cp='cp -i' which is force root to prompt when using -f (it's a security measure to prevent you doing something stupid)
 
You are right:

Code:
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
 
This is why I allow my site account SSH and use that to manage the site unless I need to su into root for any server stuff.
 
Wow, great resource and discussion!

I have a question: While I'm in PuTTy, is there a way via SSH to "get" the zip file directly from xF server to my server vs. having to download to my local machine and then upload it?
 
Wow, great resource and discussion!

I have a question: While I'm in PuTTy, is there a way via SSH to "get" the zip file directly from xF server to my server vs. having to download to my local machine and then upload it?
No, because you have to select the version you want (and the full / upgrade version), along with accepting the TOS each time you download it.
 
I'm going to have a go at my first attempt to upgrade my multiple installs of xF all on the same VPS in multiple accounts. I plan to upload the upgrade file to one account login via Putty using my root userID, and unzip it using putty. From there I'll run the cp command to copy over the files to each of the various accounts folders.

When in PuTTY, when I unzip the upgrade all the files are then owned by "root:root" (since that account allows me access to all the files on the server). Once I copy the upgrade files over to the various xF folders they are copied over with this same root ownership. From past experience, this ownership being different from the account has caused problems with other scripts and I assume wouldn't be good for xF either.

My questions:
  1. Is this something y'all deal with or do you login using the credentials of the account to which you are upgrading?
  2. Is there a way to use the cp command in a way that the ownership into the various accounts is set properly?
  3. Is the only way to do this is to recursively chown newaccount:newaccount to all the files in /home/account/public_html/* ??
 
Gotcha! I use to do this when I was manually upgrading 8 WP installs the same way... basically at the end of copying all the files I'd do:

chown -R account:account/home/account/www/wp

I'm assuming I'll do the same for xF, just do it one folder up since I'm installing all my xf forums in the account root:

chown -R account:account/home/account/www

I was surprised that non of the replies above address this ownership question. Are you all not changing the ownership of the files when they are copied over or was that step just omitted?

WHOOPS! I just found out the hard way that changing /public_html to account:account caused me to get a 403 Forbidden error ! So, make sure public_html is set to account:nobody
 
Last edited:
Gotcha! I use to do this when I was manually upgrading 8 WP installs the same way... basically at the end of copying all the files I'd do:

chown -R account:account/home/account/www/wp

I'm assuming I'll do the same for xF, just do it one folder up since I'm installing all my xf forums in the account root:

chown -R account:account/home/account/www

I was surprised that non of the replies above address this ownership question. Are you all not changing the ownership of the files when they are copied over or was that step just omitted?

WHOOPS! I just found out the hard way that changing /public_html to account:account caused me to get a 403 Forbidden error ! So, make sure public_html is set to account:nobody

That is why you cd into the public folder and use * :)
 
Just to be clear, my understanding is that as long as the "data" and "internal_data" hierarchies are read/writeable by the webserver and everything else is readable by the webserver, the website will function. From the perspective of the site functioning, it doesn't matter what account owns all of the files. File ownership only starts mattering when you need to start editing the files, etc. Clearly it's a good idea to have the forum account own the files, but it's not a webserver issue.

From this perspective, copying all of the files over as root and then "chown -R owner:group *"ing seems like a good idea. Am I getting this right?

Could you do the opposite? Could you "chown -R owner:group *" and then follow the instructions in this resource as the forum account? That would have the same outcome, right?
 
What OS are you using? The -f flag doesn't work for me on Centos OS 6.3. Have to use the \ to kill it.

I ran into this too, but a hack seems to do the trick in a pinch. Any experts care to comment on this:

yes |cp -fRp upload/* www/

That seems to force the "yes" on all the copied files.
 
Gave this a shot on my upgrade to 1.2.4 and wanted to share my thanks. I spent more time backing up and testing on a non-critical directory than doing the actual copy to production and xenforo upgrade itself o_O
 
Could you do the opposite? Could you "chown -R owner:group *" and then follow the instructions in this resource as the forum account? That would have the same outcome, right?
I did this and it worked just fine. It is appealing because I like to do as little as possible as root.

Just to be clear, my understanding is that as long as the "data" and "internal_data" hierarchies are read/writeable by the webserver and everything else is readable by the webserver, the website will function. From the perspective of the site functioning, it doesn't matter what account owns all of the files. File ownership only starts mattering when you need to start editing the files, etc. Clearly it's a good idea to have the forum account own the files, but it's not a webserver issue.
As I've been mucking around more, creating a test server and upgrading, this seems to be correct.
 
Top Bottom