Completely new to how to install Moodle for my site

Completely new to how to install Moodle for my site

by Daphne Chin -
Number of replies: 23

Hi Everyone, I currently have site hosted on godaddy's delux web hosting. (ourcompany.com)

My partner wants to install moodle and have our students access it via (ourcompany/moodle.com)

How do we go about setting this up?

Do we set it up in the current web hosting or use a VPS to set up moodle on it?

We were thinking of buying a VPS with cpanel but have no experience in doing any of these.


Any help would be greatly appreciated.

Average of ratings: -
In reply to Daphne Chin

Re: Completely new to how to install Moodle for my site

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hello. The documentation About Moodle FAQ gives suggestions for setting up Moodle depending on your technical knowledge and the size of your company/number of potential users. It might  be a good starting place.

Average of ratings: Useful (2)
In reply to Mary Cooch

Re: Completely new to how to install Moodle for my site

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

I recommend you get a MoodleCloud account first so you can start playing with Moodle immediately, so when your "real" site is up you are ready to go. 

Average of ratings: Useful (3)
In reply to Marcus Green

Re: Completely new to how to install Moodle for my site

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
+1. At the beginning you don't have to worry about installation issues.

For later, get some orientation in the https://docs.moodle.org/en/Category:Installation.

Talking of GoDaddy, here is one man's crusade against a moloch: "Go Daddy! (Where to?)" https://moodle.org/mod/forum/discuss.php?d=193106.
;-8
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Completely new to how to install Moodle for my site

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

I use some cheap hosting here in the UK that has what seems to me an absurdly good level of support. I pay about £48 per year (around $US70 ish), and when I email them I get a knowledgeable reply really quickly. I suppose my point is that there are good companies out there.

Average of ratings: Useful (1)
In reply to Mary Cooch

Re: Completely new to how to install Moodle for my site

by Daphne Chin -

Appreciate the link! Will take a look. Thanks again

In reply to Daphne Chin

Re: Completely new to how to install Moodle for my site

by Usman Asar -
Picture of Plugin developers Picture of Testers

Daphne,

yes this can be done, depending on how big your moodle is going to be, as though Deluxe gives out Unlimited domains and email, but doesn't looks like  to a promising package for running Moodle that can handle more than 10-15 concurrent users, Ultimate package could have been able to run Moodle fine.

If you are going to use same hosting account for hosting, then yes you can use mycompany.com/moodle as hosting (means a moodle folder user same domain), else on a seperate server, you can always use a sub-domain (moodle.mycompany.com).

Now questions remains, how  many users you'll be expecting to use moodle?

Average of ratings: Useful (1)
In reply to Usman Asar

Re: Completely new to how to install Moodle for my site

by Daphne Chin -

Hi, thanks for the reply.

we most probably will be having more than 15-20 Users concurrently, So a seperate server would be my option. 

I have already bought a VPS but don't really know where to go from there. Thanks for the suggestion about the moodle.mysite.com . Didnt think of that haha


I currently have VPS server set up :

CentOS 6 + cPanel

1 GB ram

40GB space


But the WHM is kinda confusing to me. Will try to set up a subdomain there. 

In reply to Daphne Chin

Re: Completely new to how to install Moodle for my site

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Daphne, I use a Godaddy VPS for my Moodle.  I also have an experimental Deluxe Hosted Server with Moodle running on it.  So I can tell you that Moodle 3.0+ can run on either of these.  The setup is slightly different on each, so you are going to have to tell me where you really want your Moodle running (even if "both" is your answer.)

Folks here on Moodle know that I do it, and of course, you will find mixed opinions.  However, my own experience with Godaddy is that their servers are rock solid.  However, don't expect Godaddy to help you at all with running Moodle.

Also, you are going to have to be patient for I am in the middle of teaching courses right now.

I run Moodle on my VPS for about 15 courses a year, about 450 students per year.  My Godaddy VPS serves this purpose well.

I will try to watch for your posts.  

Average of ratings: Useful (1)
In reply to Rick Jerz

Re: Completely new to how to install Moodle for my site

by Daphne Chin -
Hi Rick,

Wow, really really appreciate your help.


I want my moodle hosted on my VPS (moodle.mysite.com)

My domain (moodle.mysite.com) is not bought yet, so its just an IP address to access it


I have decided and already set up a cPanel account and have access to all the functions (File manager / FTP accounts / mysql DBs / etc)

Where would I go from here? (Somewhere along the lines of uploading the moodle files somewhere to my site?  Im not sure where exactly.)

In reply to Daphne Chin

Re: Completely new to how to install Moodle for my site

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Okay, this will be slightly complex, but not too bad.

1) Why not purchase your domain name?  Since you have bought from GoDaddy, they are probably sending you discount promotions, like 20%, 30% 40% off new purchases.  If you think you are going to have this site for awhile, consider buying your domain name for 5 years at the discounted rate.

2) I too have WHM and cPanel.  WHM controls your overall site, cPanel controls one user.  This is good.

3) If you ever need to reboot your server, in WHM goto System Reboot | Graceful.

Here are my notes about what I did in WHM.  Some of these are optional, but see how far you get.

Things to do in WHM:

Go to Account Information | List Accounts.  If there is no account, you will want to create one for yourself.  For example, I created one for rjerzcom.  This then becomes the account where I will install moodle.  I image all of this can be done as "root", but as a novice I have learned that doing things as root can be dangerous.  So I install Moodle as rjerzcom.  (my domain, incidentally, is rjerz.com).  

(optional) Change the timezone, Home|Server Configuration|Server Time = America/Chicago (for example).

(optional) Add yourself (in my case rjerzcom) to “wheel group” users, for su access.

Try ssh to server.  This is important.  You will want to be able to ssh to your server as yourself (in my case rjerzcom).  In Terminal (Mac), I try ssh rjerzcom@mydomainname.com, password, success.  This is where you will be installing your moodle, as a user, not as root.

Try switching to su while in ssh.  Issue "su", put in the root password, and see if you have success.  At this point, as su, you can do a "yum update."  Remember if anything goes wrong on a new server, you can always reprovision your server to start from scratch.  I find that it is important to be able to ssh as yourself, and then to be able to switch to su because some administrative tasks have to be done as root.

Back in WHM, find "Easy Apache."  This is an important and nice utility.  From Easy Apache, you update apache and php, and turn on all the required Moodle directives.  I added: zip, xmlrpc, soap, mysql improved, mbstring, intl, gd. These are all needed for Moodle.  It may seem like a scary step, but do it.  Right now, I am using PHP 5.5 and Apache 2.4 (I see that I have to click on the "gear" to make changes.)  I would pick something like php 5.5.32, and then in the exhaustive options list, turn on the directives that you need.

At this point, if you are successful, you might want to try FTPing to your account (as yourself).  Sometimes FTP is handy to be able to do.

Now even though the above might seem difficult, you are basically ready to install moodle.  You see, these steps make sure that your server is ready.  If you don't, for example, install the php directives, Moodle will complain and not install.  On a GoDaddy hosted server, some of these steps are automatically done for you, but not on a VPS.  GoDaddy assumes that if you buy a VPS that you know to how to do these things on your own.

Someday, I plan to make a video showing these steps.  The "expert" server administrators will probably have their own ways of doing these things, but I am a novice.  Actually, I am a professor, not a system administrator.  

Before I go on, however, let me know if you are having any success with the above steps, please.

If you are successful gaining ssh access to your account, you should be able to type "ls -al" and see a list of files and directories, maybe 20-25 of these will show.  You will see a folder public_html.  This is where moodle will go.  It is your website, too.

Tell me, would you like to install moodle in www.yourdomain.com/moodle?  This is what I do.  I then find it easy to update moodle in the future.  But some folks want moodle to appear at www.yourdomain.com.  

I will be back with you after you report your progress.  See you again soon.


Average of ratings: Useful (2)
In reply to Daphne Chin

Re: Completely new to how to install Moodle for my site

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Oops, forgot one step.

In WHM, go to Software|MySQL Upgrade.  I had picked MySQL 5.5.  I see that mySQL 5.6 is now available. Pick either of these.  One may already be the default for you, and you may not need to make any change.

I also see that I can now pick MariaDB.  Hmmm, for now, I wouldn't do this.  But experts here might advise you differently.


In reply to Rick Jerz

Re: Completely new to how to install Moodle for my site

by Daphne Chin -

Hi Rick!

Once again, really appreciate you taking the time to slowly explain and guide me through this step by step.


I have already set up a subdomain (moodle.mysite.com) and have linked it to the IPaddress of my site on the VPS server.

I have already created an account in WHM (moodle.mysite.com) and have accesss to the CPanel.

I have used PuTTY as the SSH and have been able to connect and command "ls -al" shows many folders, as well as public_html are all in purple.

Easy Apache 3 is set-up (PHP 5.5 & Apache 2.4)

I have used FTP Before and used filezilla FTP and managed to access all my files and can see public_html , www, public_ftp, and much more.


So far not much problems.

I want it installed on www.moodle.mysite.com


Again, really appreciate your help and step-by-step guidance.

Where to from here?

In reply to Daphne Chin

Re: Completely new to how to install Moodle for my site

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Okay. Sounds good.

I have not yet installed moodle in a subdomain.  When you look at your VPS, do you see a folder for your subdomain and a public_html for it?

The steps from here are a bit easier.  You might have to interpret what I say for your own situation, but I think that you might be able to do this.

1) In cpanel for your user, go to Databases | MySQL Databases, and create a database.  You can call it anything, but I like moodle3.  My database will look like rjerzcom_moodle3.  Also, create a user. For example, I created a user called rjerzcom_mdl, but this can be almost anything.  Then, add your user to the database (lower part of screen.)  When you do this, give the user all privileges.

Then in cpanel, goto to phpMyAdmin. Pick the database that you just created, on the top bar pick "Operations", change the Collation to utf8_unicode_ci, and hit Go.

At this point, you now have your moodledatabase.

By the way, you will need to remember your database name, database user, and password for when you install moodle.

2) SSH into your server.  Up one level from public_html, create a moodledata folder.  You can name this anything, even moodledata, but maybe moodledata3.  Then change its "rights" to 777.  Here are the commands:

mkdir moodledata

chmod 777 moodledata.

At this point, you have a moodledata folder.  Remember its name.

3) I like to get and unpack moodle in a temporary folder.  While still in SSH, create a folder called moodletmp.  (mkdir moodletmp).  Then move into it (cd moodletmp).  Then get a new fresh copy of moodle.  Use this SSH command:

wget http://downloads.sourceforge.net/project/moodle/Moodle/stable30/moodle-latest-30.tgz

Next, unpack this with the following command:

tar -xvzf moodle-latest-30.tgz

4) Move this new unpacked moodle to your subdomain.  This needs to go into your public_html folder.  Again, I have not done this myself in a subdomain.  Also, I like my moodle to be in its own directory, such as www.mydomainname.com/moodle, but if you want it to be right at your domain name (not down in its own folder) you will need to modify my command.  I think you will see what is going on.

So while you are in moodletmp, and you see the moodle folder, move this moodle folder with the following command:

mv -i moodle ../public_html/moodle

5) Well, all should be well now.  This is the last step, getting moodle installed.  You do this from your browser.  Go to www.yourdomainname/moodle.  When you do this, the moodle install begins.  From here, you fill in blanks.  At one screen, you will need to put in your database name, database user name, database password, and location to your moodledata folder.  As simple as this seems, this is where many folks encounter problems.  They might not have the correct database password, for example.  They might not have the right database user name.  In general, if you don't enter the correct information, moodle will complain and not proceeded.

If successful, the install questions and process will work.  You will then have moodle running.

The beauty of these steps is that you are never in any real danger of anything.  You can always repeat any of these steps and experiment.  You can even set up an experimental moodle by creating another database, another moodledata folder (such as moodledata_exp), and install another moodle (such as moodle_exp).  The command for this moodle_exp version (from moodletmp) would be:

mv -i moodle ../public_html/moodle_exp.

You can always delete your database, remove folders (rm -rf moodle, for example.) and repeat any of these steps.  You shouldn't need to mess around with config.php.  Don't mess around with any moodle code, either.

Okay, report back to me.

One more thing.  I am giving you my technique.  If you read the moodle docs for installation, you will gain some insight to what you are really doing.  You should see that my steps somewhat parallel the moodle docs steps.  Yes, there is a "GIT" technique.  I understand this, and Ken is an expert using this technique.  But my way is a step by step way, and it helps you understand the basics, I believe.  Later on, upgrading your moodle is nearly identical (no need for a new database or moodledata folder, however.)


Average of ratings: Useful (2)
In reply to Rick Jerz

Re: Completely new to how to install Moodle for my site

by Daphne Chin -

Hi Rick!

Thanks to your guidance, I managed to set up and install moodle successfully on my site.

However, I forgot to include mysqli improved during easy apache installation and finally found out I forgot to check that.

Also, I also encountered a "Php_extensions mbstring is not okay" alert when checking for pre-requisites. But I went ahead with the installation anyway. Would that pose any problems?

Wanna thank you again for helping me tremendously. I will do more research on the upgrading part


In reply to Daphne Chin

Re: Completely new to how to install Moodle for my site

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Of course, this is good new.

Remember that you can practice installing more moodles.  At least one for "production" and one for "experimenting."

Along the way, you will probably want to make a few adjustments to php.ini.  There are also some mySQL adjustments to make.  But you don't need to do these immediately.  Just get used to your moodle.

In reply to Daphne Chin

Re: Completely new to how to install Moodle for my site

by David Ordóñez -

Hi Daphne

There is a lot of hosting companies you can check... but i don't know if is there a place here for a full list...

The thing you have to consider in my opinion, is that you need a ready to go working moodle, without configuring every aspect of your plattform, and i think a standard stack is ok for your needs.

The standard moodle installations generally uses a LAMP Server (Linux, Apache, Mysql and PHP), and you can spend time with this stack if you want to scale your application, however if scaling it's not important for you in this moment, the default LAMP stack and it's configuration offered by many companies are ok...

In my opinion you can get a VPS in a IaaS (Infraestructure as a Service) Company. With few clics you can get a working server and the only "hard work" to do is moodle installation.

And it's really cheap!!

David!!!!

Average of ratings: Useful (1)
In reply to Daphne Chin

Re: Completely new to how to install Moodle for my site

by Ken Task -
Picture of Particularly helpful Moodlers

All that have responded have shared back good info ... nothing wrong with what they've said/suggested ... however ...

With many years experience at open source software (LAMP stack), have learned one item to consider which hasn't been mentioned yet (as one is just beginning) ... updates/upgrades - makes no difference where/with whom or on what.

Am not attempting to dis-courage you in any form or fashion ... DO GO FORTH!

Moodle is at 3.0.2+ right now, but it won't stay there forever.   And like all software, updates will be required ... and am almost certain upgrades would be desired if you stay with Moodle.

So when checking out a home for your Moodle offering, if one doesn't see updates/upgrades mentioned in the info found, ask!  Case in point ... not Moodle but open sourced ... 1.5.x Joomla's hosted on SiteGround ($4.95 a month).   Just this past year, SiteGround informed all users still using 1.5.x (now totally unsecure) would have their sites blocked to public access.   They advised those customers to upgrade to the highest most secure version of Joomla, which isn't a piece of cake and does require some 'technical understanding' as well as 'expertise'.   SG did offer to upgrade ... for an un-disclosed fee (ie, they didn't post publically where anyone could read/see it).   Don't blame them cause, like Moodle's, all Joomla's NOT the same.  Upgrading some would take a lot longer than others.  That could be true of Moodle's as well.

Just my 2 'sense'!

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Completely new to how to install Moodle for my site

by Daphne Chin -

Do appreciate the heads up. Will keep that in mind =)

In reply to Ken Task

Re: Completely new to how to install Moodle for my site

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Hi Ken, with the GoDaddy VPS and WHM, I believe that WHM takes care of updates of most of Apache.  Also, Daphne does have a LAMP server, which we would agree is a good place to be.

I will be curious to see Daphne's success.  As you know, we have tried to guide many users through this process, with varying approaches.  Certainly jump in if you see me missing something or guiding incorrectly.

In reply to Rick Jerz

Re: Completely new to how to install Moodle for my site

by Ken Task -
Picture of Particularly helpful Moodlers

Was referring to Moodle updates/upgrades ... not the operating system updates/upgrades.   Uhhhh, if in a VPS, isn't the customer is responsible for those?   Considering, just this past week, yet another openssl issue announced everyone running https should update openssl.   Nice thing about most Linux OS's ... fixes/patches are released and available as soon as they have a fix.  Many times, one day - no 30 day window wait or 'out of band' updates.   And for customers on multiuser hosted systems, wonder when those boxen get the updates they need to stay secure?

No ... your way is your way ... don't host with GoDaddy so with that in mind ... believe, however, that nothing but command line (install/update/or upgrade) covers it.  The catch 22 could be how GoDaddy setups up VPS systems.

Am not a git ninja ... don't really want to be ... DO want to use it, however, because it's an efficient way to install/update and upgrade a moodle.  Learn enough to do that.   Earn git ninja belt's later and with a sandbox! ;)

Conditions: CentOS 5,6,7 as is configured installed in a standalone server ... may/may not be a VPS "cookie cutter' that many hosting providers do cause it's easier/faster for them to get a customer up and running, but not necessarily 'best' for customer (in the long run).

1. user can ssh into server and either su to root or run sudo

2. mysqld, httpd services already running

3. there is a mysql user that has full priv's to all dbs - user is known.  password is known.

4. account allows install of git via yum.

------------------------------------------
Installing git: yum -y install git [ENTER]
Done!
------------------------------------------

Already defined and known:
1. httpd (apache) knows that /var/www/ is it's space (default for CentOS)
can read/write anywhere in that space.

2. httpd (apache) knows that 'document root' is /var/www/html/ (default for CentOS) - will change this below

3. main configuration file for httpd (apache) is in /etc/httpd/conf/ and called httpd.conf


----------------------------------
Steps to installing Moodle via git
----------------------------------

Database

Create an empty database for Moodle
mysql -u root -p[password] [ENTER]
at the mysql> prompt:  create database character set utf8 collate utf8_general_ci; [ENTER]
Done!

---------

Create a data directory for Moodle

cd /var/www/ [ENTER]
mkdir moodledata [ENTER]
chown apache:apache moodledata [ENTER]
Done!
----------

Putting moodle as the default app when anyone accesses the site.

cd /etc/httpd/conf/ [ENTER]
nano httpd.conf [ENTER] ... find the line for 'DocumentRoot'.  It will show: DocumentRoot "/var/www/html"
add to the end of that path '/moodle'
Now it looks like: DocumentRoot "/var/www/html/moodle" (no trailing slash)

Save the file

Done!

Git Moodle code (already logged on and located in /var/www/ where you created moodledata)

cd html
git clone git://git.moodle.org/moodle.git moodle [ENTER]
cd moodle [ENTER]
git branch --track MOODLE_30_STABLE origin/MOODLE_30_STABLE
git checkout MOODLE_30_STABLE

Check version of Moodle code:
fgrep '$release' version.php
Version reported there the one you want?
Done!
---------

Install Moodle (already located in /var/www/html/moodle.  Paths are from that directory.)  This does NOT use apache server ... just php and mysqld are involved.

php admin/cli/install.php [ENTER]
You will be prompted for the same things as in GUI install.
Must know: DB driver (default is mysqli), DB user, DB password, location of moodledata, and when setting up the first user [admin] write down the password you gave that user

It will run through the creation of tables in the DB.  A config.php file will be created.

When finished:
chown apache:apache * -R

Done!
------------------------

Restart httpd (apache).  Remember, we changed DocumentRoot above!
/sbin/service httpd restart [ENTER]Now hit site with browser and login as admin user to complete profile for admin user.
Add another user and set that user to admin level.

Done!

Advantage:

1. no FTP ... no wget ... no download, unzip (whatever) only to have turn around and upload or after wgetting, unzipping

2. done all on the server ... code acquired from Moodle.org git servers to yours ... server to server is faster
and more accurate than user FTP or wget

3. no browser time outs.  No tweaks needed for php nor mysql (yet - you will, fairly soon, have to tweak them)

**** 4. Moodle is now easily updatable and upgradeable using just a few git commands.

How to update with no backup (really would recommend backing up first):

login as root
cd /var/www/html/moodle [ENTER]
git pull [ENTER]
php admin/cli/upgrade.php --non-interactive
chown apache:apache * -R

Done!

How to update with backup before update AND lock out users while you update.

login as root
Create a /home/backup/ directory

mkdir /home/backup/ it's ok if it belongs to root.

mysqldump -u root -p[PASSWORD] moodle > /home/backup/moodlebackupYYYYMMDD.sql [ENTER]
cd /var/www/html/
tar -cvf /home/moodlecodebackupYYYYMMDD.tar /var/www/html/moodle

Then execute the same commands above for git update - repeated just below:
The lines related to maintenance mode locks all users out.
Remember you are root user and all updated files will be tagged as belonging to root user root group.

cd /var/www/html/moodle [ENTER]
php admin/cli/maintenance.php --enable
git pull [ENTER]
php admin/cli/upgrade.php --non-interactive
chown apache:apache * -R
php admin/cli/maintenacne.php --disable

Done!

One could purge caches as well as run cron at appropriate times in scripts above as well.

php admin/cli/cron.php

php admin/cli/purge_caches.php


Truth in advertising ...
git update or upgrade will NOT update/upgrade add-on plugins ... only core code.  The Moodle Admin UI, however, will.  Small price to pay considering  backup and update or upgrade of core code *is* the 'heavy lifting' and takes minutes ... most of the time ... depending upon size of site.   Adding a backup of the moodledata directory would, of course, take longer.

One size doesn't fit all. ;)

'spirit of sharing', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Completely new to how to install Moodle for my site

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Ken, great response.  Thanks.

This forum discussions (like many others) provides folks with a good share of knowledge.

(I am not sure if I offended you, but if so, this was certainly not intentional.  It was just to make the point that there are a number of ways to install moodle.  Also, these "Godaddy" installs seem to get attention.  Daphne succeeded with our help!"

In reply to Rick Jerz

Re: Completely new to how to install Moodle for my site

by Ken Task -
Picture of Particularly helpful Moodlers

No offense taken at all! ;)

As long as she's up and running, that was the request for assistance.  She was able to follow your directions without issue and that's great! +20   Nice to have someone round with GoDaddy experience.

'spirit of sharing', Ken