Bofore you begin below, make a backup of what code you have and a database dump. moodledata won't change much.
If your original install wasn't using/with git, then the code directory doesn't have the hidden .git directory and hidden .gitfiles.
So what you have to do now ... if it's not really messed up ... is what has been tagged as a 'side load' of git from a git acquired code directory.
Basically ...
original code is in /var/www/html/ - you can see a config.php file there and a version.php file. See what version you do have there:
fgrep '$release' version.php - let's hope it's still 4.1.x.
The side load:
cd /var/www/ note that's where you can see the html directory.
Git
git clone git://git.moodle.org/moodle.git htmlgit
That will create a directory htmlgit
cd htmlgit
git branch --track MOODLE_401_STABLE origin/MOODLE_401_STABLE
git checkout MOODLE_401_STABLE
The above commands should aquire version 4.1.highest of moodle code.
To check ... still in /var/www/htmlgit
fgrep '$release' version.php
See 4.1.highest?
Then next step ... the side load ...
Still in /var/www/htmlgit/
cp -rp .git ../html/ - note the dot in front of git ... and note ../ means up-one-level
cp -rp .github ../html/
cp -p .gitattributes ../html/
cp -p .gitignore
Ok, we are done copying the hidden git stuff.
Now check: cd /var/www/html/
ls -l .git*
Do you see the 2 directories and .git files?
Ok, good.
Don't skip this one:
git reset --hard
We now check to see what git is pointed to:
git branch -a
The * at the top should be next to * MOODLE_401_STABLE
check version:
fgrep '$release' version.php
Should see the highest of 4.1.x+ with a build date.
If we see that, we are a go.
Still in /var/www/html/
php admin/cli/maintenance.php --enable
php admin/cli/upgrade.php
you will see tables being updated.
When it finishes, take site out of maintenance mode
php admin/cli/maintenance.php --disable
Check ownerships/permissions on config.php ...
*must be readable by the globe.
Let's check stuff ... still in /var/www/html/
php admin/cli/checks.php
That should return:
OK: All 'status' checks OK
Ok, now open browser and hit the site.
Login as admin level user.
First thing you need to do is go to Notifications
Plugins you have installed should be in need of updating.
Update plugins ... note you don't have to do all of them at once.
I am cautious ... I do one at a time.
I'd also listen to Mr. V!!! 4.1 is long term support .. 4.2 is not!
See you have gmail.com in profile, we might be able to do a google meet.
I'll send you a PM here on this system with info.
'SoS', Ken