<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/32/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dgerman</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/32/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dgerman"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/Special:Contributions/Dgerman"/>
	<updated>2026-04-18T23:08:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Flat_file&amp;diff=78464</id>
		<title>Flat file</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Flat_file&amp;diff=78464"/>
		<updated>2010-11-29T17:53:43Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: update image for 2.0/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: Flat file edit settings link in &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Enrolments &amp;gt; Manage enrol plugins&#039;&#039; in 2.0 onwards or &#039;&#039;Administration &amp;gt; Courses &amp;gt; Enrolments&#039;&#039; pre-2.0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A flat file allows bulk enrolment management (enrol or unenrol) of existing users in existing course. The file is read one time by Moodle then erased. The file is located in the moodle file structure as a text file and [[Cron]] provides the timing when it is read.  &lt;br /&gt;
&lt;br /&gt;
==Options==&lt;br /&gt;
The site administrator should edit the settings for a flat file if it is enabled. &lt;br /&gt;
[[Image:Enrolment Flat file options.png|thumb|center|Options for flat file enrolment]] &lt;br /&gt;
&lt;br /&gt;
Version 2.0&lt;br /&gt;
&lt;br /&gt;
[[Image:EnrolSettngsFlatFile 2.0.png]]&lt;br /&gt;
&lt;br /&gt;
The default name and location of the file is &#039;&#039;.../moodledata/1/enrolments.txt&#039;&#039;.  &lt;br /&gt;
:If you do specify a file path, it should be absolute (eg /var/moodledata/enrolments.txt) and can be read and modified by the webserver process.&lt;br /&gt;
&lt;br /&gt;
You can choose to have an email sent to notify the Administrator, Teachers and/or students when the file has been processed.&lt;br /&gt;
&lt;br /&gt;
==Flat file structure==&lt;br /&gt;
The file should be structured with the action, role, user id, and course ID number.  Optionally a start time and end time can be added as additional fields.&lt;br /&gt;
&lt;br /&gt;
The edit field link will give details on how to format the flat file on the Administration &amp;gt; Courses &amp;gt; Enrolments&#039;&#039; page.&lt;br /&gt;
&lt;br /&gt;
[[Image:Enrolment Flat file data.png|thumb|center|Flat file instructions for fields and records]]&lt;br /&gt;
 &lt;br /&gt;
==See also==&lt;br /&gt;
*[[Upload users]]&lt;br /&gt;
*[[Bulk user actions]] how to download site user information (including userIDs)&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=13289 How does flat file work?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=45514 un-enroll a user from a course]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=144997 Flat file enrolments - how is this typically used by organisations?]&lt;br /&gt;
&lt;br /&gt;
[[Category:Enrolment]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Inscription par fichier plat]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78411</id>
		<title>Upload users</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78411"/>
		<updated>2010-11-29T02:08:55Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: pull update user section up here&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Users &amp;gt; Accounts &amp;gt; Upload users&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Upload users preview.png|thumb|Upload users preview in Moodle 1.9]]&lt;br /&gt;
Firstly, note that it is usually not necessary to import users in bulk - to keep maintenance work down you should first explore forms of authentication that do not require manual maintenance, such as [[External database authentication|connecting to existing external databases]] or letting the [[Internal enrolment|users create their own accounts]]. See [[Manage authentication]] for more information.&lt;br /&gt;
&lt;br /&gt;
If you are sure you want to import multiple user accounts from a text file, then you need to format your text file as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upload users file format==&lt;br /&gt;
&lt;br /&gt;
* Each line contains fields &#039;&#039;&#039;separated&#039;&#039;&#039; by commas (or other delimiters) without quotes (&amp;quot;) and no trailing delimiter&lt;br /&gt;
* The first line is special, and contains fieldnames defining the format for the rest of the file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Required fields&#039;&#039;&#039;:  In any order&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;username, password, firstname, lastname, email&amp;lt;/code&amp;gt;&lt;br /&gt;
:Validity checks fare performed for:&lt;br /&gt;
#&amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt; can only contain alphabetical &#039;&#039;&#039;lowercase&#039;&#039;&#039; letters , numbers, hypen &#039;-&#039;, underscore &#039;_&#039;, period &#039;.&#039;, or at-sign &#039;@&#039; &lt;br /&gt;
#&amp;lt;code&amp;gt;Password&amp;lt;/code&amp;gt; should meet the requirements for the site&#039;s [[Site_policies#Password_policy|Password policy]]. .To force password change, set the password field to &amp;lt;code&amp;gt;changeme&amp;lt;/code&amp;gt;.&lt;br /&gt;
#&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt; is in the form: &#039;&#039;name@example.com&#039;&#039; .&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Optional fields&#039;&#039;&#039;: To provide values other than the default include one or more of these&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;institution, department, city, country, lang, auth, ajax, timezone, idnumber, icq, phone1, phone2, address, url, description, mailformat, maildisplay, htmleditor, autosubscribe, emailstop&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Custom profile field names&#039;&#039;&#039;: (Optional). xxxxx is the real custom user profile field name (i.e. the unique shortname)&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;profile_field_xxxxx&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
: Create the custom fields BEFORE importing. Use the standard header. The &amp;quot;shortname&amp;quot; for your custom field is xxxxx. The first record must include &amp;quot;profile_field_xxxxx&amp;quot;.&lt;br /&gt;
:&#039;&#039;&#039;Example&#039;&#039;&#039;: To create a custom field &amp;quot;genre&amp;quot;, you must write a shortname &amp;quot;genre&amp;quot; in the new field, and write &amp;quot;profile_field_genre&amp;quot; in the header of the .csv file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Special fields&#039;&#039;&#039;: Used for changing of usernames or deleting of users&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
*&#039;&#039;&#039;Enrolment fields&#039;&#039;&#039;: (Optional):&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;course1, type1, role1, group1, enrolperiod1, course2, type2, role2, group2, enrolperiod2&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
**&amp;lt;code&amp;gt;course&amp;lt;/code&amp;gt; is the &amp;quot;shortname&amp;quot;  if present the user will be enrolled in those courses.&lt;br /&gt;
** &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt; refers to the role to be used for associated course enrolment. Value 1 is default course role, 2 is legacy Teacher role and 3 is legacy Non-editing Teacher.&lt;br /&gt;
** You can use role field instead to specify roles directly - use either role short name or id (numeric names of roles are not supported).&lt;br /&gt;
** Users may be also assigned to groups in course (group1 in course1, group2 in course2, etc.).&lt;br /&gt;
*** A group is identified by name or id (numeric group names are not supported).&lt;br /&gt;
** From Moodle 2.0, you can set the enrolment duration, in days, for each course (&amp;lt;code&amp;gt;enrolperiod1&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;enrolperiod2&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course2&amp;lt;/code&amp;gt;, etc.).&lt;br /&gt;
&lt;br /&gt;
Commas within  a field must be encoded as &amp;amp;#44 - the script will decode these back to commas.&lt;br /&gt;
&lt;br /&gt;
For Boolean fields, use &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; for false and &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; for true.&lt;br /&gt;
&lt;br /&gt;
Turn email off: &amp;lt;code&amp;gt;emailstop&amp;lt;/code&amp;gt; set to &amp;lt;CODE&amp;gt;1&amp;lt;/CODE&amp;gt; if the email address should be disabled (default: email is enabled):&lt;br /&gt;
&lt;br /&gt;
To prevent users from receiving a large number of emails from courses or forced subscription forums use the &#039;&#039;&#039;maildigest&#039;&#039;&#039;.  The options for this field are 0 = No digest, 1 = Complete digest and 2 = Digest with just subjects.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a valid upload file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;username, password, firstname, lastname, email, course1, group1&amp;lt;br /&amp;gt;&lt;br /&gt;
jonest, verysecret, Tom, Jones, jonest@someplace.edu, math102, Section 1&amp;lt;br /&amp;gt;&lt;br /&gt;
reznort, somesecret, Trent, Reznor, reznort@someplace.edu,math102, Section 3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Updating existing accounts==&lt;br /&gt;
By default Moodle  creates new user accounts, and skips lines where the &amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt; matches an existing account. Set &amp;quot;Upload Type&amp;quot; to &#039;&#039;&#039;Add  new and update existing accounts&#039;&#039;&#039;, and existing user account will be updated.&lt;br /&gt;
&lt;br /&gt;
Include  fieldname &amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt; to updating existing accounts and change usernames.  In the preview options, Set &amp;quot;Allow renames&amp;quot; to &#039;&#039;&#039;Yes&#039;&#039;. &lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: errors updating existing accounts can affect your users badly. Be careful when using the options to update.&lt;br /&gt;
&lt;br /&gt;
==After preview==&lt;br /&gt;
After the preprocessing, depending on the contents of the upload, the following may be available before final user creation&lt;br /&gt;
*Settings&lt;br /&gt;
** New user password &lt;br /&gt;
** Existing user details&lt;br /&gt;
** Existing user password&lt;br /&gt;
** Allow renames&lt;br /&gt;
** Allow deletes&lt;br /&gt;
** Prevent email addess duplicates&lt;br /&gt;
** Select for bulk operations&lt;br /&gt;
&lt;br /&gt;
* Default values&lt;br /&gt;
** Authentication method: Manual account |no login | EMail-based self-registration&lt;br /&gt;
** Email display: Allow only other course members to see my email address | hide .. from everyone | allow anyone ...&lt;br /&gt;
** Email format Pretty HTML | plain text&lt;br /&gt;
** Email digest type: none|complete subjects&lt;br /&gt;
** Forum auto-subscribe: no |yes when  I post&lt;br /&gt;
** When editing text: use HTML| standard web forms&lt;br /&gt;
** AJAX and Javascript: yes|no&lt;br /&gt;
** city/town&lt;br /&gt;
** country&lt;br /&gt;
** timezone&lt;br /&gt;
** Preferred language&lt;br /&gt;
** Description&lt;br /&gt;
** Web page&lt;br /&gt;
** ID number&lt;br /&gt;
** Institution&lt;br /&gt;
** Department&lt;br /&gt;
** Phone&lt;br /&gt;
** Mobile Phone&lt;br /&gt;
** Address&lt;br /&gt;
&lt;br /&gt;
==After results ==&lt;br /&gt;
Users which were not added, will NOT be auto-enrolled in courses&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Open another moodle browser and &lt;br /&gt;
* Site administration&lt;br /&gt;
** Courses&lt;br /&gt;
*** Add/edit courses; select the category, and the course&lt;br /&gt;
* Course administration&lt;br /&gt;
** Users&lt;br /&gt;
*** Enrolled Users&lt;br /&gt;
**** Enrol users and select the users flagged from other window&lt;br /&gt;
&lt;br /&gt;
==Templates==&lt;br /&gt;
&lt;br /&gt;
The default values are processed as templates in which the following codes are allowed:&lt;br /&gt;
&lt;br /&gt;
* %l - will be replaced by the lastname&lt;br /&gt;
* %f - will be replaced by the firstname&lt;br /&gt;
* %u - will be replaced by the username&lt;br /&gt;
* %% - will be replaced by the %&lt;br /&gt;
&lt;br /&gt;
Between the percent sign (%) and any code letter (l, f or u) the following modifiers are allowed:&lt;br /&gt;
&lt;br /&gt;
* (-) minus sign - the information specified by the code letter will be converted to lowercase&lt;br /&gt;
* (+) plus sign - the information specified by the code letter will be converted to UPPERCASE&lt;br /&gt;
* (~) tilde sign - the information specified by the code letter will be converted to Title Case&lt;br /&gt;
* a decimal number - the information specified by the code letter will be truncated to that many characters&lt;br /&gt;
&lt;br /&gt;
For example, if the firstname is John and the lastname is Doe, the following values will be obtained with the specified templates:&lt;br /&gt;
&lt;br /&gt;
* %l%f = DoeJohn&lt;br /&gt;
* %l%1f = DoeJ&lt;br /&gt;
* %-l%+f = doeJOHN&lt;br /&gt;
* %-f_%-l = john_doe&lt;br /&gt;
* http://www.example.com/~%u/ = http://www.example.com/~jdoe/ (if the username is jdoe or %-1f%-l)&lt;br /&gt;
&lt;br /&gt;
Template processing is done only on default values, and not on the values retrieved from the CSV file.&lt;br /&gt;
&lt;br /&gt;
In order to create correct Moodle usernames, the username is always converted to lowercase. Moreover, if the &amp;quot;Allow extended characters in usernames&amp;quot; option in the Site policies page is off, characters different to letters, digits, dash (-) and dot (.) are removed. For example if the firstname is John Jr. and the lastname is Doe, the username %-f_%-l will produce john jr._doe when Allow extended characters in usernames is on, and johnjr.doe when off.&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;New username duplicate handling&amp;quot; setting is set to Append counter, an auto-increment counter will be append to duplicate usernames produced by the template. For example, if the CSV file contains the users named John Doe, Jane Doe and Jenny Doe without explicit usernames, the default username is %-1f%-l and New username duplicate handling is set to Append counter, then the usernames produced will be jdoe, jdoe2 and jdoe3. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Deleting accounts==&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt; field is present, users with value 1 for it will be deleted. In this case, all the fields may be omitted, except for &amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Deleting and uploading accounts could be done with a single CSV file. For example, the following file will add the user Tom Jones and delete the user reznort:&lt;br /&gt;
&lt;br /&gt;
 username, firstname, lastname, deleted&lt;br /&gt;
 jonest, Tom, Jones, 0&lt;br /&gt;
 reznort, , , 1 &lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
In Moodle 1.8 the file must be UTF-8. In Moodle 1.9 onwards, the encoding may be selected from a large list, including ISO-8859-1.&lt;br /&gt;
&lt;br /&gt;
==Hints==&lt;br /&gt;
&lt;br /&gt;
===Spreadsheet===&lt;br /&gt;
&lt;br /&gt;
If you use a spreadsheet program such as Excel to create your .csv file, check the resulting output in a text editor before you upload it.  It is possible to get trailing commas on each line from an empty field if you have added and deleted columns of information prior to saving the final file. Also check the character encoding. A csv file is a simple text file (ASCII or Unicode) that can be used to upload user accounts.&lt;br /&gt;
&lt;br /&gt;
Excel translates passwords that begin with - (minus) or + (plus) as zero. Even when saving as .csv and saying &amp;quot;Yes&amp;quot; to &amp;quot;Keep this format, and leave out any incompatible features.&amp;quot; Check for this before uploading, as a zero halts the upload process.&lt;br /&gt;
&lt;br /&gt;
If you use a formula in Excel to create fields (for example, the concatenate function to create a user name), then remember to copy the cells with the formula and use special paste with values checked to make them into an acceptable data for a csv file.&lt;br /&gt;
&lt;br /&gt;
===Country===&lt;br /&gt;
The country should be written as a two letter code, in capitals. For example, use BE for Belgium or NL for the Netherlands.  Using &amp;quot;be&amp;quot; or &amp;quot;nl&amp;quot; as a country code will result in a database error.&lt;br /&gt;
:&#039;&#039;Tip:&#039;&#039;  If you are having trouble working out the two-letter code for a country, you can consult this Moodle source code file /moodle/lang/en_utf8/countries.php [http://cvs.moodle.org/moodle/lang/en_utf8/countries.php?view=markup&amp;amp;pathrev=MOODLE_19_STABLE or click here for a 1.9 STABLE list].&lt;br /&gt;
ISO Website: [http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
Moodle Docs:&lt;br /&gt;
*[[Flat file]]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=36851 Can I auto enroll from Excel?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=58215 Making Email Optional]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97903 Uploading users to custom roles]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=144569 Matriculacion con flat file csv] - discussion in Spanish&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
[[Category:Enrolment]]&lt;br /&gt;
[[Category:Groups]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Importer des utilisateurs]]&lt;br /&gt;
[[ja:ユーザのアップロード]]&lt;br /&gt;
[[zh:上传用户]]&lt;br /&gt;
[[ru:Загрузка пользователей]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78410</id>
		<title>Upload users</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78410"/>
		<updated>2010-11-29T02:00:06Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: /* MOVE Updating existing accounts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Users &amp;gt; Accounts &amp;gt; Upload users&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Upload users preview.png|thumb|Upload users preview in Moodle 1.9]]&lt;br /&gt;
Firstly, note that it is usually not necessary to import users in bulk - to keep maintenance work down you should first explore forms of authentication that do not require manual maintenance, such as [[External database authentication|connecting to existing external databases]] or letting the [[Internal enrolment|users create their own accounts]]. See [[Manage authentication]] for more information.&lt;br /&gt;
&lt;br /&gt;
If you are sure you want to import multiple user accounts from a text file, then you need to format your text file as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upload users file format==&lt;br /&gt;
&lt;br /&gt;
* Each line contains fields &#039;&#039;&#039;separated&#039;&#039;&#039; by commas (or other delimiters) without quotes (&amp;quot;) and no trailing delimiter&lt;br /&gt;
* The first line is special, and contains fieldnames defining the format for the rest of the file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Required fields&#039;&#039;&#039;:  In any order&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;username, password, firstname, lastname, email&amp;lt;/code&amp;gt;&lt;br /&gt;
:Validity checks fare performed for:&lt;br /&gt;
#&amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt; can only contain alphabetical &#039;&#039;&#039;lowercase&#039;&#039;&#039; letters , numbers, hypen &#039;-&#039;, underscore &#039;_&#039;, period &#039;.&#039;, or at-sign &#039;@&#039; &lt;br /&gt;
#&amp;lt;code&amp;gt;Password&amp;lt;/code&amp;gt; should meet the requirements for the site&#039;s [[Site_policies#Password_policy|Password policy]]. .To force password change, set the password field to &amp;lt;code&amp;gt;changeme&amp;lt;/code&amp;gt;.&lt;br /&gt;
#&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt; is in the form: &#039;&#039;name@example.com&#039;&#039; .&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Optional fields&#039;&#039;&#039;: To provide values other than the default include one or more of these&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;institution, department, city, country, lang, auth, ajax, timezone, idnumber, icq, phone1, phone2, address, url, description, mailformat, maildisplay, htmleditor, autosubscribe, emailstop&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Custom profile field names&#039;&#039;&#039;: (Optional). xxxxx is the real custom user profile field name (i.e. the unique shortname)&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;profile_field_xxxxx&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
: Create the custom fields BEFORE importing. Use the standard header. The &amp;quot;shortname&amp;quot; for your custom field is xxxxx. The first record must include &amp;quot;profile_field_xxxxx&amp;quot;.&lt;br /&gt;
:&#039;&#039;&#039;Example&#039;&#039;&#039;: To create a custom field &amp;quot;genre&amp;quot;, you must write a shortname &amp;quot;genre&amp;quot; in the new field, and write &amp;quot;profile_field_genre&amp;quot; in the header of the .csv file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Special fields&#039;&#039;&#039;: Used for changing of usernames or deleting of users&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
*&#039;&#039;&#039;Enrolment fields&#039;&#039;&#039;: (Optional):&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;course1, type1, role1, group1, enrolperiod1, course2, type2, role2, group2, enrolperiod2&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
**&amp;lt;code&amp;gt;course&amp;lt;/code&amp;gt; is the &amp;quot;shortname&amp;quot;  if present the user will be enrolled in those courses.&lt;br /&gt;
** &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt; refers to the role to be used for associated course enrolment. Value 1 is default course role, 2 is legacy Teacher role and 3 is legacy Non-editing Teacher.&lt;br /&gt;
** You can use role field instead to specify roles directly - use either role short name or id (numeric names of roles are not supported).&lt;br /&gt;
** Users may be also assigned to groups in course (group1 in course1, group2 in course2, etc.).&lt;br /&gt;
*** A group is identified by name or id (numeric group names are not supported).&lt;br /&gt;
** From Moodle 2.0, you can set the enrolment duration, in days, for each course (&amp;lt;code&amp;gt;enrolperiod1&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;enrolperiod2&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course2&amp;lt;/code&amp;gt;, etc.).&lt;br /&gt;
&lt;br /&gt;
Commas within  a field must be encoded as &amp;amp;#44 - the script will decode these back to commas.&lt;br /&gt;
&lt;br /&gt;
For Boolean fields, use &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; for false and &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; for true.&lt;br /&gt;
&lt;br /&gt;
Turn email off: &amp;lt;code&amp;gt;emailstop&amp;lt;/code&amp;gt; set to &amp;lt;CODE&amp;gt;1&amp;lt;/CODE&amp;gt; if the email address should be disabled (default: email is enabled):&lt;br /&gt;
&lt;br /&gt;
To prevent users from receiving a large number of emails from courses or forced subscription forums use the &#039;&#039;&#039;maildigest&#039;&#039;&#039;.  The options for this field are 0 = No digest, 1 = Complete digest and 2 = Digest with just subjects.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a valid upload file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;username, password, firstname, lastname, email, course1, group1&amp;lt;br /&amp;gt;&lt;br /&gt;
jonest, verysecret, Tom, Jones, jonest@someplace.edu, math102, Section 1&amp;lt;br /&amp;gt;&lt;br /&gt;
reznort, somesecret, Trent, Reznor, reznort@someplace.edu,math102, Section 3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==After preview==&lt;br /&gt;
After the preprocessing, depending on the contents of the upload, the following may be available before final user creation&lt;br /&gt;
*Settings&lt;br /&gt;
** New user password &lt;br /&gt;
** Existing user details&lt;br /&gt;
** Existing user password&lt;br /&gt;
** Allow renames&lt;br /&gt;
** Allow deletes&lt;br /&gt;
** Prevent email addess duplicates&lt;br /&gt;
** Select for bulk operations&lt;br /&gt;
&lt;br /&gt;
* Default values&lt;br /&gt;
** Authentication method: Manual account |no login | EMail-based self-registration&lt;br /&gt;
** Email display: Allow only other course members to see my email address | hide .. from everyone | allow anyone ...&lt;br /&gt;
** Email format Pretty HTML | plain text&lt;br /&gt;
** Email digest type: none|complete subjects&lt;br /&gt;
** Forum auto-subscribe: no |yes when  I post&lt;br /&gt;
** When editing text: use HTML| standard web forms&lt;br /&gt;
** AJAX and Javascript: yes|no&lt;br /&gt;
** city/town&lt;br /&gt;
** country&lt;br /&gt;
** timezone&lt;br /&gt;
** Preferred language&lt;br /&gt;
** Description&lt;br /&gt;
** Web page&lt;br /&gt;
** ID number&lt;br /&gt;
** Institution&lt;br /&gt;
** Department&lt;br /&gt;
** Phone&lt;br /&gt;
** Mobile Phone&lt;br /&gt;
** Address&lt;br /&gt;
==After results ==&lt;br /&gt;
Users which were not added, will NOT be auto-enrolled in courses&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Open another moodle browser and &lt;br /&gt;
* Site administration&lt;br /&gt;
** Courses&lt;br /&gt;
*** Add/edit courses; select the category, and the course&lt;br /&gt;
* Course administration&lt;br /&gt;
** Users&lt;br /&gt;
*** Enrolled Users&lt;br /&gt;
**** Enrol users and select the users flagged from other window&lt;br /&gt;
&lt;br /&gt;
==Templates==&lt;br /&gt;
&lt;br /&gt;
The default values are processed as templates in which the following codes are allowed:&lt;br /&gt;
&lt;br /&gt;
* %l - will be replaced by the lastname&lt;br /&gt;
* %f - will be replaced by the firstname&lt;br /&gt;
* %u - will be replaced by the username&lt;br /&gt;
* %% - will be replaced by the %&lt;br /&gt;
&lt;br /&gt;
Between the percent sign (%) and any code letter (l, f or u) the following modifiers are allowed:&lt;br /&gt;
&lt;br /&gt;
* (-) minus sign - the information specified by the code letter will be converted to lowercase&lt;br /&gt;
* (+) plus sign - the information specified by the code letter will be converted to UPPERCASE&lt;br /&gt;
* (~) tilde sign - the information specified by the code letter will be converted to Title Case&lt;br /&gt;
* a decimal number - the information specified by the code letter will be truncated to that many characters&lt;br /&gt;
&lt;br /&gt;
For example, if the firstname is John and the lastname is Doe, the following values will be obtained with the specified templates:&lt;br /&gt;
&lt;br /&gt;
* %l%f = DoeJohn&lt;br /&gt;
* %l%1f = DoeJ&lt;br /&gt;
* %-l%+f = doeJOHN&lt;br /&gt;
* %-f_%-l = john_doe&lt;br /&gt;
* http://www.example.com/~%u/ = http://www.example.com/~jdoe/ (if the username is jdoe or %-1f%-l)&lt;br /&gt;
&lt;br /&gt;
Template processing is done only on default values, and not on the values retrieved from the CSV file.&lt;br /&gt;
&lt;br /&gt;
In order to create correct Moodle usernames, the username is always converted to lowercase. Moreover, if the &amp;quot;Allow extended characters in usernames&amp;quot; option in the Site policies page is off, characters different to letters, digits, dash (-) and dot (.) are removed. For example if the firstname is John Jr. and the lastname is Doe, the username %-f_%-l will produce john jr._doe when Allow extended characters in usernames is on, and johnjr.doe when off.&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;New username duplicate handling&amp;quot; setting is set to Append counter, an auto-increment counter will be append to duplicate usernames produced by the template. For example, if the CSV file contains the users named John Doe, Jane Doe and Jenny Doe without explicit usernames, the default username is %-1f%-l and New username duplicate handling is set to Append counter, then the usernames produced will be jdoe, jdoe2 and jdoe3. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Deleting accounts==&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt; field is present, users with value 1 for it will be deleted. In this case, all the fields may be omitted, except for &amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Deleting and uploading accounts could be done with a single CSV file. For example, the following file will add the user Tom Jones and delete the user reznort:&lt;br /&gt;
&lt;br /&gt;
 username, firstname, lastname, deleted&lt;br /&gt;
 jonest, Tom, Jones, 0&lt;br /&gt;
 reznort, , , 1 &lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
In Moodle 1.8 the file must be UTF-8. In Moodle 1.9 onwards, the encoding may be selected from a large list, including ISO-8859-1.&lt;br /&gt;
&lt;br /&gt;
==Hints==&lt;br /&gt;
&lt;br /&gt;
===Spreadsheet===&lt;br /&gt;
&lt;br /&gt;
If you use a spreadsheet program such as Excel to create your .csv file, check the resulting output in a text editor before you upload it.  It is possible to get trailing commas on each line from an empty field if you have added and deleted columns of information prior to saving the final file. Also check the character encoding. A csv file is a simple text file (ASCII or Unicode) that can be used to upload user accounts.&lt;br /&gt;
&lt;br /&gt;
Excel translates passwords that begin with - (minus) or + (plus) as zero. Even when saving as .csv and saying &amp;quot;Yes&amp;quot; to &amp;quot;Keep this format, and leave out any incompatible features.&amp;quot; Check for this before uploading, as a zero halts the upload process.&lt;br /&gt;
&lt;br /&gt;
If you use a formula in Excel to create fields (for example, the concatenate function to create a user name), then remember to copy the cells with the formula and use special paste with values checked to make them into an acceptable data for a csv file.&lt;br /&gt;
&lt;br /&gt;
===Country===&lt;br /&gt;
The country should be written as a two letter code, in capitals. For example, use BE for Belgium or NL for the Netherlands.  Using &amp;quot;be&amp;quot; or &amp;quot;nl&amp;quot; as a country code will result in a database error.&lt;br /&gt;
:&#039;&#039;Tip:&#039;&#039;  If you are having trouble working out the two-letter code for a country, you can consult this Moodle source code file /moodle/lang/en_utf8/countries.php [http://cvs.moodle.org/moodle/lang/en_utf8/countries.php?view=markup&amp;amp;pathrev=MOODLE_19_STABLE or click here for a 1.9 STABLE list].&lt;br /&gt;
ISO Website: [http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
Moodle Docs:&lt;br /&gt;
*[[Flat file]]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=36851 Can I auto enroll from Excel?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=58215 Making Email Optional]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97903 Uploading users to custom roles]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=144569 Matriculacion con flat file csv] - discussion in Spanish&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
[[Category:Enrolment]]&lt;br /&gt;
[[Category:Groups]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Importer des utilisateurs]]&lt;br /&gt;
[[ja:ユーザのアップロード]]&lt;br /&gt;
[[zh:上传用户]]&lt;br /&gt;
[[ru:Загрузка пользователей]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78409</id>
		<title>Upload users</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78409"/>
		<updated>2010-11-29T01:55:28Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: /* After results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Users &amp;gt; Accounts &amp;gt; Upload users&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Upload users preview.png|thumb|Upload users preview in Moodle 1.9]]&lt;br /&gt;
Firstly, note that it is usually not necessary to import users in bulk - to keep maintenance work down you should first explore forms of authentication that do not require manual maintenance, such as [[External database authentication|connecting to existing external databases]] or letting the [[Internal enrolment|users create their own accounts]]. See [[Manage authentication]] for more information.&lt;br /&gt;
&lt;br /&gt;
If you are sure you want to import multiple user accounts from a text file, then you need to format your text file as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upload users file format==&lt;br /&gt;
&lt;br /&gt;
* Each line contains fields &#039;&#039;&#039;separated&#039;&#039;&#039; by commas (or other delimiters) without quotes (&amp;quot;) and no trailing delimiter&lt;br /&gt;
* The first line is special, and contains fieldnames defining the format for the rest of the file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Required fields&#039;&#039;&#039;:  In any order&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;username, password, firstname, lastname, email&amp;lt;/code&amp;gt;&lt;br /&gt;
:Validity checks fare performed for:&lt;br /&gt;
#&amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt; can only contain alphabetical &#039;&#039;&#039;lowercase&#039;&#039;&#039; letters , numbers, hypen &#039;-&#039;, underscore &#039;_&#039;, period &#039;.&#039;, or at-sign &#039;@&#039; &lt;br /&gt;
#&amp;lt;code&amp;gt;Password&amp;lt;/code&amp;gt; should meet the requirements for the site&#039;s [[Site_policies#Password_policy|Password policy]]. .To force password change, set the password field to &amp;lt;code&amp;gt;changeme&amp;lt;/code&amp;gt;.&lt;br /&gt;
#&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt; is in the form: &#039;&#039;name@example.com&#039;&#039; .&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Optional fields&#039;&#039;&#039;: To provide values other than the default include one or more of these&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;institution, department, city, country, lang, auth, ajax, timezone, idnumber, icq, phone1, phone2, address, url, description, mailformat, maildisplay, htmleditor, autosubscribe, emailstop&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Custom profile field names&#039;&#039;&#039;: (Optional). xxxxx is the real custom user profile field name (i.e. the unique shortname)&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;profile_field_xxxxx&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
: Create the custom fields BEFORE importing. Use the standard header. The &amp;quot;shortname&amp;quot; for your custom field is xxxxx. The first record must include &amp;quot;profile_field_xxxxx&amp;quot;.&lt;br /&gt;
:&#039;&#039;&#039;Example&#039;&#039;&#039;: To create a custom field &amp;quot;genre&amp;quot;, you must write a shortname &amp;quot;genre&amp;quot; in the new field, and write &amp;quot;profile_field_genre&amp;quot; in the header of the .csv file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Special fields&#039;&#039;&#039;: Used for changing of usernames or deleting of users&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
*&#039;&#039;&#039;Enrolment fields&#039;&#039;&#039;: (Optional):&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;course1, type1, role1, group1, enrolperiod1, course2, type2, role2, group2, enrolperiod2&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
**&amp;lt;code&amp;gt;course&amp;lt;/code&amp;gt; is the &amp;quot;shortname&amp;quot;  if present the user will be enrolled in those courses.&lt;br /&gt;
** &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt; refers to the role to be used for associated course enrolment. Value 1 is default course role, 2 is legacy Teacher role and 3 is legacy Non-editing Teacher.&lt;br /&gt;
** You can use role field instead to specify roles directly - use either role short name or id (numeric names of roles are not supported).&lt;br /&gt;
** Users may be also assigned to groups in course (group1 in course1, group2 in course2, etc.).&lt;br /&gt;
*** A group is identified by name or id (numeric group names are not supported).&lt;br /&gt;
** From Moodle 2.0, you can set the enrolment duration, in days, for each course (&amp;lt;code&amp;gt;enrolperiod1&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;enrolperiod2&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course2&amp;lt;/code&amp;gt;, etc.).&lt;br /&gt;
&lt;br /&gt;
Commas within  a field must be encoded as &amp;amp;#44 - the script will decode these back to commas.&lt;br /&gt;
&lt;br /&gt;
For Boolean fields, use &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; for false and &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; for true.&lt;br /&gt;
&lt;br /&gt;
Turn email off: &amp;lt;code&amp;gt;emailstop&amp;lt;/code&amp;gt; set to &amp;lt;CODE&amp;gt;1&amp;lt;/CODE&amp;gt; if the email address should be disabled (default: email is enabled):&lt;br /&gt;
&lt;br /&gt;
To prevent users from receiving a large number of emails from courses or forced subscription forums use the &#039;&#039;&#039;maildigest&#039;&#039;&#039;.  The options for this field are 0 = No digest, 1 = Complete digest and 2 = Digest with just subjects.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a valid upload file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;username, password, firstname, lastname, email, course1, group1&amp;lt;br /&amp;gt;&lt;br /&gt;
jonest, verysecret, Tom, Jones, jonest@someplace.edu, math102, Section 1&amp;lt;br /&amp;gt;&lt;br /&gt;
reznort, somesecret, Trent, Reznor, reznort@someplace.edu,math102, Section 3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==After preview==&lt;br /&gt;
After the preprocessing, depending on the contents of the upload, the following may be available before final user creation&lt;br /&gt;
*Settings&lt;br /&gt;
** New user password &lt;br /&gt;
** Existing user details&lt;br /&gt;
** Existing user password&lt;br /&gt;
** Allow renames&lt;br /&gt;
** Allow deletes&lt;br /&gt;
** Prevent email addess duplicates&lt;br /&gt;
** Select for bulk operations&lt;br /&gt;
&lt;br /&gt;
* Default values&lt;br /&gt;
** Authentication method: Manual account |no login | EMail-based self-registration&lt;br /&gt;
** Email display: Allow only other course members to see my email address | hide .. from everyone | allow anyone ...&lt;br /&gt;
** Email format Pretty HTML | plain text&lt;br /&gt;
** Email digest type: none|complete subjects&lt;br /&gt;
** Forum auto-subscribe: no |yes when  I post&lt;br /&gt;
** When editing text: use HTML| standard web forms&lt;br /&gt;
** AJAX and Javascript: yes|no&lt;br /&gt;
** city/town&lt;br /&gt;
** country&lt;br /&gt;
** timezone&lt;br /&gt;
** Preferred language&lt;br /&gt;
** Description&lt;br /&gt;
** Web page&lt;br /&gt;
** ID number&lt;br /&gt;
** Institution&lt;br /&gt;
** Department&lt;br /&gt;
** Phone&lt;br /&gt;
** Mobile Phone&lt;br /&gt;
** Address&lt;br /&gt;
==After results ==&lt;br /&gt;
Users which were not added, will NOT be auto-enrolled in courses&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Open another moodle browser and &lt;br /&gt;
* Site administration&lt;br /&gt;
** Courses&lt;br /&gt;
*** Add/edit courses; select the category, and the course&lt;br /&gt;
* Course administration&lt;br /&gt;
** Users&lt;br /&gt;
*** Enrolled Users&lt;br /&gt;
**** Enrol users and select the users flagged from other window&lt;br /&gt;
&lt;br /&gt;
==Templates==&lt;br /&gt;
&lt;br /&gt;
The default values are processed as templates in which the following codes are allowed:&lt;br /&gt;
&lt;br /&gt;
* %l - will be replaced by the lastname&lt;br /&gt;
* %f - will be replaced by the firstname&lt;br /&gt;
* %u - will be replaced by the username&lt;br /&gt;
* %% - will be replaced by the %&lt;br /&gt;
&lt;br /&gt;
Between the percent sign (%) and any code letter (l, f or u) the following modifiers are allowed:&lt;br /&gt;
&lt;br /&gt;
* (-) minus sign - the information specified by the code letter will be converted to lowercase&lt;br /&gt;
* (+) plus sign - the information specified by the code letter will be converted to UPPERCASE&lt;br /&gt;
* (~) tilde sign - the information specified by the code letter will be converted to Title Case&lt;br /&gt;
* a decimal number - the information specified by the code letter will be truncated to that many characters&lt;br /&gt;
&lt;br /&gt;
For example, if the firstname is John and the lastname is Doe, the following values will be obtained with the specified templates:&lt;br /&gt;
&lt;br /&gt;
* %l%f = DoeJohn&lt;br /&gt;
* %l%1f = DoeJ&lt;br /&gt;
* %-l%+f = doeJOHN&lt;br /&gt;
* %-f_%-l = john_doe&lt;br /&gt;
* http://www.example.com/~%u/ = http://www.example.com/~jdoe/ (if the username is jdoe or %-1f%-l)&lt;br /&gt;
&lt;br /&gt;
Template processing is done only on default values, and not on the values retrieved from the CSV file.&lt;br /&gt;
&lt;br /&gt;
In order to create correct Moodle usernames, the username is always converted to lowercase. Moreover, if the &amp;quot;Allow extended characters in usernames&amp;quot; option in the Site policies page is off, characters different to letters, digits, dash (-) and dot (.) are removed. For example if the firstname is John Jr. and the lastname is Doe, the username %-f_%-l will produce john jr._doe when Allow extended characters in usernames is on, and johnjr.doe when off.&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;New username duplicate handling&amp;quot; setting is set to Append counter, an auto-increment counter will be append to duplicate usernames produced by the template. For example, if the CSV file contains the users named John Doe, Jane Doe and Jenny Doe without explicit usernames, the default username is %-1f%-l and New username duplicate handling is set to Append counter, then the usernames produced will be jdoe, jdoe2 and jdoe3. &lt;br /&gt;
&lt;br /&gt;
==Updating existing accounts==&lt;br /&gt;
&lt;br /&gt;
By default Moodle assumes that you will be creating new user accounts, and skips records where the username matches an existing account. However, if you set &amp;quot;Update existing accounts&amp;quot; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the existing user account will be updated.&lt;br /&gt;
&lt;br /&gt;
When updating existing accounts you can change usernames as well. Set &amp;quot;Allow renames&amp;quot; to &#039;&#039;&#039;Yes&#039;&#039;&#039; and include in your file a field called &amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: any errors updating existing accounts can affect your users badly. Be careful when using the options to update.&lt;br /&gt;
&lt;br /&gt;
==Deleting accounts==&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt; field is present, users with value 1 for it will be deleted. In this case, all the fields may be omitted, except for &amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Deleting and uploading accounts could be done with a single CSV file. For example, the following file will add the user Tom Jones and delete the user reznort:&lt;br /&gt;
&lt;br /&gt;
 username, firstname, lastname, deleted&lt;br /&gt;
 jonest, Tom, Jones, 0&lt;br /&gt;
 reznort, , , 1 &lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
In Moodle 1.8 the file must be UTF-8. In Moodle 1.9 onwards, the encoding may be selected from a large list, including ISO-8859-1.&lt;br /&gt;
&lt;br /&gt;
==Hints==&lt;br /&gt;
&lt;br /&gt;
===Spreadsheet===&lt;br /&gt;
&lt;br /&gt;
If you use a spreadsheet program such as Excel to create your .csv file, check the resulting output in a text editor before you upload it.  It is possible to get trailing commas on each line from an empty field if you have added and deleted columns of information prior to saving the final file. Also check the character encoding. A csv file is a simple text file (ASCII or Unicode) that can be used to upload user accounts.&lt;br /&gt;
&lt;br /&gt;
Excel translates passwords that begin with - (minus) or + (plus) as zero. Even when saving as .csv and saying &amp;quot;Yes&amp;quot; to &amp;quot;Keep this format, and leave out any incompatible features.&amp;quot; Check for this before uploading, as a zero halts the upload process.&lt;br /&gt;
&lt;br /&gt;
If you use a formula in Excel to create fields (for example, the concatenate function to create a user name), then remember to copy the cells with the formula and use special paste with values checked to make them into an acceptable data for a csv file.&lt;br /&gt;
&lt;br /&gt;
===Country===&lt;br /&gt;
The country should be written as a two letter code, in capitals. For example, use BE for Belgium or NL for the Netherlands.  Using &amp;quot;be&amp;quot; or &amp;quot;nl&amp;quot; as a country code will result in a database error.&lt;br /&gt;
:&#039;&#039;Tip:&#039;&#039;  If you are having trouble working out the two-letter code for a country, you can consult this Moodle source code file /moodle/lang/en_utf8/countries.php [http://cvs.moodle.org/moodle/lang/en_utf8/countries.php?view=markup&amp;amp;pathrev=MOODLE_19_STABLE or click here for a 1.9 STABLE list].&lt;br /&gt;
ISO Website: [http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
Moodle Docs:&lt;br /&gt;
*[[Flat file]]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=36851 Can I auto enroll from Excel?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=58215 Making Email Optional]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97903 Uploading users to custom roles]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=144569 Matriculacion con flat file csv] - discussion in Spanish&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
[[Category:Enrolment]]&lt;br /&gt;
[[Category:Groups]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Importer des utilisateurs]]&lt;br /&gt;
[[ja:ユーザのアップロード]]&lt;br /&gt;
[[zh:上传用户]]&lt;br /&gt;
[[ru:Загрузка пользователей]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78408</id>
		<title>Upload users</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78408"/>
		<updated>2010-11-29T01:54:44Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: enroll skipped users from another browser window&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Users &amp;gt; Accounts &amp;gt; Upload users&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Upload users preview.png|thumb|Upload users preview in Moodle 1.9]]&lt;br /&gt;
Firstly, note that it is usually not necessary to import users in bulk - to keep maintenance work down you should first explore forms of authentication that do not require manual maintenance, such as [[External database authentication|connecting to existing external databases]] or letting the [[Internal enrolment|users create their own accounts]]. See [[Manage authentication]] for more information.&lt;br /&gt;
&lt;br /&gt;
If you are sure you want to import multiple user accounts from a text file, then you need to format your text file as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upload users file format==&lt;br /&gt;
&lt;br /&gt;
* Each line contains fields &#039;&#039;&#039;separated&#039;&#039;&#039; by commas (or other delimiters) without quotes (&amp;quot;) and no trailing delimiter&lt;br /&gt;
* The first line is special, and contains fieldnames defining the format for the rest of the file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Required fields&#039;&#039;&#039;:  In any order&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;username, password, firstname, lastname, email&amp;lt;/code&amp;gt;&lt;br /&gt;
:Validity checks fare performed for:&lt;br /&gt;
#&amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt; can only contain alphabetical &#039;&#039;&#039;lowercase&#039;&#039;&#039; letters , numbers, hypen &#039;-&#039;, underscore &#039;_&#039;, period &#039;.&#039;, or at-sign &#039;@&#039; &lt;br /&gt;
#&amp;lt;code&amp;gt;Password&amp;lt;/code&amp;gt; should meet the requirements for the site&#039;s [[Site_policies#Password_policy|Password policy]]. .To force password change, set the password field to &amp;lt;code&amp;gt;changeme&amp;lt;/code&amp;gt;.&lt;br /&gt;
#&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt; is in the form: &#039;&#039;name@example.com&#039;&#039; .&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Optional fields&#039;&#039;&#039;: To provide values other than the default include one or more of these&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;institution, department, city, country, lang, auth, ajax, timezone, idnumber, icq, phone1, phone2, address, url, description, mailformat, maildisplay, htmleditor, autosubscribe, emailstop&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Custom profile field names&#039;&#039;&#039;: (Optional). xxxxx is the real custom user profile field name (i.e. the unique shortname)&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;profile_field_xxxxx&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
: Create the custom fields BEFORE importing. Use the standard header. The &amp;quot;shortname&amp;quot; for your custom field is xxxxx. The first record must include &amp;quot;profile_field_xxxxx&amp;quot;.&lt;br /&gt;
:&#039;&#039;&#039;Example&#039;&#039;&#039;: To create a custom field &amp;quot;genre&amp;quot;, you must write a shortname &amp;quot;genre&amp;quot; in the new field, and write &amp;quot;profile_field_genre&amp;quot; in the header of the .csv file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Special fields&#039;&#039;&#039;: Used for changing of usernames or deleting of users&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
*&#039;&#039;&#039;Enrolment fields&#039;&#039;&#039;: (Optional):&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;course1, type1, role1, group1, enrolperiod1, course2, type2, role2, group2, enrolperiod2&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
**&amp;lt;code&amp;gt;course&amp;lt;/code&amp;gt; is the &amp;quot;shortname&amp;quot;  if present the user will be enrolled in those courses.&lt;br /&gt;
** &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt; refers to the role to be used for associated course enrolment. Value 1 is default course role, 2 is legacy Teacher role and 3 is legacy Non-editing Teacher.&lt;br /&gt;
** You can use role field instead to specify roles directly - use either role short name or id (numeric names of roles are not supported).&lt;br /&gt;
** Users may be also assigned to groups in course (group1 in course1, group2 in course2, etc.).&lt;br /&gt;
*** A group is identified by name or id (numeric group names are not supported).&lt;br /&gt;
** From Moodle 2.0, you can set the enrolment duration, in days, for each course (&amp;lt;code&amp;gt;enrolperiod1&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;enrolperiod2&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course2&amp;lt;/code&amp;gt;, etc.).&lt;br /&gt;
&lt;br /&gt;
Commas within  a field must be encoded as &amp;amp;#44 - the script will decode these back to commas.&lt;br /&gt;
&lt;br /&gt;
For Boolean fields, use &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; for false and &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; for true.&lt;br /&gt;
&lt;br /&gt;
Turn email off: &amp;lt;code&amp;gt;emailstop&amp;lt;/code&amp;gt; set to &amp;lt;CODE&amp;gt;1&amp;lt;/CODE&amp;gt; if the email address should be disabled (default: email is enabled):&lt;br /&gt;
&lt;br /&gt;
To prevent users from receiving a large number of emails from courses or forced subscription forums use the &#039;&#039;&#039;maildigest&#039;&#039;&#039;.  The options for this field are 0 = No digest, 1 = Complete digest and 2 = Digest with just subjects.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a valid upload file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;username, password, firstname, lastname, email, course1, group1&amp;lt;br /&amp;gt;&lt;br /&gt;
jonest, verysecret, Tom, Jones, jonest@someplace.edu, math102, Section 1&amp;lt;br /&amp;gt;&lt;br /&gt;
reznort, somesecret, Trent, Reznor, reznort@someplace.edu,math102, Section 3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==After preview==&lt;br /&gt;
After the preprocessing, depending on the contents of the upload, the following may be available before final user creation&lt;br /&gt;
*Settings&lt;br /&gt;
** New user password &lt;br /&gt;
** Existing user details&lt;br /&gt;
** Existing user password&lt;br /&gt;
** Allow renames&lt;br /&gt;
** Allow deletes&lt;br /&gt;
** Prevent email addess duplicates&lt;br /&gt;
** Select for bulk operations&lt;br /&gt;
&lt;br /&gt;
* Default values&lt;br /&gt;
** Authentication method: Manual account |no login | EMail-based self-registration&lt;br /&gt;
** Email display: Allow only other course members to see my email address | hide .. from everyone | allow anyone ...&lt;br /&gt;
** Email format Pretty HTML | plain text&lt;br /&gt;
** Email digest type: none|complete subjects&lt;br /&gt;
** Forum auto-subscribe: no |yes when  I post&lt;br /&gt;
** When editing text: use HTML| standard web forms&lt;br /&gt;
** AJAX and Javascript: yes|no&lt;br /&gt;
** city/town&lt;br /&gt;
** country&lt;br /&gt;
** timezone&lt;br /&gt;
** Preferred language&lt;br /&gt;
** Description&lt;br /&gt;
** Web page&lt;br /&gt;
** ID number&lt;br /&gt;
** Institution&lt;br /&gt;
** Department&lt;br /&gt;
** Phone&lt;br /&gt;
** Mobile Phone&lt;br /&gt;
** Address&lt;br /&gt;
==After preview==&lt;br /&gt;
Users which were not added, will NOT be auto-enrolled in courses&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Open another moodle browser and &lt;br /&gt;
* Site administration&lt;br /&gt;
** Courses&lt;br /&gt;
*** Add/edit courses; select the category, and the course&lt;br /&gt;
* Course administration&lt;br /&gt;
** Users&lt;br /&gt;
*** Enrolled Users&lt;br /&gt;
**** Enrol users and select the users flagged from other window&lt;br /&gt;
&lt;br /&gt;
==Templates==&lt;br /&gt;
&lt;br /&gt;
The default values are processed as templates in which the following codes are allowed:&lt;br /&gt;
&lt;br /&gt;
* %l - will be replaced by the lastname&lt;br /&gt;
* %f - will be replaced by the firstname&lt;br /&gt;
* %u - will be replaced by the username&lt;br /&gt;
* %% - will be replaced by the %&lt;br /&gt;
&lt;br /&gt;
Between the percent sign (%) and any code letter (l, f or u) the following modifiers are allowed:&lt;br /&gt;
&lt;br /&gt;
* (-) minus sign - the information specified by the code letter will be converted to lowercase&lt;br /&gt;
* (+) plus sign - the information specified by the code letter will be converted to UPPERCASE&lt;br /&gt;
* (~) tilde sign - the information specified by the code letter will be converted to Title Case&lt;br /&gt;
* a decimal number - the information specified by the code letter will be truncated to that many characters&lt;br /&gt;
&lt;br /&gt;
For example, if the firstname is John and the lastname is Doe, the following values will be obtained with the specified templates:&lt;br /&gt;
&lt;br /&gt;
* %l%f = DoeJohn&lt;br /&gt;
* %l%1f = DoeJ&lt;br /&gt;
* %-l%+f = doeJOHN&lt;br /&gt;
* %-f_%-l = john_doe&lt;br /&gt;
* http://www.example.com/~%u/ = http://www.example.com/~jdoe/ (if the username is jdoe or %-1f%-l)&lt;br /&gt;
&lt;br /&gt;
Template processing is done only on default values, and not on the values retrieved from the CSV file.&lt;br /&gt;
&lt;br /&gt;
In order to create correct Moodle usernames, the username is always converted to lowercase. Moreover, if the &amp;quot;Allow extended characters in usernames&amp;quot; option in the Site policies page is off, characters different to letters, digits, dash (-) and dot (.) are removed. For example if the firstname is John Jr. and the lastname is Doe, the username %-f_%-l will produce john jr._doe when Allow extended characters in usernames is on, and johnjr.doe when off.&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;New username duplicate handling&amp;quot; setting is set to Append counter, an auto-increment counter will be append to duplicate usernames produced by the template. For example, if the CSV file contains the users named John Doe, Jane Doe and Jenny Doe without explicit usernames, the default username is %-1f%-l and New username duplicate handling is set to Append counter, then the usernames produced will be jdoe, jdoe2 and jdoe3. &lt;br /&gt;
&lt;br /&gt;
==Updating existing accounts==&lt;br /&gt;
&lt;br /&gt;
By default Moodle assumes that you will be creating new user accounts, and skips records where the username matches an existing account. However, if you set &amp;quot;Update existing accounts&amp;quot; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the existing user account will be updated.&lt;br /&gt;
&lt;br /&gt;
When updating existing accounts you can change usernames as well. Set &amp;quot;Allow renames&amp;quot; to &#039;&#039;&#039;Yes&#039;&#039;&#039; and include in your file a field called &amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: any errors updating existing accounts can affect your users badly. Be careful when using the options to update.&lt;br /&gt;
&lt;br /&gt;
==Deleting accounts==&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt; field is present, users with value 1 for it will be deleted. In this case, all the fields may be omitted, except for &amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Deleting and uploading accounts could be done with a single CSV file. For example, the following file will add the user Tom Jones and delete the user reznort:&lt;br /&gt;
&lt;br /&gt;
 username, firstname, lastname, deleted&lt;br /&gt;
 jonest, Tom, Jones, 0&lt;br /&gt;
 reznort, , , 1 &lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
In Moodle 1.8 the file must be UTF-8. In Moodle 1.9 onwards, the encoding may be selected from a large list, including ISO-8859-1.&lt;br /&gt;
&lt;br /&gt;
==Hints==&lt;br /&gt;
&lt;br /&gt;
===Spreadsheet===&lt;br /&gt;
&lt;br /&gt;
If you use a spreadsheet program such as Excel to create your .csv file, check the resulting output in a text editor before you upload it.  It is possible to get trailing commas on each line from an empty field if you have added and deleted columns of information prior to saving the final file. Also check the character encoding. A csv file is a simple text file (ASCII or Unicode) that can be used to upload user accounts.&lt;br /&gt;
&lt;br /&gt;
Excel translates passwords that begin with - (minus) or + (plus) as zero. Even when saving as .csv and saying &amp;quot;Yes&amp;quot; to &amp;quot;Keep this format, and leave out any incompatible features.&amp;quot; Check for this before uploading, as a zero halts the upload process.&lt;br /&gt;
&lt;br /&gt;
If you use a formula in Excel to create fields (for example, the concatenate function to create a user name), then remember to copy the cells with the formula and use special paste with values checked to make them into an acceptable data for a csv file.&lt;br /&gt;
&lt;br /&gt;
===Country===&lt;br /&gt;
The country should be written as a two letter code, in capitals. For example, use BE for Belgium or NL for the Netherlands.  Using &amp;quot;be&amp;quot; or &amp;quot;nl&amp;quot; as a country code will result in a database error.&lt;br /&gt;
:&#039;&#039;Tip:&#039;&#039;  If you are having trouble working out the two-letter code for a country, you can consult this Moodle source code file /moodle/lang/en_utf8/countries.php [http://cvs.moodle.org/moodle/lang/en_utf8/countries.php?view=markup&amp;amp;pathrev=MOODLE_19_STABLE or click here for a 1.9 STABLE list].&lt;br /&gt;
ISO Website: [http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
Moodle Docs:&lt;br /&gt;
*[[Flat file]]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=36851 Can I auto enroll from Excel?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=58215 Making Email Optional]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97903 Uploading users to custom roles]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=144569 Matriculacion con flat file csv] - discussion in Spanish&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
[[Category:Enrolment]]&lt;br /&gt;
[[Category:Groups]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Importer des utilisateurs]]&lt;br /&gt;
[[ja:ユーザのアップロード]]&lt;br /&gt;
[[zh:上传用户]]&lt;br /&gt;
[[ru:Загрузка пользователей]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78407</id>
		<title>Upload users</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78407"/>
		<updated>2010-11-29T01:24:31Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: add After Preview&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Users &amp;gt; Accounts &amp;gt; Upload users&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Upload users preview.png|thumb|Upload users preview in Moodle 1.9]]&lt;br /&gt;
Firstly, note that it is usually not necessary to import users in bulk - to keep maintenance work down you should first explore forms of authentication that do not require manual maintenance, such as [[External database authentication|connecting to existing external databases]] or letting the [[Internal enrolment|users create their own accounts]]. See [[Manage authentication]] for more information.&lt;br /&gt;
&lt;br /&gt;
If you are sure you want to import multiple user accounts from a text file, then you need to format your text file as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upload users file format==&lt;br /&gt;
&lt;br /&gt;
* Each line contains fields &#039;&#039;&#039;separated&#039;&#039;&#039; by commas (or other delimiters) without quotes (&amp;quot;) and no trailing delimiter&lt;br /&gt;
* The first line is special, and contains fieldnames defining the format for the rest of the file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Required fields&#039;&#039;&#039;:  In any order&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;username, password, firstname, lastname, email&amp;lt;/code&amp;gt;&lt;br /&gt;
:Validity checks fare performed for:&lt;br /&gt;
#&amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt; can only contain alphabetical &#039;&#039;&#039;lowercase&#039;&#039;&#039; letters , numbers, hypen &#039;-&#039;, underscore &#039;_&#039;, period &#039;.&#039;, or at-sign &#039;@&#039; &lt;br /&gt;
#&amp;lt;code&amp;gt;Password&amp;lt;/code&amp;gt; should meet the requirements for the site&#039;s [[Site_policies#Password_policy|Password policy]]. .To force password change, set the password field to &amp;lt;code&amp;gt;changeme&amp;lt;/code&amp;gt;.&lt;br /&gt;
#&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt; is in the form: &#039;&#039;name@example.com&#039;&#039; .&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Optional fields&#039;&#039;&#039;: To provide values other than the default include one or more of these&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;institution, department, city, country, lang, auth, ajax, timezone, idnumber, icq, phone1, phone2, address, url, description, mailformat, maildisplay, htmleditor, autosubscribe, emailstop&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Custom profile field names&#039;&#039;&#039;: (Optional). xxxxx is the real custom user profile field name (i.e. the unique shortname)&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;profile_field_xxxxx&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
: Create the custom fields BEFORE importing. Use the standard header. The &amp;quot;shortname&amp;quot; for your custom field is xxxxx. The first record must include &amp;quot;profile_field_xxxxx&amp;quot;.&lt;br /&gt;
:&#039;&#039;&#039;Example&#039;&#039;&#039;: To create a custom field &amp;quot;genre&amp;quot;, you must write a shortname &amp;quot;genre&amp;quot; in the new field, and write &amp;quot;profile_field_genre&amp;quot; in the header of the .csv file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Special fields&#039;&#039;&#039;: Used for changing of usernames or deleting of users&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
*&#039;&#039;&#039;Enrolment fields&#039;&#039;&#039;: (Optional):&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;course1, type1, role1, group1, enrolperiod1, course2, type2, role2, group2, enrolperiod2&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
**&amp;lt;code&amp;gt;course&amp;lt;/code&amp;gt; is the &amp;quot;shortname&amp;quot;  if present the user will be enrolled in those courses.&lt;br /&gt;
** &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt; refers to the role to be used for associated course enrolment. Value 1 is default course role, 2 is legacy Teacher role and 3 is legacy Non-editing Teacher.&lt;br /&gt;
** You can use role field instead to specify roles directly - use either role short name or id (numeric names of roles are not supported).&lt;br /&gt;
** Users may be also assigned to groups in course (group1 in course1, group2 in course2, etc.).&lt;br /&gt;
*** A group is identified by name or id (numeric group names are not supported).&lt;br /&gt;
** From Moodle 2.0, you can set the enrolment duration, in days, for each course (&amp;lt;code&amp;gt;enrolperiod1&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;enrolperiod2&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course2&amp;lt;/code&amp;gt;, etc.).&lt;br /&gt;
&lt;br /&gt;
Commas within  a field must be encoded as &amp;amp;#44 - the script will decode these back to commas.&lt;br /&gt;
&lt;br /&gt;
For Boolean fields, use &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; for false and &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; for true.&lt;br /&gt;
&lt;br /&gt;
Turn email off: &amp;lt;code&amp;gt;emailstop&amp;lt;/code&amp;gt; set to &amp;lt;CODE&amp;gt;1&amp;lt;/CODE&amp;gt; if the email address should be disabled (default: email is enabled):&lt;br /&gt;
&lt;br /&gt;
To prevent users from receiving a large number of emails from courses or forced subscription forums use the &#039;&#039;&#039;maildigest&#039;&#039;&#039;.  The options for this field are 0 = No digest, 1 = Complete digest and 2 = Digest with just subjects.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a valid upload file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;username, password, firstname, lastname, email, course1, group1&amp;lt;br /&amp;gt;&lt;br /&gt;
jonest, verysecret, Tom, Jones, jonest@someplace.edu, math102, Section 1&amp;lt;br /&amp;gt;&lt;br /&gt;
reznort, somesecret, Trent, Reznor, reznort@someplace.edu,math102, Section 3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==After preview==&lt;br /&gt;
After the preprocessing, depending on the contents of the upload, the following may be available before final user creation&lt;br /&gt;
*Settings&lt;br /&gt;
** New user password &lt;br /&gt;
** Existing user details&lt;br /&gt;
** Existing user password&lt;br /&gt;
** Allow renames&lt;br /&gt;
** Allow deletes&lt;br /&gt;
** Prevent email addess duplicates&lt;br /&gt;
** Select for bulk operations&lt;br /&gt;
&lt;br /&gt;
* Default values&lt;br /&gt;
** Authentication method: Manual account |no login | EMail-based self-registration&lt;br /&gt;
** Email display: Allow only other course members to see my email address | hide .. from everyone | allow anyone ...&lt;br /&gt;
** Email format Pretty HTML | plain text&lt;br /&gt;
** Email digest type: none|complete subjects&lt;br /&gt;
** Forum auto-subscribe: no |yes when  I post&lt;br /&gt;
** When editing text: use HTML| standard web forms&lt;br /&gt;
** AJAX and Javascript: yes|no&lt;br /&gt;
** city/town&lt;br /&gt;
** country&lt;br /&gt;
** timezone&lt;br /&gt;
** Preferred language&lt;br /&gt;
** Description&lt;br /&gt;
** Web page&lt;br /&gt;
** ID number&lt;br /&gt;
** Institution&lt;br /&gt;
** Department&lt;br /&gt;
** Phone&lt;br /&gt;
** Mobile Phone&lt;br /&gt;
** Address&lt;br /&gt;
==After preview==&lt;br /&gt;
Users which were not added, will NOT be auto-enrolled in courses&lt;br /&gt;
&lt;br /&gt;
==Templates==&lt;br /&gt;
&lt;br /&gt;
The default values are processed as templates in which the following codes are allowed:&lt;br /&gt;
&lt;br /&gt;
* %l - will be replaced by the lastname&lt;br /&gt;
* %f - will be replaced by the firstname&lt;br /&gt;
* %u - will be replaced by the username&lt;br /&gt;
* %% - will be replaced by the %&lt;br /&gt;
&lt;br /&gt;
Between the percent sign (%) and any code letter (l, f or u) the following modifiers are allowed:&lt;br /&gt;
&lt;br /&gt;
* (-) minus sign - the information specified by the code letter will be converted to lowercase&lt;br /&gt;
* (+) plus sign - the information specified by the code letter will be converted to UPPERCASE&lt;br /&gt;
* (~) tilde sign - the information specified by the code letter will be converted to Title Case&lt;br /&gt;
* a decimal number - the information specified by the code letter will be truncated to that many characters&lt;br /&gt;
&lt;br /&gt;
For example, if the firstname is John and the lastname is Doe, the following values will be obtained with the specified templates:&lt;br /&gt;
&lt;br /&gt;
* %l%f = DoeJohn&lt;br /&gt;
* %l%1f = DoeJ&lt;br /&gt;
* %-l%+f = doeJOHN&lt;br /&gt;
* %-f_%-l = john_doe&lt;br /&gt;
* http://www.example.com/~%u/ = http://www.example.com/~jdoe/ (if the username is jdoe or %-1f%-l)&lt;br /&gt;
&lt;br /&gt;
Template processing is done only on default values, and not on the values retrieved from the CSV file.&lt;br /&gt;
&lt;br /&gt;
In order to create correct Moodle usernames, the username is always converted to lowercase. Moreover, if the &amp;quot;Allow extended characters in usernames&amp;quot; option in the Site policies page is off, characters different to letters, digits, dash (-) and dot (.) are removed. For example if the firstname is John Jr. and the lastname is Doe, the username %-f_%-l will produce john jr._doe when Allow extended characters in usernames is on, and johnjr.doe when off.&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;New username duplicate handling&amp;quot; setting is set to Append counter, an auto-increment counter will be append to duplicate usernames produced by the template. For example, if the CSV file contains the users named John Doe, Jane Doe and Jenny Doe without explicit usernames, the default username is %-1f%-l and New username duplicate handling is set to Append counter, then the usernames produced will be jdoe, jdoe2 and jdoe3. &lt;br /&gt;
&lt;br /&gt;
==Updating existing accounts==&lt;br /&gt;
&lt;br /&gt;
By default Moodle assumes that you will be creating new user accounts, and skips records where the username matches an existing account. However, if you set &amp;quot;Update existing accounts&amp;quot; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the existing user account will be updated.&lt;br /&gt;
&lt;br /&gt;
When updating existing accounts you can change usernames as well. Set &amp;quot;Allow renames&amp;quot; to &#039;&#039;&#039;Yes&#039;&#039;&#039; and include in your file a field called &amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: any errors updating existing accounts can affect your users badly. Be careful when using the options to update.&lt;br /&gt;
&lt;br /&gt;
==Deleting accounts==&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt; field is present, users with value 1 for it will be deleted. In this case, all the fields may be omitted, except for &amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Deleting and uploading accounts could be done with a single CSV file. For example, the following file will add the user Tom Jones and delete the user reznort:&lt;br /&gt;
&lt;br /&gt;
 username, firstname, lastname, deleted&lt;br /&gt;
 jonest, Tom, Jones, 0&lt;br /&gt;
 reznort, , , 1 &lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
In Moodle 1.8 the file must be UTF-8. In Moodle 1.9 onwards, the encoding may be selected from a large list, including ISO-8859-1.&lt;br /&gt;
&lt;br /&gt;
==Hints==&lt;br /&gt;
&lt;br /&gt;
===Spreadsheet===&lt;br /&gt;
&lt;br /&gt;
If you use a spreadsheet program such as Excel to create your .csv file, check the resulting output in a text editor before you upload it.  It is possible to get trailing commas on each line from an empty field if you have added and deleted columns of information prior to saving the final file. Also check the character encoding. A csv file is a simple text file (ASCII or Unicode) that can be used to upload user accounts.&lt;br /&gt;
&lt;br /&gt;
Excel translates passwords that begin with - (minus) or + (plus) as zero. Even when saving as .csv and saying &amp;quot;Yes&amp;quot; to &amp;quot;Keep this format, and leave out any incompatible features.&amp;quot; Check for this before uploading, as a zero halts the upload process.&lt;br /&gt;
&lt;br /&gt;
If you use a formula in Excel to create fields (for example, the concatenate function to create a user name), then remember to copy the cells with the formula and use special paste with values checked to make them into an acceptable data for a csv file.&lt;br /&gt;
&lt;br /&gt;
===Country===&lt;br /&gt;
The country should be written as a two letter code, in capitals. For example, use BE for Belgium or NL for the Netherlands.  Using &amp;quot;be&amp;quot; or &amp;quot;nl&amp;quot; as a country code will result in a database error.&lt;br /&gt;
:&#039;&#039;Tip:&#039;&#039;  If you are having trouble working out the two-letter code for a country, you can consult this Moodle source code file /moodle/lang/en_utf8/countries.php [http://cvs.moodle.org/moodle/lang/en_utf8/countries.php?view=markup&amp;amp;pathrev=MOODLE_19_STABLE or click here for a 1.9 STABLE list].&lt;br /&gt;
ISO Website: [http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
Moodle Docs:&lt;br /&gt;
*[[Flat file]]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=36851 Can I auto enroll from Excel?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=58215 Making Email Optional]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97903 Uploading users to custom roles]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=144569 Matriculacion con flat file csv] - discussion in Spanish&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
[[Category:Enrolment]]&lt;br /&gt;
[[Category:Groups]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Importer des utilisateurs]]&lt;br /&gt;
[[ja:ユーザのアップロード]]&lt;br /&gt;
[[zh:上传用户]]&lt;br /&gt;
[[ru:Загрузка пользователей]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78403</id>
		<title>Upload users</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78403"/>
		<updated>2010-11-28T23:14:56Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: after preview settings and defaults&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Users &amp;gt; Accounts &amp;gt; Upload users&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Upload users preview.png|thumb|Upload users preview in Moodle 1.9]]&lt;br /&gt;
Firstly, note that it is usually not necessary to import users in bulk - to keep maintenance work down you should first explore forms of authentication that do not require manual maintenance, such as [[External database authentication|connecting to existing external databases]] or letting the [[Internal enrolment|users create their own accounts]]. See [[Manage authentication]] for more information.&lt;br /&gt;
&lt;br /&gt;
If you are sure you want to import multiple user accounts from a text file, then you need to format your text file as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upload users file format==&lt;br /&gt;
&lt;br /&gt;
* Each line contains fields &#039;&#039;&#039;separated&#039;&#039;&#039; by commas (or other delimiters) without quotes (&amp;quot;) and no trailing delimiter&lt;br /&gt;
* The first line is special, and contains fieldnames defining the format for the rest of the file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Required fields&#039;&#039;&#039;:  In any order&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;username, password, firstname, lastname, email&amp;lt;/code&amp;gt;&lt;br /&gt;
:Validity checks fare performed for:&lt;br /&gt;
#&amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt; can only contain alphabetical &#039;&#039;&#039;lowercase&#039;&#039;&#039; letters , numbers, hypen &#039;-&#039;, underscore &#039;_&#039;, period &#039;.&#039;, or at-sign &#039;@&#039; &lt;br /&gt;
#&amp;lt;code&amp;gt;Password&amp;lt;/code&amp;gt; should meet the requirements for the site&#039;s [[Site_policies#Password_policy|Password policy]]. .To force password change, set the password field to &amp;lt;code&amp;gt;changeme&amp;lt;/code&amp;gt;.&lt;br /&gt;
#&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt; is in the form: &#039;&#039;name@example.com&#039;&#039; .&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Optional fields&#039;&#039;&#039;: To provide values other than the default include one or more of these&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;institution, department, city, country, lang, auth, ajax, timezone, idnumber, icq, phone1, phone2, address, url, description, mailformat, maildisplay, htmleditor, autosubscribe, emailstop&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Custom profile field names&#039;&#039;&#039;: (Optional). xxxxx is the real custom user profile field name (i.e. the unique shortname)&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;profile_field_xxxxx&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
: Create the custom fields BEFORE importing. Use the standard header. The &amp;quot;shortname&amp;quot; for your custom field is xxxxx. The first record must include &amp;quot;profile_field_xxxxx&amp;quot;.&lt;br /&gt;
:&#039;&#039;&#039;Example&#039;&#039;&#039;: To create a custom field &amp;quot;genre&amp;quot;, you must write a shortname &amp;quot;genre&amp;quot; in the new field, and write &amp;quot;profile_field_genre&amp;quot; in the header of the .csv file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Special fields&#039;&#039;&#039;: Used for changing of usernames or deleting of users&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
*&#039;&#039;&#039;Enrolment fields&#039;&#039;&#039;: (Optional):&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;course1, type1, role1, group1, enrolperiod1, course2, type2, role2, group2, enrolperiod2&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
**&amp;lt;code&amp;gt;course&amp;lt;/code&amp;gt; is the &amp;quot;shortname&amp;quot;  if present the user will be enrolled in those courses.&lt;br /&gt;
** &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt; refers to the role to be used for associated course enrolment. Value 1 is default course role, 2 is legacy Teacher role and 3 is legacy Non-editing Teacher.&lt;br /&gt;
** You can use role field instead to specify roles directly - use either role short name or id (numeric names of roles are not supported).&lt;br /&gt;
** Users may be also assigned to groups in course (group1 in course1, group2 in course2, etc.).&lt;br /&gt;
*** A group is identified by name or id (numeric group names are not supported).&lt;br /&gt;
** From Moodle 2.0, you can set the enrolment duration, in days, for each course (&amp;lt;code&amp;gt;enrolperiod1&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;enrolperiod2&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course2&amp;lt;/code&amp;gt;, etc.).&lt;br /&gt;
&lt;br /&gt;
Commas within  a field must be encoded as &amp;amp;#44 - the script will decode these back to commas.&lt;br /&gt;
&lt;br /&gt;
For Boolean fields, use &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; for false and &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; for true.&lt;br /&gt;
&lt;br /&gt;
Turn email off: &amp;lt;code&amp;gt;emailstop&amp;lt;/code&amp;gt; set to &amp;lt;CODE&amp;gt;1&amp;lt;/CODE&amp;gt; if the email address should be disabled (default: email is enabled):&lt;br /&gt;
&lt;br /&gt;
To prevent users from receiving a large number of emails from courses or forced subscription forums use the &#039;&#039;&#039;maildigest&#039;&#039;&#039;.  The options for this field are 0 = No digest, 1 = Complete digest and 2 = Digest with just subjects.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a valid upload file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;username, password, firstname, lastname, email, course1, group1&amp;lt;br /&amp;gt;&lt;br /&gt;
jonest, verysecret, Tom, Jones, jonest@someplace.edu, math102, Section 1&amp;lt;br /&amp;gt;&lt;br /&gt;
reznort, somesecret, Trent, Reznor, reznort@someplace.edu,math102, Section 3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==After preview==&lt;br /&gt;
After the preprocessing, depending on the contents of the upload, the following may be available before final user creation&lt;br /&gt;
*Settings&lt;br /&gt;
** New user password &lt;br /&gt;
** Existing user details&lt;br /&gt;
** Existing user password&lt;br /&gt;
** Allow renames&lt;br /&gt;
** Allow deletes&lt;br /&gt;
** Prevent email addess duplicates&lt;br /&gt;
** Select for bulk operations&lt;br /&gt;
&lt;br /&gt;
* Default values&lt;br /&gt;
** Authentication method: Manual account |no login | EMail-based self-registration&lt;br /&gt;
** Email display: Allow only other course members to see my email address | hide .. from everyone | allow anyone ...&lt;br /&gt;
** Email format Pretty HTML | plain text&lt;br /&gt;
** Email digest type: none|complete subjects&lt;br /&gt;
** Forum auto-subscribe: no |yes when  I post&lt;br /&gt;
** When editing text: use HTML| standard web forms&lt;br /&gt;
** AJAX and Javascript: yes|no&lt;br /&gt;
** city/town&lt;br /&gt;
** country&lt;br /&gt;
** timezone&lt;br /&gt;
** Preferred language&lt;br /&gt;
** Description&lt;br /&gt;
** Web page&lt;br /&gt;
** ID number&lt;br /&gt;
** Institution&lt;br /&gt;
** Department&lt;br /&gt;
** Phone&lt;br /&gt;
** Mobile Phone&lt;br /&gt;
** Address&lt;br /&gt;
&lt;br /&gt;
==Templates==&lt;br /&gt;
&lt;br /&gt;
The default values are processed as templates in which the following codes are allowed:&lt;br /&gt;
&lt;br /&gt;
* %l - will be replaced by the lastname&lt;br /&gt;
* %f - will be replaced by the firstname&lt;br /&gt;
* %u - will be replaced by the username&lt;br /&gt;
* %% - will be replaced by the %&lt;br /&gt;
&lt;br /&gt;
Between the percent sign (%) and any code letter (l, f or u) the following modifiers are allowed:&lt;br /&gt;
&lt;br /&gt;
* (-) minus sign - the information specified by the code letter will be converted to lowercase&lt;br /&gt;
* (+) plus sign - the information specified by the code letter will be converted to UPPERCASE&lt;br /&gt;
* (~) tilde sign - the information specified by the code letter will be converted to Title Case&lt;br /&gt;
* a decimal number - the information specified by the code letter will be truncated to that many characters&lt;br /&gt;
&lt;br /&gt;
For example, if the firstname is John and the lastname is Doe, the following values will be obtained with the specified templates:&lt;br /&gt;
&lt;br /&gt;
* %l%f = DoeJohn&lt;br /&gt;
* %l%1f = DoeJ&lt;br /&gt;
* %-l%+f = doeJOHN&lt;br /&gt;
* %-f_%-l = john_doe&lt;br /&gt;
* http://www.example.com/~%u/ = http://www.example.com/~jdoe/ (if the username is jdoe or %-1f%-l)&lt;br /&gt;
&lt;br /&gt;
Template processing is done only on default values, and not on the values retrieved from the CSV file.&lt;br /&gt;
&lt;br /&gt;
In order to create correct Moodle usernames, the username is always converted to lowercase. Moreover, if the &amp;quot;Allow extended characters in usernames&amp;quot; option in the Site policies page is off, characters different to letters, digits, dash (-) and dot (.) are removed. For example if the firstname is John Jr. and the lastname is Doe, the username %-f_%-l will produce john jr._doe when Allow extended characters in usernames is on, and johnjr.doe when off.&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;New username duplicate handling&amp;quot; setting is set to Append counter, an auto-increment counter will be append to duplicate usernames produced by the template. For example, if the CSV file contains the users named John Doe, Jane Doe and Jenny Doe without explicit usernames, the default username is %-1f%-l and New username duplicate handling is set to Append counter, then the usernames produced will be jdoe, jdoe2 and jdoe3. &lt;br /&gt;
&lt;br /&gt;
==Updating existing accounts==&lt;br /&gt;
&lt;br /&gt;
By default Moodle assumes that you will be creating new user accounts, and skips records where the username matches an existing account. However, if you set &amp;quot;Update existing accounts&amp;quot; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the existing user account will be updated.&lt;br /&gt;
&lt;br /&gt;
When updating existing accounts you can change usernames as well. Set &amp;quot;Allow renames&amp;quot; to &#039;&#039;&#039;Yes&#039;&#039;&#039; and include in your file a field called &amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: any errors updating existing accounts can affect your users badly. Be careful when using the options to update.&lt;br /&gt;
&lt;br /&gt;
==Deleting accounts==&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt; field is present, users with value 1 for it will be deleted. In this case, all the fields may be omitted, except for &amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Deleting and uploading accounts could be done with a single CSV file. For example, the following file will add the user Tom Jones and delete the user reznort:&lt;br /&gt;
&lt;br /&gt;
 username, firstname, lastname, deleted&lt;br /&gt;
 jonest, Tom, Jones, 0&lt;br /&gt;
 reznort, , , 1 &lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
In Moodle 1.8 the file must be UTF-8. In Moodle 1.9 onwards, the encoding may be selected from a large list, including ISO-8859-1.&lt;br /&gt;
&lt;br /&gt;
==Hints==&lt;br /&gt;
&lt;br /&gt;
===Spreadsheet===&lt;br /&gt;
&lt;br /&gt;
If you use a spreadsheet program such as Excel to create your .csv file, check the resulting output in a text editor before you upload it.  It is possible to get trailing commas on each line from an empty field if you have added and deleted columns of information prior to saving the final file. Also check the character encoding. A csv file is a simple text file (ASCII or Unicode) that can be used to upload user accounts.&lt;br /&gt;
&lt;br /&gt;
Excel translates passwords that begin with - (minus) or + (plus) as zero. Even when saving as .csv and saying &amp;quot;Yes&amp;quot; to &amp;quot;Keep this format, and leave out any incompatible features.&amp;quot; Check for this before uploading, as a zero halts the upload process.&lt;br /&gt;
&lt;br /&gt;
If you use a formula in Excel to create fields (for example, the concatenate function to create a user name), then remember to copy the cells with the formula and use special paste with values checked to make them into an acceptable data for a csv file.&lt;br /&gt;
&lt;br /&gt;
===Country===&lt;br /&gt;
The country should be written as a two letter code, in capitals. For example, use BE for Belgium or NL for the Netherlands.  Using &amp;quot;be&amp;quot; or &amp;quot;nl&amp;quot; as a country code will result in a database error.&lt;br /&gt;
:&#039;&#039;Tip:&#039;&#039;  If you are having trouble working out the two-letter code for a country, you can consult this Moodle source code file /moodle/lang/en_utf8/countries.php [http://cvs.moodle.org/moodle/lang/en_utf8/countries.php?view=markup&amp;amp;pathrev=MOODLE_19_STABLE or click here for a 1.9 STABLE list].&lt;br /&gt;
ISO Website: [http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
Moodle Docs:&lt;br /&gt;
*[[Flat file]]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=36851 Can I auto enroll from Excel?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=58215 Making Email Optional]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97903 Uploading users to custom roles]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=144569 Matriculacion con flat file csv] - discussion in Spanish&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
[[Category:Enrolment]]&lt;br /&gt;
[[Category:Groups]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Importer des utilisateurs]]&lt;br /&gt;
[[ja:ユーザのアップロード]]&lt;br /&gt;
[[zh:上传用户]]&lt;br /&gt;
[[ru:Загрузка пользователей]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78401</id>
		<title>Upload users</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Upload_users&amp;diff=78401"/>
		<updated>2010-11-28T22:45:09Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: add a little details, more precise(just as accurate),simpler example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Users &amp;gt; Accounts &amp;gt; Upload users&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Upload users preview.png|thumb|Upload users preview in Moodle 1.9]]&lt;br /&gt;
Firstly, note that it is usually not necessary to import users in bulk - to keep maintenance work down you should first explore forms of authentication that do not require manual maintenance, such as [[External database authentication|connecting to existing external databases]] or letting the [[Internal enrolment|users create their own accounts]]. See [[Manage authentication]] for more information.&lt;br /&gt;
&lt;br /&gt;
If you are sure you want to import multiple user accounts from a text file, then you need to format your text file as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upload users file format==&lt;br /&gt;
&lt;br /&gt;
* Each line contains fields &#039;&#039;&#039;separated&#039;&#039;&#039; by commas (or other delimiters) without quotes (&amp;quot;) and no trailing delimiter&lt;br /&gt;
* The first line is special, and contains fieldnames defining the format for the rest of the file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Required fields&#039;&#039;&#039;:  In any order&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;username, password, firstname, lastname, email&amp;lt;/code&amp;gt;&lt;br /&gt;
:Validity checks fare performed for:&lt;br /&gt;
#&amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt; can only contain alphabetical &#039;&#039;&#039;lowercase&#039;&#039;&#039; letters , numbers, hypen &#039;-&#039;, underscore &#039;_&#039;, period &#039;.&#039;, or at-sign &#039;@&#039; &lt;br /&gt;
#&amp;lt;code&amp;gt;Password&amp;lt;/code&amp;gt; should meet the requirements for the site&#039;s [[Site_policies#Password_policy|Password policy]]. .To force password change, set the password field to &amp;lt;code&amp;gt;changeme&amp;lt;/code&amp;gt;.&lt;br /&gt;
#&amp;lt;code&amp;gt;email&amp;lt;/code&amp;gt; is in the form: &#039;&#039;name@example.com&#039;&#039; .&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Optional fields&#039;&#039;&#039;: To provide values other than the default include one or more of these&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;institution, department, city, country, lang, auth, ajax, timezone, idnumber, icq, phone1, phone2, address, url, description, mailformat, maildisplay, htmleditor, autosubscribe, emailstop&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Custom profile field names&#039;&#039;&#039;: (Optional). xxxxx is the real custom user profile field name (i.e. the unique shortname)&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;profile_field_xxxxx&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
: Create the custom fields BEFORE importing. Use the standard header. The &amp;quot;shortname&amp;quot; for your custom field is xxxxx. The first record must include &amp;quot;profile_field_xxxxx&amp;quot;.&lt;br /&gt;
:&#039;&#039;&#039;Example&#039;&#039;&#039;: To create a custom field &amp;quot;genre&amp;quot;, you must write a shortname &amp;quot;genre&amp;quot; in the new field, and write &amp;quot;profile_field_genre&amp;quot; in the header of the .csv file.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Special fields&#039;&#039;&#039;: Used for changing of usernames or deleting of users&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
*&#039;&#039;&#039;Enrolment fields&#039;&#039;&#039;: (Optional):&lt;br /&gt;
:&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;course1, type1, role1, group1, enrolperiod1, course2, type2, role2, group2, enrolperiod2&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
**&amp;lt;code&amp;gt;course&amp;lt;/code&amp;gt; is the &amp;quot;shortname&amp;quot;  if present the user will be enrolled in those courses.&lt;br /&gt;
** &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt; refers to the role to be used for associated course enrolment. Value 1 is default course role, 2 is legacy Teacher role and 3 is legacy Non-editing Teacher.&lt;br /&gt;
** You can use role field instead to specify roles directly - use either role short name or id (numeric names of roles are not supported).&lt;br /&gt;
** Users may be also assigned to groups in course (group1 in course1, group2 in course2, etc.).&lt;br /&gt;
*** A group is identified by name or id (numeric group names are not supported).&lt;br /&gt;
** From Moodle 2.0, you can set the enrolment duration, in days, for each course (&amp;lt;code&amp;gt;enrolperiod1&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;enrolperiod2&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;course2&amp;lt;/code&amp;gt;, etc.).&lt;br /&gt;
&lt;br /&gt;
Commas within  a field must be encoded as &amp;amp;#44 - the script will decode these back to commas.&lt;br /&gt;
&lt;br /&gt;
For Boolean fields, use &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; for false and &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; for true.&lt;br /&gt;
&lt;br /&gt;
Turn email off: &amp;lt;code&amp;gt;emailstop&amp;lt;/code&amp;gt; set to &amp;lt;CODE&amp;gt;1&amp;lt;/CODE&amp;gt; if the email address should be disabled (default: email is enabled):&lt;br /&gt;
&lt;br /&gt;
To prevent users from receiving a large number of emails from courses or forced subscription forums use the &#039;&#039;&#039;maildigest&#039;&#039;&#039;.  The options for this field are 0 = No digest, 1 = Complete digest and 2 = Digest with just subjects.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a valid upload file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;username, password, firstname, lastname, email, course1, group1&amp;lt;br /&amp;gt;&lt;br /&gt;
jonest, verysecret, Tom, Jones, jonest@someplace.edu, math102, Section 1&amp;lt;br /&amp;gt;&lt;br /&gt;
reznort, somesecret, Trent, Reznor, reznort@someplace.edu,math102, Section 3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Templates==&lt;br /&gt;
&lt;br /&gt;
The default values are processed as templates in which the following codes are allowed:&lt;br /&gt;
&lt;br /&gt;
* %l - will be replaced by the lastname&lt;br /&gt;
* %f - will be replaced by the firstname&lt;br /&gt;
* %u - will be replaced by the username&lt;br /&gt;
* %% - will be replaced by the %&lt;br /&gt;
&lt;br /&gt;
Between the percent sign (%) and any code letter (l, f or u) the following modifiers are allowed:&lt;br /&gt;
&lt;br /&gt;
* (-) minus sign - the information specified by the code letter will be converted to lowercase&lt;br /&gt;
* (+) plus sign - the information specified by the code letter will be converted to UPPERCASE&lt;br /&gt;
* (~) tilde sign - the information specified by the code letter will be converted to Title Case&lt;br /&gt;
* a decimal number - the information specified by the code letter will be truncated to that many characters&lt;br /&gt;
&lt;br /&gt;
For example, if the firstname is John and the lastname is Doe, the following values will be obtained with the specified templates:&lt;br /&gt;
&lt;br /&gt;
* %l%f = DoeJohn&lt;br /&gt;
* %l%1f = DoeJ&lt;br /&gt;
* %-l%+f = doeJOHN&lt;br /&gt;
* %-f_%-l = john_doe&lt;br /&gt;
* http://www.example.com/~%u/ = http://www.example.com/~jdoe/ (if the username is jdoe or %-1f%-l)&lt;br /&gt;
&lt;br /&gt;
Template processing is done only on default values, and not on the values retrieved from the CSV file.&lt;br /&gt;
&lt;br /&gt;
In order to create correct Moodle usernames, the username is always converted to lowercase. Moreover, if the &amp;quot;Allow extended characters in usernames&amp;quot; option in the Site policies page is off, characters different to letters, digits, dash (-) and dot (.) are removed. For example if the firstname is John Jr. and the lastname is Doe, the username %-f_%-l will produce john jr._doe when Allow extended characters in usernames is on, and johnjr.doe when off.&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;New username duplicate handling&amp;quot; setting is set to Append counter, an auto-increment counter will be append to duplicate usernames produced by the template. For example, if the CSV file contains the users named John Doe, Jane Doe and Jenny Doe without explicit usernames, the default username is %-1f%-l and New username duplicate handling is set to Append counter, then the usernames produced will be jdoe, jdoe2 and jdoe3. &lt;br /&gt;
&lt;br /&gt;
==Updating existing accounts==&lt;br /&gt;
&lt;br /&gt;
By default Moodle assumes that you will be creating new user accounts, and skips records where the username matches an existing account. However, if you set &amp;quot;Update existing accounts&amp;quot; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the existing user account will be updated.&lt;br /&gt;
&lt;br /&gt;
When updating existing accounts you can change usernames as well. Set &amp;quot;Allow renames&amp;quot; to &#039;&#039;&#039;Yes&#039;&#039;&#039; and include in your file a field called &amp;lt;code&amp;gt;oldusername&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: any errors updating existing accounts can affect your users badly. Be careful when using the options to update.&lt;br /&gt;
&lt;br /&gt;
==Deleting accounts==&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;code&amp;gt;deleted&amp;lt;/code&amp;gt; field is present, users with value 1 for it will be deleted. In this case, all the fields may be omitted, except for &amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Deleting and uploading accounts could be done with a single CSV file. For example, the following file will add the user Tom Jones and delete the user reznort:&lt;br /&gt;
&lt;br /&gt;
 username, firstname, lastname, deleted&lt;br /&gt;
 jonest, Tom, Jones, 0&lt;br /&gt;
 reznort, , , 1 &lt;br /&gt;
&lt;br /&gt;
==Encoding==&lt;br /&gt;
&lt;br /&gt;
In Moodle 1.8 the file must be UTF-8. In Moodle 1.9 onwards, the encoding may be selected from a large list, including ISO-8859-1.&lt;br /&gt;
&lt;br /&gt;
==Hints==&lt;br /&gt;
&lt;br /&gt;
===Spreadsheet===&lt;br /&gt;
&lt;br /&gt;
If you use a spreadsheet program such as Excel to create your .csv file, check the resulting output in a text editor before you upload it.  It is possible to get trailing commas on each line from an empty field if you have added and deleted columns of information prior to saving the final file. Also check the character encoding. A csv file is a simple text file (ASCII or Unicode) that can be used to upload user accounts.&lt;br /&gt;
&lt;br /&gt;
Excel translates passwords that begin with - (minus) or + (plus) as zero. Even when saving as .csv and saying &amp;quot;Yes&amp;quot; to &amp;quot;Keep this format, and leave out any incompatible features.&amp;quot; Check for this before uploading, as a zero halts the upload process.&lt;br /&gt;
&lt;br /&gt;
If you use a formula in Excel to create fields (for example, the concatenate function to create a user name), then remember to copy the cells with the formula and use special paste with values checked to make them into an acceptable data for a csv file.&lt;br /&gt;
&lt;br /&gt;
===Country===&lt;br /&gt;
The country should be written as a two letter code, in capitals. For example, use BE for Belgium or NL for the Netherlands.  Using &amp;quot;be&amp;quot; or &amp;quot;nl&amp;quot; as a country code will result in a database error.&lt;br /&gt;
:&#039;&#039;Tip:&#039;&#039;  If you are having trouble working out the two-letter code for a country, you can consult this Moodle source code file /moodle/lang/en_utf8/countries.php [http://cvs.moodle.org/moodle/lang/en_utf8/countries.php?view=markup&amp;amp;pathrev=MOODLE_19_STABLE or click here for a 1.9 STABLE list].&lt;br /&gt;
ISO Website: [http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
Moodle Docs:&lt;br /&gt;
*[[Flat file]]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=36851 Can I auto enroll from Excel?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=58215 Making Email Optional]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97903 Uploading users to custom roles]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=144569 Matriculacion con flat file csv] - discussion in Spanish&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
[[Category:Enrolment]]&lt;br /&gt;
[[Category:Groups]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Importer des utilisateurs]]&lt;br /&gt;
[[ja:ユーザのアップロード]]&lt;br /&gt;
[[zh:上传用户]]&lt;br /&gt;
[[ru:Загрузка пользователей]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=error/moodle/csvloaderror&amp;diff=78399</id>
		<title>error/moodle/csvloaderror</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=error/moodle/csvloaderror&amp;diff=78399"/>
		<updated>2010-11-28T20:58:30Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: usernames must be lowercase&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Unfortunately the module which load the csv data doesn&#039;t explain what&#039;s wrong.&lt;br /&gt;
&lt;br /&gt;
#Check&lt;br /&gt;
## First line must contain column headings SPELLED correctly&lt;br /&gt;
## There should not be quotes (i.e. &amp;quot;)&lt;br /&gt;
## There should not be a trailing comma (i.e. ,)&lt;br /&gt;
&lt;br /&gt;
While you&#039;re here,contrary to popular belief, usernames must be in lowercase in the file to be uploaded.&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=error/moodle/csvloaderror&amp;diff=78397</id>
		<title>error/moodle/csvloaderror</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=error/moodle/csvloaderror&amp;diff=78397"/>
		<updated>2010-11-28T20:55:00Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: Some of things that can be incorrect in a csv upload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Unfortunately the module which load the csv data doesn&#039;t explain what&#039;s wrong.&lt;br /&gt;
&lt;br /&gt;
#Check&lt;br /&gt;
## First line must contain column headings SPELLED correctly&lt;br /&gt;
## There should not be quotes (i.e. &amp;quot;)&lt;br /&gt;
## There should not be a trailing comma (i.e. ,)&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Using_Git_to_backup_moodledata&amp;diff=44773</id>
		<title>Using Git to backup moodledata</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Using_Git_to_backup_moodledata&amp;diff=44773"/>
		<updated>2008-10-03T19:41:54Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: add link which talks about git&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
[[GIT]] [https://docs.moodle.org/en/Development:Tracking_Moodle_CVS_with_git] is a distributed source code management system. For the purpose of this document, GIT&#039;s basic feature is that it allows to keep the whole history of a directory tree and track all changes. The basic idea of using GIT as a backup tool is that you can clone you moodledata directory on other disk and/or computer.&lt;br /&gt;
&lt;br /&gt;
Create new file called .gitignore in the moodledata with the following content:&lt;br /&gt;
&lt;br /&gt;
 cache&lt;br /&gt;
 lang&lt;br /&gt;
 sessions&lt;br /&gt;
 temp&lt;br /&gt;
&lt;br /&gt;
Transform your moodledata into the git repository:&lt;br /&gt;
&lt;br /&gt;
 cd /srv/www/moodledata&lt;br /&gt;
 git init&lt;br /&gt;
 git add .&lt;br /&gt;
 git commit -m &amp;quot;Initial commit of moodledata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Put following commands into the cronjob&lt;br /&gt;
&lt;br /&gt;
 cd /srv/www/moodledata&lt;br /&gt;
 git add .&lt;br /&gt;
 git commit -a -m &amp;quot;AUTO: committed changes in moodledata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Create a backup clone on local machine, e.g. on a separate disk&lt;br /&gt;
&lt;br /&gt;
 cd /mnt/backup&lt;br /&gt;
 git clone --no-hardlinks --bare /srv/www/moodledata/.git datamoodle.git&lt;br /&gt;
&lt;br /&gt;
Push changes into a bare clone&lt;br /&gt;
&lt;br /&gt;
 cd /srv/www/moodledata&lt;br /&gt;
 git push /mnt/backup/datamoodle.git&lt;br /&gt;
&lt;br /&gt;
Or, pull changes from the clone (here created on a separate machine)&lt;br /&gt;
&lt;br /&gt;
 git --bare fetch ssh://your.moodle.serv.er/backup/datamoodle.git master:master&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Roles_FAQ&amp;diff=32025</id>
		<title>Roles FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Roles_FAQ&amp;diff=32025"/>
		<updated>2008-02-10T19:49:31Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: add scroll down, a little help&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Roles}}&lt;br /&gt;
&lt;br /&gt;
==What is the definition of a...==&lt;br /&gt;
&lt;br /&gt;
;Role&lt;br /&gt;
:An identifier of the user&#039;s status in some context, for example Teacher, Student and Forum moderator&lt;br /&gt;
;Capability&lt;br /&gt;
:A description of a particular Moodle feature, for example [[Capabilities/moodle/blog:create|moodle/blog:create]]&lt;br /&gt;
;Permission&lt;br /&gt;
:A setting for a capability - inherit, allow, prevent or prohibit&lt;br /&gt;
;Context&lt;br /&gt;
:A &amp;quot;space&amp;quot; in Moodle, such as courses, activity modules or blocks&lt;br /&gt;
&lt;br /&gt;
==Why isn&#039;t my role change taking effect?==&lt;br /&gt;
&lt;br /&gt;
In Moodle 1.9 and newer role changes are immediate; in Moodle 1.7.x and 1.8.x role they are not, and will take effect after the next login from that user. Regarding testing new roles, please refer to the information in [[Manage roles]].&lt;br /&gt;
&lt;br /&gt;
Also, please check the context in which the role is assigned. Certain capabilities e.g. [[Capabilities/moodle/user:update|moodle/user:update]] may only be applied in the system context, so assigning a role in the course context will result in the role change not taking effect.&lt;br /&gt;
&lt;br /&gt;
==Why are participants being added automatically when a new course is created?==&lt;br /&gt;
&lt;br /&gt;
If a user is assigned a global role or a role in the course category context then the user has this role in ALL courses in that context. Thus users who are students or teachers at the category level appear as course participants in all courses in that category.&lt;br /&gt;
&lt;br /&gt;
Please check &#039;&#039;Administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Assign global roles&#039;&#039; and also the Assign roles link in course categories page and unassign users as necessary.&lt;br /&gt;
&lt;br /&gt;
==Why are all students enrolled in all courses?==&lt;br /&gt;
&lt;br /&gt;
Either&lt;br /&gt;
*Users are assigned the role of student in the site/system context rather than the course context (see FAQ above)&lt;br /&gt;
Or&lt;br /&gt;
*The default role for all users in &#039;&#039;Administration &amp;gt; Users &amp;gt; Permissions &amp;gt; User policies&#039;&#039; is set to Student rather than Authenticated user (Moodle 1.8 onwards).&lt;br /&gt;
&lt;br /&gt;
==Why are there differences in the users listed as course participants and users assigned roles in a course?==&lt;br /&gt;
&lt;br /&gt;
Users assigned roles in a higher context, for example users assigned the role of teacher in a course category context, may appear as course participants. The discussion [http://moodle.org/mod/forum/discuss.php?d=59900 Discrepancies between Assign Roles lists and Participants list] contains a longer explanation. &lt;br /&gt;
&lt;br /&gt;
==How can I prevent administrators being listed as course participants?==&lt;br /&gt;
&lt;br /&gt;
Ensure that administrators are not assigned another role in addition to their admin role.&lt;br /&gt;
&lt;br /&gt;
==Why are hidden assignments still visible?==&lt;br /&gt;
&lt;br /&gt;
Hidden assignments are not hidden from admins or teachers i.e. users with the [[Capabilities/moodle/role:viewhiddenassigns|viewhiddenassigns capability]].&lt;br /&gt;
&lt;br /&gt;
==Where are permissions inherited from?==&lt;br /&gt;
&lt;br /&gt;
Permissions are inherited from a role assigned in a higher-level context which has permissions set to allow for particular capabilities. If permission is never allowed/not set in any context (in particular, if you are creating or editing a role at the site level), then a user will have no permission for that capability.&lt;br /&gt;
&lt;br /&gt;
For example, the Student role has permission not set for the change site configuration capability. The permission is never allowed in any context so users assigned the role of Student cannot change the site configuration.&lt;br /&gt;
&lt;br /&gt;
==What is a hierarchy of permissions?==&lt;br /&gt;
&lt;br /&gt;
This determines which permission wins or is going to be in effect if there is an apparent conflict. For example, the site allows all students the permission to post in forums, but a teacher might prevent that right in a particular course. The hierarchy of permissions would allow a student to post in one course but not in another course.&lt;br /&gt;
&lt;br /&gt;
==Are there any differences in Roles in Moodle 1.7 and 1.8?==&lt;br /&gt;
&lt;br /&gt;
In addition to many Roles fixes and refinements (see the list of [http://tracker.moodle.org/secure/IssueNavigator.jspa?mode=hide&amp;amp;requestId=10221 Roles improvements] in the Tracker), in Moodle 1.8 the &#039;&#039;system&#039;&#039; context is separated from the &#039;&#039;site&#039;&#039; context.&lt;br /&gt;
&lt;br /&gt;
The site context in Moodle 1.8 is the &amp;quot;front page course&amp;quot; and its activities. Roles may be assigned in the  site context via &#039;&#039;Administration &amp;gt; Front Page &amp;gt; Front Page roles&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;Duplicate role&amp;quot; button has been added in Moodle 1.8, which makes creating new roles based on predefined roles much quicker.&lt;br /&gt;
&lt;br /&gt;
==How do I change the name for &amp;quot;teacher&amp;quot; in the course description?==&lt;br /&gt;
&lt;br /&gt;
Either&lt;br /&gt;
* Edit the role of Teacher via &#039;&#039;Administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; and rename it. The new name will apply site-wide.&lt;br /&gt;
Or&lt;br /&gt;
* Create a duplicate teacher role with an alternative name and assign users the duplicate teacher role as appropriate in the course context. In &#039;&#039;Administration &amp;gt; Appearance &amp;gt; Course manager&#039;&#039; select the alternative name for teacher that you wish to be displayed in the course description.&lt;br /&gt;
Or&lt;br /&gt;
* One more way to do it in 1.8 is to create new &amp;quot;dummy&amp;quot; roles (no capabilities) with those names and assign them to teachers along with the real roles. In the course manager settings you can choose which roles display on the front page under each course. (The feature request [http://tracker.moodle.org/browse/MDL-9182 Ability to assign or display custom title for role of person in course] contains this further method.)&lt;br /&gt;
&lt;br /&gt;
{{Moodle 1.9}}From Moodle 1.9 onwards, names for different roles in a course may be changed in the [[Course settings|course settings]].&lt;br /&gt;
&lt;br /&gt;
==How do I enable teachers to set role overrides?==&lt;br /&gt;
&lt;br /&gt;
#Access &#039;&#039;Administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;.&lt;br /&gt;
#Edit the teacher role and change the capability [[Capabilities/moodle/role:override|moodle/role:override]] to allow.&lt;br /&gt;
#Click the button &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
#Click the tab &amp;quot;Allow role overrides&amp;quot; (in &#039;&#039;Administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;).&lt;br /&gt;
#Check the appropriate box to allow a teacher to override the student role.&lt;br /&gt;
#Click the button &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==How do I enable teachers to assign other teachers in a course?==&lt;br /&gt;
&lt;br /&gt;
This is disabled by default but it can be switched on by modifying the teacher&#039;s role. In &#039;&#039;Administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; select the &amp;quot;Allow role assignments&amp;quot; tab and tick the checkbox where Teacher and Teacher intersect.&lt;br /&gt;
&lt;br /&gt;
==Why doesn&#039;t &amp;quot;Switch role to..&amp;quot; within a course seem to work properly for a course creator?==&lt;br /&gt;
&lt;br /&gt;
This feature is intended for teachers so that they can see how their course appears for students. It doesn&#039;t work reliably outside the course.&lt;br /&gt;
&lt;br /&gt;
Further information about this feature can be found in [[Switch roles]] and the paragraph on testing a new role in [[Manage roles]].&lt;br /&gt;
&lt;br /&gt;
==Are there any example roles?==&lt;br /&gt;
&lt;br /&gt;
Yes, as follows:&lt;br /&gt;
&lt;br /&gt;
*[[Inspector role|Inspector]] - for providing external inspectors with permission to view all courses (without being required to enrol)&lt;br /&gt;
*[[Parent role|Parent]] - for providing parents/mentors/tutors with permission to view certain information about their children/mentees/tutees&lt;br /&gt;
*[[Demo teacher role|Demo teacher]] - for providing a demonstration teacher account with a password which can&#039;t be changed&lt;br /&gt;
*[[Forum moderator role]] - for providing a user with permission in a particular forum to edit or delete forum posts, split discussions and move discussions to other forums&lt;br /&gt;
*[[Keyholder role]] - for setting the person named as holding a course [[Enrolment key|enrolment key]]&lt;br /&gt;
&lt;br /&gt;
==Logged-in users can&#039;t read the site news. What can I do?==&lt;br /&gt;
&lt;br /&gt;
#Access &#039;&#039;Site Administration &amp;gt; Front Page &amp;gt; Front Page roles&#039;&#039;&lt;br /&gt;
#Follow the &amp;quot;Override roles&amp;quot; link&lt;br /&gt;
#Click on &amp;quot;Authenticated User&amp;quot;&lt;br /&gt;
#Scroll down to &#039;&#039;&#039;Forum&#039;&#039;&#039;&lt;br /&gt;
#Change the capability [[Capabilities/mod/forum:viewdiscussion|mod/forum:viewdiscussion]] to &#039;&#039;allow&#039;&#039;&lt;br /&gt;
#Click the &amp;quot;Save changes&amp;quot; button at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
==How do I enable logged-in users to participate in front page activities?==&lt;br /&gt;
&lt;br /&gt;
Either:&lt;br /&gt;
#Access &#039;&#039;Site Administration &amp;gt; Front Page &amp;gt; Front Page roles&#039;&#039;&lt;br /&gt;
#Follow the &amp;quot;Override roles&amp;quot; link&lt;br /&gt;
#Click on &amp;quot;Authenticated User&amp;quot;&lt;br /&gt;
#Change capabilities to &#039;&#039;allow&#039;&#039; for all required activities e.g. record a choice, reply to posts&lt;br /&gt;
#Click the &amp;quot;Save changes&amp;quot; button at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
Note that for this to work, you need to make the default role for all users &amp;quot;authenticated user&amp;quot;. This is the default for new versions of Moodle. In older versions, the default setting is guest, so if you have recently upgraded, you may have to change this setting. You can change the setting via &#039;&#039;Site Administration &amp;gt; Permissions &amp;gt; User Policies&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Or:&lt;br /&gt;
#Access &#039;&#039;Site Administration &amp;gt; Front Page &amp;gt; Front Page roles&#039;&#039;&lt;br /&gt;
#Click on Student&lt;br /&gt;
#Select all users in the potential users list, and use the left-facing arrow button to add them to the existing users list&lt;br /&gt;
&lt;br /&gt;
{{Moodle 1.9}}Or, in Moodle 1.9 onwards:&lt;br /&gt;
#Access &#039;&#039;Site Administration &amp;gt; Front Page &amp;gt; Front Page settings&#039;&#039;&lt;br /&gt;
#Set the default front page role to student.&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[es:FAQ_roles]]&lt;br /&gt;
[[fr:FAQ des rôles]]&lt;br /&gt;
[[ja:ロールFAQ]]&lt;br /&gt;
[[ru:FAQ по ролям]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31701</id>
		<title>Installing Moodle</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31701"/>
		<updated>2008-01-29T02:20:03Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: /* Creating the data directory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Firstly don&#039;t panic! :-)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don&#039;t panic, once you know how to do it you can install Moodle in minutes!&lt;br /&gt;
&lt;br /&gt;
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via  [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].&lt;br /&gt;
&lt;br /&gt;
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you]  through the process of choosing a host and setting up moodle via cpanel. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning:&#039;&#039;&#039; some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don&#039;t work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.&lt;br /&gt;
&lt;br /&gt;
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle&#039;s complete packages]]. They provide alternative instructions to install all this on most popular platforms.&lt;br /&gt;
==Table of Contents==&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Most web hosts support all of these requirements by default. You should contact your web host&#039;s support desk to check that this is the case &#039;&#039;&#039;before&#039;&#039;&#039; signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.&lt;br /&gt;
&lt;br /&gt;
The requirements for Moodle are as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hardware&#039;&#039;&#039; (unless you are using a hosted server). &lt;br /&gt;
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.&lt;br /&gt;
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 &#039;&#039;concurrent&#039;&#039; users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. &lt;br /&gt;
&#039;&#039;&#039;Software&#039;&#039;&#039;&lt;br /&gt;
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. &lt;br /&gt;
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.&lt;br /&gt;
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.&lt;br /&gt;
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. &lt;br /&gt;
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).&lt;br /&gt;
** PHP Settings&lt;br /&gt;
*** &#039;&#039;safe_mode&#039;&#039; needs to be OFF (check in your php.ini or Apache configuration file).&lt;br /&gt;
*** &#039;&#039;memory_limit&#039;&#039; should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.&lt;br /&gt;
*** &#039;&#039;session.save_handler&#039;&#039; needs to be set to files. &lt;br /&gt;
** PHP Extensions and libraries&lt;br /&gt;
*** The mbstring extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** The iconv extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.&lt;br /&gt;
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.&lt;br /&gt;
*** The pgsql extension is required if you are using the PostgreSQL database.&lt;br /&gt;
*** The zlib extension is required for zip/unzip functionality.&lt;br /&gt;
*** The curl extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The tokenizer extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is &#039;&#039;the&#039;&#039; choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. &lt;br /&gt;
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). &lt;br /&gt;
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).&lt;br /&gt;
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting &amp;quot;strict mode&amp;quot; must be OFF (set to &amp;quot;&amp;quot; or &amp;quot;MYSQL40&amp;quot;) in the MySQL configuration file. &lt;br /&gt;
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== How many users? ==&lt;br /&gt;
&lt;br /&gt;
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Browsing users&#039;&#039;&#039;: the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).&lt;br /&gt;
* &#039;&#039;&#039;Concurrent database users&#039;&#039;&#039;: the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.&lt;br /&gt;
&lt;br /&gt;
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. &lt;br /&gt;
&lt;br /&gt;
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.&lt;br /&gt;
&lt;br /&gt;
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Download and copy files into place ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Moodle, either as a compressed package or via CVS. &lt;br /&gt;
* There are two types of compressed packages on the  [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment.  &lt;br /&gt;
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. &lt;br /&gt;
&lt;br /&gt;
After downloading, unpack the archive using either &lt;br /&gt;
 tar -zxvf [filename]&lt;br /&gt;
or&lt;br /&gt;
 unzip [filename]&lt;br /&gt;
as appropriate. &lt;br /&gt;
&lt;br /&gt;
If using CVS, run the CVS Checkout command.&lt;br /&gt;
&lt;br /&gt;
You will now be left with a directory called &amp;quot;moodle&amp;quot;, containing a number of files and folders.&lt;br /&gt;
&lt;br /&gt;
You can either place the whole folder in your web server documents directory, in which case the site will be located at &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com/moodle&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;, or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the &amp;quot;File Manager&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Structure of moodle directory ===&lt;br /&gt;
&lt;br /&gt;
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;config.php&#039;&#039; - contains basic settings. This file does not come with Moodle - you will create it.&lt;br /&gt;
:&#039;&#039;install.php&#039;&#039; - the script you will run to create config.php&lt;br /&gt;
:&#039;&#039;version.php&#039;&#039; - defines the current version of Moodle code&lt;br /&gt;
:&#039;&#039;index.php&#039;&#039; - the front page of the site&lt;br /&gt;
:&#039;&#039;admin/&#039;&#039; - code to administrate the whole server&lt;br /&gt;
:&#039;&#039;auth/&#039;&#039; - plugin modules to authenticate users&lt;br /&gt;
:&#039;&#039;blocks/&#039;&#039; - plugin modules for the little side blocks on many pages&lt;br /&gt;
:&#039;&#039;calendar/&#039;&#039; - all the code for managing and displaying calendars&lt;br /&gt;
:&#039;&#039;course/&#039;&#039; - code to display and manage courses&lt;br /&gt;
:&#039;&#039;doc/&#039;&#039; - help documentation for Moodle (eg this page)&lt;br /&gt;
:&#039;&#039;files/&#039;&#039; - code to display and manage uploaded files&lt;br /&gt;
:&#039;&#039;lang/&#039;&#039; - texts in different languages, one directory per language&lt;br /&gt;
:&#039;&#039;lib/&#039;&#039; - libraries of core Moodle code&lt;br /&gt;
:&#039;&#039;login/&#039;&#039; - code to handle login and account creation&lt;br /&gt;
:&#039;&#039;mod/&#039;&#039; - all the main Moodle course modules are in here&lt;br /&gt;
:&#039;&#039;pix/&#039;&#039; - generic site graphics&lt;br /&gt;
:&#039;&#039;theme/&#039;&#039; - theme packs/skins to change the look of the site.&lt;br /&gt;
:&#039;&#039;user/&#039;&#039; - code to display and manage users&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Setting-up your system==&lt;br /&gt;
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.&lt;br /&gt;
&lt;br /&gt;
=== Check web server settings ===&lt;br /&gt;
&lt;br /&gt;
*Firstly, make sure that your web server is set up to use index.php as a default page (perhaps in addition to index.html, default.htm and so on). In Apache, this is done using a DirectoryIndex parameter in your httpd.conf file. Mine usually looks like this:&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; index.php index.html index.htm&lt;br /&gt;
&lt;br /&gt;
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).&lt;br /&gt;
&lt;br /&gt;
*Secondly, &#039;&#039;&#039;if you are using Apache 2&#039;&#039;&#039;, then you should turn on the &#039;&#039;AcceptPathInfo&#039;&#039; variable, which allows scripts to be passed arguments like &amp;lt;nowiki&amp;gt;http://server/file.php/arg1/arg2&amp;lt;/nowiki&amp;gt;. This is essential to allow relative links between your resources, and also provides a performance boost for people using your Moodle web site. You can turn this on by adding these lines to your httpd.conf file.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;AcceptPathInfo&#039;&#039;&#039; on&lt;br /&gt;
&lt;br /&gt;
=== Check PHP settings ===&lt;br /&gt;
Moodle requires a number of PHP settings to be active for it to work. &#039;&#039;&#039;On most servers these will already be the default settings&#039;&#039;&#039;.  However, some PHP servers (and some of the more recent PHP versions) may have things set differently. These are defined in PHP&#039;s configuration file (usually called &#039;&#039;&#039;php.ini&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 magic_quotes_gpc = 1    (preferred but not necessary)&lt;br /&gt;
 magic_quotes_runtime = 0    (necessary)&lt;br /&gt;
 file_uploads = 1&lt;br /&gt;
 session.auto_start = 0&lt;br /&gt;
 session.bug_compat_warn = 0&lt;br /&gt;
&lt;br /&gt;
:You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:&lt;br /&gt;
 &lt;br /&gt;
 post_max_size = 16M&lt;br /&gt;
 upload_max_filesize = 16M&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Using a .htaccess file for webserver and PHP settings ===&lt;br /&gt;
&lt;br /&gt;
Use the above if you can directly edit your server&#039;s files, but if you are setting-up Moodle on a webhost, or don&#039;t have access to &#039;&#039;&#039;httpd.conf&#039;&#039;&#039; or &#039;&#039;&#039;php.ini&#039;&#039;&#039; on your server, or you have Moodle on a server with other applications that require different settings, then don&#039;t worry, you can often still override the default settings. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration.&lt;br /&gt;
&lt;br /&gt;
* Create a file called &#039;&#039;&#039;.htaccess&#039;&#039;&#039; in Moodle&#039;s main directory that contains lines like the following. &lt;br /&gt;
&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
 php_flag magic_quotes_gpc 1&lt;br /&gt;
 php_flag magic_quotes_runtime 0&lt;br /&gt;
 php_flag file_uploads 1&lt;br /&gt;
 php_flag session.auto_start 0&lt;br /&gt;
 php_flag session.bug_compat_warn 0&lt;br /&gt;
&lt;br /&gt;
:If you have Apache version 2 installed, add these lines:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;IfDefine APACHE2&amp;gt;&lt;br /&gt;
     AcceptPathInfo on&lt;br /&gt;
 &amp;lt;/IfDefine&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Otherwise add this single line:&lt;br /&gt;
&lt;br /&gt;
 AcceptPathInfo on&lt;br /&gt;
&lt;br /&gt;
* Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:&lt;br /&gt;
&lt;br /&gt;
 LimitRequestBody 0&lt;br /&gt;
 php_value upload_max_filesize 2M&lt;br /&gt;
 php_value post_max_size 2M&lt;br /&gt;
     &lt;br /&gt;
* The easiest thing to do is just copy the sample file from lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:&lt;br /&gt;
&lt;br /&gt;
 cp lib/htaccess .htaccess&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Creating an empty database ===&lt;br /&gt;
&lt;br /&gt;
You need to create an empty database (eg &amp;quot;&#039;&#039;moodle&#039;&#039;&amp;quot;) in your database system along with a special user (eg &amp;quot;moodleuser&amp;quot;) that has access to that database (and that database only). You could use the &amp;quot;root&amp;quot; user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Warning&#039;&#039;&#039;: Bear in mind that, as of Moodle version 1.5.x, Moodle doesn&#039;t work with MySQL 5.x&#039;s strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL&#039;s configuration file (called &amp;quot;my.ini&amp;quot; in Windows and &amp;quot;my.cnf&amp;quot; on Unix/Linux) and comment out that option or set it to &amp;lt;code&amp;gt;sql-mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You have to restart MySQL after changing this setting. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt; If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command &amp;lt;code&amp;gt;SET @@global.sql_mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;;&amp;lt;/code&amp;gt; (be sure to use single quotes, and don&#039;t forget the semicolon).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 &amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
====Using a hosted server====&lt;br /&gt;
If you are using a webhost, they will probably have a control panel web interface for you to create your database.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;[http://www.cpanel.com/ cPanel]&#039;&#039;&#039; system is one of the most popular of these. &lt;br /&gt;
To create a database using cPanel:&lt;br /&gt;
&lt;br /&gt;
# Click on the &#039;&#039;&#039;MySQL Databases&#039;&#039;&#039; icon.&lt;br /&gt;
# Type &#039;&#039;&#039;moodle&#039;&#039;&#039; in the New Database field and click &#039;&#039;&#039;Create Database&#039;&#039;&#039;.&lt;br /&gt;
# Type a &#039;&#039;username&#039;&#039; and &#039;&#039;password&#039;&#039; (not one you use elsewhere) in the respective fields and click &#039;&#039;&#039;Create  User&#039;&#039;&#039;.&amp;lt;br&amp;gt;Note that the &#039;&#039;username&#039;&#039; and &#039;&#039;database&#039;&#039; names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.&lt;br /&gt;
# Now use the &#039;&#039;&#039;Add Users to Databases&#039;&#039;&#039; button and give this new user account &#039;&#039;&#039;ALL&#039;&#039;&#039; rights to the new database.&lt;br /&gt;
&lt;br /&gt;
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using the command line====&lt;br /&gt;
&lt;br /&gt;
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):&lt;br /&gt;
&lt;br /&gt;
- Start the MySQL Client program:&lt;br /&gt;
 #&#039;&#039;&#039;mysql -u root -p&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 Welcome to the MySQL monitor.  Commands end with ; or \g.&lt;br /&gt;
 Your MySQL connection id is 2 to server version: 5.0.22-log&lt;br /&gt;
 &lt;br /&gt;
 Type &#039;help;&#039; or &#039;\h&#039; for help. Type &#039;\c&#039; to clear the buffer.&lt;br /&gt;
 &lt;br /&gt;
 mysql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- The prompt changes to &amp;quot;mysql&amp;gt;&amp;quot; to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you&#039;ll get the line continuation symbol &#039;-&amp;gt;&#039;; this is your second chance to type the semi-colon and hit Enter.) &lt;br /&gt;
&lt;br /&gt;
- Begin by checking for any existing databases called &amp;quot;moodle&amp;quot; - if there are any you should change the name in all the commands which follow:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;SHOW DATABASES;&#039;&#039;&#039;&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | Database                |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | information_schema      |&lt;br /&gt;
 | mysql                   |&lt;br /&gt;
 | test                    |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 3 rows in set (0.03 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a database to store the Moodle tables. We&#039;ll call this &amp;quot;moodle&amp;quot;, as there are none with that name already in the above list, but change it if you need to.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;CREATE DATABASE moodle;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Change the default character set and collation of the &amp;quot;moodle&amp;quot; database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a username and password to access the database &amp;quot;moodle&amp;quot; and grant database access permissions. We&#039;ll call the user &amp;quot;moodleuser&amp;quot; and set the password as &amp;quot;yourpassword&amp;quot;. It&#039;s a good idea to change these for your installation however most people keep the username as &amp;quot;moodleuser&amp;quot;. Remember the username and password you have set, as you&#039;ll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;DROP,INDEX,ALTER ON moodle.*&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;TO moodleuser@localhost IDENTIFIED BY &#039;yourpassword&#039;;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 0 rows affected (0.01 sec)&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Security Warnings&#039;&#039;&#039;: Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting &amp;quot;ALL&amp;quot; permissions on the database.&lt;br /&gt;
: &#039;&#039;&#039;Note&#039;&#039;&#039;: For MySQL 4.0.1 or earlier, you don&#039;t need the CREATE TEMPORARY TABLES permission. &lt;br /&gt;
&lt;br /&gt;
- Exit the MySQL Client program:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;QUIT&#039;&#039;&#039;&lt;br /&gt;
 Bye&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
- Reload the grant tables using the mysqladmin program:&lt;br /&gt;
 #&#039;&#039;&#039;mysqladmin -u root -p reload&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
And some example command lines for PostgreSQL:&lt;br /&gt;
&lt;br /&gt;
   # su - postgres&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create user moodleuser createdb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create database moodle &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;with encoding &#039;unicode&#039;&amp;lt;/font&amp;gt;;&amp;quot; -U moodleuser template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser nocreatedb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser with encrypted password &#039;yourpassword&#039;;&amp;quot; template1&lt;br /&gt;
   &amp;gt; su - root&lt;br /&gt;
   # /etc/init.d/postgresql reload&lt;br /&gt;
&lt;br /&gt;
If the Postgres create database command above (&amp;gt;psql -c &amp;quot;create database moodle...&amp;quot;) gives an error message you may want to try:&lt;br /&gt;
 psql -c &amp;quot;create database moodle with template=template1 encoding = &#039;unicode&#039; owner =  moodleuser &amp;lt;br&amp;gt;     location = &#039;/var/mydata&#039;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If the create database command asks you for a password, run the line containing &#039;encrypted password&#039; first before proceeding.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;:&lt;br /&gt;
* Step-by-step instructions on  [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&amp;lt;div id=CreatDataDir &amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Creating the data directory  ===&lt;br /&gt;
&lt;br /&gt;
Moodle will also need some space on your server&#039;s hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create the &#039;&#039;&#039;moodledata&#039;&#039;&#039; directory for you but if it fails then you will have to create a directory for this purpose manually.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security warning&#039;&#039;&#039;: For security purposes, it&#039;s best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called &#039;&#039;&#039;.htaccess&#039;&#039;&#039;, containing these lines:&lt;br /&gt;
&lt;br /&gt;
 order deny,allow&lt;br /&gt;
 deny from all&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ownership &amp;amp; Permissions&#039;&#039;&#039;: To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like &amp;quot;nobody&amp;quot; or &amp;quot;apache&amp;quot;, and then giving that user read, write and execute permissions. As an example, to change the owner to &amp;quot;nobody&amp;quot; you could use:&lt;br /&gt;
&lt;br /&gt;
 chown -R nobody:apache moodledata&lt;br /&gt;
&lt;br /&gt;
To change the permissions so that the owner has read,write and execute permissions, use something like this:&lt;br /&gt;
&lt;br /&gt;
 chmod -R 0770 moodledata&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you are receiving permission denied messages, try &#039;&#039;chmod -R 0770 moodledata&#039;&#039; and then adjust the settings so that they are more secure. A more secure setting is &#039;&#039;chmod -R 0750 moodledata&#039;&#039;. According to the comments in config-dist.php, &amp;quot;On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions.&amp;quot; To do this you could use &#039;&#039;chmod -R 707 moodledata&#039;&#039;. See also the [[Security | security page]].&lt;br /&gt;
&lt;br /&gt;
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the &#039;&#039;&#039;config.php&#039;&#039;&#039; file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:&lt;br /&gt;
&lt;br /&gt;
 $CFG-&amp;gt;dataroot  = &#039;/data/moodledata&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 &amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;CPanel and webhosts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
On cPanel systems you can use the &amp;quot;File Manager&amp;quot; to find the folder, click on it, then choose &amp;quot;Change Permissions&amp;quot;. On many shared hosting servers, you will probably need to restrict all file access to your &amp;quot;group&amp;quot; (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as &amp;quot;&#039;&#039;&#039;Safe Mode&#039;&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Run the installer script to create config.php ==&lt;br /&gt;
&lt;br /&gt;
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourserver/install.php&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039; directly.&lt;br /&gt;
&lt;br /&gt;
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)&lt;br /&gt;
&lt;br /&gt;
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called &#039;&#039;&#039;config.php&#039;&#039;&#039;. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload &#039;&#039;&#039;config.php&#039;&#039;&#039; into the main Moodle directory on the server.&lt;br /&gt;
&lt;br /&gt;
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Go to the admin page to continue configuration ==&lt;br /&gt;
&lt;br /&gt;
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the &amp;quot;admin&amp;quot; page for the rest of the configuration.&lt;br /&gt;
&lt;br /&gt;
The first time you access this admin page, you will be presented with a GPL &amp;quot;shrink wrap&amp;quot; agreement with which you must agree before you can continue with the setup.&lt;br /&gt;
&lt;br /&gt;
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:&lt;br /&gt;
&lt;br /&gt;
 CREATE TABLE course (&lt;br /&gt;
    id int(10) unsigned NOT NULL auto_increment,&lt;br /&gt;
    category int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    password varchar(50) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    fullname varchar(254) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    shortname varchar(15) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    summary text NOT NULL,&lt;br /&gt;
    format tinyint(4) NOT NULL default &#039;1&#039;,&lt;br /&gt;
    teacher varchar(100) NOT NULL default &#039;Teacher&#039;,&lt;br /&gt;
    startdate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    enddate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    timemodified int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
 ) TYPE=MyISAM;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SUCCESS&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...and so on, followed by: &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;Main databases set up successfully.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn&#039;t in a restricted &amp;quot;Safe Mode&amp;quot; (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing &#039;&#039;&#039;&amp;lt;?php phpinfo() ?&amp;gt;&#039;&#039;&#039; and looking at it through a browser. Check all these and try this page again.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don&#039;t worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the &amp;quot;buggy referrer&amp;quot; problem. This is easy to fix: just turn off the &amp;quot;secureforms&amp;quot; setting, then try to continue again.&lt;br /&gt;
&lt;br /&gt;
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;green&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click &amp;quot;Save changes&amp;quot;. Not all the fields are required, but if you miss any important fields you&#039;ll be re-prompted for them.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;, with password &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:&lt;br /&gt;
&lt;br /&gt;
* creating and deleting courses&lt;br /&gt;
* creating and editing user accounts&lt;br /&gt;
* administering teacher accounts&lt;br /&gt;
* changing site-wide settings like themes etc&lt;br /&gt;
&lt;br /&gt;
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Set up cron ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Cron|Cron instructions]].&lt;br /&gt;
&lt;br /&gt;
== Set up backups ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Backup settings| backup instructions]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Create a new course ==&lt;br /&gt;
&lt;br /&gt;
Now that Moodle is running properly, you can try creating a new course to play with.&lt;br /&gt;
&lt;br /&gt;
Select &amp;quot;Create a new course&amp;quot; from the Admin page (or the admin links on the home page).&lt;br /&gt;
&lt;br /&gt;
Fill out the form, paying special attention to the course format. You don&#039;t have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.&lt;br /&gt;
&lt;br /&gt;
Press &amp;quot;Save changes&amp;quot;, and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the &amp;quot;Add a new user&amp;quot; on the Admin page.&lt;br /&gt;
&lt;br /&gt;
Once done, the course is ready to customize, and is accessible via the &amp;quot;Courses&amp;quot; link on the home page.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation FAQ]]&lt;br /&gt;
*[[Complete install packages]] might be an easier first time installs on some systems&lt;br /&gt;
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop&lt;br /&gt;
* [[Upgrading Moodle]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion&lt;br /&gt;
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[cs:Instalace]]&lt;br /&gt;
[[de:Installieren von Moodle]]&lt;br /&gt;
[[es:Instalación de moodle]]&lt;br /&gt;
[[fr:Installation de Moodle]]&lt;br /&gt;
[[ja:Moodleのインストール]]&lt;br /&gt;
[[nl:Installatiegids]]&lt;br /&gt;
[[pl:Instalacja Moodle]]&lt;br /&gt;
[[pt:Instalação do Moodle]]&lt;br /&gt;
[[ru:Установка Moodle]]&lt;br /&gt;
[[sk:Inštalácia]]&lt;br /&gt;
[[zh:安装Moodlezh:]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31698</id>
		<title>Installing Moodle</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31698"/>
		<updated>2008-01-29T01:55:03Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: /* Using a hosted server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Firstly don&#039;t panic! :-)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don&#039;t panic, once you know how to do it you can install Moodle in minutes!&lt;br /&gt;
&lt;br /&gt;
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via  [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].&lt;br /&gt;
&lt;br /&gt;
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you]  through the process of choosing a host and setting up moodle via cpanel. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning:&#039;&#039;&#039; some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don&#039;t work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.&lt;br /&gt;
&lt;br /&gt;
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle&#039;s complete packages]]. They provide alternative instructions to install all this on most popular platforms.&lt;br /&gt;
==Table of Contents==&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Most web hosts support all of these requirements by default. You should contact your web host&#039;s support desk to check that this is the case &#039;&#039;&#039;before&#039;&#039;&#039; signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.&lt;br /&gt;
&lt;br /&gt;
The requirements for Moodle are as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hardware&#039;&#039;&#039; (unless you are using a hosted server). &lt;br /&gt;
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.&lt;br /&gt;
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 &#039;&#039;concurrent&#039;&#039; users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. &lt;br /&gt;
&#039;&#039;&#039;Software&#039;&#039;&#039;&lt;br /&gt;
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. &lt;br /&gt;
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.&lt;br /&gt;
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.&lt;br /&gt;
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. &lt;br /&gt;
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).&lt;br /&gt;
** PHP Settings&lt;br /&gt;
*** &#039;&#039;safe_mode&#039;&#039; needs to be OFF (check in your php.ini or Apache configuration file).&lt;br /&gt;
*** &#039;&#039;memory_limit&#039;&#039; should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.&lt;br /&gt;
*** &#039;&#039;session.save_handler&#039;&#039; needs to be set to files. &lt;br /&gt;
** PHP Extensions and libraries&lt;br /&gt;
*** The mbstring extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** The iconv extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.&lt;br /&gt;
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.&lt;br /&gt;
*** The pgsql extension is required if you are using the PostgreSQL database.&lt;br /&gt;
*** The zlib extension is required for zip/unzip functionality.&lt;br /&gt;
*** The curl extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The tokenizer extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is &#039;&#039;the&#039;&#039; choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. &lt;br /&gt;
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). &lt;br /&gt;
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).&lt;br /&gt;
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting &amp;quot;strict mode&amp;quot; must be OFF (set to &amp;quot;&amp;quot; or &amp;quot;MYSQL40&amp;quot;) in the MySQL configuration file. &lt;br /&gt;
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== How many users? ==&lt;br /&gt;
&lt;br /&gt;
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Browsing users&#039;&#039;&#039;: the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).&lt;br /&gt;
* &#039;&#039;&#039;Concurrent database users&#039;&#039;&#039;: the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.&lt;br /&gt;
&lt;br /&gt;
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. &lt;br /&gt;
&lt;br /&gt;
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.&lt;br /&gt;
&lt;br /&gt;
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Download and copy files into place ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Moodle, either as a compressed package or via CVS. &lt;br /&gt;
* There are two types of compressed packages on the  [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment.  &lt;br /&gt;
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. &lt;br /&gt;
&lt;br /&gt;
After downloading, unpack the archive using either &lt;br /&gt;
 tar -zxvf [filename]&lt;br /&gt;
or&lt;br /&gt;
 unzip [filename]&lt;br /&gt;
as appropriate. &lt;br /&gt;
&lt;br /&gt;
If using CVS, run the CVS Checkout command.&lt;br /&gt;
&lt;br /&gt;
You will now be left with a directory called &amp;quot;moodle&amp;quot;, containing a number of files and folders.&lt;br /&gt;
&lt;br /&gt;
You can either place the whole folder in your web server documents directory, in which case the site will be located at &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com/moodle&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;, or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the &amp;quot;File Manager&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Structure of moodle directory ===&lt;br /&gt;
&lt;br /&gt;
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;config.php&#039;&#039; - contains basic settings. This file does not come with Moodle - you will create it.&lt;br /&gt;
:&#039;&#039;install.php&#039;&#039; - the script you will run to create config.php&lt;br /&gt;
:&#039;&#039;version.php&#039;&#039; - defines the current version of Moodle code&lt;br /&gt;
:&#039;&#039;index.php&#039;&#039; - the front page of the site&lt;br /&gt;
:&#039;&#039;admin/&#039;&#039; - code to administrate the whole server&lt;br /&gt;
:&#039;&#039;auth/&#039;&#039; - plugin modules to authenticate users&lt;br /&gt;
:&#039;&#039;blocks/&#039;&#039; - plugin modules for the little side blocks on many pages&lt;br /&gt;
:&#039;&#039;calendar/&#039;&#039; - all the code for managing and displaying calendars&lt;br /&gt;
:&#039;&#039;course/&#039;&#039; - code to display and manage courses&lt;br /&gt;
:&#039;&#039;doc/&#039;&#039; - help documentation for Moodle (eg this page)&lt;br /&gt;
:&#039;&#039;files/&#039;&#039; - code to display and manage uploaded files&lt;br /&gt;
:&#039;&#039;lang/&#039;&#039; - texts in different languages, one directory per language&lt;br /&gt;
:&#039;&#039;lib/&#039;&#039; - libraries of core Moodle code&lt;br /&gt;
:&#039;&#039;login/&#039;&#039; - code to handle login and account creation&lt;br /&gt;
:&#039;&#039;mod/&#039;&#039; - all the main Moodle course modules are in here&lt;br /&gt;
:&#039;&#039;pix/&#039;&#039; - generic site graphics&lt;br /&gt;
:&#039;&#039;theme/&#039;&#039; - theme packs/skins to change the look of the site.&lt;br /&gt;
:&#039;&#039;user/&#039;&#039; - code to display and manage users&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Setting-up your system==&lt;br /&gt;
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.&lt;br /&gt;
&lt;br /&gt;
=== Check web server settings ===&lt;br /&gt;
&lt;br /&gt;
*Firstly, make sure that your web server is set up to use index.php as a default page (perhaps in addition to index.html, default.htm and so on). In Apache, this is done using a DirectoryIndex parameter in your httpd.conf file. Mine usually looks like this:&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; index.php index.html index.htm&lt;br /&gt;
&lt;br /&gt;
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).&lt;br /&gt;
&lt;br /&gt;
*Secondly, &#039;&#039;&#039;if you are using Apache 2&#039;&#039;&#039;, then you should turn on the &#039;&#039;AcceptPathInfo&#039;&#039; variable, which allows scripts to be passed arguments like &amp;lt;nowiki&amp;gt;http://server/file.php/arg1/arg2&amp;lt;/nowiki&amp;gt;. This is essential to allow relative links between your resources, and also provides a performance boost for people using your Moodle web site. You can turn this on by adding these lines to your httpd.conf file.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;AcceptPathInfo&#039;&#039;&#039; on&lt;br /&gt;
&lt;br /&gt;
=== Check PHP settings ===&lt;br /&gt;
Moodle requires a number of PHP settings to be active for it to work. &#039;&#039;&#039;On most servers these will already be the default settings&#039;&#039;&#039;.  However, some PHP servers (and some of the more recent PHP versions) may have things set differently. These are defined in PHP&#039;s configuration file (usually called &#039;&#039;&#039;php.ini&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 magic_quotes_gpc = 1    (preferred but not necessary)&lt;br /&gt;
 magic_quotes_runtime = 0    (necessary)&lt;br /&gt;
 file_uploads = 1&lt;br /&gt;
 session.auto_start = 0&lt;br /&gt;
 session.bug_compat_warn = 0&lt;br /&gt;
&lt;br /&gt;
:You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:&lt;br /&gt;
 &lt;br /&gt;
 post_max_size = 16M&lt;br /&gt;
 upload_max_filesize = 16M&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Using a .htaccess file for webserver and PHP settings ===&lt;br /&gt;
&lt;br /&gt;
Use the above if you can directly edit your server&#039;s files, but if you are setting-up Moodle on a webhost, or don&#039;t have access to &#039;&#039;&#039;httpd.conf&#039;&#039;&#039; or &#039;&#039;&#039;php.ini&#039;&#039;&#039; on your server, or you have Moodle on a server with other applications that require different settings, then don&#039;t worry, you can often still override the default settings. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration.&lt;br /&gt;
&lt;br /&gt;
* Create a file called &#039;&#039;&#039;.htaccess&#039;&#039;&#039; in Moodle&#039;s main directory that contains lines like the following. &lt;br /&gt;
&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
 php_flag magic_quotes_gpc 1&lt;br /&gt;
 php_flag magic_quotes_runtime 0&lt;br /&gt;
 php_flag file_uploads 1&lt;br /&gt;
 php_flag session.auto_start 0&lt;br /&gt;
 php_flag session.bug_compat_warn 0&lt;br /&gt;
&lt;br /&gt;
:If you have Apache version 2 installed, add these lines:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;IfDefine APACHE2&amp;gt;&lt;br /&gt;
     AcceptPathInfo on&lt;br /&gt;
 &amp;lt;/IfDefine&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Otherwise add this single line:&lt;br /&gt;
&lt;br /&gt;
 AcceptPathInfo on&lt;br /&gt;
&lt;br /&gt;
* Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:&lt;br /&gt;
&lt;br /&gt;
 LimitRequestBody 0&lt;br /&gt;
 php_value upload_max_filesize 2M&lt;br /&gt;
 php_value post_max_size 2M&lt;br /&gt;
     &lt;br /&gt;
* The easiest thing to do is just copy the sample file from lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:&lt;br /&gt;
&lt;br /&gt;
 cp lib/htaccess .htaccess&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Creating an empty database ===&lt;br /&gt;
&lt;br /&gt;
You need to create an empty database (eg &amp;quot;&#039;&#039;moodle&#039;&#039;&amp;quot;) in your database system along with a special user (eg &amp;quot;moodleuser&amp;quot;) that has access to that database (and that database only). You could use the &amp;quot;root&amp;quot; user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Warning&#039;&#039;&#039;: Bear in mind that, as of Moodle version 1.5.x, Moodle doesn&#039;t work with MySQL 5.x&#039;s strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL&#039;s configuration file (called &amp;quot;my.ini&amp;quot; in Windows and &amp;quot;my.cnf&amp;quot; on Unix/Linux) and comment out that option or set it to &amp;lt;code&amp;gt;sql-mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You have to restart MySQL after changing this setting. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt; If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command &amp;lt;code&amp;gt;SET @@global.sql_mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;;&amp;lt;/code&amp;gt; (be sure to use single quotes, and don&#039;t forget the semicolon).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 &amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
====Using a hosted server====&lt;br /&gt;
If you are using a webhost, they will probably have a control panel web interface for you to create your database.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;[http://www.cpanel.com/ cPanel]&#039;&#039;&#039; system is one of the most popular of these. &lt;br /&gt;
To create a database using cPanel:&lt;br /&gt;
&lt;br /&gt;
# Click on the &#039;&#039;&#039;MySQL Databases&#039;&#039;&#039; icon.&lt;br /&gt;
# Type &#039;&#039;&#039;moodle&#039;&#039;&#039; in the New Database field and click &#039;&#039;&#039;Create Database&#039;&#039;&#039;.&lt;br /&gt;
# Type a &#039;&#039;username&#039;&#039; and &#039;&#039;password&#039;&#039; (not one you use elsewhere) in the respective fields and click &#039;&#039;&#039;Create  User&#039;&#039;&#039;.&amp;lt;br&amp;gt;Note that the &#039;&#039;username&#039;&#039; and &#039;&#039;database&#039;&#039; names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.&lt;br /&gt;
# Now use the &#039;&#039;&#039;Add Users to Databases&#039;&#039;&#039; button and give this new user account &#039;&#039;&#039;ALL&#039;&#039;&#039; rights to the new database.&lt;br /&gt;
&lt;br /&gt;
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using the command line====&lt;br /&gt;
&lt;br /&gt;
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):&lt;br /&gt;
&lt;br /&gt;
- Start the MySQL Client program:&lt;br /&gt;
 #&#039;&#039;&#039;mysql -u root -p&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 Welcome to the MySQL monitor.  Commands end with ; or \g.&lt;br /&gt;
 Your MySQL connection id is 2 to server version: 5.0.22-log&lt;br /&gt;
 &lt;br /&gt;
 Type &#039;help;&#039; or &#039;\h&#039; for help. Type &#039;\c&#039; to clear the buffer.&lt;br /&gt;
 &lt;br /&gt;
 mysql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- The prompt changes to &amp;quot;mysql&amp;gt;&amp;quot; to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you&#039;ll get the line continuation symbol &#039;-&amp;gt;&#039;; this is your second chance to type the semi-colon and hit Enter.) &lt;br /&gt;
&lt;br /&gt;
- Begin by checking for any existing databases called &amp;quot;moodle&amp;quot; - if there are any you should change the name in all the commands which follow:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;SHOW DATABASES;&#039;&#039;&#039;&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | Database                |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | information_schema      |&lt;br /&gt;
 | mysql                   |&lt;br /&gt;
 | test                    |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 3 rows in set (0.03 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a database to store the Moodle tables. We&#039;ll call this &amp;quot;moodle&amp;quot;, as there are none with that name already in the above list, but change it if you need to.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;CREATE DATABASE moodle;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Change the default character set and collation of the &amp;quot;moodle&amp;quot; database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a username and password to access the database &amp;quot;moodle&amp;quot; and grant database access permissions. We&#039;ll call the user &amp;quot;moodleuser&amp;quot; and set the password as &amp;quot;yourpassword&amp;quot;. It&#039;s a good idea to change these for your installation however most people keep the username as &amp;quot;moodleuser&amp;quot;. Remember the username and password you have set, as you&#039;ll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;DROP,INDEX,ALTER ON moodle.*&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;TO moodleuser@localhost IDENTIFIED BY &#039;yourpassword&#039;;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 0 rows affected (0.01 sec)&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Security Warnings&#039;&#039;&#039;: Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting &amp;quot;ALL&amp;quot; permissions on the database.&lt;br /&gt;
: &#039;&#039;&#039;Note&#039;&#039;&#039;: For MySQL 4.0.1 or earlier, you don&#039;t need the CREATE TEMPORARY TABLES permission. &lt;br /&gt;
&lt;br /&gt;
- Exit the MySQL Client program:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;QUIT&#039;&#039;&#039;&lt;br /&gt;
 Bye&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
- Reload the grant tables using the mysqladmin program:&lt;br /&gt;
 #&#039;&#039;&#039;mysqladmin -u root -p reload&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
And some example command lines for PostgreSQL:&lt;br /&gt;
&lt;br /&gt;
   # su - postgres&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create user moodleuser createdb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create database moodle &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;with encoding &#039;unicode&#039;&amp;lt;/font&amp;gt;;&amp;quot; -U moodleuser template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser nocreatedb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser with encrypted password &#039;yourpassword&#039;;&amp;quot; template1&lt;br /&gt;
   &amp;gt; su - root&lt;br /&gt;
   # /etc/init.d/postgresql reload&lt;br /&gt;
&lt;br /&gt;
If the Postgres create database command above (&amp;gt;psql -c &amp;quot;create database moodle...&amp;quot;) gives an error message you may want to try:&lt;br /&gt;
 psql -c &amp;quot;create database moodle with template=template1 encoding = &#039;unicode&#039; owner =  moodleuser &amp;lt;br&amp;gt;     location = &#039;/var/mydata&#039;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If the create database command asks you for a password, run the line containing &#039;encrypted password&#039; first before proceeding.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;:&lt;br /&gt;
* Step-by-step instructions on  [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&amp;lt;div id=CreatDataDir &amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Creating the data directory  ===&lt;br /&gt;
&lt;br /&gt;
Moodle will also need some space on your server&#039;s hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create the &#039;&#039;&#039;moodledata&#039;&#039;&#039; directory for you but if it fails then you will have to create a directory for this purpose manually.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security warning&#039;&#039;&#039;: For security purposes, it&#039;s best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called &#039;&#039;&#039;.htaccess&#039;&#039;&#039;, containing these lines:&lt;br /&gt;
&lt;br /&gt;
 order deny,allow&lt;br /&gt;
 deny from all&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ownership &amp;amp; Permissions&#039;&#039;&#039;: To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like &amp;quot;nobody&amp;quot; or &amp;quot;apache&amp;quot;, and then giving that user read, write and execute permissions. As an example, to change the owner to &amp;quot;nobody&amp;quot; you could use:&lt;br /&gt;
&lt;br /&gt;
 chown -R nobody:apache moodledata&lt;br /&gt;
&lt;br /&gt;
To change the permissions so that the owner has read,write and execute permissions, use something like this:&lt;br /&gt;
&lt;br /&gt;
 chmod -R 0770 moodledata&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you are receiving permission denied messages, try &#039;&#039;chmod -R 0770 moodledata&#039;&#039; and then adjust the settings so that they are more secure. A more secure setting is &#039;&#039;chmod -R 0750 moodledata&#039;&#039;. According to the comments in config-dist.php, &amp;quot;On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions.&amp;quot; To do this you could use &#039;&#039;chmod -R 707 moodledata&#039;&#039;. See also the [[Security | security page]].&lt;br /&gt;
&lt;br /&gt;
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the &#039;&#039;&#039;config.php&#039;&#039;&#039; file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:&lt;br /&gt;
&lt;br /&gt;
 $CFG-&amp;gt;dataroot  = &#039;/data/moodledata&#039;;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;CPanel and webhosts&#039;&#039;&#039;: On cPanel systems you can use the &amp;quot;File Manager&amp;quot; to find the folder, click on it, then choose &amp;quot;Change Permissions&amp;quot;. On many shared hosting servers, you will probably need to restrict all file access to your &amp;quot;group&amp;quot; (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as &amp;quot;&#039;&#039;&#039;Safe Mode&#039;&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Run the installer script to create config.php ==&lt;br /&gt;
&lt;br /&gt;
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourserver/install.php&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039; directly.&lt;br /&gt;
&lt;br /&gt;
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)&lt;br /&gt;
&lt;br /&gt;
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called &#039;&#039;&#039;config.php&#039;&#039;&#039;. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload &#039;&#039;&#039;config.php&#039;&#039;&#039; into the main Moodle directory on the server.&lt;br /&gt;
&lt;br /&gt;
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Go to the admin page to continue configuration ==&lt;br /&gt;
&lt;br /&gt;
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the &amp;quot;admin&amp;quot; page for the rest of the configuration.&lt;br /&gt;
&lt;br /&gt;
The first time you access this admin page, you will be presented with a GPL &amp;quot;shrink wrap&amp;quot; agreement with which you must agree before you can continue with the setup.&lt;br /&gt;
&lt;br /&gt;
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:&lt;br /&gt;
&lt;br /&gt;
 CREATE TABLE course (&lt;br /&gt;
    id int(10) unsigned NOT NULL auto_increment,&lt;br /&gt;
    category int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    password varchar(50) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    fullname varchar(254) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    shortname varchar(15) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    summary text NOT NULL,&lt;br /&gt;
    format tinyint(4) NOT NULL default &#039;1&#039;,&lt;br /&gt;
    teacher varchar(100) NOT NULL default &#039;Teacher&#039;,&lt;br /&gt;
    startdate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    enddate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    timemodified int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
 ) TYPE=MyISAM;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SUCCESS&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...and so on, followed by: &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;Main databases set up successfully.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn&#039;t in a restricted &amp;quot;Safe Mode&amp;quot; (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing &#039;&#039;&#039;&amp;lt;?php phpinfo() ?&amp;gt;&#039;&#039;&#039; and looking at it through a browser. Check all these and try this page again.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don&#039;t worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the &amp;quot;buggy referrer&amp;quot; problem. This is easy to fix: just turn off the &amp;quot;secureforms&amp;quot; setting, then try to continue again.&lt;br /&gt;
&lt;br /&gt;
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;green&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click &amp;quot;Save changes&amp;quot;. Not all the fields are required, but if you miss any important fields you&#039;ll be re-prompted for them.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;, with password &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:&lt;br /&gt;
&lt;br /&gt;
* creating and deleting courses&lt;br /&gt;
* creating and editing user accounts&lt;br /&gt;
* administering teacher accounts&lt;br /&gt;
* changing site-wide settings like themes etc&lt;br /&gt;
&lt;br /&gt;
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Set up cron ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Cron|Cron instructions]].&lt;br /&gt;
&lt;br /&gt;
== Set up backups ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Backup settings| backup instructions]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Create a new course ==&lt;br /&gt;
&lt;br /&gt;
Now that Moodle is running properly, you can try creating a new course to play with.&lt;br /&gt;
&lt;br /&gt;
Select &amp;quot;Create a new course&amp;quot; from the Admin page (or the admin links on the home page).&lt;br /&gt;
&lt;br /&gt;
Fill out the form, paying special attention to the course format. You don&#039;t have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.&lt;br /&gt;
&lt;br /&gt;
Press &amp;quot;Save changes&amp;quot;, and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the &amp;quot;Add a new user&amp;quot; on the Admin page.&lt;br /&gt;
&lt;br /&gt;
Once done, the course is ready to customize, and is accessible via the &amp;quot;Courses&amp;quot; link on the home page.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation FAQ]]&lt;br /&gt;
*[[Complete install packages]] might be an easier first time installs on some systems&lt;br /&gt;
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop&lt;br /&gt;
* [[Upgrading Moodle]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion&lt;br /&gt;
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[cs:Instalace]]&lt;br /&gt;
[[de:Installieren von Moodle]]&lt;br /&gt;
[[es:Instalación de moodle]]&lt;br /&gt;
[[fr:Installation de Moodle]]&lt;br /&gt;
[[ja:Moodleのインストール]]&lt;br /&gt;
[[nl:Installatiegids]]&lt;br /&gt;
[[pl:Instalacja Moodle]]&lt;br /&gt;
[[pt:Instalação do Moodle]]&lt;br /&gt;
[[ru:Установка Moodle]]&lt;br /&gt;
[[sk:Inštalácia]]&lt;br /&gt;
[[zh:安装Moodlezh:]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31696</id>
		<title>Installing Moodle</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31696"/>
		<updated>2008-01-29T01:48:43Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: /* Using a hosted server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Firstly don&#039;t panic! :-)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don&#039;t panic, once you know how to do it you can install Moodle in minutes!&lt;br /&gt;
&lt;br /&gt;
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via  [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].&lt;br /&gt;
&lt;br /&gt;
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you]  through the process of choosing a host and setting up moodle via cpanel. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning:&#039;&#039;&#039; some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don&#039;t work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.&lt;br /&gt;
&lt;br /&gt;
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle&#039;s complete packages]]. They provide alternative instructions to install all this on most popular platforms.&lt;br /&gt;
==Table of Contents==&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Most web hosts support all of these requirements by default. You should contact your web host&#039;s support desk to check that this is the case &#039;&#039;&#039;before&#039;&#039;&#039; signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.&lt;br /&gt;
&lt;br /&gt;
The requirements for Moodle are as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hardware&#039;&#039;&#039; (unless you are using a hosted server). &lt;br /&gt;
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.&lt;br /&gt;
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 &#039;&#039;concurrent&#039;&#039; users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. &lt;br /&gt;
&#039;&#039;&#039;Software&#039;&#039;&#039;&lt;br /&gt;
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. &lt;br /&gt;
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.&lt;br /&gt;
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.&lt;br /&gt;
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. &lt;br /&gt;
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).&lt;br /&gt;
** PHP Settings&lt;br /&gt;
*** &#039;&#039;safe_mode&#039;&#039; needs to be OFF (check in your php.ini or Apache configuration file).&lt;br /&gt;
*** &#039;&#039;memory_limit&#039;&#039; should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.&lt;br /&gt;
*** &#039;&#039;session.save_handler&#039;&#039; needs to be set to files. &lt;br /&gt;
** PHP Extensions and libraries&lt;br /&gt;
*** The mbstring extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** The iconv extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.&lt;br /&gt;
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.&lt;br /&gt;
*** The pgsql extension is required if you are using the PostgreSQL database.&lt;br /&gt;
*** The zlib extension is required for zip/unzip functionality.&lt;br /&gt;
*** The curl extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The tokenizer extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is &#039;&#039;the&#039;&#039; choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. &lt;br /&gt;
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). &lt;br /&gt;
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).&lt;br /&gt;
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting &amp;quot;strict mode&amp;quot; must be OFF (set to &amp;quot;&amp;quot; or &amp;quot;MYSQL40&amp;quot;) in the MySQL configuration file. &lt;br /&gt;
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== How many users? ==&lt;br /&gt;
&lt;br /&gt;
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Browsing users&#039;&#039;&#039;: the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).&lt;br /&gt;
* &#039;&#039;&#039;Concurrent database users&#039;&#039;&#039;: the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.&lt;br /&gt;
&lt;br /&gt;
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. &lt;br /&gt;
&lt;br /&gt;
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.&lt;br /&gt;
&lt;br /&gt;
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Download and copy files into place ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Moodle, either as a compressed package or via CVS. &lt;br /&gt;
* There are two types of compressed packages on the  [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment.  &lt;br /&gt;
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. &lt;br /&gt;
&lt;br /&gt;
After downloading, unpack the archive using either &lt;br /&gt;
 tar -zxvf [filename]&lt;br /&gt;
or&lt;br /&gt;
 unzip [filename]&lt;br /&gt;
as appropriate. &lt;br /&gt;
&lt;br /&gt;
If using CVS, run the CVS Checkout command.&lt;br /&gt;
&lt;br /&gt;
You will now be left with a directory called &amp;quot;moodle&amp;quot;, containing a number of files and folders.&lt;br /&gt;
&lt;br /&gt;
You can either place the whole folder in your web server documents directory, in which case the site will be located at &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com/moodle&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;, or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the &amp;quot;File Manager&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Structure of moodle directory ===&lt;br /&gt;
&lt;br /&gt;
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;config.php&#039;&#039; - contains basic settings. This file does not come with Moodle - you will create it.&lt;br /&gt;
:&#039;&#039;install.php&#039;&#039; - the script you will run to create config.php&lt;br /&gt;
:&#039;&#039;version.php&#039;&#039; - defines the current version of Moodle code&lt;br /&gt;
:&#039;&#039;index.php&#039;&#039; - the front page of the site&lt;br /&gt;
:&#039;&#039;admin/&#039;&#039; - code to administrate the whole server&lt;br /&gt;
:&#039;&#039;auth/&#039;&#039; - plugin modules to authenticate users&lt;br /&gt;
:&#039;&#039;blocks/&#039;&#039; - plugin modules for the little side blocks on many pages&lt;br /&gt;
:&#039;&#039;calendar/&#039;&#039; - all the code for managing and displaying calendars&lt;br /&gt;
:&#039;&#039;course/&#039;&#039; - code to display and manage courses&lt;br /&gt;
:&#039;&#039;doc/&#039;&#039; - help documentation for Moodle (eg this page)&lt;br /&gt;
:&#039;&#039;files/&#039;&#039; - code to display and manage uploaded files&lt;br /&gt;
:&#039;&#039;lang/&#039;&#039; - texts in different languages, one directory per language&lt;br /&gt;
:&#039;&#039;lib/&#039;&#039; - libraries of core Moodle code&lt;br /&gt;
:&#039;&#039;login/&#039;&#039; - code to handle login and account creation&lt;br /&gt;
:&#039;&#039;mod/&#039;&#039; - all the main Moodle course modules are in here&lt;br /&gt;
:&#039;&#039;pix/&#039;&#039; - generic site graphics&lt;br /&gt;
:&#039;&#039;theme/&#039;&#039; - theme packs/skins to change the look of the site.&lt;br /&gt;
:&#039;&#039;user/&#039;&#039; - code to display and manage users&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Setting-up your system==&lt;br /&gt;
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.&lt;br /&gt;
&lt;br /&gt;
=== Check web server settings ===&lt;br /&gt;
&lt;br /&gt;
*Firstly, make sure that your web server is set up to use index.php as a default page (perhaps in addition to index.html, default.htm and so on). In Apache, this is done using a DirectoryIndex parameter in your httpd.conf file. Mine usually looks like this:&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; index.php index.html index.htm&lt;br /&gt;
&lt;br /&gt;
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).&lt;br /&gt;
&lt;br /&gt;
*Secondly, &#039;&#039;&#039;if you are using Apache 2&#039;&#039;&#039;, then you should turn on the &#039;&#039;AcceptPathInfo&#039;&#039; variable, which allows scripts to be passed arguments like &amp;lt;nowiki&amp;gt;http://server/file.php/arg1/arg2&amp;lt;/nowiki&amp;gt;. This is essential to allow relative links between your resources, and also provides a performance boost for people using your Moodle web site. You can turn this on by adding these lines to your httpd.conf file.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;AcceptPathInfo&#039;&#039;&#039; on&lt;br /&gt;
&lt;br /&gt;
=== Check PHP settings ===&lt;br /&gt;
Moodle requires a number of PHP settings to be active for it to work. &#039;&#039;&#039;On most servers these will already be the default settings&#039;&#039;&#039;.  However, some PHP servers (and some of the more recent PHP versions) may have things set differently. These are defined in PHP&#039;s configuration file (usually called &#039;&#039;&#039;php.ini&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 magic_quotes_gpc = 1    (preferred but not necessary)&lt;br /&gt;
 magic_quotes_runtime = 0    (necessary)&lt;br /&gt;
 file_uploads = 1&lt;br /&gt;
 session.auto_start = 0&lt;br /&gt;
 session.bug_compat_warn = 0&lt;br /&gt;
&lt;br /&gt;
:You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:&lt;br /&gt;
 &lt;br /&gt;
 post_max_size = 16M&lt;br /&gt;
 upload_max_filesize = 16M&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Using a .htaccess file for webserver and PHP settings ===&lt;br /&gt;
&lt;br /&gt;
Use the above if you can directly edit your server&#039;s files, but if you are setting-up Moodle on a webhost, or don&#039;t have access to &#039;&#039;&#039;httpd.conf&#039;&#039;&#039; or &#039;&#039;&#039;php.ini&#039;&#039;&#039; on your server, or you have Moodle on a server with other applications that require different settings, then don&#039;t worry, you can often still override the default settings. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration.&lt;br /&gt;
&lt;br /&gt;
* Create a file called &#039;&#039;&#039;.htaccess&#039;&#039;&#039; in Moodle&#039;s main directory that contains lines like the following. &lt;br /&gt;
&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
 php_flag magic_quotes_gpc 1&lt;br /&gt;
 php_flag magic_quotes_runtime 0&lt;br /&gt;
 php_flag file_uploads 1&lt;br /&gt;
 php_flag session.auto_start 0&lt;br /&gt;
 php_flag session.bug_compat_warn 0&lt;br /&gt;
&lt;br /&gt;
:If you have Apache version 2 installed, add these lines:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;IfDefine APACHE2&amp;gt;&lt;br /&gt;
     AcceptPathInfo on&lt;br /&gt;
 &amp;lt;/IfDefine&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Otherwise add this single line:&lt;br /&gt;
&lt;br /&gt;
 AcceptPathInfo on&lt;br /&gt;
&lt;br /&gt;
* Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:&lt;br /&gt;
&lt;br /&gt;
 LimitRequestBody 0&lt;br /&gt;
 php_value upload_max_filesize 2M&lt;br /&gt;
 php_value post_max_size 2M&lt;br /&gt;
     &lt;br /&gt;
* The easiest thing to do is just copy the sample file from lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:&lt;br /&gt;
&lt;br /&gt;
 cp lib/htaccess .htaccess&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Creating an empty database ===&lt;br /&gt;
&lt;br /&gt;
You need to create an empty database (eg &amp;quot;&#039;&#039;moodle&#039;&#039;&amp;quot;) in your database system along with a special user (eg &amp;quot;moodleuser&amp;quot;) that has access to that database (and that database only). You could use the &amp;quot;root&amp;quot; user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Warning&#039;&#039;&#039;: Bear in mind that, as of Moodle version 1.5.x, Moodle doesn&#039;t work with MySQL 5.x&#039;s strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL&#039;s configuration file (called &amp;quot;my.ini&amp;quot; in Windows and &amp;quot;my.cnf&amp;quot; on Unix/Linux) and comment out that option or set it to &amp;lt;code&amp;gt;sql-mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You have to restart MySQL after changing this setting. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt; If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command &amp;lt;code&amp;gt;SET @@global.sql_mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;;&amp;lt;/code&amp;gt; (be sure to use single quotes, and don&#039;t forget the semicolon).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 &amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
====Using a hosted server====&lt;br /&gt;
If you are using a webhost, they will probably have a control panel web interface for you to create your database.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;[http://www.cpanel.com/ cPanel]&#039;&#039;&#039; system is one of the most popular of these. &lt;br /&gt;
To create a database using cPanel:&lt;br /&gt;
&lt;br /&gt;
# Click on the &#039;&#039;&#039;MySQL Databases&#039;&#039;&#039; icon.&lt;br /&gt;
# Type &#039;&#039;&#039;moodle&#039;&#039;&#039; in the New Database field and click &#039;&#039;&#039;Create Database&#039;&#039;&#039;.&lt;br /&gt;
# Type a username and password (not one you use elsewhere) in the respective fields and click &#039;&#039;&#039;Create  User&#039;&#039;&#039;.&lt;br /&gt;
 Note that the username and database names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.&lt;br /&gt;
# Now use the &#039;&#039;&#039;Add Users to Databases&#039;&#039;&#039; button and give this new user account &#039;&#039;&#039;ALL&#039;&#039;&#039; rights to the new database.&lt;br /&gt;
&lt;br /&gt;
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using the command line====&lt;br /&gt;
&lt;br /&gt;
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):&lt;br /&gt;
&lt;br /&gt;
- Start the MySQL Client program:&lt;br /&gt;
 #&#039;&#039;&#039;mysql -u root -p&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 Welcome to the MySQL monitor.  Commands end with ; or \g.&lt;br /&gt;
 Your MySQL connection id is 2 to server version: 5.0.22-log&lt;br /&gt;
 &lt;br /&gt;
 Type &#039;help;&#039; or &#039;\h&#039; for help. Type &#039;\c&#039; to clear the buffer.&lt;br /&gt;
 &lt;br /&gt;
 mysql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- The prompt changes to &amp;quot;mysql&amp;gt;&amp;quot; to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you&#039;ll get the line continuation symbol &#039;-&amp;gt;&#039;; this is your second chance to type the semi-colon and hit Enter.) &lt;br /&gt;
&lt;br /&gt;
- Begin by checking for any existing databases called &amp;quot;moodle&amp;quot; - if there are any you should change the name in all the commands which follow:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;SHOW DATABASES;&#039;&#039;&#039;&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | Database                |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | information_schema      |&lt;br /&gt;
 | mysql                   |&lt;br /&gt;
 | test                    |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 3 rows in set (0.03 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a database to store the Moodle tables. We&#039;ll call this &amp;quot;moodle&amp;quot;, as there are none with that name already in the above list, but change it if you need to.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;CREATE DATABASE moodle;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Change the default character set and collation of the &amp;quot;moodle&amp;quot; database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a username and password to access the database &amp;quot;moodle&amp;quot; and grant database access permissions. We&#039;ll call the user &amp;quot;moodleuser&amp;quot; and set the password as &amp;quot;yourpassword&amp;quot;. It&#039;s a good idea to change these for your installation however most people keep the username as &amp;quot;moodleuser&amp;quot;. Remember the username and password you have set, as you&#039;ll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;DROP,INDEX,ALTER ON moodle.*&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;TO moodleuser@localhost IDENTIFIED BY &#039;yourpassword&#039;;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 0 rows affected (0.01 sec)&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Security Warnings&#039;&#039;&#039;: Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting &amp;quot;ALL&amp;quot; permissions on the database.&lt;br /&gt;
: &#039;&#039;&#039;Note&#039;&#039;&#039;: For MySQL 4.0.1 or earlier, you don&#039;t need the CREATE TEMPORARY TABLES permission. &lt;br /&gt;
&lt;br /&gt;
- Exit the MySQL Client program:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;QUIT&#039;&#039;&#039;&lt;br /&gt;
 Bye&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
- Reload the grant tables using the mysqladmin program:&lt;br /&gt;
 #&#039;&#039;&#039;mysqladmin -u root -p reload&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
And some example command lines for PostgreSQL:&lt;br /&gt;
&lt;br /&gt;
   # su - postgres&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create user moodleuser createdb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create database moodle &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;with encoding &#039;unicode&#039;&amp;lt;/font&amp;gt;;&amp;quot; -U moodleuser template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser nocreatedb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser with encrypted password &#039;yourpassword&#039;;&amp;quot; template1&lt;br /&gt;
   &amp;gt; su - root&lt;br /&gt;
   # /etc/init.d/postgresql reload&lt;br /&gt;
&lt;br /&gt;
If the Postgres create database command above (&amp;gt;psql -c &amp;quot;create database moodle...&amp;quot;) gives an error message you may want to try:&lt;br /&gt;
 psql -c &amp;quot;create database moodle with template=template1 encoding = &#039;unicode&#039; owner =  moodleuser &amp;lt;br&amp;gt;     location = &#039;/var/mydata&#039;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If the create database command asks you for a password, run the line containing &#039;encrypted password&#039; first before proceeding.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;:&lt;br /&gt;
* Step-by-step instructions on  [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&amp;lt;div id=CreatDataDir &amp;gt;&lt;br /&gt;
=== Creating the data directory  ===&lt;br /&gt;
&lt;br /&gt;
Moodle will also need some space on your server&#039;s hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create the &#039;&#039;&#039;moodledata&#039;&#039;&#039; directory for you but if it fails then you will have to create a directory for this purpose manually.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security warning&#039;&#039;&#039;: For security purposes, it&#039;s best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called &#039;&#039;&#039;.htaccess&#039;&#039;&#039;, containing these lines:&lt;br /&gt;
&lt;br /&gt;
 order deny,allow&lt;br /&gt;
 deny from all&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ownership &amp;amp; Permissions&#039;&#039;&#039;: To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like &amp;quot;nobody&amp;quot; or &amp;quot;apache&amp;quot;, and then giving that user read, write and execute permissions. As an example, to change the owner to &amp;quot;nobody&amp;quot; you could use:&lt;br /&gt;
&lt;br /&gt;
 chown -R nobody:apache moodledata&lt;br /&gt;
&lt;br /&gt;
To change the permissions so that the owner has read,write and execute permissions, use something like this:&lt;br /&gt;
&lt;br /&gt;
 chmod -R 0770 moodledata&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you are receiving permission denied messages, try &#039;&#039;chmod -R 0770 moodledata&#039;&#039; and then adjust the settings so that they are more secure. A more secure setting is &#039;&#039;chmod -R 0750 moodledata&#039;&#039;. According to the comments in config-dist.php, &amp;quot;On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions.&amp;quot; To do this you could use &#039;&#039;chmod -R 707 moodledata&#039;&#039;. See also the [[Security | security page]].&lt;br /&gt;
&lt;br /&gt;
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the &#039;&#039;&#039;config.php&#039;&#039;&#039; file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:&lt;br /&gt;
&lt;br /&gt;
 $CFG-&amp;gt;dataroot  = &#039;/data/moodledata&#039;;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;CPanel and webhosts&#039;&#039;&#039;: On cPanel systems you can use the &amp;quot;File Manager&amp;quot; to find the folder, click on it, then choose &amp;quot;Change Permissions&amp;quot;. On many shared hosting servers, you will probably need to restrict all file access to your &amp;quot;group&amp;quot; (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as &amp;quot;&#039;&#039;&#039;Safe Mode&#039;&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Run the installer script to create config.php ==&lt;br /&gt;
&lt;br /&gt;
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourserver/install.php&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039; directly.&lt;br /&gt;
&lt;br /&gt;
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)&lt;br /&gt;
&lt;br /&gt;
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called &#039;&#039;&#039;config.php&#039;&#039;&#039;. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload &#039;&#039;&#039;config.php&#039;&#039;&#039; into the main Moodle directory on the server.&lt;br /&gt;
&lt;br /&gt;
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Go to the admin page to continue configuration ==&lt;br /&gt;
&lt;br /&gt;
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the &amp;quot;admin&amp;quot; page for the rest of the configuration.&lt;br /&gt;
&lt;br /&gt;
The first time you access this admin page, you will be presented with a GPL &amp;quot;shrink wrap&amp;quot; agreement with which you must agree before you can continue with the setup.&lt;br /&gt;
&lt;br /&gt;
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:&lt;br /&gt;
&lt;br /&gt;
 CREATE TABLE course (&lt;br /&gt;
    id int(10) unsigned NOT NULL auto_increment,&lt;br /&gt;
    category int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    password varchar(50) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    fullname varchar(254) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    shortname varchar(15) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    summary text NOT NULL,&lt;br /&gt;
    format tinyint(4) NOT NULL default &#039;1&#039;,&lt;br /&gt;
    teacher varchar(100) NOT NULL default &#039;Teacher&#039;,&lt;br /&gt;
    startdate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    enddate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    timemodified int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
 ) TYPE=MyISAM;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SUCCESS&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...and so on, followed by: &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;Main databases set up successfully.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn&#039;t in a restricted &amp;quot;Safe Mode&amp;quot; (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing &#039;&#039;&#039;&amp;lt;?php phpinfo() ?&amp;gt;&#039;&#039;&#039; and looking at it through a browser. Check all these and try this page again.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don&#039;t worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the &amp;quot;buggy referrer&amp;quot; problem. This is easy to fix: just turn off the &amp;quot;secureforms&amp;quot; setting, then try to continue again.&lt;br /&gt;
&lt;br /&gt;
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;green&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click &amp;quot;Save changes&amp;quot;. Not all the fields are required, but if you miss any important fields you&#039;ll be re-prompted for them.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;, with password &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:&lt;br /&gt;
&lt;br /&gt;
* creating and deleting courses&lt;br /&gt;
* creating and editing user accounts&lt;br /&gt;
* administering teacher accounts&lt;br /&gt;
* changing site-wide settings like themes etc&lt;br /&gt;
&lt;br /&gt;
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Set up cron ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Cron|Cron instructions]].&lt;br /&gt;
&lt;br /&gt;
== Set up backups ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Backup settings| backup instructions]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Create a new course ==&lt;br /&gt;
&lt;br /&gt;
Now that Moodle is running properly, you can try creating a new course to play with.&lt;br /&gt;
&lt;br /&gt;
Select &amp;quot;Create a new course&amp;quot; from the Admin page (or the admin links on the home page).&lt;br /&gt;
&lt;br /&gt;
Fill out the form, paying special attention to the course format. You don&#039;t have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.&lt;br /&gt;
&lt;br /&gt;
Press &amp;quot;Save changes&amp;quot;, and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the &amp;quot;Add a new user&amp;quot; on the Admin page.&lt;br /&gt;
&lt;br /&gt;
Once done, the course is ready to customize, and is accessible via the &amp;quot;Courses&amp;quot; link on the home page.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation FAQ]]&lt;br /&gt;
*[[Complete install packages]] might be an easier first time installs on some systems&lt;br /&gt;
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop&lt;br /&gt;
* [[Upgrading Moodle]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion&lt;br /&gt;
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[cs:Instalace]]&lt;br /&gt;
[[de:Installieren von Moodle]]&lt;br /&gt;
[[es:Instalación de moodle]]&lt;br /&gt;
[[fr:Installation de Moodle]]&lt;br /&gt;
[[ja:Moodleのインストール]]&lt;br /&gt;
[[nl:Installatiegids]]&lt;br /&gt;
[[pl:Instalacja Moodle]]&lt;br /&gt;
[[pt:Instalação do Moodle]]&lt;br /&gt;
[[ru:Установка Moodle]]&lt;br /&gt;
[[sk:Inštalácia]]&lt;br /&gt;
[[zh:安装Moodlezh:]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31695</id>
		<title>Installing Moodle</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31695"/>
		<updated>2008-01-29T01:41:17Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Firstly don&#039;t panic! :-)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don&#039;t panic, once you know how to do it you can install Moodle in minutes!&lt;br /&gt;
&lt;br /&gt;
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via  [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].&lt;br /&gt;
&lt;br /&gt;
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you]  through the process of choosing a host and setting up moodle via cpanel. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning:&#039;&#039;&#039; some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don&#039;t work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.&lt;br /&gt;
&lt;br /&gt;
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle&#039;s complete packages]]. They provide alternative instructions to install all this on most popular platforms.&lt;br /&gt;
==Table of Contents==&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Most web hosts support all of these requirements by default. You should contact your web host&#039;s support desk to check that this is the case &#039;&#039;&#039;before&#039;&#039;&#039; signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.&lt;br /&gt;
&lt;br /&gt;
The requirements for Moodle are as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hardware&#039;&#039;&#039; (unless you are using a hosted server). &lt;br /&gt;
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.&lt;br /&gt;
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 &#039;&#039;concurrent&#039;&#039; users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. &lt;br /&gt;
&#039;&#039;&#039;Software&#039;&#039;&#039;&lt;br /&gt;
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. &lt;br /&gt;
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.&lt;br /&gt;
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.&lt;br /&gt;
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. &lt;br /&gt;
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).&lt;br /&gt;
** PHP Settings&lt;br /&gt;
*** &#039;&#039;safe_mode&#039;&#039; needs to be OFF (check in your php.ini or Apache configuration file).&lt;br /&gt;
*** &#039;&#039;memory_limit&#039;&#039; should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.&lt;br /&gt;
*** &#039;&#039;session.save_handler&#039;&#039; needs to be set to files. &lt;br /&gt;
** PHP Extensions and libraries&lt;br /&gt;
*** The mbstring extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** The iconv extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.&lt;br /&gt;
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.&lt;br /&gt;
*** The pgsql extension is required if you are using the PostgreSQL database.&lt;br /&gt;
*** The zlib extension is required for zip/unzip functionality.&lt;br /&gt;
*** The curl extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The tokenizer extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is &#039;&#039;the&#039;&#039; choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. &lt;br /&gt;
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). &lt;br /&gt;
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).&lt;br /&gt;
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting &amp;quot;strict mode&amp;quot; must be OFF (set to &amp;quot;&amp;quot; or &amp;quot;MYSQL40&amp;quot;) in the MySQL configuration file. &lt;br /&gt;
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== How many users? ==&lt;br /&gt;
&lt;br /&gt;
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Browsing users&#039;&#039;&#039;: the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).&lt;br /&gt;
* &#039;&#039;&#039;Concurrent database users&#039;&#039;&#039;: the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.&lt;br /&gt;
&lt;br /&gt;
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. &lt;br /&gt;
&lt;br /&gt;
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.&lt;br /&gt;
&lt;br /&gt;
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Download and copy files into place ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Moodle, either as a compressed package or via CVS. &lt;br /&gt;
* There are two types of compressed packages on the  [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment.  &lt;br /&gt;
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. &lt;br /&gt;
&lt;br /&gt;
After downloading, unpack the archive using either &lt;br /&gt;
 tar -zxvf [filename]&lt;br /&gt;
or&lt;br /&gt;
 unzip [filename]&lt;br /&gt;
as appropriate. &lt;br /&gt;
&lt;br /&gt;
If using CVS, run the CVS Checkout command.&lt;br /&gt;
&lt;br /&gt;
You will now be left with a directory called &amp;quot;moodle&amp;quot;, containing a number of files and folders.&lt;br /&gt;
&lt;br /&gt;
You can either place the whole folder in your web server documents directory, in which case the site will be located at &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com/moodle&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;, or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the &amp;quot;File Manager&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Structure of moodle directory ===&lt;br /&gt;
&lt;br /&gt;
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;config.php&#039;&#039; - contains basic settings. This file does not come with Moodle - you will create it.&lt;br /&gt;
:&#039;&#039;install.php&#039;&#039; - the script you will run to create config.php&lt;br /&gt;
:&#039;&#039;version.php&#039;&#039; - defines the current version of Moodle code&lt;br /&gt;
:&#039;&#039;index.php&#039;&#039; - the front page of the site&lt;br /&gt;
:&#039;&#039;admin/&#039;&#039; - code to administrate the whole server&lt;br /&gt;
:&#039;&#039;auth/&#039;&#039; - plugin modules to authenticate users&lt;br /&gt;
:&#039;&#039;blocks/&#039;&#039; - plugin modules for the little side blocks on many pages&lt;br /&gt;
:&#039;&#039;calendar/&#039;&#039; - all the code for managing and displaying calendars&lt;br /&gt;
:&#039;&#039;course/&#039;&#039; - code to display and manage courses&lt;br /&gt;
:&#039;&#039;doc/&#039;&#039; - help documentation for Moodle (eg this page)&lt;br /&gt;
:&#039;&#039;files/&#039;&#039; - code to display and manage uploaded files&lt;br /&gt;
:&#039;&#039;lang/&#039;&#039; - texts in different languages, one directory per language&lt;br /&gt;
:&#039;&#039;lib/&#039;&#039; - libraries of core Moodle code&lt;br /&gt;
:&#039;&#039;login/&#039;&#039; - code to handle login and account creation&lt;br /&gt;
:&#039;&#039;mod/&#039;&#039; - all the main Moodle course modules are in here&lt;br /&gt;
:&#039;&#039;pix/&#039;&#039; - generic site graphics&lt;br /&gt;
:&#039;&#039;theme/&#039;&#039; - theme packs/skins to change the look of the site.&lt;br /&gt;
:&#039;&#039;user/&#039;&#039; - code to display and manage users&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Setting-up your system==&lt;br /&gt;
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.&lt;br /&gt;
&lt;br /&gt;
=== Check web server settings ===&lt;br /&gt;
&lt;br /&gt;
*Firstly, make sure that your web server is set up to use index.php as a default page (perhaps in addition to index.html, default.htm and so on). In Apache, this is done using a DirectoryIndex parameter in your httpd.conf file. Mine usually looks like this:&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; index.php index.html index.htm&lt;br /&gt;
&lt;br /&gt;
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).&lt;br /&gt;
&lt;br /&gt;
*Secondly, &#039;&#039;&#039;if you are using Apache 2&#039;&#039;&#039;, then you should turn on the &#039;&#039;AcceptPathInfo&#039;&#039; variable, which allows scripts to be passed arguments like &amp;lt;nowiki&amp;gt;http://server/file.php/arg1/arg2&amp;lt;/nowiki&amp;gt;. This is essential to allow relative links between your resources, and also provides a performance boost for people using your Moodle web site. You can turn this on by adding these lines to your httpd.conf file.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;AcceptPathInfo&#039;&#039;&#039; on&lt;br /&gt;
&lt;br /&gt;
=== Check PHP settings ===&lt;br /&gt;
Moodle requires a number of PHP settings to be active for it to work. &#039;&#039;&#039;On most servers these will already be the default settings&#039;&#039;&#039;.  However, some PHP servers (and some of the more recent PHP versions) may have things set differently. These are defined in PHP&#039;s configuration file (usually called &#039;&#039;&#039;php.ini&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 magic_quotes_gpc = 1    (preferred but not necessary)&lt;br /&gt;
 magic_quotes_runtime = 0    (necessary)&lt;br /&gt;
 file_uploads = 1&lt;br /&gt;
 session.auto_start = 0&lt;br /&gt;
 session.bug_compat_warn = 0&lt;br /&gt;
&lt;br /&gt;
:You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:&lt;br /&gt;
 &lt;br /&gt;
 post_max_size = 16M&lt;br /&gt;
 upload_max_filesize = 16M&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Using a .htaccess file for webserver and PHP settings ===&lt;br /&gt;
&lt;br /&gt;
Use the above if you can directly edit your server&#039;s files, but if you are setting-up Moodle on a webhost, or don&#039;t have access to &#039;&#039;&#039;httpd.conf&#039;&#039;&#039; or &#039;&#039;&#039;php.ini&#039;&#039;&#039; on your server, or you have Moodle on a server with other applications that require different settings, then don&#039;t worry, you can often still override the default settings. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration.&lt;br /&gt;
&lt;br /&gt;
* Create a file called &#039;&#039;&#039;.htaccess&#039;&#039;&#039; in Moodle&#039;s main directory that contains lines like the following. &lt;br /&gt;
&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
 php_flag magic_quotes_gpc 1&lt;br /&gt;
 php_flag magic_quotes_runtime 0&lt;br /&gt;
 php_flag file_uploads 1&lt;br /&gt;
 php_flag session.auto_start 0&lt;br /&gt;
 php_flag session.bug_compat_warn 0&lt;br /&gt;
&lt;br /&gt;
:If you have Apache version 2 installed, add these lines:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;IfDefine APACHE2&amp;gt;&lt;br /&gt;
     AcceptPathInfo on&lt;br /&gt;
 &amp;lt;/IfDefine&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Otherwise add this single line:&lt;br /&gt;
&lt;br /&gt;
 AcceptPathInfo on&lt;br /&gt;
&lt;br /&gt;
* Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:&lt;br /&gt;
&lt;br /&gt;
 LimitRequestBody 0&lt;br /&gt;
 php_value upload_max_filesize 2M&lt;br /&gt;
 php_value post_max_size 2M&lt;br /&gt;
     &lt;br /&gt;
* The easiest thing to do is just copy the sample file from lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:&lt;br /&gt;
&lt;br /&gt;
 cp lib/htaccess .htaccess&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Creating an empty database ===&lt;br /&gt;
&lt;br /&gt;
You need to create an empty database (eg &amp;quot;&#039;&#039;moodle&#039;&#039;&amp;quot;) in your database system along with a special user (eg &amp;quot;moodleuser&amp;quot;) that has access to that database (and that database only). You could use the &amp;quot;root&amp;quot; user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Warning&#039;&#039;&#039;: Bear in mind that, as of Moodle version 1.5.x, Moodle doesn&#039;t work with MySQL 5.x&#039;s strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL&#039;s configuration file (called &amp;quot;my.ini&amp;quot; in Windows and &amp;quot;my.cnf&amp;quot; on Unix/Linux) and comment out that option or set it to &amp;lt;code&amp;gt;sql-mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You have to restart MySQL after changing this setting. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt; If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command &amp;lt;code&amp;gt;SET @@global.sql_mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;;&amp;lt;/code&amp;gt; (be sure to use single quotes, and don&#039;t forget the semicolon).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 &amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
====Using a hosted server====&lt;br /&gt;
If you are using a webhost, they will probably have a control panel web interface for you to create your database.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;[http://www.cpanel.com/ cPanel]&#039;&#039;&#039; system is one of the most popular of these. &lt;br /&gt;
To create a database using cPanel:&lt;br /&gt;
&lt;br /&gt;
# Click on the &#039;&#039;&#039;MySQL Databases&#039;&#039;&#039; icon.&lt;br /&gt;
# Type &#039;&#039;&#039;moodle&#039;&#039;&#039; in the New Database field and click &#039;&#039;&#039;Create Database&#039;&#039;&#039;.&lt;br /&gt;
# Type a username and password (not one you use elsewhere) in the respective fields and click &#039;&#039;&#039;Create  User&#039;&#039;&#039;.&lt;br /&gt;
# Now use the &#039;&#039;&#039;Add Users to Databases&#039;&#039;&#039; button and give this new user account &#039;&#039;&#039;ALL&#039;&#039;&#039; rights to the new database.&lt;br /&gt;
# Note that the username and database names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.&lt;br /&gt;
&lt;br /&gt;
Continue with [[Installing_Moodle#CreatDataDir |Creating the data directory]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using the command line====&lt;br /&gt;
&lt;br /&gt;
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):&lt;br /&gt;
&lt;br /&gt;
- Start the MySQL Client program:&lt;br /&gt;
 #&#039;&#039;&#039;mysql -u root -p&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 Welcome to the MySQL monitor.  Commands end with ; or \g.&lt;br /&gt;
 Your MySQL connection id is 2 to server version: 5.0.22-log&lt;br /&gt;
 &lt;br /&gt;
 Type &#039;help;&#039; or &#039;\h&#039; for help. Type &#039;\c&#039; to clear the buffer.&lt;br /&gt;
 &lt;br /&gt;
 mysql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- The prompt changes to &amp;quot;mysql&amp;gt;&amp;quot; to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you&#039;ll get the line continuation symbol &#039;-&amp;gt;&#039;; this is your second chance to type the semi-colon and hit Enter.) &lt;br /&gt;
&lt;br /&gt;
- Begin by checking for any existing databases called &amp;quot;moodle&amp;quot; - if there are any you should change the name in all the commands which follow:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;SHOW DATABASES;&#039;&#039;&#039;&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | Database                |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | information_schema      |&lt;br /&gt;
 | mysql                   |&lt;br /&gt;
 | test                    |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 3 rows in set (0.03 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a database to store the Moodle tables. We&#039;ll call this &amp;quot;moodle&amp;quot;, as there are none with that name already in the above list, but change it if you need to.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;CREATE DATABASE moodle;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Change the default character set and collation of the &amp;quot;moodle&amp;quot; database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a username and password to access the database &amp;quot;moodle&amp;quot; and grant database access permissions. We&#039;ll call the user &amp;quot;moodleuser&amp;quot; and set the password as &amp;quot;yourpassword&amp;quot;. It&#039;s a good idea to change these for your installation however most people keep the username as &amp;quot;moodleuser&amp;quot;. Remember the username and password you have set, as you&#039;ll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;DROP,INDEX,ALTER ON moodle.*&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;TO moodleuser@localhost IDENTIFIED BY &#039;yourpassword&#039;;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 0 rows affected (0.01 sec)&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Security Warnings&#039;&#039;&#039;: Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting &amp;quot;ALL&amp;quot; permissions on the database.&lt;br /&gt;
: &#039;&#039;&#039;Note&#039;&#039;&#039;: For MySQL 4.0.1 or earlier, you don&#039;t need the CREATE TEMPORARY TABLES permission. &lt;br /&gt;
&lt;br /&gt;
- Exit the MySQL Client program:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;QUIT&#039;&#039;&#039;&lt;br /&gt;
 Bye&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
- Reload the grant tables using the mysqladmin program:&lt;br /&gt;
 #&#039;&#039;&#039;mysqladmin -u root -p reload&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
And some example command lines for PostgreSQL:&lt;br /&gt;
&lt;br /&gt;
   # su - postgres&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create user moodleuser createdb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create database moodle &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;with encoding &#039;unicode&#039;&amp;lt;/font&amp;gt;;&amp;quot; -U moodleuser template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser nocreatedb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser with encrypted password &#039;yourpassword&#039;;&amp;quot; template1&lt;br /&gt;
   &amp;gt; su - root&lt;br /&gt;
   # /etc/init.d/postgresql reload&lt;br /&gt;
&lt;br /&gt;
If the Postgres create database command above (&amp;gt;psql -c &amp;quot;create database moodle...&amp;quot;) gives an error message you may want to try:&lt;br /&gt;
 psql -c &amp;quot;create database moodle with template=template1 encoding = &#039;unicode&#039; owner =  moodleuser &amp;lt;br&amp;gt;     location = &#039;/var/mydata&#039;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If the create database command asks you for a password, run the line containing &#039;encrypted password&#039; first before proceeding.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;:&lt;br /&gt;
* Step-by-step instructions on  [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&amp;lt;div id=CreatDataDir &amp;gt;&lt;br /&gt;
=== Creating the data directory  ===&lt;br /&gt;
&lt;br /&gt;
Moodle will also need some space on your server&#039;s hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create the &#039;&#039;&#039;moodledata&#039;&#039;&#039; directory for you but if it fails then you will have to create a directory for this purpose manually.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security warning&#039;&#039;&#039;: For security purposes, it&#039;s best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called &#039;&#039;&#039;.htaccess&#039;&#039;&#039;, containing these lines:&lt;br /&gt;
&lt;br /&gt;
 order deny,allow&lt;br /&gt;
 deny from all&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ownership &amp;amp; Permissions&#039;&#039;&#039;: To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like &amp;quot;nobody&amp;quot; or &amp;quot;apache&amp;quot;, and then giving that user read, write and execute permissions. As an example, to change the owner to &amp;quot;nobody&amp;quot; you could use:&lt;br /&gt;
&lt;br /&gt;
 chown -R nobody:apache moodledata&lt;br /&gt;
&lt;br /&gt;
To change the permissions so that the owner has read,write and execute permissions, use something like this:&lt;br /&gt;
&lt;br /&gt;
 chmod -R 0770 moodledata&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you are receiving permission denied messages, try &#039;&#039;chmod -R 0770 moodledata&#039;&#039; and then adjust the settings so that they are more secure. A more secure setting is &#039;&#039;chmod -R 0750 moodledata&#039;&#039;. According to the comments in config-dist.php, &amp;quot;On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions.&amp;quot; To do this you could use &#039;&#039;chmod -R 707 moodledata&#039;&#039;. See also the [[Security | security page]].&lt;br /&gt;
&lt;br /&gt;
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the &#039;&#039;&#039;config.php&#039;&#039;&#039; file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:&lt;br /&gt;
&lt;br /&gt;
 $CFG-&amp;gt;dataroot  = &#039;/data/moodledata&#039;;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;CPanel and webhosts&#039;&#039;&#039;: On cPanel systems you can use the &amp;quot;File Manager&amp;quot; to find the folder, click on it, then choose &amp;quot;Change Permissions&amp;quot;. On many shared hosting servers, you will probably need to restrict all file access to your &amp;quot;group&amp;quot; (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as &amp;quot;&#039;&#039;&#039;Safe Mode&#039;&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Run the installer script to create config.php ==&lt;br /&gt;
&lt;br /&gt;
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourserver/install.php&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039; directly.&lt;br /&gt;
&lt;br /&gt;
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)&lt;br /&gt;
&lt;br /&gt;
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called &#039;&#039;&#039;config.php&#039;&#039;&#039;. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload &#039;&#039;&#039;config.php&#039;&#039;&#039; into the main Moodle directory on the server.&lt;br /&gt;
&lt;br /&gt;
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Go to the admin page to continue configuration ==&lt;br /&gt;
&lt;br /&gt;
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the &amp;quot;admin&amp;quot; page for the rest of the configuration.&lt;br /&gt;
&lt;br /&gt;
The first time you access this admin page, you will be presented with a GPL &amp;quot;shrink wrap&amp;quot; agreement with which you must agree before you can continue with the setup.&lt;br /&gt;
&lt;br /&gt;
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:&lt;br /&gt;
&lt;br /&gt;
 CREATE TABLE course (&lt;br /&gt;
    id int(10) unsigned NOT NULL auto_increment,&lt;br /&gt;
    category int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    password varchar(50) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    fullname varchar(254) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    shortname varchar(15) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    summary text NOT NULL,&lt;br /&gt;
    format tinyint(4) NOT NULL default &#039;1&#039;,&lt;br /&gt;
    teacher varchar(100) NOT NULL default &#039;Teacher&#039;,&lt;br /&gt;
    startdate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    enddate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    timemodified int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
 ) TYPE=MyISAM;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SUCCESS&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...and so on, followed by: &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;Main databases set up successfully.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn&#039;t in a restricted &amp;quot;Safe Mode&amp;quot; (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing &#039;&#039;&#039;&amp;lt;?php phpinfo() ?&amp;gt;&#039;&#039;&#039; and looking at it through a browser. Check all these and try this page again.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don&#039;t worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the &amp;quot;buggy referrer&amp;quot; problem. This is easy to fix: just turn off the &amp;quot;secureforms&amp;quot; setting, then try to continue again.&lt;br /&gt;
&lt;br /&gt;
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;green&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click &amp;quot;Save changes&amp;quot;. Not all the fields are required, but if you miss any important fields you&#039;ll be re-prompted for them.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;, with password &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:&lt;br /&gt;
&lt;br /&gt;
* creating and deleting courses&lt;br /&gt;
* creating and editing user accounts&lt;br /&gt;
* administering teacher accounts&lt;br /&gt;
* changing site-wide settings like themes etc&lt;br /&gt;
&lt;br /&gt;
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Set up cron ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Cron|Cron instructions]].&lt;br /&gt;
&lt;br /&gt;
== Set up backups ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Backup settings| backup instructions]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Create a new course ==&lt;br /&gt;
&lt;br /&gt;
Now that Moodle is running properly, you can try creating a new course to play with.&lt;br /&gt;
&lt;br /&gt;
Select &amp;quot;Create a new course&amp;quot; from the Admin page (or the admin links on the home page).&lt;br /&gt;
&lt;br /&gt;
Fill out the form, paying special attention to the course format. You don&#039;t have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.&lt;br /&gt;
&lt;br /&gt;
Press &amp;quot;Save changes&amp;quot;, and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the &amp;quot;Add a new user&amp;quot; on the Admin page.&lt;br /&gt;
&lt;br /&gt;
Once done, the course is ready to customize, and is accessible via the &amp;quot;Courses&amp;quot; link on the home page.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation FAQ]]&lt;br /&gt;
*[[Complete install packages]] might be an easier first time installs on some systems&lt;br /&gt;
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop&lt;br /&gt;
* [[Upgrading Moodle]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion&lt;br /&gt;
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[cs:Instalace]]&lt;br /&gt;
[[de:Installieren von Moodle]]&lt;br /&gt;
[[es:Instalación de moodle]]&lt;br /&gt;
[[fr:Installation de Moodle]]&lt;br /&gt;
[[ja:Moodleのインストール]]&lt;br /&gt;
[[nl:Installatiegids]]&lt;br /&gt;
[[pl:Instalacja Moodle]]&lt;br /&gt;
[[pt:Instalação do Moodle]]&lt;br /&gt;
[[ru:Установка Moodle]]&lt;br /&gt;
[[sk:Inštalácia]]&lt;br /&gt;
[[zh:安装Moodlezh:]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31694</id>
		<title>Installing Moodle</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31694"/>
		<updated>2008-01-29T01:31:41Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: /* Creating an empty database */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Firstly don&#039;t panic! :-)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don&#039;t panic, once you know how to do it you can install Moodle in minutes!&lt;br /&gt;
&lt;br /&gt;
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via  [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].&lt;br /&gt;
&lt;br /&gt;
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you]  through the process of choosing a host and setting up moodle via cpanel. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning:&#039;&#039;&#039; some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don&#039;t work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.&lt;br /&gt;
&lt;br /&gt;
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle&#039;s complete packages]]. They provide alternative instructions to install all this on most popular platforms.&lt;br /&gt;
==Table of Contents==&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Most web hosts support all of these requirements by default. You should contact your web host&#039;s support desk to check that this is the case &#039;&#039;&#039;before&#039;&#039;&#039; signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.&lt;br /&gt;
&lt;br /&gt;
The requirements for Moodle are as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hardware&#039;&#039;&#039; (unless you are using a hosted server). &lt;br /&gt;
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.&lt;br /&gt;
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 &#039;&#039;concurrent&#039;&#039; users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. &lt;br /&gt;
&#039;&#039;&#039;Software&#039;&#039;&#039;&lt;br /&gt;
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. &lt;br /&gt;
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.&lt;br /&gt;
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.&lt;br /&gt;
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. &lt;br /&gt;
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).&lt;br /&gt;
** PHP Settings&lt;br /&gt;
*** &#039;&#039;safe_mode&#039;&#039; needs to be OFF (check in your php.ini or Apache configuration file).&lt;br /&gt;
*** &#039;&#039;memory_limit&#039;&#039; should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.&lt;br /&gt;
*** &#039;&#039;session.save_handler&#039;&#039; needs to be set to files. &lt;br /&gt;
** PHP Extensions and libraries&lt;br /&gt;
*** The mbstring extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** The iconv extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.&lt;br /&gt;
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.&lt;br /&gt;
*** The pgsql extension is required if you are using the PostgreSQL database.&lt;br /&gt;
*** The zlib extension is required for zip/unzip functionality.&lt;br /&gt;
*** The curl extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The tokenizer extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is &#039;&#039;the&#039;&#039; choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. &lt;br /&gt;
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). &lt;br /&gt;
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).&lt;br /&gt;
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting &amp;quot;strict mode&amp;quot; must be OFF (set to &amp;quot;&amp;quot; or &amp;quot;MYSQL40&amp;quot;) in the MySQL configuration file. &lt;br /&gt;
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== How many users? ==&lt;br /&gt;
&lt;br /&gt;
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Browsing users&#039;&#039;&#039;: the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).&lt;br /&gt;
* &#039;&#039;&#039;Concurrent database users&#039;&#039;&#039;: the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.&lt;br /&gt;
&lt;br /&gt;
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. &lt;br /&gt;
&lt;br /&gt;
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.&lt;br /&gt;
&lt;br /&gt;
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Download and copy files into place ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Moodle, either as a compressed package or via CVS. &lt;br /&gt;
* There are two types of compressed packages on the  [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment.  &lt;br /&gt;
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. &lt;br /&gt;
&lt;br /&gt;
After downloading, unpack the archive using either &lt;br /&gt;
 tar -zxvf [filename]&lt;br /&gt;
or&lt;br /&gt;
 unzip [filename]&lt;br /&gt;
as appropriate. &lt;br /&gt;
&lt;br /&gt;
If using CVS, run the CVS Checkout command.&lt;br /&gt;
&lt;br /&gt;
You will now be left with a directory called &amp;quot;moodle&amp;quot;, containing a number of files and folders.&lt;br /&gt;
&lt;br /&gt;
You can either place the whole folder in your web server documents directory, in which case the site will be located at &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com/moodle&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;, or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the &amp;quot;File Manager&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Structure of moodle directory ===&lt;br /&gt;
&lt;br /&gt;
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;config.php&#039;&#039; - contains basic settings. This file does not come with Moodle - you will create it.&lt;br /&gt;
:&#039;&#039;install.php&#039;&#039; - the script you will run to create config.php&lt;br /&gt;
:&#039;&#039;version.php&#039;&#039; - defines the current version of Moodle code&lt;br /&gt;
:&#039;&#039;index.php&#039;&#039; - the front page of the site&lt;br /&gt;
:&#039;&#039;admin/&#039;&#039; - code to administrate the whole server&lt;br /&gt;
:&#039;&#039;auth/&#039;&#039; - plugin modules to authenticate users&lt;br /&gt;
:&#039;&#039;blocks/&#039;&#039; - plugin modules for the little side blocks on many pages&lt;br /&gt;
:&#039;&#039;calendar/&#039;&#039; - all the code for managing and displaying calendars&lt;br /&gt;
:&#039;&#039;course/&#039;&#039; - code to display and manage courses&lt;br /&gt;
:&#039;&#039;doc/&#039;&#039; - help documentation for Moodle (eg this page)&lt;br /&gt;
:&#039;&#039;files/&#039;&#039; - code to display and manage uploaded files&lt;br /&gt;
:&#039;&#039;lang/&#039;&#039; - texts in different languages, one directory per language&lt;br /&gt;
:&#039;&#039;lib/&#039;&#039; - libraries of core Moodle code&lt;br /&gt;
:&#039;&#039;login/&#039;&#039; - code to handle login and account creation&lt;br /&gt;
:&#039;&#039;mod/&#039;&#039; - all the main Moodle course modules are in here&lt;br /&gt;
:&#039;&#039;pix/&#039;&#039; - generic site graphics&lt;br /&gt;
:&#039;&#039;theme/&#039;&#039; - theme packs/skins to change the look of the site.&lt;br /&gt;
:&#039;&#039;user/&#039;&#039; - code to display and manage users&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Setting-up your system==&lt;br /&gt;
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.&lt;br /&gt;
&lt;br /&gt;
=== Check web server settings ===&lt;br /&gt;
&lt;br /&gt;
*Firstly, make sure that your web server is set up to use index.php as a default page (perhaps in addition to index.html, default.htm and so on). In Apache, this is done using a DirectoryIndex parameter in your httpd.conf file. Mine usually looks like this:&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; index.php index.html index.htm&lt;br /&gt;
&lt;br /&gt;
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).&lt;br /&gt;
&lt;br /&gt;
*Secondly, &#039;&#039;&#039;if you are using Apache 2&#039;&#039;&#039;, then you should turn on the &#039;&#039;AcceptPathInfo&#039;&#039; variable, which allows scripts to be passed arguments like &amp;lt;nowiki&amp;gt;http://server/file.php/arg1/arg2&amp;lt;/nowiki&amp;gt;. This is essential to allow relative links between your resources, and also provides a performance boost for people using your Moodle web site. You can turn this on by adding these lines to your httpd.conf file.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;AcceptPathInfo&#039;&#039;&#039; on&lt;br /&gt;
&lt;br /&gt;
=== Check PHP settings ===&lt;br /&gt;
Moodle requires a number of PHP settings to be active for it to work. &#039;&#039;&#039;On most servers these will already be the default settings&#039;&#039;&#039;.  However, some PHP servers (and some of the more recent PHP versions) may have things set differently. These are defined in PHP&#039;s configuration file (usually called &#039;&#039;&#039;php.ini&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 magic_quotes_gpc = 1    (preferred but not necessary)&lt;br /&gt;
 magic_quotes_runtime = 0    (necessary)&lt;br /&gt;
 file_uploads = 1&lt;br /&gt;
 session.auto_start = 0&lt;br /&gt;
 session.bug_compat_warn = 0&lt;br /&gt;
&lt;br /&gt;
:You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:&lt;br /&gt;
 &lt;br /&gt;
 post_max_size = 16M&lt;br /&gt;
 upload_max_filesize = 16M&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Using a .htaccess file for webserver and PHP settings ===&lt;br /&gt;
&lt;br /&gt;
Use the above if you can directly edit your server&#039;s files, but if you are setting-up Moodle on a webhost, or don&#039;t have access to &#039;&#039;&#039;httpd.conf&#039;&#039;&#039; or &#039;&#039;&#039;php.ini&#039;&#039;&#039; on your server, or you have Moodle on a server with other applications that require different settings, then don&#039;t worry, you can often still override the default settings. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration.&lt;br /&gt;
&lt;br /&gt;
* Create a file called &#039;&#039;&#039;.htaccess&#039;&#039;&#039; in Moodle&#039;s main directory that contains lines like the following. &lt;br /&gt;
&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
 php_flag magic_quotes_gpc 1&lt;br /&gt;
 php_flag magic_quotes_runtime 0&lt;br /&gt;
 php_flag file_uploads 1&lt;br /&gt;
 php_flag session.auto_start 0&lt;br /&gt;
 php_flag session.bug_compat_warn 0&lt;br /&gt;
&lt;br /&gt;
:If you have Apache version 2 installed, add these lines:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;IfDefine APACHE2&amp;gt;&lt;br /&gt;
     AcceptPathInfo on&lt;br /&gt;
 &amp;lt;/IfDefine&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Otherwise add this single line:&lt;br /&gt;
&lt;br /&gt;
 AcceptPathInfo on&lt;br /&gt;
&lt;br /&gt;
* Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:&lt;br /&gt;
&lt;br /&gt;
 LimitRequestBody 0&lt;br /&gt;
 php_value upload_max_filesize 2M&lt;br /&gt;
 php_value post_max_size 2M&lt;br /&gt;
     &lt;br /&gt;
* The easiest thing to do is just copy the sample file from lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:&lt;br /&gt;
&lt;br /&gt;
 cp lib/htaccess .htaccess&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Creating an empty database ===&lt;br /&gt;
&lt;br /&gt;
You need to create an empty database (eg &amp;quot;&#039;&#039;moodle&#039;&#039;&amp;quot;) in your database system along with a special user (eg &amp;quot;moodleuser&amp;quot;) that has access to that database (and that database only). You could use the &amp;quot;root&amp;quot; user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Warning&#039;&#039;&#039;: Bear in mind that, as of Moodle version 1.5.x, Moodle doesn&#039;t work with MySQL 5.x&#039;s strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL&#039;s configuration file (called &amp;quot;my.ini&amp;quot; in Windows and &amp;quot;my.cnf&amp;quot; on Unix/Linux) and comment out that option or set it to &amp;lt;code&amp;gt;sql-mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You have to restart MySQL after changing this setting. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt; If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command &amp;lt;code&amp;gt;SET @@global.sql_mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;;&amp;lt;/code&amp;gt; (be sure to use single quotes, and don&#039;t forget the semicolon).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 &amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
====Using a hosted server====&lt;br /&gt;
If you are using a webhost, they will probably have a control panel web interface for you to create your database.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;[http://www.cpanel.com/ cPanel]&#039;&#039;&#039; system is one of the most popular of these. &lt;br /&gt;
To create a database using cPanel:&lt;br /&gt;
&lt;br /&gt;
# Click on the &#039;&#039;&#039;MySQL Databases&#039;&#039;&#039; icon.&lt;br /&gt;
# Type &#039;&#039;&#039;moodle&#039;&#039;&#039; in the New Database field and click &#039;&#039;&#039;Create Database&#039;&#039;&#039;.&lt;br /&gt;
# Type a username and password (not one you use elsewhere) in the respective fields and click &#039;&#039;&#039;Create  User&#039;&#039;&#039;.&lt;br /&gt;
# Now use the &#039;&#039;&#039;Add Users to Databases&#039;&#039;&#039; button and give this new user account &#039;&#039;&#039;ALL&#039;&#039;&#039; rights to the new database.&lt;br /&gt;
# Note that the username and database names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.&lt;br /&gt;
&lt;br /&gt;
Continue with [[Installing_Moodle#CreDDir |Creating the data directory]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using the command line====&lt;br /&gt;
&lt;br /&gt;
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):&lt;br /&gt;
&lt;br /&gt;
- Start the MySQL Client program:&lt;br /&gt;
 #&#039;&#039;&#039;mysql -u root -p&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 Welcome to the MySQL monitor.  Commands end with ; or \g.&lt;br /&gt;
 Your MySQL connection id is 2 to server version: 5.0.22-log&lt;br /&gt;
 &lt;br /&gt;
 Type &#039;help;&#039; or &#039;\h&#039; for help. Type &#039;\c&#039; to clear the buffer.&lt;br /&gt;
 &lt;br /&gt;
 mysql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- The prompt changes to &amp;quot;mysql&amp;gt;&amp;quot; to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you&#039;ll get the line continuation symbol &#039;-&amp;gt;&#039;; this is your second chance to type the semi-colon and hit Enter.) &lt;br /&gt;
&lt;br /&gt;
- Begin by checking for any existing databases called &amp;quot;moodle&amp;quot; - if there are any you should change the name in all the commands which follow:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;SHOW DATABASES;&#039;&#039;&#039;&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | Database                |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | information_schema      |&lt;br /&gt;
 | mysql                   |&lt;br /&gt;
 | test                    |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 3 rows in set (0.03 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a database to store the Moodle tables. We&#039;ll call this &amp;quot;moodle&amp;quot;, as there are none with that name already in the above list, but change it if you need to.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;CREATE DATABASE moodle;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Change the default character set and collation of the &amp;quot;moodle&amp;quot; database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a username and password to access the database &amp;quot;moodle&amp;quot; and grant database access permissions. We&#039;ll call the user &amp;quot;moodleuser&amp;quot; and set the password as &amp;quot;yourpassword&amp;quot;. It&#039;s a good idea to change these for your installation however most people keep the username as &amp;quot;moodleuser&amp;quot;. Remember the username and password you have set, as you&#039;ll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;DROP,INDEX,ALTER ON moodle.*&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;TO moodleuser@localhost IDENTIFIED BY &#039;yourpassword&#039;;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 0 rows affected (0.01 sec)&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Security Warnings&#039;&#039;&#039;: Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting &amp;quot;ALL&amp;quot; permissions on the database.&lt;br /&gt;
: &#039;&#039;&#039;Note&#039;&#039;&#039;: For MySQL 4.0.1 or earlier, you don&#039;t need the CREATE TEMPORARY TABLES permission. &lt;br /&gt;
&lt;br /&gt;
- Exit the MySQL Client program:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;QUIT&#039;&#039;&#039;&lt;br /&gt;
 Bye&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
- Reload the grant tables using the mysqladmin program:&lt;br /&gt;
 #&#039;&#039;&#039;mysqladmin -u root -p reload&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
And some example command lines for PostgreSQL:&lt;br /&gt;
&lt;br /&gt;
   # su - postgres&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create user moodleuser createdb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create database moodle &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;with encoding &#039;unicode&#039;&amp;lt;/font&amp;gt;;&amp;quot; -U moodleuser template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser nocreatedb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser with encrypted password &#039;yourpassword&#039;;&amp;quot; template1&lt;br /&gt;
   &amp;gt; su - root&lt;br /&gt;
   # /etc/init.d/postgresql reload&lt;br /&gt;
&lt;br /&gt;
If the Postgres create database command above (&amp;gt;psql -c &amp;quot;create database moodle...&amp;quot;) gives an error message you may want to try:&lt;br /&gt;
 psql -c &amp;quot;create database moodle with template=template1 encoding = &#039;unicode&#039; owner =  moodleuser &amp;lt;br&amp;gt;     location = &#039;/var/mydata&#039;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If the create database command asks you for a password, run the line containing &#039;encrypted password&#039; first before proceeding.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;:&lt;br /&gt;
* Step-by-step instructions on  [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Creating the data directory (moodledata) ===&lt;br /&gt;
&lt;br /&gt;
Moodle will also need some space on your server&#039;s hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create this directory for you but if it fails then you will have to create a directory for this purpose manually.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security warning&#039;&#039;&#039;: For security purposes, it&#039;s best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called &#039;&#039;&#039;.htaccess&#039;&#039;&#039;, containing these lines:&lt;br /&gt;
&lt;br /&gt;
 order deny,allow&lt;br /&gt;
 deny from all&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ownership &amp;amp; Permissions&#039;&#039;&#039;: To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like &amp;quot;nobody&amp;quot; or &amp;quot;apache&amp;quot;, and then giving that user read, write and execute permissions. As an example, to change the owner to &amp;quot;nobody&amp;quot; you could use:&lt;br /&gt;
&lt;br /&gt;
 chown -R nobody:apache moodledata&lt;br /&gt;
&lt;br /&gt;
To change the permissions so that the owner has read,write and execute permissions, use something like this:&lt;br /&gt;
&lt;br /&gt;
 chmod -R 0770 moodledata&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you are receiving permission denied messages, try &#039;&#039;chmod -R 0770 moodledata&#039;&#039; and then adjust the settings so that they are more secure. A more secure setting is &#039;&#039;chmod -R 0750 moodledata&#039;&#039;. According to the comments in config-dist.php, &amp;quot;On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions.&amp;quot; To do this you could use &#039;&#039;chmod -R 707 moodledata&#039;&#039;. See also the [[Security | security page]].&lt;br /&gt;
&lt;br /&gt;
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the &#039;&#039;&#039;config.php&#039;&#039;&#039; file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:&lt;br /&gt;
&lt;br /&gt;
 $CFG-&amp;gt;dataroot  = &#039;/data/moodledata&#039;;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;CPanel and webhosts&#039;&#039;&#039;: On cPanel systems you can use the &amp;quot;File Manager&amp;quot; to find the folder, click on it, then choose &amp;quot;Change Permissions&amp;quot;. On many shared hosting servers, you will probably need to restrict all file access to your &amp;quot;group&amp;quot; (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as &amp;quot;&#039;&#039;&#039;Safe Mode&#039;&#039;&#039;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Run the installer script to create config.php ==&lt;br /&gt;
&lt;br /&gt;
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourserver/install.php&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039; directly.&lt;br /&gt;
&lt;br /&gt;
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)&lt;br /&gt;
&lt;br /&gt;
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called &#039;&#039;&#039;config.php&#039;&#039;&#039;. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload &#039;&#039;&#039;config.php&#039;&#039;&#039; into the main Moodle directory on the server.&lt;br /&gt;
&lt;br /&gt;
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Go to the admin page to continue configuration ==&lt;br /&gt;
&lt;br /&gt;
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the &amp;quot;admin&amp;quot; page for the rest of the configuration.&lt;br /&gt;
&lt;br /&gt;
The first time you access this admin page, you will be presented with a GPL &amp;quot;shrink wrap&amp;quot; agreement with which you must agree before you can continue with the setup.&lt;br /&gt;
&lt;br /&gt;
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:&lt;br /&gt;
&lt;br /&gt;
 CREATE TABLE course (&lt;br /&gt;
    id int(10) unsigned NOT NULL auto_increment,&lt;br /&gt;
    category int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    password varchar(50) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    fullname varchar(254) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    shortname varchar(15) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    summary text NOT NULL,&lt;br /&gt;
    format tinyint(4) NOT NULL default &#039;1&#039;,&lt;br /&gt;
    teacher varchar(100) NOT NULL default &#039;Teacher&#039;,&lt;br /&gt;
    startdate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    enddate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    timemodified int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
 ) TYPE=MyISAM;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SUCCESS&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...and so on, followed by: &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;Main databases set up successfully.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn&#039;t in a restricted &amp;quot;Safe Mode&amp;quot; (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing &#039;&#039;&#039;&amp;lt;?php phpinfo() ?&amp;gt;&#039;&#039;&#039; and looking at it through a browser. Check all these and try this page again.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don&#039;t worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the &amp;quot;buggy referrer&amp;quot; problem. This is easy to fix: just turn off the &amp;quot;secureforms&amp;quot; setting, then try to continue again.&lt;br /&gt;
&lt;br /&gt;
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;green&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click &amp;quot;Save changes&amp;quot;. Not all the fields are required, but if you miss any important fields you&#039;ll be re-prompted for them.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;, with password &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:&lt;br /&gt;
&lt;br /&gt;
* creating and deleting courses&lt;br /&gt;
* creating and editing user accounts&lt;br /&gt;
* administering teacher accounts&lt;br /&gt;
* changing site-wide settings like themes etc&lt;br /&gt;
&lt;br /&gt;
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Set up cron ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Cron|Cron instructions]].&lt;br /&gt;
&lt;br /&gt;
== Set up backups ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Backup settings| backup instructions]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Create a new course ==&lt;br /&gt;
&lt;br /&gt;
Now that Moodle is running properly, you can try creating a new course to play with.&lt;br /&gt;
&lt;br /&gt;
Select &amp;quot;Create a new course&amp;quot; from the Admin page (or the admin links on the home page).&lt;br /&gt;
&lt;br /&gt;
Fill out the form, paying special attention to the course format. You don&#039;t have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.&lt;br /&gt;
&lt;br /&gt;
Press &amp;quot;Save changes&amp;quot;, and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the &amp;quot;Add a new user&amp;quot; on the Admin page.&lt;br /&gt;
&lt;br /&gt;
Once done, the course is ready to customize, and is accessible via the &amp;quot;Courses&amp;quot; link on the home page.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation FAQ]]&lt;br /&gt;
*[[Complete install packages]] might be an easier first time installs on some systems&lt;br /&gt;
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop&lt;br /&gt;
* [[Upgrading Moodle]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion&lt;br /&gt;
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[cs:Instalace]]&lt;br /&gt;
[[de:Installieren von Moodle]]&lt;br /&gt;
[[es:Instalación de moodle]]&lt;br /&gt;
[[fr:Installation de Moodle]]&lt;br /&gt;
[[ja:Moodleのインストール]]&lt;br /&gt;
[[nl:Installatiegids]]&lt;br /&gt;
[[pl:Instalacja Moodle]]&lt;br /&gt;
[[pt:Instalação do Moodle]]&lt;br /&gt;
[[ru:Установка Moodle]]&lt;br /&gt;
[[sk:Inštalácia]]&lt;br /&gt;
[[zh:安装Moodlezh:]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31693</id>
		<title>Installing Moodle</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31693"/>
		<updated>2008-01-29T01:28:41Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: /* Using a hosted server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Firstly don&#039;t panic! :-)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don&#039;t panic, once you know how to do it you can install Moodle in minutes!&lt;br /&gt;
&lt;br /&gt;
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via  [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].&lt;br /&gt;
&lt;br /&gt;
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you]  through the process of choosing a host and setting up moodle via cpanel. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning:&#039;&#039;&#039; some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don&#039;t work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.&lt;br /&gt;
&lt;br /&gt;
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle&#039;s complete packages]]. They provide alternative instructions to install all this on most popular platforms.&lt;br /&gt;
==Table of Contents==&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Most web hosts support all of these requirements by default. You should contact your web host&#039;s support desk to check that this is the case &#039;&#039;&#039;before&#039;&#039;&#039; signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.&lt;br /&gt;
&lt;br /&gt;
The requirements for Moodle are as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hardware&#039;&#039;&#039; (unless you are using a hosted server). &lt;br /&gt;
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.&lt;br /&gt;
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 &#039;&#039;concurrent&#039;&#039; users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. &lt;br /&gt;
&#039;&#039;&#039;Software&#039;&#039;&#039;&lt;br /&gt;
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. &lt;br /&gt;
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.&lt;br /&gt;
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.&lt;br /&gt;
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. &lt;br /&gt;
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).&lt;br /&gt;
** PHP Settings&lt;br /&gt;
*** &#039;&#039;safe_mode&#039;&#039; needs to be OFF (check in your php.ini or Apache configuration file).&lt;br /&gt;
*** &#039;&#039;memory_limit&#039;&#039; should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.&lt;br /&gt;
*** &#039;&#039;session.save_handler&#039;&#039; needs to be set to files. &lt;br /&gt;
** PHP Extensions and libraries&lt;br /&gt;
*** The mbstring extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** The iconv extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.&lt;br /&gt;
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.&lt;br /&gt;
*** The pgsql extension is required if you are using the PostgreSQL database.&lt;br /&gt;
*** The zlib extension is required for zip/unzip functionality.&lt;br /&gt;
*** The curl extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The tokenizer extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is &#039;&#039;the&#039;&#039; choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. &lt;br /&gt;
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). &lt;br /&gt;
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).&lt;br /&gt;
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting &amp;quot;strict mode&amp;quot; must be OFF (set to &amp;quot;&amp;quot; or &amp;quot;MYSQL40&amp;quot;) in the MySQL configuration file. &lt;br /&gt;
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== How many users? ==&lt;br /&gt;
&lt;br /&gt;
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Browsing users&#039;&#039;&#039;: the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).&lt;br /&gt;
* &#039;&#039;&#039;Concurrent database users&#039;&#039;&#039;: the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.&lt;br /&gt;
&lt;br /&gt;
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. &lt;br /&gt;
&lt;br /&gt;
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.&lt;br /&gt;
&lt;br /&gt;
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Download and copy files into place ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Moodle, either as a compressed package or via CVS. &lt;br /&gt;
* There are two types of compressed packages on the  [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment.  &lt;br /&gt;
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. &lt;br /&gt;
&lt;br /&gt;
After downloading, unpack the archive using either &lt;br /&gt;
 tar -zxvf [filename]&lt;br /&gt;
or&lt;br /&gt;
 unzip [filename]&lt;br /&gt;
as appropriate. &lt;br /&gt;
&lt;br /&gt;
If using CVS, run the CVS Checkout command.&lt;br /&gt;
&lt;br /&gt;
You will now be left with a directory called &amp;quot;moodle&amp;quot;, containing a number of files and folders.&lt;br /&gt;
&lt;br /&gt;
You can either place the whole folder in your web server documents directory, in which case the site will be located at &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com/moodle&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;, or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the &amp;quot;File Manager&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Structure of moodle directory ===&lt;br /&gt;
&lt;br /&gt;
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;config.php&#039;&#039; - contains basic settings. This file does not come with Moodle - you will create it.&lt;br /&gt;
:&#039;&#039;install.php&#039;&#039; - the script you will run to create config.php&lt;br /&gt;
:&#039;&#039;version.php&#039;&#039; - defines the current version of Moodle code&lt;br /&gt;
:&#039;&#039;index.php&#039;&#039; - the front page of the site&lt;br /&gt;
:&#039;&#039;admin/&#039;&#039; - code to administrate the whole server&lt;br /&gt;
:&#039;&#039;auth/&#039;&#039; - plugin modules to authenticate users&lt;br /&gt;
:&#039;&#039;blocks/&#039;&#039; - plugin modules for the little side blocks on many pages&lt;br /&gt;
:&#039;&#039;calendar/&#039;&#039; - all the code for managing and displaying calendars&lt;br /&gt;
:&#039;&#039;course/&#039;&#039; - code to display and manage courses&lt;br /&gt;
:&#039;&#039;doc/&#039;&#039; - help documentation for Moodle (eg this page)&lt;br /&gt;
:&#039;&#039;files/&#039;&#039; - code to display and manage uploaded files&lt;br /&gt;
:&#039;&#039;lang/&#039;&#039; - texts in different languages, one directory per language&lt;br /&gt;
:&#039;&#039;lib/&#039;&#039; - libraries of core Moodle code&lt;br /&gt;
:&#039;&#039;login/&#039;&#039; - code to handle login and account creation&lt;br /&gt;
:&#039;&#039;mod/&#039;&#039; - all the main Moodle course modules are in here&lt;br /&gt;
:&#039;&#039;pix/&#039;&#039; - generic site graphics&lt;br /&gt;
:&#039;&#039;theme/&#039;&#039; - theme packs/skins to change the look of the site.&lt;br /&gt;
:&#039;&#039;user/&#039;&#039; - code to display and manage users&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Setting-up your system==&lt;br /&gt;
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.&lt;br /&gt;
&lt;br /&gt;
=== Check web server settings ===&lt;br /&gt;
&lt;br /&gt;
*Firstly, make sure that your web server is set up to use index.php as a default page (perhaps in addition to index.html, default.htm and so on). In Apache, this is done using a DirectoryIndex parameter in your httpd.conf file. Mine usually looks like this:&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; index.php index.html index.htm&lt;br /&gt;
&lt;br /&gt;
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).&lt;br /&gt;
&lt;br /&gt;
*Secondly, &#039;&#039;&#039;if you are using Apache 2&#039;&#039;&#039;, then you should turn on the &#039;&#039;AcceptPathInfo&#039;&#039; variable, which allows scripts to be passed arguments like &amp;lt;nowiki&amp;gt;http://server/file.php/arg1/arg2&amp;lt;/nowiki&amp;gt;. This is essential to allow relative links between your resources, and also provides a performance boost for people using your Moodle web site. You can turn this on by adding these lines to your httpd.conf file.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;AcceptPathInfo&#039;&#039;&#039; on&lt;br /&gt;
&lt;br /&gt;
=== Check PHP settings ===&lt;br /&gt;
Moodle requires a number of PHP settings to be active for it to work. &#039;&#039;&#039;On most servers these will already be the default settings&#039;&#039;&#039;.  However, some PHP servers (and some of the more recent PHP versions) may have things set differently. These are defined in PHP&#039;s configuration file (usually called &#039;&#039;&#039;php.ini&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 magic_quotes_gpc = 1    (preferred but not necessary)&lt;br /&gt;
 magic_quotes_runtime = 0    (necessary)&lt;br /&gt;
 file_uploads = 1&lt;br /&gt;
 session.auto_start = 0&lt;br /&gt;
 session.bug_compat_warn = 0&lt;br /&gt;
&lt;br /&gt;
:You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:&lt;br /&gt;
 &lt;br /&gt;
 post_max_size = 16M&lt;br /&gt;
 upload_max_filesize = 16M&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Using a .htaccess file for webserver and PHP settings ===&lt;br /&gt;
&lt;br /&gt;
Use the above if you can directly edit your server&#039;s files, but if you are setting-up Moodle on a webhost, or don&#039;t have access to &#039;&#039;&#039;httpd.conf&#039;&#039;&#039; or &#039;&#039;&#039;php.ini&#039;&#039;&#039; on your server, or you have Moodle on a server with other applications that require different settings, then don&#039;t worry, you can often still override the default settings. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration.&lt;br /&gt;
&lt;br /&gt;
* Create a file called &#039;&#039;&#039;.htaccess&#039;&#039;&#039; in Moodle&#039;s main directory that contains lines like the following. &lt;br /&gt;
&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
 php_flag magic_quotes_gpc 1&lt;br /&gt;
 php_flag magic_quotes_runtime 0&lt;br /&gt;
 php_flag file_uploads 1&lt;br /&gt;
 php_flag session.auto_start 0&lt;br /&gt;
 php_flag session.bug_compat_warn 0&lt;br /&gt;
&lt;br /&gt;
:If you have Apache version 2 installed, add these lines:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;IfDefine APACHE2&amp;gt;&lt;br /&gt;
     AcceptPathInfo on&lt;br /&gt;
 &amp;lt;/IfDefine&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Otherwise add this single line:&lt;br /&gt;
&lt;br /&gt;
 AcceptPathInfo on&lt;br /&gt;
&lt;br /&gt;
* Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:&lt;br /&gt;
&lt;br /&gt;
 LimitRequestBody 0&lt;br /&gt;
 php_value upload_max_filesize 2M&lt;br /&gt;
 php_value post_max_size 2M&lt;br /&gt;
     &lt;br /&gt;
* The easiest thing to do is just copy the sample file from lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:&lt;br /&gt;
&lt;br /&gt;
 cp lib/htaccess .htaccess&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Creating an empty database ===&lt;br /&gt;
&lt;br /&gt;
You need to create an empty database (eg &amp;quot;&#039;&#039;moodle&#039;&#039;&amp;quot;) in your database system along with a special user (eg &amp;quot;moodleuser&amp;quot;) that has access to that database (and that database only). You could use the &amp;quot;root&amp;quot; user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Warning&#039;&#039;&#039;: Bear in mind that, as of Moodle version 1.5.x, Moodle doesn&#039;t work with MySQL 5.x&#039;s strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL&#039;s configuration file (called &amp;quot;my.ini&amp;quot; in Windows and &amp;quot;my.cnf&amp;quot; on Unix/Linux) and comment out that option or set it to &amp;lt;code&amp;gt;sql-mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You have to restart MySQL after changing this setting. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt; If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command &amp;lt;code&amp;gt;SET @@global.sql_mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;;&amp;lt;/code&amp;gt; (be sure to use single quotes, and don&#039;t forget the semicolon).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 &amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
====Using a hosted server====&lt;br /&gt;
If you are using a webhost, they will probably have a control panel web interface for you to create your database.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;[http://www.cpanel.com/ cPanel]&#039;&#039;&#039; system is one of the most popular of these. &lt;br /&gt;
To create a database using cPanel:&lt;br /&gt;
&lt;br /&gt;
# Click on the &#039;&#039;&#039;MySQL Databases&#039;&#039;&#039; icon.&lt;br /&gt;
# Type &#039;&#039;&#039;moodle&#039;&#039;&#039; in the New Database field and click &#039;&#039;&#039;Create Database&#039;&#039;&#039;.&lt;br /&gt;
# Type a username and password (not one you use elsewhere) in the respective fields and click &#039;&#039;&#039;Create  User&#039;&#039;&#039;.&lt;br /&gt;
# Now use the &#039;&#039;&#039;Add Users to Databases&#039;&#039;&#039; button and give this new user account &#039;&#039;&#039;ALL&#039;&#039;&#039; rights to the new database.&lt;br /&gt;
# Note that the username and database names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.&lt;br /&gt;
&lt;br /&gt;
Continue with [[Installing_Moodle#CreDDir |Creating the data directory]]&lt;br /&gt;
&lt;br /&gt;
====Using the command line====&lt;br /&gt;
&lt;br /&gt;
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):&lt;br /&gt;
&lt;br /&gt;
- Start the MySQL Client program:&lt;br /&gt;
 #&#039;&#039;&#039;mysql -u root -p&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 Welcome to the MySQL monitor.  Commands end with ; or \g.&lt;br /&gt;
 Your MySQL connection id is 2 to server version: 5.0.22-log&lt;br /&gt;
 &lt;br /&gt;
 Type &#039;help;&#039; or &#039;\h&#039; for help. Type &#039;\c&#039; to clear the buffer.&lt;br /&gt;
 &lt;br /&gt;
 mysql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- The prompt changes to &amp;quot;mysql&amp;gt;&amp;quot; to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you&#039;ll get the line continuation symbol &#039;-&amp;gt;&#039;; this is your second chance to type the semi-colon and hit Enter.) &lt;br /&gt;
&lt;br /&gt;
- Begin by checking for any existing databases called &amp;quot;moodle&amp;quot; - if there are any you should change the name in all the commands which follow:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;SHOW DATABASES;&#039;&#039;&#039;&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | Database                |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | information_schema      |&lt;br /&gt;
 | mysql                   |&lt;br /&gt;
 | test                    |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 3 rows in set (0.03 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a database to store the Moodle tables. We&#039;ll call this &amp;quot;moodle&amp;quot;, as there are none with that name already in the above list, but change it if you need to.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;CREATE DATABASE moodle;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Change the default character set and collation of the &amp;quot;moodle&amp;quot; database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a username and password to access the database &amp;quot;moodle&amp;quot; and grant database access permissions. We&#039;ll call the user &amp;quot;moodleuser&amp;quot; and set the password as &amp;quot;yourpassword&amp;quot;. It&#039;s a good idea to change these for your installation however most people keep the username as &amp;quot;moodleuser&amp;quot;. Remember the username and password you have set, as you&#039;ll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;DROP,INDEX,ALTER ON moodle.*&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;TO moodleuser@localhost IDENTIFIED BY &#039;yourpassword&#039;;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 0 rows affected (0.01 sec)&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Security Warnings&#039;&#039;&#039;: Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting &amp;quot;ALL&amp;quot; permissions on the database.&lt;br /&gt;
: &#039;&#039;&#039;Note&#039;&#039;&#039;: For MySQL 4.0.1 or earlier, you don&#039;t need the CREATE TEMPORARY TABLES permission. &lt;br /&gt;
&lt;br /&gt;
- Exit the MySQL Client program:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;QUIT&#039;&#039;&#039;&lt;br /&gt;
 Bye&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
- Reload the grant tables using the mysqladmin program:&lt;br /&gt;
 #&#039;&#039;&#039;mysqladmin -u root -p reload&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
And some example command lines for PostgreSQL:&lt;br /&gt;
&lt;br /&gt;
   # su - postgres&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create user moodleuser createdb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create database moodle &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;with encoding &#039;unicode&#039;&amp;lt;/font&amp;gt;;&amp;quot; -U moodleuser template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser nocreatedb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser with encrypted password &#039;yourpassword&#039;;&amp;quot; template1&lt;br /&gt;
   &amp;gt; su - root&lt;br /&gt;
   # /etc/init.d/postgresql reload&lt;br /&gt;
&lt;br /&gt;
If the Postgres create database command above (&amp;gt;psql -c &amp;quot;create database moodle...&amp;quot;) gives an error message you may want to try:&lt;br /&gt;
 psql -c &amp;quot;create database moodle with template=template1 encoding = &#039;unicode&#039; owner =  moodleuser &amp;lt;br&amp;gt;     location = &#039;/var/mydata&#039;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If the create database command asks you for a password, run the line containing &#039;encrypted password&#039; first before proceeding.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;:&lt;br /&gt;
* Step-by-step instructions on  [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Creating the data directory (moodledata) ===&lt;br /&gt;
&lt;br /&gt;
Moodle will also need some space on your server&#039;s hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create this directory for you but if it fails then you will have to create a directory for this purpose manually.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security warning&#039;&#039;&#039;: For security purposes, it&#039;s best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called &#039;&#039;&#039;.htaccess&#039;&#039;&#039;, containing these lines:&lt;br /&gt;
&lt;br /&gt;
 order deny,allow&lt;br /&gt;
 deny from all&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ownership &amp;amp; Permissions&#039;&#039;&#039;: To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like &amp;quot;nobody&amp;quot; or &amp;quot;apache&amp;quot;, and then giving that user read, write and execute permissions. As an example, to change the owner to &amp;quot;nobody&amp;quot; you could use:&lt;br /&gt;
&lt;br /&gt;
 chown -R nobody:apache moodledata&lt;br /&gt;
&lt;br /&gt;
To change the permissions so that the owner has read,write and execute permissions, use something like this:&lt;br /&gt;
&lt;br /&gt;
 chmod -R 0770 moodledata&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you are receiving permission denied messages, try &#039;&#039;chmod -R 0770 moodledata&#039;&#039; and then adjust the settings so that they are more secure. A more secure setting is &#039;&#039;chmod -R 0750 moodledata&#039;&#039;. According to the comments in config-dist.php, &amp;quot;On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions.&amp;quot; To do this you could use &#039;&#039;chmod -R 707 moodledata&#039;&#039;. See also the [[Security | security page]].&lt;br /&gt;
&lt;br /&gt;
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the &#039;&#039;&#039;config.php&#039;&#039;&#039; file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:&lt;br /&gt;
&lt;br /&gt;
 $CFG-&amp;gt;dataroot  = &#039;/data/moodledata&#039;;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;CPanel and webhosts&#039;&#039;&#039;: On cPanel systems you can use the &amp;quot;File Manager&amp;quot; to find the folder, click on it, then choose &amp;quot;Change Permissions&amp;quot;. On many shared hosting servers, you will probably need to restrict all file access to your &amp;quot;group&amp;quot; (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as &amp;quot;&#039;&#039;&#039;Safe Mode&#039;&#039;&#039;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Run the installer script to create config.php ==&lt;br /&gt;
&lt;br /&gt;
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourserver/install.php&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039; directly.&lt;br /&gt;
&lt;br /&gt;
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)&lt;br /&gt;
&lt;br /&gt;
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called &#039;&#039;&#039;config.php&#039;&#039;&#039;. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload &#039;&#039;&#039;config.php&#039;&#039;&#039; into the main Moodle directory on the server.&lt;br /&gt;
&lt;br /&gt;
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Go to the admin page to continue configuration ==&lt;br /&gt;
&lt;br /&gt;
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the &amp;quot;admin&amp;quot; page for the rest of the configuration.&lt;br /&gt;
&lt;br /&gt;
The first time you access this admin page, you will be presented with a GPL &amp;quot;shrink wrap&amp;quot; agreement with which you must agree before you can continue with the setup.&lt;br /&gt;
&lt;br /&gt;
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:&lt;br /&gt;
&lt;br /&gt;
 CREATE TABLE course (&lt;br /&gt;
    id int(10) unsigned NOT NULL auto_increment,&lt;br /&gt;
    category int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    password varchar(50) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    fullname varchar(254) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    shortname varchar(15) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    summary text NOT NULL,&lt;br /&gt;
    format tinyint(4) NOT NULL default &#039;1&#039;,&lt;br /&gt;
    teacher varchar(100) NOT NULL default &#039;Teacher&#039;,&lt;br /&gt;
    startdate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    enddate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    timemodified int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
 ) TYPE=MyISAM;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SUCCESS&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...and so on, followed by: &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;Main databases set up successfully.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn&#039;t in a restricted &amp;quot;Safe Mode&amp;quot; (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing &#039;&#039;&#039;&amp;lt;?php phpinfo() ?&amp;gt;&#039;&#039;&#039; and looking at it through a browser. Check all these and try this page again.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don&#039;t worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the &amp;quot;buggy referrer&amp;quot; problem. This is easy to fix: just turn off the &amp;quot;secureforms&amp;quot; setting, then try to continue again.&lt;br /&gt;
&lt;br /&gt;
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;green&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click &amp;quot;Save changes&amp;quot;. Not all the fields are required, but if you miss any important fields you&#039;ll be re-prompted for them.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;, with password &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:&lt;br /&gt;
&lt;br /&gt;
* creating and deleting courses&lt;br /&gt;
* creating and editing user accounts&lt;br /&gt;
* administering teacher accounts&lt;br /&gt;
* changing site-wide settings like themes etc&lt;br /&gt;
&lt;br /&gt;
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Set up cron ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Cron|Cron instructions]].&lt;br /&gt;
&lt;br /&gt;
== Set up backups ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Backup settings| backup instructions]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Create a new course ==&lt;br /&gt;
&lt;br /&gt;
Now that Moodle is running properly, you can try creating a new course to play with.&lt;br /&gt;
&lt;br /&gt;
Select &amp;quot;Create a new course&amp;quot; from the Admin page (or the admin links on the home page).&lt;br /&gt;
&lt;br /&gt;
Fill out the form, paying special attention to the course format. You don&#039;t have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.&lt;br /&gt;
&lt;br /&gt;
Press &amp;quot;Save changes&amp;quot;, and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the &amp;quot;Add a new user&amp;quot; on the Admin page.&lt;br /&gt;
&lt;br /&gt;
Once done, the course is ready to customize, and is accessible via the &amp;quot;Courses&amp;quot; link on the home page.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation FAQ]]&lt;br /&gt;
*[[Complete install packages]] might be an easier first time installs on some systems&lt;br /&gt;
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop&lt;br /&gt;
* [[Upgrading Moodle]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion&lt;br /&gt;
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[cs:Instalace]]&lt;br /&gt;
[[de:Installieren von Moodle]]&lt;br /&gt;
[[es:Instalación de moodle]]&lt;br /&gt;
[[fr:Installation de Moodle]]&lt;br /&gt;
[[ja:Moodleのインストール]]&lt;br /&gt;
[[nl:Installatiegids]]&lt;br /&gt;
[[pl:Instalacja Moodle]]&lt;br /&gt;
[[pt:Instalação do Moodle]]&lt;br /&gt;
[[ru:Установка Moodle]]&lt;br /&gt;
[[sk:Inštalácia]]&lt;br /&gt;
[[zh:安装Moodlezh:]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31692</id>
		<title>Installing Moodle</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31692"/>
		<updated>2008-01-29T01:27:22Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: /* Using the command line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Firstly don&#039;t panic! :-)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don&#039;t panic, once you know how to do it you can install Moodle in minutes!&lt;br /&gt;
&lt;br /&gt;
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via  [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].&lt;br /&gt;
&lt;br /&gt;
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you]  through the process of choosing a host and setting up moodle via cpanel. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning:&#039;&#039;&#039; some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don&#039;t work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.&lt;br /&gt;
&lt;br /&gt;
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle&#039;s complete packages]]. They provide alternative instructions to install all this on most popular platforms.&lt;br /&gt;
==Table of Contents==&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Most web hosts support all of these requirements by default. You should contact your web host&#039;s support desk to check that this is the case &#039;&#039;&#039;before&#039;&#039;&#039; signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.&lt;br /&gt;
&lt;br /&gt;
The requirements for Moodle are as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hardware&#039;&#039;&#039; (unless you are using a hosted server). &lt;br /&gt;
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.&lt;br /&gt;
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 &#039;&#039;concurrent&#039;&#039; users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. &lt;br /&gt;
&#039;&#039;&#039;Software&#039;&#039;&#039;&lt;br /&gt;
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. &lt;br /&gt;
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.&lt;br /&gt;
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.&lt;br /&gt;
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. &lt;br /&gt;
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).&lt;br /&gt;
** PHP Settings&lt;br /&gt;
*** &#039;&#039;safe_mode&#039;&#039; needs to be OFF (check in your php.ini or Apache configuration file).&lt;br /&gt;
*** &#039;&#039;memory_limit&#039;&#039; should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.&lt;br /&gt;
*** &#039;&#039;session.save_handler&#039;&#039; needs to be set to files. &lt;br /&gt;
** PHP Extensions and libraries&lt;br /&gt;
*** The mbstring extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** The iconv extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.&lt;br /&gt;
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.&lt;br /&gt;
*** The pgsql extension is required if you are using the PostgreSQL database.&lt;br /&gt;
*** The zlib extension is required for zip/unzip functionality.&lt;br /&gt;
*** The curl extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The tokenizer extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is &#039;&#039;the&#039;&#039; choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. &lt;br /&gt;
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). &lt;br /&gt;
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).&lt;br /&gt;
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting &amp;quot;strict mode&amp;quot; must be OFF (set to &amp;quot;&amp;quot; or &amp;quot;MYSQL40&amp;quot;) in the MySQL configuration file. &lt;br /&gt;
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== How many users? ==&lt;br /&gt;
&lt;br /&gt;
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Browsing users&#039;&#039;&#039;: the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).&lt;br /&gt;
* &#039;&#039;&#039;Concurrent database users&#039;&#039;&#039;: the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.&lt;br /&gt;
&lt;br /&gt;
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. &lt;br /&gt;
&lt;br /&gt;
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.&lt;br /&gt;
&lt;br /&gt;
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Download and copy files into place ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Moodle, either as a compressed package or via CVS. &lt;br /&gt;
* There are two types of compressed packages on the  [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment.  &lt;br /&gt;
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. &lt;br /&gt;
&lt;br /&gt;
After downloading, unpack the archive using either &lt;br /&gt;
 tar -zxvf [filename]&lt;br /&gt;
or&lt;br /&gt;
 unzip [filename]&lt;br /&gt;
as appropriate. &lt;br /&gt;
&lt;br /&gt;
If using CVS, run the CVS Checkout command.&lt;br /&gt;
&lt;br /&gt;
You will now be left with a directory called &amp;quot;moodle&amp;quot;, containing a number of files and folders.&lt;br /&gt;
&lt;br /&gt;
You can either place the whole folder in your web server documents directory, in which case the site will be located at &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com/moodle&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;, or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the &amp;quot;File Manager&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Structure of moodle directory ===&lt;br /&gt;
&lt;br /&gt;
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;config.php&#039;&#039; - contains basic settings. This file does not come with Moodle - you will create it.&lt;br /&gt;
:&#039;&#039;install.php&#039;&#039; - the script you will run to create config.php&lt;br /&gt;
:&#039;&#039;version.php&#039;&#039; - defines the current version of Moodle code&lt;br /&gt;
:&#039;&#039;index.php&#039;&#039; - the front page of the site&lt;br /&gt;
:&#039;&#039;admin/&#039;&#039; - code to administrate the whole server&lt;br /&gt;
:&#039;&#039;auth/&#039;&#039; - plugin modules to authenticate users&lt;br /&gt;
:&#039;&#039;blocks/&#039;&#039; - plugin modules for the little side blocks on many pages&lt;br /&gt;
:&#039;&#039;calendar/&#039;&#039; - all the code for managing and displaying calendars&lt;br /&gt;
:&#039;&#039;course/&#039;&#039; - code to display and manage courses&lt;br /&gt;
:&#039;&#039;doc/&#039;&#039; - help documentation for Moodle (eg this page)&lt;br /&gt;
:&#039;&#039;files/&#039;&#039; - code to display and manage uploaded files&lt;br /&gt;
:&#039;&#039;lang/&#039;&#039; - texts in different languages, one directory per language&lt;br /&gt;
:&#039;&#039;lib/&#039;&#039; - libraries of core Moodle code&lt;br /&gt;
:&#039;&#039;login/&#039;&#039; - code to handle login and account creation&lt;br /&gt;
:&#039;&#039;mod/&#039;&#039; - all the main Moodle course modules are in here&lt;br /&gt;
:&#039;&#039;pix/&#039;&#039; - generic site graphics&lt;br /&gt;
:&#039;&#039;theme/&#039;&#039; - theme packs/skins to change the look of the site.&lt;br /&gt;
:&#039;&#039;user/&#039;&#039; - code to display and manage users&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Setting-up your system==&lt;br /&gt;
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.&lt;br /&gt;
&lt;br /&gt;
=== Check web server settings ===&lt;br /&gt;
&lt;br /&gt;
*Firstly, make sure that your web server is set up to use index.php as a default page (perhaps in addition to index.html, default.htm and so on). In Apache, this is done using a DirectoryIndex parameter in your httpd.conf file. Mine usually looks like this:&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; index.php index.html index.htm&lt;br /&gt;
&lt;br /&gt;
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).&lt;br /&gt;
&lt;br /&gt;
*Secondly, &#039;&#039;&#039;if you are using Apache 2&#039;&#039;&#039;, then you should turn on the &#039;&#039;AcceptPathInfo&#039;&#039; variable, which allows scripts to be passed arguments like &amp;lt;nowiki&amp;gt;http://server/file.php/arg1/arg2&amp;lt;/nowiki&amp;gt;. This is essential to allow relative links between your resources, and also provides a performance boost for people using your Moodle web site. You can turn this on by adding these lines to your httpd.conf file.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;AcceptPathInfo&#039;&#039;&#039; on&lt;br /&gt;
&lt;br /&gt;
=== Check PHP settings ===&lt;br /&gt;
Moodle requires a number of PHP settings to be active for it to work. &#039;&#039;&#039;On most servers these will already be the default settings&#039;&#039;&#039;.  However, some PHP servers (and some of the more recent PHP versions) may have things set differently. These are defined in PHP&#039;s configuration file (usually called &#039;&#039;&#039;php.ini&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 magic_quotes_gpc = 1    (preferred but not necessary)&lt;br /&gt;
 magic_quotes_runtime = 0    (necessary)&lt;br /&gt;
 file_uploads = 1&lt;br /&gt;
 session.auto_start = 0&lt;br /&gt;
 session.bug_compat_warn = 0&lt;br /&gt;
&lt;br /&gt;
:You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:&lt;br /&gt;
 &lt;br /&gt;
 post_max_size = 16M&lt;br /&gt;
 upload_max_filesize = 16M&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Using a .htaccess file for webserver and PHP settings ===&lt;br /&gt;
&lt;br /&gt;
Use the above if you can directly edit your server&#039;s files, but if you are setting-up Moodle on a webhost, or don&#039;t have access to &#039;&#039;&#039;httpd.conf&#039;&#039;&#039; or &#039;&#039;&#039;php.ini&#039;&#039;&#039; on your server, or you have Moodle on a server with other applications that require different settings, then don&#039;t worry, you can often still override the default settings. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration.&lt;br /&gt;
&lt;br /&gt;
* Create a file called &#039;&#039;&#039;.htaccess&#039;&#039;&#039; in Moodle&#039;s main directory that contains lines like the following. &lt;br /&gt;
&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
 php_flag magic_quotes_gpc 1&lt;br /&gt;
 php_flag magic_quotes_runtime 0&lt;br /&gt;
 php_flag file_uploads 1&lt;br /&gt;
 php_flag session.auto_start 0&lt;br /&gt;
 php_flag session.bug_compat_warn 0&lt;br /&gt;
&lt;br /&gt;
:If you have Apache version 2 installed, add these lines:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;IfDefine APACHE2&amp;gt;&lt;br /&gt;
     AcceptPathInfo on&lt;br /&gt;
 &amp;lt;/IfDefine&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Otherwise add this single line:&lt;br /&gt;
&lt;br /&gt;
 AcceptPathInfo on&lt;br /&gt;
&lt;br /&gt;
* Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:&lt;br /&gt;
&lt;br /&gt;
 LimitRequestBody 0&lt;br /&gt;
 php_value upload_max_filesize 2M&lt;br /&gt;
 php_value post_max_size 2M&lt;br /&gt;
     &lt;br /&gt;
* The easiest thing to do is just copy the sample file from lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:&lt;br /&gt;
&lt;br /&gt;
 cp lib/htaccess .htaccess&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Creating an empty database ===&lt;br /&gt;
&lt;br /&gt;
You need to create an empty database (eg &amp;quot;&#039;&#039;moodle&#039;&#039;&amp;quot;) in your database system along with a special user (eg &amp;quot;moodleuser&amp;quot;) that has access to that database (and that database only). You could use the &amp;quot;root&amp;quot; user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Warning&#039;&#039;&#039;: Bear in mind that, as of Moodle version 1.5.x, Moodle doesn&#039;t work with MySQL 5.x&#039;s strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL&#039;s configuration file (called &amp;quot;my.ini&amp;quot; in Windows and &amp;quot;my.cnf&amp;quot; on Unix/Linux) and comment out that option or set it to &amp;lt;code&amp;gt;sql-mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You have to restart MySQL after changing this setting. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt; If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command &amp;lt;code&amp;gt;SET @@global.sql_mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;;&amp;lt;/code&amp;gt; (be sure to use single quotes, and don&#039;t forget the semicolon).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 &amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
====Using a hosted server====&lt;br /&gt;
If you are using a webhost, they will probably have a control panel web interface for you to create your database.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;[http://www.cpanel.com/ cPanel]&#039;&#039;&#039; system is one of the most popular of these. &lt;br /&gt;
To create a database using cPanel:&lt;br /&gt;
&lt;br /&gt;
# Click on the &#039;&#039;&#039;MySQL Databases&#039;&#039;&#039; icon.&lt;br /&gt;
# Type &#039;&#039;&#039;moodle&#039;&#039;&#039; in the New Database field and click &#039;&#039;&#039;Create Database&#039;&#039;&#039;.&lt;br /&gt;
# Type a username and password (not one you use elsewhere) in the respective fields and click &#039;&#039;&#039;Create  User&#039;&#039;&#039;.&lt;br /&gt;
# Now use the &#039;&#039;&#039;Add Users to Databases&#039;&#039;&#039; button and give this new user account &#039;&#039;&#039;ALL&#039;&#039;&#039; rights to the new database.&lt;br /&gt;
# Note that the username and database names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.&lt;br /&gt;
&lt;br /&gt;
Continue with [https://docs.moodle.org/en/Installing_Moodle#CreDDir Creating the data directory]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using the command line====&lt;br /&gt;
&lt;br /&gt;
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):&lt;br /&gt;
&lt;br /&gt;
- Start the MySQL Client program:&lt;br /&gt;
 #&#039;&#039;&#039;mysql -u root -p&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 Welcome to the MySQL monitor.  Commands end with ; or \g.&lt;br /&gt;
 Your MySQL connection id is 2 to server version: 5.0.22-log&lt;br /&gt;
 &lt;br /&gt;
 Type &#039;help;&#039; or &#039;\h&#039; for help. Type &#039;\c&#039; to clear the buffer.&lt;br /&gt;
 &lt;br /&gt;
 mysql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- The prompt changes to &amp;quot;mysql&amp;gt;&amp;quot; to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you&#039;ll get the line continuation symbol &#039;-&amp;gt;&#039;; this is your second chance to type the semi-colon and hit Enter.) &lt;br /&gt;
&lt;br /&gt;
- Begin by checking for any existing databases called &amp;quot;moodle&amp;quot; - if there are any you should change the name in all the commands which follow:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;SHOW DATABASES;&#039;&#039;&#039;&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | Database                |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | information_schema      |&lt;br /&gt;
 | mysql                   |&lt;br /&gt;
 | test                    |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 3 rows in set (0.03 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a database to store the Moodle tables. We&#039;ll call this &amp;quot;moodle&amp;quot;, as there are none with that name already in the above list, but change it if you need to.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;CREATE DATABASE moodle;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Change the default character set and collation of the &amp;quot;moodle&amp;quot; database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a username and password to access the database &amp;quot;moodle&amp;quot; and grant database access permissions. We&#039;ll call the user &amp;quot;moodleuser&amp;quot; and set the password as &amp;quot;yourpassword&amp;quot;. It&#039;s a good idea to change these for your installation however most people keep the username as &amp;quot;moodleuser&amp;quot;. Remember the username and password you have set, as you&#039;ll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;DROP,INDEX,ALTER ON moodle.*&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;TO moodleuser@localhost IDENTIFIED BY &#039;yourpassword&#039;;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 0 rows affected (0.01 sec)&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Security Warnings&#039;&#039;&#039;: Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting &amp;quot;ALL&amp;quot; permissions on the database.&lt;br /&gt;
: &#039;&#039;&#039;Note&#039;&#039;&#039;: For MySQL 4.0.1 or earlier, you don&#039;t need the CREATE TEMPORARY TABLES permission. &lt;br /&gt;
&lt;br /&gt;
- Exit the MySQL Client program:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;QUIT&#039;&#039;&#039;&lt;br /&gt;
 Bye&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
- Reload the grant tables using the mysqladmin program:&lt;br /&gt;
 #&#039;&#039;&#039;mysqladmin -u root -p reload&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
And some example command lines for PostgreSQL:&lt;br /&gt;
&lt;br /&gt;
   # su - postgres&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create user moodleuser createdb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create database moodle &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;with encoding &#039;unicode&#039;&amp;lt;/font&amp;gt;;&amp;quot; -U moodleuser template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser nocreatedb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser with encrypted password &#039;yourpassword&#039;;&amp;quot; template1&lt;br /&gt;
   &amp;gt; su - root&lt;br /&gt;
   # /etc/init.d/postgresql reload&lt;br /&gt;
&lt;br /&gt;
If the Postgres create database command above (&amp;gt;psql -c &amp;quot;create database moodle...&amp;quot;) gives an error message you may want to try:&lt;br /&gt;
 psql -c &amp;quot;create database moodle with template=template1 encoding = &#039;unicode&#039; owner =  moodleuser &amp;lt;br&amp;gt;     location = &#039;/var/mydata&#039;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If the create database command asks you for a password, run the line containing &#039;encrypted password&#039; first before proceeding.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;:&lt;br /&gt;
* Step-by-step instructions on  [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Creating the data directory (moodledata) ===&lt;br /&gt;
&lt;br /&gt;
Moodle will also need some space on your server&#039;s hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create this directory for you but if it fails then you will have to create a directory for this purpose manually.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security warning&#039;&#039;&#039;: For security purposes, it&#039;s best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called &#039;&#039;&#039;.htaccess&#039;&#039;&#039;, containing these lines:&lt;br /&gt;
&lt;br /&gt;
 order deny,allow&lt;br /&gt;
 deny from all&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ownership &amp;amp; Permissions&#039;&#039;&#039;: To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like &amp;quot;nobody&amp;quot; or &amp;quot;apache&amp;quot;, and then giving that user read, write and execute permissions. As an example, to change the owner to &amp;quot;nobody&amp;quot; you could use:&lt;br /&gt;
&lt;br /&gt;
 chown -R nobody:apache moodledata&lt;br /&gt;
&lt;br /&gt;
To change the permissions so that the owner has read,write and execute permissions, use something like this:&lt;br /&gt;
&lt;br /&gt;
 chmod -R 0770 moodledata&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you are receiving permission denied messages, try &#039;&#039;chmod -R 0770 moodledata&#039;&#039; and then adjust the settings so that they are more secure. A more secure setting is &#039;&#039;chmod -R 0750 moodledata&#039;&#039;. According to the comments in config-dist.php, &amp;quot;On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions.&amp;quot; To do this you could use &#039;&#039;chmod -R 707 moodledata&#039;&#039;. See also the [[Security | security page]].&lt;br /&gt;
&lt;br /&gt;
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the &#039;&#039;&#039;config.php&#039;&#039;&#039; file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:&lt;br /&gt;
&lt;br /&gt;
 $CFG-&amp;gt;dataroot  = &#039;/data/moodledata&#039;;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;CPanel and webhosts&#039;&#039;&#039;: On cPanel systems you can use the &amp;quot;File Manager&amp;quot; to find the folder, click on it, then choose &amp;quot;Change Permissions&amp;quot;. On many shared hosting servers, you will probably need to restrict all file access to your &amp;quot;group&amp;quot; (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as &amp;quot;&#039;&#039;&#039;Safe Mode&#039;&#039;&#039;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Run the installer script to create config.php ==&lt;br /&gt;
&lt;br /&gt;
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourserver/install.php&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039; directly.&lt;br /&gt;
&lt;br /&gt;
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)&lt;br /&gt;
&lt;br /&gt;
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called &#039;&#039;&#039;config.php&#039;&#039;&#039;. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload &#039;&#039;&#039;config.php&#039;&#039;&#039; into the main Moodle directory on the server.&lt;br /&gt;
&lt;br /&gt;
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Go to the admin page to continue configuration ==&lt;br /&gt;
&lt;br /&gt;
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the &amp;quot;admin&amp;quot; page for the rest of the configuration.&lt;br /&gt;
&lt;br /&gt;
The first time you access this admin page, you will be presented with a GPL &amp;quot;shrink wrap&amp;quot; agreement with which you must agree before you can continue with the setup.&lt;br /&gt;
&lt;br /&gt;
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:&lt;br /&gt;
&lt;br /&gt;
 CREATE TABLE course (&lt;br /&gt;
    id int(10) unsigned NOT NULL auto_increment,&lt;br /&gt;
    category int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    password varchar(50) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    fullname varchar(254) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    shortname varchar(15) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    summary text NOT NULL,&lt;br /&gt;
    format tinyint(4) NOT NULL default &#039;1&#039;,&lt;br /&gt;
    teacher varchar(100) NOT NULL default &#039;Teacher&#039;,&lt;br /&gt;
    startdate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    enddate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    timemodified int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
 ) TYPE=MyISAM;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SUCCESS&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...and so on, followed by: &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;Main databases set up successfully.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn&#039;t in a restricted &amp;quot;Safe Mode&amp;quot; (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing &#039;&#039;&#039;&amp;lt;?php phpinfo() ?&amp;gt;&#039;&#039;&#039; and looking at it through a browser. Check all these and try this page again.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don&#039;t worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the &amp;quot;buggy referrer&amp;quot; problem. This is easy to fix: just turn off the &amp;quot;secureforms&amp;quot; setting, then try to continue again.&lt;br /&gt;
&lt;br /&gt;
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;green&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click &amp;quot;Save changes&amp;quot;. Not all the fields are required, but if you miss any important fields you&#039;ll be re-prompted for them.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;, with password &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:&lt;br /&gt;
&lt;br /&gt;
* creating and deleting courses&lt;br /&gt;
* creating and editing user accounts&lt;br /&gt;
* administering teacher accounts&lt;br /&gt;
* changing site-wide settings like themes etc&lt;br /&gt;
&lt;br /&gt;
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Set up cron ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Cron|Cron instructions]].&lt;br /&gt;
&lt;br /&gt;
== Set up backups ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Backup settings| backup instructions]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Create a new course ==&lt;br /&gt;
&lt;br /&gt;
Now that Moodle is running properly, you can try creating a new course to play with.&lt;br /&gt;
&lt;br /&gt;
Select &amp;quot;Create a new course&amp;quot; from the Admin page (or the admin links on the home page).&lt;br /&gt;
&lt;br /&gt;
Fill out the form, paying special attention to the course format. You don&#039;t have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.&lt;br /&gt;
&lt;br /&gt;
Press &amp;quot;Save changes&amp;quot;, and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the &amp;quot;Add a new user&amp;quot; on the Admin page.&lt;br /&gt;
&lt;br /&gt;
Once done, the course is ready to customize, and is accessible via the &amp;quot;Courses&amp;quot; link on the home page.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation FAQ]]&lt;br /&gt;
*[[Complete install packages]] might be an easier first time installs on some systems&lt;br /&gt;
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop&lt;br /&gt;
* [[Upgrading Moodle]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion&lt;br /&gt;
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[cs:Instalace]]&lt;br /&gt;
[[de:Installieren von Moodle]]&lt;br /&gt;
[[es:Instalación de moodle]]&lt;br /&gt;
[[fr:Installation de Moodle]]&lt;br /&gt;
[[ja:Moodleのインストール]]&lt;br /&gt;
[[nl:Installatiegids]]&lt;br /&gt;
[[pl:Instalacja Moodle]]&lt;br /&gt;
[[pt:Instalação do Moodle]]&lt;br /&gt;
[[ru:Установка Moodle]]&lt;br /&gt;
[[sk:Inštalácia]]&lt;br /&gt;
[[zh:安装Moodlezh:]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31691</id>
		<title>Installing Moodle</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31691"/>
		<updated>2008-01-29T01:25:46Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: /* Creating the data directory (moodledata) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Firstly don&#039;t panic! :-)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don&#039;t panic, once you know how to do it you can install Moodle in minutes!&lt;br /&gt;
&lt;br /&gt;
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via  [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].&lt;br /&gt;
&lt;br /&gt;
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you]  through the process of choosing a host and setting up moodle via cpanel. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning:&#039;&#039;&#039; some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don&#039;t work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.&lt;br /&gt;
&lt;br /&gt;
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle&#039;s complete packages]]. They provide alternative instructions to install all this on most popular platforms.&lt;br /&gt;
==Table of Contents==&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Most web hosts support all of these requirements by default. You should contact your web host&#039;s support desk to check that this is the case &#039;&#039;&#039;before&#039;&#039;&#039; signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.&lt;br /&gt;
&lt;br /&gt;
The requirements for Moodle are as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hardware&#039;&#039;&#039; (unless you are using a hosted server). &lt;br /&gt;
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.&lt;br /&gt;
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 &#039;&#039;concurrent&#039;&#039; users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. &lt;br /&gt;
&#039;&#039;&#039;Software&#039;&#039;&#039;&lt;br /&gt;
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. &lt;br /&gt;
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.&lt;br /&gt;
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.&lt;br /&gt;
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. &lt;br /&gt;
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).&lt;br /&gt;
** PHP Settings&lt;br /&gt;
*** &#039;&#039;safe_mode&#039;&#039; needs to be OFF (check in your php.ini or Apache configuration file).&lt;br /&gt;
*** &#039;&#039;memory_limit&#039;&#039; should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.&lt;br /&gt;
*** &#039;&#039;session.save_handler&#039;&#039; needs to be set to files. &lt;br /&gt;
** PHP Extensions and libraries&lt;br /&gt;
*** The mbstring extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** The iconv extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.&lt;br /&gt;
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.&lt;br /&gt;
*** The pgsql extension is required if you are using the PostgreSQL database.&lt;br /&gt;
*** The zlib extension is required for zip/unzip functionality.&lt;br /&gt;
*** The curl extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The tokenizer extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is &#039;&#039;the&#039;&#039; choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. &lt;br /&gt;
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). &lt;br /&gt;
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).&lt;br /&gt;
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting &amp;quot;strict mode&amp;quot; must be OFF (set to &amp;quot;&amp;quot; or &amp;quot;MYSQL40&amp;quot;) in the MySQL configuration file. &lt;br /&gt;
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== How many users? ==&lt;br /&gt;
&lt;br /&gt;
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Browsing users&#039;&#039;&#039;: the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).&lt;br /&gt;
* &#039;&#039;&#039;Concurrent database users&#039;&#039;&#039;: the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.&lt;br /&gt;
&lt;br /&gt;
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. &lt;br /&gt;
&lt;br /&gt;
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.&lt;br /&gt;
&lt;br /&gt;
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Download and copy files into place ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Moodle, either as a compressed package or via CVS. &lt;br /&gt;
* There are two types of compressed packages on the  [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment.  &lt;br /&gt;
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. &lt;br /&gt;
&lt;br /&gt;
After downloading, unpack the archive using either &lt;br /&gt;
 tar -zxvf [filename]&lt;br /&gt;
or&lt;br /&gt;
 unzip [filename]&lt;br /&gt;
as appropriate. &lt;br /&gt;
&lt;br /&gt;
If using CVS, run the CVS Checkout command.&lt;br /&gt;
&lt;br /&gt;
You will now be left with a directory called &amp;quot;moodle&amp;quot;, containing a number of files and folders.&lt;br /&gt;
&lt;br /&gt;
You can either place the whole folder in your web server documents directory, in which case the site will be located at &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com/moodle&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;, or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the &amp;quot;File Manager&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Structure of moodle directory ===&lt;br /&gt;
&lt;br /&gt;
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;config.php&#039;&#039; - contains basic settings. This file does not come with Moodle - you will create it.&lt;br /&gt;
:&#039;&#039;install.php&#039;&#039; - the script you will run to create config.php&lt;br /&gt;
:&#039;&#039;version.php&#039;&#039; - defines the current version of Moodle code&lt;br /&gt;
:&#039;&#039;index.php&#039;&#039; - the front page of the site&lt;br /&gt;
:&#039;&#039;admin/&#039;&#039; - code to administrate the whole server&lt;br /&gt;
:&#039;&#039;auth/&#039;&#039; - plugin modules to authenticate users&lt;br /&gt;
:&#039;&#039;blocks/&#039;&#039; - plugin modules for the little side blocks on many pages&lt;br /&gt;
:&#039;&#039;calendar/&#039;&#039; - all the code for managing and displaying calendars&lt;br /&gt;
:&#039;&#039;course/&#039;&#039; - code to display and manage courses&lt;br /&gt;
:&#039;&#039;doc/&#039;&#039; - help documentation for Moodle (eg this page)&lt;br /&gt;
:&#039;&#039;files/&#039;&#039; - code to display and manage uploaded files&lt;br /&gt;
:&#039;&#039;lang/&#039;&#039; - texts in different languages, one directory per language&lt;br /&gt;
:&#039;&#039;lib/&#039;&#039; - libraries of core Moodle code&lt;br /&gt;
:&#039;&#039;login/&#039;&#039; - code to handle login and account creation&lt;br /&gt;
:&#039;&#039;mod/&#039;&#039; - all the main Moodle course modules are in here&lt;br /&gt;
:&#039;&#039;pix/&#039;&#039; - generic site graphics&lt;br /&gt;
:&#039;&#039;theme/&#039;&#039; - theme packs/skins to change the look of the site.&lt;br /&gt;
:&#039;&#039;user/&#039;&#039; - code to display and manage users&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Setting-up your system==&lt;br /&gt;
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.&lt;br /&gt;
&lt;br /&gt;
=== Check web server settings ===&lt;br /&gt;
&lt;br /&gt;
*Firstly, make sure that your web server is set up to use index.php as a default page (perhaps in addition to index.html, default.htm and so on). In Apache, this is done using a DirectoryIndex parameter in your httpd.conf file. Mine usually looks like this:&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; index.php index.html index.htm&lt;br /&gt;
&lt;br /&gt;
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).&lt;br /&gt;
&lt;br /&gt;
*Secondly, &#039;&#039;&#039;if you are using Apache 2&#039;&#039;&#039;, then you should turn on the &#039;&#039;AcceptPathInfo&#039;&#039; variable, which allows scripts to be passed arguments like &amp;lt;nowiki&amp;gt;http://server/file.php/arg1/arg2&amp;lt;/nowiki&amp;gt;. This is essential to allow relative links between your resources, and also provides a performance boost for people using your Moodle web site. You can turn this on by adding these lines to your httpd.conf file.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;AcceptPathInfo&#039;&#039;&#039; on&lt;br /&gt;
&lt;br /&gt;
=== Check PHP settings ===&lt;br /&gt;
Moodle requires a number of PHP settings to be active for it to work. &#039;&#039;&#039;On most servers these will already be the default settings&#039;&#039;&#039;.  However, some PHP servers (and some of the more recent PHP versions) may have things set differently. These are defined in PHP&#039;s configuration file (usually called &#039;&#039;&#039;php.ini&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 magic_quotes_gpc = 1    (preferred but not necessary)&lt;br /&gt;
 magic_quotes_runtime = 0    (necessary)&lt;br /&gt;
 file_uploads = 1&lt;br /&gt;
 session.auto_start = 0&lt;br /&gt;
 session.bug_compat_warn = 0&lt;br /&gt;
&lt;br /&gt;
:You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:&lt;br /&gt;
 &lt;br /&gt;
 post_max_size = 16M&lt;br /&gt;
 upload_max_filesize = 16M&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Using a .htaccess file for webserver and PHP settings ===&lt;br /&gt;
&lt;br /&gt;
Use the above if you can directly edit your server&#039;s files, but if you are setting-up Moodle on a webhost, or don&#039;t have access to &#039;&#039;&#039;httpd.conf&#039;&#039;&#039; or &#039;&#039;&#039;php.ini&#039;&#039;&#039; on your server, or you have Moodle on a server with other applications that require different settings, then don&#039;t worry, you can often still override the default settings. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration.&lt;br /&gt;
&lt;br /&gt;
* Create a file called &#039;&#039;&#039;.htaccess&#039;&#039;&#039; in Moodle&#039;s main directory that contains lines like the following. &lt;br /&gt;
&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
 php_flag magic_quotes_gpc 1&lt;br /&gt;
 php_flag magic_quotes_runtime 0&lt;br /&gt;
 php_flag file_uploads 1&lt;br /&gt;
 php_flag session.auto_start 0&lt;br /&gt;
 php_flag session.bug_compat_warn 0&lt;br /&gt;
&lt;br /&gt;
:If you have Apache version 2 installed, add these lines:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;IfDefine APACHE2&amp;gt;&lt;br /&gt;
     AcceptPathInfo on&lt;br /&gt;
 &amp;lt;/IfDefine&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Otherwise add this single line:&lt;br /&gt;
&lt;br /&gt;
 AcceptPathInfo on&lt;br /&gt;
&lt;br /&gt;
* Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:&lt;br /&gt;
&lt;br /&gt;
 LimitRequestBody 0&lt;br /&gt;
 php_value upload_max_filesize 2M&lt;br /&gt;
 php_value post_max_size 2M&lt;br /&gt;
     &lt;br /&gt;
* The easiest thing to do is just copy the sample file from lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:&lt;br /&gt;
&lt;br /&gt;
 cp lib/htaccess .htaccess&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Creating an empty database ===&lt;br /&gt;
&lt;br /&gt;
You need to create an empty database (eg &amp;quot;&#039;&#039;moodle&#039;&#039;&amp;quot;) in your database system along with a special user (eg &amp;quot;moodleuser&amp;quot;) that has access to that database (and that database only). You could use the &amp;quot;root&amp;quot; user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Warning&#039;&#039;&#039;: Bear in mind that, as of Moodle version 1.5.x, Moodle doesn&#039;t work with MySQL 5.x&#039;s strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL&#039;s configuration file (called &amp;quot;my.ini&amp;quot; in Windows and &amp;quot;my.cnf&amp;quot; on Unix/Linux) and comment out that option or set it to &amp;lt;code&amp;gt;sql-mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You have to restart MySQL after changing this setting. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt; If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command &amp;lt;code&amp;gt;SET @@global.sql_mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;;&amp;lt;/code&amp;gt; (be sure to use single quotes, and don&#039;t forget the semicolon).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 &amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
====Using a hosted server====&lt;br /&gt;
If you are using a webhost, they will probably have a control panel web interface for you to create your database.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;[http://www.cpanel.com/ cPanel]&#039;&#039;&#039; system is one of the most popular of these. &lt;br /&gt;
To create a database using cPanel:&lt;br /&gt;
&lt;br /&gt;
# Click on the &#039;&#039;&#039;MySQL Databases&#039;&#039;&#039; icon.&lt;br /&gt;
# Type &#039;&#039;&#039;moodle&#039;&#039;&#039; in the New Database field and click &#039;&#039;&#039;Create Database&#039;&#039;&#039;.&lt;br /&gt;
# Type a username and password (not one you use elsewhere) in the respective fields and click &#039;&#039;&#039;Create  User&#039;&#039;&#039;.&lt;br /&gt;
# Now use the &#039;&#039;&#039;Add Users to Databases&#039;&#039;&#039; button and give this new user account &#039;&#039;&#039;ALL&#039;&#039;&#039; rights to the new database.&lt;br /&gt;
# Note that the username and database names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.&lt;br /&gt;
&lt;br /&gt;
Continue with [https://docs.moodle.org/en/Installing_Moodle#CreDDir Creating the data directory]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using the command line====&lt;br /&gt;
&lt;br /&gt;
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):&lt;br /&gt;
&lt;br /&gt;
- Start the MySQL Client program:&lt;br /&gt;
 #&#039;&#039;&#039;mysql -u root -p&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 Welcome to the MySQL monitor.  Commands end with ; or \g.&lt;br /&gt;
 Your MySQL connection id is 2 to server version: 5.0.22-log&lt;br /&gt;
 &lt;br /&gt;
 Type &#039;help;&#039; or &#039;\h&#039; for help. Type &#039;\c&#039; to clear the buffer.&lt;br /&gt;
 &lt;br /&gt;
 mysql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- The prompt changes to &amp;quot;mysql&amp;gt;&amp;quot; to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you&#039;ll get the line continuation symbol &#039;-&amp;gt;&#039;; this is your second chance to type the semi-colon and hit Enter.) &lt;br /&gt;
&lt;br /&gt;
- Begin by checking for any existing databases called &amp;quot;moodle&amp;quot; - if there are any you should change the name in all the commands which follow:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;SHOW DATABASES;&#039;&#039;&#039;&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | Database                |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | information_schema      |&lt;br /&gt;
 | mysql                   |&lt;br /&gt;
 | test                    |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 3 rows in set (0.03 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a database to store the Moodle tables. We&#039;ll call this &amp;quot;moodle&amp;quot;, as there are none with that name already in the above list, but change it if you need to.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;CREATE DATABASE moodle;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Change the default character set and collation of the &amp;quot;moodle&amp;quot; database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a username and password to access the database &amp;quot;moodle&amp;quot; and grant database access permissions. We&#039;ll call the user &amp;quot;moodleuser&amp;quot; and set the password as &amp;quot;yourpassword&amp;quot;. It&#039;s a good idea to change these for your installation however most people keep the username as &amp;quot;moodleuser&amp;quot;. Remember the username and password you have set, as you&#039;ll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;DROP,INDEX,ALTER ON moodle.*&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;TO moodleuser@localhost IDENTIFIED BY &#039;yourpassword&#039;;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 0 rows affected (0.01 sec)&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Security Warnings&#039;&#039;&#039;: Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting &amp;quot;ALL&amp;quot; permissions on the database.&lt;br /&gt;
: &#039;&#039;&#039;Note&#039;&#039;&#039;: For MySQL 4.0.1 or earlier, you don&#039;t need the CREATE TEMPORARY TABLES permission. &lt;br /&gt;
&lt;br /&gt;
- Exit the MySQL Client program:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;QUIT&#039;&#039;&#039;&lt;br /&gt;
 Bye&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
- Reload the grant tables using the mysqladmin program:&lt;br /&gt;
 #&#039;&#039;&#039;mysqladmin -u root -p reload&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
And some example command lines for PostgreSQL:&lt;br /&gt;
&lt;br /&gt;
   # su - postgres&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create user moodleuser createdb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create database moodle &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;with encoding &#039;unicode&#039;&amp;lt;/font&amp;gt;;&amp;quot; -U moodleuser template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser nocreatedb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser with encrypted password &#039;yourpassword&#039;;&amp;quot; template1&lt;br /&gt;
   &amp;gt; su - root&lt;br /&gt;
   # /etc/init.d/postgresql reload&lt;br /&gt;
&lt;br /&gt;
If the Postgres create database command above (&amp;gt;psql -c &amp;quot;create database moodle...&amp;quot;) gives an error message you may want to try:&lt;br /&gt;
 psql -c &amp;quot;create database moodle with template=template1 encoding = &#039;unicode&#039; owner =  moodleuser &amp;lt;br&amp;gt;     location = &#039;/var/mydata&#039;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If the create database command asks you for a password, run the line containing &#039;encrypted password&#039; first before proceeding.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;:&lt;br /&gt;
* Step-by-step instructions on  [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;a id=CreDDir&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Creating the data directory (moodledata) ===&lt;br /&gt;
&lt;br /&gt;
Moodle will also need some space on your server&#039;s hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create this directory for you but if it fails then you will have to create a directory for this purpose manually.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security warning&#039;&#039;&#039;: For security purposes, it&#039;s best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called &#039;&#039;&#039;.htaccess&#039;&#039;&#039;, containing these lines:&lt;br /&gt;
&lt;br /&gt;
 order deny,allow&lt;br /&gt;
 deny from all&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ownership &amp;amp; Permissions&#039;&#039;&#039;: To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like &amp;quot;nobody&amp;quot; or &amp;quot;apache&amp;quot;, and then giving that user read, write and execute permissions. As an example, to change the owner to &amp;quot;nobody&amp;quot; you could use:&lt;br /&gt;
&lt;br /&gt;
 chown -R nobody:apache moodledata&lt;br /&gt;
&lt;br /&gt;
To change the permissions so that the owner has read,write and execute permissions, use something like this:&lt;br /&gt;
&lt;br /&gt;
 chmod -R 0770 moodledata&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you are receiving permission denied messages, try &#039;&#039;chmod -R 0770 moodledata&#039;&#039; and then adjust the settings so that they are more secure. A more secure setting is &#039;&#039;chmod -R 0750 moodledata&#039;&#039;. According to the comments in config-dist.php, &amp;quot;On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions.&amp;quot; To do this you could use &#039;&#039;chmod -R 707 moodledata&#039;&#039;. See also the [[Security | security page]].&lt;br /&gt;
&lt;br /&gt;
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the &#039;&#039;&#039;config.php&#039;&#039;&#039; file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:&lt;br /&gt;
&lt;br /&gt;
 $CFG-&amp;gt;dataroot  = &#039;/data/moodledata&#039;;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;CPanel and webhosts&#039;&#039;&#039;: On cPanel systems you can use the &amp;quot;File Manager&amp;quot; to find the folder, click on it, then choose &amp;quot;Change Permissions&amp;quot;. On many shared hosting servers, you will probably need to restrict all file access to your &amp;quot;group&amp;quot; (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as &amp;quot;&#039;&#039;&#039;Safe Mode&#039;&#039;&#039;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Run the installer script to create config.php ==&lt;br /&gt;
&lt;br /&gt;
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourserver/install.php&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039; directly.&lt;br /&gt;
&lt;br /&gt;
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)&lt;br /&gt;
&lt;br /&gt;
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called &#039;&#039;&#039;config.php&#039;&#039;&#039;. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload &#039;&#039;&#039;config.php&#039;&#039;&#039; into the main Moodle directory on the server.&lt;br /&gt;
&lt;br /&gt;
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Go to the admin page to continue configuration ==&lt;br /&gt;
&lt;br /&gt;
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the &amp;quot;admin&amp;quot; page for the rest of the configuration.&lt;br /&gt;
&lt;br /&gt;
The first time you access this admin page, you will be presented with a GPL &amp;quot;shrink wrap&amp;quot; agreement with which you must agree before you can continue with the setup.&lt;br /&gt;
&lt;br /&gt;
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:&lt;br /&gt;
&lt;br /&gt;
 CREATE TABLE course (&lt;br /&gt;
    id int(10) unsigned NOT NULL auto_increment,&lt;br /&gt;
    category int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    password varchar(50) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    fullname varchar(254) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    shortname varchar(15) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    summary text NOT NULL,&lt;br /&gt;
    format tinyint(4) NOT NULL default &#039;1&#039;,&lt;br /&gt;
    teacher varchar(100) NOT NULL default &#039;Teacher&#039;,&lt;br /&gt;
    startdate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    enddate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    timemodified int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
 ) TYPE=MyISAM;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SUCCESS&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...and so on, followed by: &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;Main databases set up successfully.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn&#039;t in a restricted &amp;quot;Safe Mode&amp;quot; (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing &#039;&#039;&#039;&amp;lt;?php phpinfo() ?&amp;gt;&#039;&#039;&#039; and looking at it through a browser. Check all these and try this page again.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don&#039;t worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the &amp;quot;buggy referrer&amp;quot; problem. This is easy to fix: just turn off the &amp;quot;secureforms&amp;quot; setting, then try to continue again.&lt;br /&gt;
&lt;br /&gt;
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;green&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click &amp;quot;Save changes&amp;quot;. Not all the fields are required, but if you miss any important fields you&#039;ll be re-prompted for them.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;, with password &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:&lt;br /&gt;
&lt;br /&gt;
* creating and deleting courses&lt;br /&gt;
* creating and editing user accounts&lt;br /&gt;
* administering teacher accounts&lt;br /&gt;
* changing site-wide settings like themes etc&lt;br /&gt;
&lt;br /&gt;
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Set up cron ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Cron|Cron instructions]].&lt;br /&gt;
&lt;br /&gt;
== Set up backups ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Backup settings| backup instructions]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Create a new course ==&lt;br /&gt;
&lt;br /&gt;
Now that Moodle is running properly, you can try creating a new course to play with.&lt;br /&gt;
&lt;br /&gt;
Select &amp;quot;Create a new course&amp;quot; from the Admin page (or the admin links on the home page).&lt;br /&gt;
&lt;br /&gt;
Fill out the form, paying special attention to the course format. You don&#039;t have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.&lt;br /&gt;
&lt;br /&gt;
Press &amp;quot;Save changes&amp;quot;, and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the &amp;quot;Add a new user&amp;quot; on the Admin page.&lt;br /&gt;
&lt;br /&gt;
Once done, the course is ready to customize, and is accessible via the &amp;quot;Courses&amp;quot; link on the home page.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation FAQ]]&lt;br /&gt;
*[[Complete install packages]] might be an easier first time installs on some systems&lt;br /&gt;
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop&lt;br /&gt;
* [[Upgrading Moodle]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion&lt;br /&gt;
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[cs:Instalace]]&lt;br /&gt;
[[de:Installieren von Moodle]]&lt;br /&gt;
[[es:Instalación de moodle]]&lt;br /&gt;
[[fr:Installation de Moodle]]&lt;br /&gt;
[[ja:Moodleのインストール]]&lt;br /&gt;
[[nl:Installatiegids]]&lt;br /&gt;
[[pl:Instalacja Moodle]]&lt;br /&gt;
[[pt:Instalação do Moodle]]&lt;br /&gt;
[[ru:Установка Moodle]]&lt;br /&gt;
[[sk:Inštalácia]]&lt;br /&gt;
[[zh:安装Moodlezh:]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31690</id>
		<title>Installing Moodle</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/32/en/index.php?title=Installing_Moodle&amp;diff=31690"/>
		<updated>2008-01-29T01:24:20Z</updated>

		<summary type="html">&lt;p&gt;Dgerman: /* Using a hosted server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Firstly don&#039;t panic! :-)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this page may look long and complicated. Don&#039;t panic, once you know how to do it you can install Moodle in minutes!&lt;br /&gt;
&lt;br /&gt;
If you have problems please read this page carefully - most common issues are answered in here. If you still have trouble, you can seek help from the Moodle community via  [http://moodle.org/course/view.php?id=5 moodle.org Using Moodle].&lt;br /&gt;
&lt;br /&gt;
Another option is to contact a [http://moodle.com/hosting/ Moodle Partner providing Moodle hosting] who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating! A Moodle partner is the preferred option but if you decide to choose a hosting company that has cpanel then [http://otaru-jc.ac.jp/hagley/settingupmoodleonhostingwithcpanel.swf this tutorial will guide you]  through the process of choosing a host and setting up moodle via cpanel. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning:&#039;&#039;&#039; some hosting companies offer one-click moodle install options, which whilst sometimes effective, usually use old (sometimes years old) versions of moodle and sometimes simply don&#039;t work. If one of these goes wrong, your best bet is often to start from scratch following the instructions here yourself. Its almost certainly quicker.&lt;br /&gt;
&lt;br /&gt;
If you want to run Moodle on your own computer and this page looks a bit daunting, then please see our guides: [[Installing AMP |Installing Apache, MySQL and PHP(AMP)]] or [[Complete install packages| how to install one of Moodle&#039;s complete packages]]. They provide alternative instructions to install all this on most popular platforms.&lt;br /&gt;
==Table of Contents==&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
&lt;br /&gt;
Moodle is primarily developed in Linux using [[Apache]], [[MySQL]] and [[PHP]] (also sometimes known as the LAMP platform), but is also regularly tested with Windows XP/2000/2003 (WAMP), Solaris 10 (Sparc and x64), Mac OS X and Netware 6 operating systems. Support for PostgreSQL, Oracle and Microsoft SQL Server is also available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Blank page problem while installing Moodle on Windows Vista may occur; following these steps: [[Installing Moodle on Windows Vista]] might help.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Most web hosts support all of these requirements by default. You should contact your web host&#039;s support desk to check that this is the case &#039;&#039;&#039;before&#039;&#039;&#039; signing-up with them. It is especially important to ask about any PHP memory limits or MySQL question limits. If your prospective host does not provide a service which meets these requirements, or you are already signed up with them, ask them why and consider taking your business elsewhere if they do not change.&lt;br /&gt;
&lt;br /&gt;
The requirements for Moodle are as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hardware&#039;&#039;&#039; (unless you are using a hosted server). &lt;br /&gt;
* Disk space: 160MB free (min). You will require more free space to store your teaching materials.&lt;br /&gt;
* Memory: 256MB (min), 1GB (recommended). The general rule of thumb is that Moodle can support 50 &#039;&#039;concurrent&#039;&#039; users for every 1GB of RAM, but this will vary depending on your specific hardware and software combination. &lt;br /&gt;
&#039;&#039;&#039;Software&#039;&#039;&#039;&lt;br /&gt;
* Web server software. Most people use [[Apache]], but Moodle should work fine under any web server that supports [[PHP]], such as [[IIS]] on Windows platforms. PHP does impose requirements on versions of web servers, however these are complex and the general advice is to use the newest version possible of your chosen web server. &lt;br /&gt;
* PHP scripting language. (Please note that there have been issues installing Moodle with [http://www.php-accelerator.co.uk PHP-Accelerator]). There are currently two versions (or branches) of PHP available: PHP4 and PHP5 and the version requirements are listed below.&lt;br /&gt;
** For Moodle version 1.4 or later: PHP4 (version 4.1.0 or later) or PHP5 (version 5.1.0 or later) are supported.&lt;br /&gt;
** For Moodle version 1.6 or later: the PHP4 (version 4.3.0 or later) or PHP5 (version 5.1.0 or later) are supported. &lt;br /&gt;
** Future Moodle versions 2.0 or later will not support PHP4 and will require PHP5 (version 5.2.0 or later).&lt;br /&gt;
** PHP Settings&lt;br /&gt;
*** &#039;&#039;safe_mode&#039;&#039; needs to be OFF (check in your php.ini or Apache configuration file).&lt;br /&gt;
*** &#039;&#039;memory_limit&#039;&#039; should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.&lt;br /&gt;
*** &#039;&#039;session.save_handler&#039;&#039; needs to be set to files. &lt;br /&gt;
** PHP Extensions and libraries&lt;br /&gt;
*** The mbstring extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** The iconv extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make.&lt;br /&gt;
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.&lt;br /&gt;
*** The pgsql extension is required if you are using the PostgreSQL database.&lt;br /&gt;
*** The zlib extension is required for zip/unzip functionality.&lt;br /&gt;
*** The curl extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The tokenizer extension is recommended for Moodle 1.8 or later.&lt;br /&gt;
*** The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is &#039;&#039;the&#039;&#039; choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment. &lt;br /&gt;
** For Moodle 1.5 or later, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). &lt;br /&gt;
** For Moodle 1.6 or later, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).&lt;br /&gt;
** For Moodle 1.7 or later, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting &amp;quot;strict mode&amp;quot; must be OFF (set to &amp;quot;&amp;quot; or &amp;quot;MYSQL40&amp;quot;) in the MySQL configuration file. &lt;br /&gt;
: PostgreSQL Notes: The minimum version of PostgreSQL is 7.4 and Moodle is widely used with 8.0 and 8.1.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== How many users? ==&lt;br /&gt;
&lt;br /&gt;
In addition to the hardware and software requirements, you will also need to think about the capacity of your Moodle installation in terms of the number of users it can handle. There are two numbers to plan for:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Browsing users&#039;&#039;&#039;: the maximum number of users able to browse your Moodle site. This is the number of computers in your organization or on your course (whichever is greater).&lt;br /&gt;
* &#039;&#039;&#039;Concurrent database users&#039;&#039;&#039;: the maximum number of concurrent database users (needed for Moodle activities such as quizzes). This is the number of users who will be using Moodle at the same time. In an educational institution, use your timetable/roster to obtain this figure.&lt;br /&gt;
&lt;br /&gt;
Once you know these figures for your users, you can start work out if your Moodle installation can support this capacity. The exact number of users depends on your hardware/software/network combination. Usually the amount of memory installed (RAM) is the deciding factor but a faster overall processor speed will also help in reducing waiting times for pages to load. &lt;br /&gt;
&lt;br /&gt;
The general rule of thumb for a single server is that the approx max concurrent users = RAM (GB) * 50 and the approx max browsing users = Approx max concurrent users * 5. As an example, a university with 500 total computers on campus and 100 concurrent users at any time will need approx 2GB of RAM on the one server to support the number of concurrent users.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note if you are using a hosted account&#039;&#039;&#039;: Ask your provider what limits are placed on the number of concurrent database connections and the processor load. This will give a good estimate of the number of users your Moodle install can manage.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; As of August 31, 2007, the moodle 1.8.2+ codes are still not suitable for large installation, especially if you have large number (e.g. 20,000+) of courses. The main reason is the codes related to ROLES are still not fully optimized with database queries and still need some work. If you are planning to use 1.8.x codes for a larger institution, please make sure that you have sufficient time to do your own testing and performance profiling.&lt;br /&gt;
&lt;br /&gt;
[Update] This performance issue has been improved quite a bit in the most recent 1.8.3+ version (see this thread discussion: http://moodle.org/mod/forum/discuss.php?d=83281). However, you should still plan with caution if you are planning to use Moodle 1.8.x code base for larger installation.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Download and copy files into place ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Moodle, either as a compressed package or via CVS. &lt;br /&gt;
* There are two types of compressed packages on the  [http://download.moodle.org/ download page: http://download.moodle.org/], the standard distribution with Moodle only files and the [[Complete install packages|complete install]], which contains programs to operate Moodle in a web environment.  &lt;br /&gt;
* To use CVS, helpful instructions are available at the [[CVS_for_Administrators | CVS for Administrators]] page. The full [http://cvs.moodle.org/moodle/ Moodle CVS repository] is also available for browsing. &lt;br /&gt;
&lt;br /&gt;
After downloading, unpack the archive using either &lt;br /&gt;
 tar -zxvf [filename]&lt;br /&gt;
or&lt;br /&gt;
 unzip [filename]&lt;br /&gt;
as appropriate. &lt;br /&gt;
&lt;br /&gt;
If using CVS, run the CVS Checkout command.&lt;br /&gt;
&lt;br /&gt;
You will now be left with a directory called &amp;quot;moodle&amp;quot;, containing a number of files and folders.&lt;br /&gt;
&lt;br /&gt;
You can either place the whole folder in your web server documents directory, in which case the site will be located at &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com/moodle&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;, or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourwebserver.com&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like cPanel allow you to uncompress archives in the &amp;quot;File Manager&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Structure of moodle directory ===&lt;br /&gt;
&lt;br /&gt;
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;config.php&#039;&#039; - contains basic settings. This file does not come with Moodle - you will create it.&lt;br /&gt;
:&#039;&#039;install.php&#039;&#039; - the script you will run to create config.php&lt;br /&gt;
:&#039;&#039;version.php&#039;&#039; - defines the current version of Moodle code&lt;br /&gt;
:&#039;&#039;index.php&#039;&#039; - the front page of the site&lt;br /&gt;
:&#039;&#039;admin/&#039;&#039; - code to administrate the whole server&lt;br /&gt;
:&#039;&#039;auth/&#039;&#039; - plugin modules to authenticate users&lt;br /&gt;
:&#039;&#039;blocks/&#039;&#039; - plugin modules for the little side blocks on many pages&lt;br /&gt;
:&#039;&#039;calendar/&#039;&#039; - all the code for managing and displaying calendars&lt;br /&gt;
:&#039;&#039;course/&#039;&#039; - code to display and manage courses&lt;br /&gt;
:&#039;&#039;doc/&#039;&#039; - help documentation for Moodle (eg this page)&lt;br /&gt;
:&#039;&#039;files/&#039;&#039; - code to display and manage uploaded files&lt;br /&gt;
:&#039;&#039;lang/&#039;&#039; - texts in different languages, one directory per language&lt;br /&gt;
:&#039;&#039;lib/&#039;&#039; - libraries of core Moodle code&lt;br /&gt;
:&#039;&#039;login/&#039;&#039; - code to handle login and account creation&lt;br /&gt;
:&#039;&#039;mod/&#039;&#039; - all the main Moodle course modules are in here&lt;br /&gt;
:&#039;&#039;pix/&#039;&#039; - generic site graphics&lt;br /&gt;
:&#039;&#039;theme/&#039;&#039; - theme packs/skins to change the look of the site.&lt;br /&gt;
:&#039;&#039;user/&#039;&#039; - code to display and manage users&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Setting-up your system==&lt;br /&gt;
To ensure that Moodle will install successfully, you need to check that the web server settings are correct, then create a blank database for Moodle to use and finally create a directory on your hard disk for Moodle to save your materials and other files you upload into your courses.&lt;br /&gt;
&lt;br /&gt;
=== Check web server settings ===&lt;br /&gt;
&lt;br /&gt;
*Firstly, make sure that your web server is set up to use index.php as a default page (perhaps in addition to index.html, default.htm and so on). In Apache, this is done using a DirectoryIndex parameter in your httpd.conf file. Mine usually looks like this:&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; index.php index.html index.htm&lt;br /&gt;
&lt;br /&gt;
:Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).&lt;br /&gt;
&lt;br /&gt;
*Secondly, &#039;&#039;&#039;if you are using Apache 2&#039;&#039;&#039;, then you should turn on the &#039;&#039;AcceptPathInfo&#039;&#039; variable, which allows scripts to be passed arguments like &amp;lt;nowiki&amp;gt;http://server/file.php/arg1/arg2&amp;lt;/nowiki&amp;gt;. This is essential to allow relative links between your resources, and also provides a performance boost for people using your Moodle web site. You can turn this on by adding these lines to your httpd.conf file.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;AcceptPathInfo&#039;&#039;&#039; on&lt;br /&gt;
&lt;br /&gt;
=== Check PHP settings ===&lt;br /&gt;
Moodle requires a number of PHP settings to be active for it to work. &#039;&#039;&#039;On most servers these will already be the default settings&#039;&#039;&#039;.  However, some PHP servers (and some of the more recent PHP versions) may have things set differently. These are defined in PHP&#039;s configuration file (usually called &#039;&#039;&#039;php.ini&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 magic_quotes_gpc = 1    (preferred but not necessary)&lt;br /&gt;
 magic_quotes_runtime = 0    (necessary)&lt;br /&gt;
 file_uploads = 1&lt;br /&gt;
 session.auto_start = 0&lt;br /&gt;
 session.bug_compat_warn = 0&lt;br /&gt;
&lt;br /&gt;
:You may also want to set other, optional php.ini file settings while you are already editing it. For instance, you may want to reset the maximum upload size of file attachments, which usually defaults to 2M(egabytes). For instance, to set these to 16 Megabytes:&lt;br /&gt;
 &lt;br /&gt;
 post_max_size = 16M&lt;br /&gt;
 upload_max_filesize = 16M&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Using a .htaccess file for webserver and PHP settings ===&lt;br /&gt;
&lt;br /&gt;
Use the above if you can directly edit your server&#039;s files, but if you are setting-up Moodle on a webhost, or don&#039;t have access to &#039;&#039;&#039;httpd.conf&#039;&#039;&#039; or &#039;&#039;&#039;php.ini&#039;&#039;&#039; on your server, or you have Moodle on a server with other applications that require different settings, then don&#039;t worry, you can often still override the default settings. This only works on Apache servers and only when Overrides have been allowed in the main Apache configuration.&lt;br /&gt;
&lt;br /&gt;
* Create a file called &#039;&#039;&#039;.htaccess&#039;&#039;&#039; in Moodle&#039;s main directory that contains lines like the following. &lt;br /&gt;
&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
 php_flag magic_quotes_gpc 1&lt;br /&gt;
 php_flag magic_quotes_runtime 0&lt;br /&gt;
 php_flag file_uploads 1&lt;br /&gt;
 php_flag session.auto_start 0&lt;br /&gt;
 php_flag session.bug_compat_warn 0&lt;br /&gt;
&lt;br /&gt;
:If you have Apache version 2 installed, add these lines:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;IfDefine APACHE2&amp;gt;&lt;br /&gt;
     AcceptPathInfo on&lt;br /&gt;
 &amp;lt;/IfDefine&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Otherwise add this single line:&lt;br /&gt;
&lt;br /&gt;
 AcceptPathInfo on&lt;br /&gt;
&lt;br /&gt;
* Optionally, you can also do things like define the maximum size for uploaded files, etc by adding these lines:&lt;br /&gt;
&lt;br /&gt;
 LimitRequestBody 0&lt;br /&gt;
 php_value upload_max_filesize 2M&lt;br /&gt;
 php_value post_max_size 2M&lt;br /&gt;
     &lt;br /&gt;
* The easiest thing to do is just copy the sample file from lib/htaccess and edit it to suit your needs. It contains further instructions. For example, in a Unix shell:&lt;br /&gt;
&lt;br /&gt;
 cp lib/htaccess .htaccess&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Use a .htaccess file only [http://httpd.apache.org/docs/1.3/howto/htaccess.html#when as a last resort] as it can have an impact on the performance of your Moodle site and cause pages to load slowly on your browser.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Creating an empty database ===&lt;br /&gt;
&lt;br /&gt;
You need to create an empty database (eg &amp;quot;&#039;&#039;moodle&#039;&#039;&amp;quot;) in your database system along with a special user (eg &amp;quot;moodleuser&amp;quot;) that has access to that database (and that database only). You could use the &amp;quot;root&amp;quot; user if you wanted to for a test server, but this is not recommended for a production system: if hackers manage to discover the password then your whole database system would be at risk, rather than just one database.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Warning&#039;&#039;&#039;: Bear in mind that, as of Moodle version 1.5.x, Moodle doesn&#039;t work with MySQL 5.x&#039;s strict mode setting (STRICT_TRANS_TABLES and/or STRICT_ALL_TABLES) -- see [http://moodle.org/mod/forum/discuss.php?d=58552 forum discussion]. So if you are using MySQL 5.x, edit MySQL&#039;s configuration file (called &amp;quot;my.ini&amp;quot; in Windows and &amp;quot;my.cnf&amp;quot; on Unix/Linux) and comment out that option or set it to &amp;lt;code&amp;gt;sql-mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You have to restart MySQL after changing this setting. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt; If you do not have access to your server, use PHPMyAdmin (or another MySQL client) and enter the command &amp;lt;code&amp;gt;SET @@global.sql_mode=&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;;&amp;lt;/code&amp;gt; (be sure to use single quotes, and don&#039;t forget the semicolon).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=background-color:lightCyan border=1 cellpadding=5 cellspacing=0 &amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
====Using a hosted server====&lt;br /&gt;
If you are using a webhost, they will probably have a control panel web interface for you to create your database.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;[http://www.cpanel.com/ cPanel]&#039;&#039;&#039; system is one of the most popular of these. &lt;br /&gt;
To create a database using cPanel:&lt;br /&gt;
&lt;br /&gt;
# Click on the &#039;&#039;&#039;MySQL Databases&#039;&#039;&#039; icon.&lt;br /&gt;
# Type &#039;&#039;&#039;moodle&#039;&#039;&#039; in the New Database field and click &#039;&#039;&#039;Create Database&#039;&#039;&#039;.&lt;br /&gt;
# Type a username and password (not one you use elsewhere) in the respective fields and click &#039;&#039;&#039;Create  User&#039;&#039;&#039;.&lt;br /&gt;
# Now use the &#039;&#039;&#039;Add Users to Databases&#039;&#039;&#039; button and give this new user account &#039;&#039;&#039;ALL&#039;&#039;&#039; rights to the new database.&lt;br /&gt;
# Note that the username and database names may be prefixed by your cPanel account name and an underscore, and truncated to 16 characters. When entering this information into the Moodle installer - use the full names.&lt;br /&gt;
&lt;br /&gt;
Continue with [https://docs.moodle.org/en/Installing_Moodle#CreDDir Creating the data directory]&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using the command line====&lt;br /&gt;
&lt;br /&gt;
If you have access to Unix or Windows command lines then you can do the same sort of thing by typing commands. You should do this using the MySQL Client program as follows (commands which you type-in are shown in bold):&lt;br /&gt;
&lt;br /&gt;
- Start the MySQL Client program:&lt;br /&gt;
 #&#039;&#039;&#039;mysql -u root -p&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 Welcome to the MySQL monitor.  Commands end with ; or \g.&lt;br /&gt;
 Your MySQL connection id is 2 to server version: 5.0.22-log&lt;br /&gt;
 &lt;br /&gt;
 Type &#039;help;&#039; or &#039;\h&#039; for help. Type &#039;\c&#039; to clear the buffer.&lt;br /&gt;
 &lt;br /&gt;
 mysql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- The prompt changes to &amp;quot;mysql&amp;gt;&amp;quot; to indicate that you are now working in the MySQL Client program. When working in MySQL, all commands which you type-in must end in a semi-colon. (If you hit the Enter key without the final semi-colon, you&#039;ll get the line continuation symbol &#039;-&amp;gt;&#039;; this is your second chance to type the semi-colon and hit Enter.) &lt;br /&gt;
&lt;br /&gt;
- Begin by checking for any existing databases called &amp;quot;moodle&amp;quot; - if there are any you should change the name in all the commands which follow:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;SHOW DATABASES;&#039;&#039;&#039;&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | Database                |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 | information_schema      |&lt;br /&gt;
 | mysql                   |&lt;br /&gt;
 | test                    |&lt;br /&gt;
 +-------------------------+&lt;br /&gt;
 3 rows in set (0.03 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a database to store the Moodle tables. We&#039;ll call this &amp;quot;moodle&amp;quot;, as there are none with that name already in the above list, but change it if you need to.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;CREATE DATABASE moodle;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Change the default character set and collation of the &amp;quot;moodle&amp;quot; database to UTF8. Leave this out if you are installing Moodle 1.5 or earlier):&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;ALTER DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
- Create a username and password to access the database &amp;quot;moodle&amp;quot; and grant database access permissions. We&#039;ll call the user &amp;quot;moodleuser&amp;quot; and set the password as &amp;quot;yourpassword&amp;quot;. It&#039;s a good idea to change these for your installation however most people keep the username as &amp;quot;moodleuser&amp;quot;. Remember the username and password you have set, as you&#039;ll need it in the configuration screens later. This is a long command so has been split over several lines by pressing the Return key.&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;DROP,INDEX,ALTER ON moodle.*&#039;&#039;&#039;&lt;br /&gt;
     -&amp;gt; &#039;&#039;&#039;TO moodleuser@localhost IDENTIFIED BY &#039;yourpassword&#039;;&#039;&#039;&#039;&lt;br /&gt;
 Query OK, 0 rows affected (0.01 sec)&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Security Warnings&#039;&#039;&#039;: Never leave the password as the one shown here. Make sure you have a strong password (a mixture of letters and numbers, upper and lower case). Avoid granting &amp;quot;ALL&amp;quot; permissions on the database.&lt;br /&gt;
: &#039;&#039;&#039;Note&#039;&#039;&#039;: For MySQL 4.0.1 or earlier, you don&#039;t need the CREATE TEMPORARY TABLES permission. &lt;br /&gt;
&lt;br /&gt;
- Exit the MySQL Client program:&lt;br /&gt;
 mysql&amp;gt; &#039;&#039;&#039;QUIT&#039;&#039;&#039;&lt;br /&gt;
 Bye&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
- Reload the grant tables using the mysqladmin program:&lt;br /&gt;
 #&#039;&#039;&#039;mysqladmin -u root -p reload&#039;&#039;&#039;&lt;br /&gt;
 Enter password:&lt;br /&gt;
 #&lt;br /&gt;
&lt;br /&gt;
And some example command lines for PostgreSQL:&lt;br /&gt;
&lt;br /&gt;
   # su - postgres&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create user moodleuser createdb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;create database moodle &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;with encoding &#039;unicode&#039;&amp;lt;/font&amp;gt;;&amp;quot; -U moodleuser template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser nocreatedb;&amp;quot; template1&lt;br /&gt;
   &amp;gt; psql -c &amp;quot;alter user moodleuser with encrypted password &#039;yourpassword&#039;;&amp;quot; template1&lt;br /&gt;
   &amp;gt; su - root&lt;br /&gt;
   # /etc/init.d/postgresql reload&lt;br /&gt;
&lt;br /&gt;
If the Postgres create database command above (&amp;gt;psql -c &amp;quot;create database moodle...&amp;quot;) gives an error message you may want to try:&lt;br /&gt;
 psql -c &amp;quot;create database moodle with template=template1 encoding = &#039;unicode&#039; owner =  moodleuser &amp;lt;br&amp;gt;     location = &#039;/var/mydata&#039;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If the create database command asks you for a password, run the line containing &#039;encrypted password&#039; first before proceeding.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;:&lt;br /&gt;
* Step-by-step instructions on  [https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Ubuntu installation for Ubuntu(Debian)]&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
=== Creating the data directory (moodledata) ===&lt;br /&gt;
&lt;br /&gt;
Moodle will also need some space on your server&#039;s hard disk to store uploaded files, such as course documents and user pictures. The Moodle installer tries hard to create this directory for you but if it fails then you will have to create a directory for this purpose manually.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security warning&#039;&#039;&#039;: For security purposes, it&#039;s best that this directory is NOT accessible directly via the web. The easiest way to do this is to simply locate it OUTSIDE the web directory, but if you must have it in the web directory (and you are using Apache) then protect it by creating a file in the data directory called &#039;&#039;&#039;.htaccess&#039;&#039;&#039;, containing these lines:&lt;br /&gt;
&lt;br /&gt;
 order deny,allow&lt;br /&gt;
 deny from all&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ownership &amp;amp; Permissions&#039;&#039;&#039;: To make sure that Moodle can save uploaded files in this directory, check that the web server software has permission to read, write and execute in this directory. On Unix machines, this means setting the owner of the directory to be something like &amp;quot;nobody&amp;quot; or &amp;quot;apache&amp;quot;, and then giving that user read, write and execute permissions. As an example, to change the owner to &amp;quot;nobody&amp;quot; you could use:&lt;br /&gt;
&lt;br /&gt;
 chown -R nobody:apache moodledata&lt;br /&gt;
&lt;br /&gt;
To change the permissions so that the owner has read,write and execute permissions, use something like this:&lt;br /&gt;
&lt;br /&gt;
 chmod -R 0770 moodledata&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you are receiving permission denied messages, try &#039;&#039;chmod -R 0770 moodledata&#039;&#039; and then adjust the settings so that they are more secure. A more secure setting is &#039;&#039;chmod -R 0750 moodledata&#039;&#039;. According to the comments in config-dist.php, &amp;quot;On hosting systems you might need to make sure that your group has no permissions at all while others have full permissions.&amp;quot; To do this you could use &#039;&#039;chmod -R 707 moodledata&#039;&#039;. See also the [[Security | security page]].&lt;br /&gt;
&lt;br /&gt;
Remember that by default moodle will issue a warning about moodle data directories created inside the web directory, but otherwise this directory can be located where you wish. You can later move or change the location of this directory, but if you do, be sure to edit the setting in the &#039;&#039;&#039;config.php&#039;&#039;&#039; file that sets this; e.g. if moodledata is under a directory called data, then it would look like this:&lt;br /&gt;
&lt;br /&gt;
 $CFG-&amp;gt;dataroot  = &#039;/data/moodledata&#039;;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;CPanel and webhosts&#039;&#039;&#039;: On cPanel systems you can use the &amp;quot;File Manager&amp;quot; to find the folder, click on it, then choose &amp;quot;Change Permissions&amp;quot;. On many shared hosting servers, you will probably need to restrict all file access to your &amp;quot;group&amp;quot; (to prevent other webhost customers from looking at or changing your files), but provide full read/write access to everyone else (which will allow the web server to access your files). Speak to your server administrator if you are having trouble setting this up securely. In particular it will not be possible to create a usable data directory on sites that use a PHP feature known as &amp;quot;&#039;&#039;&#039;Safe Mode&#039;&#039;&#039;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Run the installer script to create config.php ==&lt;br /&gt;
&lt;br /&gt;
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;http://yourserver/install.php&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039; directly.&lt;br /&gt;
&lt;br /&gt;
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)&lt;br /&gt;
&lt;br /&gt;
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called &#039;&#039;&#039;config.php&#039;&#039;&#039;. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload &#039;&#039;&#039;config.php&#039;&#039;&#039; into the main Moodle directory on the server.&lt;br /&gt;
&lt;br /&gt;
Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, check in the Installation Forum for more help.&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Go to the admin page to continue configuration ==&lt;br /&gt;
&lt;br /&gt;
Once the basic config.php has been correctly created in the previous step, trying to access the front page of your site will take you to the &amp;quot;admin&amp;quot; page for the rest of the configuration.&lt;br /&gt;
&lt;br /&gt;
The first time you access this admin page, you will be presented with a GPL &amp;quot;shrink wrap&amp;quot; agreement with which you must agree before you can continue with the setup.&lt;br /&gt;
&lt;br /&gt;
Now Moodle will start setting up your database and creating tables to store data. Firstly, the main database tables are created. You should see a number of SQL statements followed by status messages that look like this:&lt;br /&gt;
&lt;br /&gt;
 CREATE TABLE course (&lt;br /&gt;
    id int(10) unsigned NOT NULL auto_increment,&lt;br /&gt;
    category int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    password varchar(50) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    fullname varchar(254) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    shortname varchar(15) NOT NULL default &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;,&lt;br /&gt;
    summary text NOT NULL,&lt;br /&gt;
    format tinyint(4) NOT NULL default &#039;1&#039;,&lt;br /&gt;
    teacher varchar(100) NOT NULL default &#039;Teacher&#039;,&lt;br /&gt;
    startdate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    enddate int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    timemodified int(10) unsigned NOT NULL default &#039;0&#039;,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
 ) TYPE=MyISAM;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;SUCCESS&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...and so on, followed by: &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;Main databases set up successfully.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t see these, then there must have been some problem with the database or the configuration settings you defined in config.php. Check that PHP isn&#039;t in a restricted &amp;quot;Safe Mode&amp;quot; (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing &#039;&#039;&#039;&amp;lt;?php phpinfo() ?&amp;gt;&#039;&#039;&#039; and looking at it through a browser. Check all these and try this page again.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
You should now see a form where you can define more configuration variables for your installation, such as the default language, SMTP hosts and so on. Don&#039;t worry too much about getting everything right just now - you can always come back and edit these later on using the admin interface. The defaults are designed to be useful and secure for most sites. Scroll down to the bottom and click &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the &amp;quot;buggy referrer&amp;quot; problem. This is easy to fix: just turn off the &amp;quot;secureforms&amp;quot; setting, then try to continue again.&lt;br /&gt;
&lt;br /&gt;
Next you will see more pages that print lots of status messages as they set up all the tables required by the various Moodle module. As before, they should all be &amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;green&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Scroll down the very bottom of the page and press the &amp;quot;Continue&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
The next page is a form where you can define parameters for your Moodle site and the front page, such as the name, format, description and so on. Fill this out (you can always come back and change these later) and then press &amp;quot;Save changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Finally, you will then be asked to create a top-level administration user for future access to the admin pages. Fill out the details with your own name, email etc and then click &amp;quot;Save changes&amp;quot;. Not all the fields are required, but if you miss any important fields you&#039;ll be re-prompted for them.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make sure you remember the username and password you chose for the administration user account, as they will be necessary to access the administration page in future.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(If for any reason your install is interrupted, or there is a system error of some kind that prevents you from logging in using the admin account, you can usually log in using the default username of &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;, with password &amp;quot;&#039;&#039;&#039;admin&#039;&#039;&#039;&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
Once successful, you will be returned to the home page of your new site! Note the administration links that appear down the left hand side of the page (these items also appear on a separate Admin page) - these items are only visible to you because you are logged in as the admin user. All your further administration of Moodle can now be done using this menu, such as:&lt;br /&gt;
&lt;br /&gt;
* creating and deleting courses&lt;br /&gt;
* creating and editing user accounts&lt;br /&gt;
* administering teacher accounts&lt;br /&gt;
* changing site-wide settings like themes etc&lt;br /&gt;
&lt;br /&gt;
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Set up cron ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Cron|Cron instructions]].&lt;br /&gt;
&lt;br /&gt;
== Set up backups ==&lt;br /&gt;
&lt;br /&gt;
Please refer to the [[Backup settings| backup instructions]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Installing_Moodle#Table_of_Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
== Create a new course ==&lt;br /&gt;
&lt;br /&gt;
Now that Moodle is running properly, you can try creating a new course to play with.&lt;br /&gt;
&lt;br /&gt;
Select &amp;quot;Create a new course&amp;quot; from the Admin page (or the admin links on the home page).&lt;br /&gt;
&lt;br /&gt;
Fill out the form, paying special attention to the course format. You don&#039;t have to worry about the details too much at this stage, as everything can be changed later by the teacher. Note that the yellow help icons are everywhere to provide contextual help on any aspect.&lt;br /&gt;
&lt;br /&gt;
Press &amp;quot;Save changes&amp;quot;, and you will be taken to a new form where you can assign teachers to the course. You can only add existing user accounts from this form - if you want to create a new teacher account then either ask the teacher to create one for themselves (see the login page), or create one for them using the &amp;quot;Add a new user&amp;quot; on the Admin page.&lt;br /&gt;
&lt;br /&gt;
Once done, the course is ready to customize, and is accessible via the &amp;quot;Courses&amp;quot; link on the home page.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation FAQ]]&lt;br /&gt;
*[[Complete install packages]] might be an easier first time installs on some systems&lt;br /&gt;
* [[Installing Apache, MySQL and PHP]] - Open source programs that can run Moodle on the web or on a desktop&lt;br /&gt;
* [[Upgrading Moodle]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=42688 Selecting a web host for Moodle] forum discussion&lt;br /&gt;
* [[masquerading|Masquerading]] - Running Moodle behind a masquerading/NAT firewall&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[cs:Instalace]]&lt;br /&gt;
[[de:Installieren von Moodle]]&lt;br /&gt;
[[es:Instalación de moodle]]&lt;br /&gt;
[[fr:Installation de Moodle]]&lt;br /&gt;
[[ja:Moodleのインストール]]&lt;br /&gt;
[[nl:Installatiegids]]&lt;br /&gt;
[[pl:Instalacja Moodle]]&lt;br /&gt;
[[pt:Instalação do Moodle]]&lt;br /&gt;
[[ru:Установка Moodle]]&lt;br /&gt;
[[sk:Inštalácia]]&lt;br /&gt;
[[zh:安装Moodlezh:]]&lt;/div&gt;</summary>
		<author><name>Dgerman</name></author>
	</entry>
</feed>