Installing Moodle
Total Page:16
File Type:pdf, Size:1020Kb
Installing Moodle Main page ► Installation ► Installing Moodle INSTALLATION Installing Moodle Installation Quickstart Cron Installing plugins Installation FAQ Upgrading Upgrade overview Automatic updates deployment Git guide Administration via command line Upgrading FAQ Moodle migration This page explains how to install Moodle. If you are an expert and/or in a hurry try Installation Quickstart. If you just want to try Moodle on a standalone machine there are one-click installers for "indows #see Complete install packages for "indows) and for %SX #see Complete Install (ackages for Mac %S '$) *hese are unsuita+le for production servers) CONTENTS ,hide- . /equirements o .). Hardware o .)2 Software 2 Set up your server 3 Download and copy files into place 6 Create an empty database 7 Create the ( moodledata ) data directory o 7). Securing moodledata in a web directory 8 &tart Moodle install o 8). Command line installer o 8)2 "eb based installer 9 Final configuration o 9). Settings within Moodle o 9)2 /emaining tasks o 9)3 Installation is complete :$ o 9)6 If something goes wrong... ; Platform specific instructions < See also Requirements Moodle is primarily developed in =inu> using Apache? (ostgreSQ=@My&Q=@Maria4A and (1( (also sometimes known as the =AMP platform$) If in dou+t? this is the safest com+ination (if for no other reason than +eing the most common$) *here are other options - see the Software section that follows: If you are installing Moodle in a "indows server? note that from php7)7 onwards? you will also need to have the Visual CCC /edistri+uta+le for Visual &tudio 2D.2 installed from: http:@@www)microsoft)com@en-us@download@details)asp>EidF3D89< Visual CCC- ( >;8 or >86$ *he +asic re0uirements for Moodle are as follows: Hardware 4isk space: .8DMB free (min$ plus as much as you need to store your materials) 7GB is pro+a+ly a realistic minimum) Processor: .G1G (min$? 2G1G dual core recommended) *hese settings may vary according to the resources used) Backups: at least the same again (at a remote location prefera+ly$ as a+ove to keep +ackups of your site) Memory: 278MB (min$? .GB or more is strongly recommended) *he general rule of thum+ is that Moodle can support .D to 2D concurrent users for every .GB of /AM? +ut this will vary depending on your speci5c hardware and software com+ination and the type of use) Concurrent really means we+ server processes in memory at the same time (i)e) users interacting with the system within a window of a few seconds$) It does H%* mean people logged in ) Software See the release notes in the dev docs for software re0uirements) Set up your server )))or desktop computer? if you are just evaluating Moodle) *here are lots of possi+ilities for installing the +asic server software depending on your particular choices) Some links and pointers are at Installing AM( If you are using a hosted server all this should +e done for you) 1owever? (especially on shared hosting) make sure you understand or 5nd out how to change (1P settings (e)g) 5le upload ma>imums$) *his can vary a huge amount from host to host) Download and copy files into place IMPORTANT: While there are now a number of pla es !ou an get the Moodle ode" !ou are strongl! ad#ised to obtain Moodle from moodle$org$ If !ou run into problems it will be a great deal easier to support !ou$ Iou have two options: 4ownload your re0uired version from http:@@moodle)org@downloads and unGip@unpack))) OR Pull the code from the Git repository #recommended for developers and also makes upgrading very simple$: $ git clone --depth=1 -b MOODLE_28_STABLE --single-branch git://git.moodle.org/moodle.git --depthF. for shallow cloning (only) latest revision --single!+ranch option to limit cloning to a single +ranch? this fetches the Moodle 2); Sta+le +ranch (latest weekly +uild$) For a fuller discussion see Git for Administrators) Either of the a+ove should result in a directory called moodle? containing a num+er of 5les and folders) Iou can either place the whole folder in your we+ server documents directory? in which case the site will +e located athttp:/%!ourwebser#er$ om%moodle? or you can copy all the contents straight into the main we+ server documents directory? in which case the site will +e simply http:/%!ourwebser#er$ om) See the documentation for your system and@or we+ server if you are unsure) Tip: If you are downloading Moodle to your local computer and then uploading it to your hosted we+ site? if possi+le upload the compressed 5le and decompress at the remote end #check your 5le manager'$) Failing that? watch F*( progress carefully for errors or missed 5les) Se ure the Moodle &les: It is vital that the 5les are not writea+le +y the we+ server user) For e>ample? on Uni>@=inu> (as root$: # chown -R root /path/to/moodle # chmod -R 0755 /path/to/moodle # find /path/to/moodle -type f -exec chmod 0644 {} \; #5les are owned +y the administrator/superuser and are only writea+le +y them - reada+le +y everyone else$ *he third command 5nds all the regular 5les and e>ecutes the chmod command D866 on them) If you want to use the +uilt-in plugin installer you need to make the directory writa+le +y we+ server user) It is strongly recommended to use AC= when your server supports it? for e>ample if your Apache server uses account www-data: # chmod -R +a "www-data allow read,delete,write,append,file_inherit,directory_inherit" /path/to/moodle *he eKect of the previous command is to allow the Apache user account (www-data in this case) to access and change 5les within the moodle site) Many people would consider this a +rave move for a new site admin to implement) In a new moodle you can safely leave this out) A default U+untu install does not have the Ca option for the chmod command anyway) *he Ca attri+ute is an AC= #Access Control =ist$ facility which allows you to set per user access for individual 5les) For e>ample? %SX has this +y default) Create an empty database He>t create a new? empty data+ase for your installation) Iou need to 5nd and make a note of following information for use during the 5nal installation stage: dbhost - the data+ase server hostname) Pro+a+ly localhost if the data+ase and we+ server are the same machine? otherwise the name of the data+ase server dbname - the data+ase name) "hatever you called it? e)g) moodle dbuser - the username for the data+ase) "hatever you assigned? e)g) moodleuser - do not use the root@superuser account) Create a proper account with the minimum permissions needed) dbpass - the password for the a+ove user If your site is hosted you should 5nd a we+!+ased administration page for data+ases as part of the control panel (or ask your administrator). For everyone else or for detailed instructions? see the page for your chosen data+ase server: (ostgreSQ= Maria4A My&Q= MSSQ= %racle #known issues? not fully supported$ Create the (moodledata) data directory Moodle re0uires a directory to store all of its 5les (all your site s uploaded 5les? temporary data? cache? session data etc)$) *he we+ server needs to +e a+le to write to this directory) %n larger systems consider how much free space you are going to use when allocating this directory) 4ue to the way Moodle caches data you may have performance issues if you use relatively slow storage (e)g) HFS) for this directory) /ead the(erformanceLrecommendations carefully and consider using (e)g)$ memcached for Caching) IMPORTANT: *his directory must NOT +e accessi+le directly via the we+) *his would +e a serious security hole) 4o not try to place it inside your we+ root or inside your Moodle program 5les directory) Moodle will not install) It can go anywhere else convenient) 1ere is an e>ample (Uni>@=inu>) of creating the directory and setting the permissions for an!one on the server to write here) *his is only appropriate for Moodle servers that are not shared) 4iscuss this with your server administrator for +etter permissions that just allow the we+ server user to access these 5les) # mkdir /path/to/moodledata # chmod 0777 /path/to/moodledata If your server supports AC= it is recommended to set following permissions? for e>ample if your Apache server uses account www-data: # chmod -R +a "www-data allow read,delete,write,append,file_inherit,directory_inherit" /path/to/moodledata If you are planning to e>ecute (1P scripts from the command line you should set the same permissions for the current user: $ sudo chmod -R +a "`whoami` allow read,delete,write,append,file_inherit,directory_inherit" /path/to/moodledata Securing moodledata in a web directory If you are using a hosted site and you have no option +ut to place moodledata in a we+ accessi+le directory) Iou may +e a+le to secure it +y creating an )htaccess 5le in the moodledata directory) *his does not work on all systems - see your host@administrator) Create a 5le called )htaccess containing only the following lines: order deny,allow deny from all Start Moodle install It s now time to run the installer to create the data+ase ta+les and con5gure your new site) *he recommended method is to use the command line installer) If you cannot do this for any reason (e)g) on a "indows server) the we+ +ased installer is still availa+le) Command line installer It s +est to run the command line as your system s we+ user) Iou need to know what that is - see your system s documentation (e)g) U+untu@4e+ian is www-data ? Centos is apache $ J>ample of using the command-line (as root - su+stitute www-data for your we+ user): # chown www-data /path/to/moodle # cd /path/to/moodle/admin/cli # sudo -u www-data /usr/bin/php