2012-09-16

Moodle_Dev_Manual_ko


Apec E-Learning 시스템 구축 및 Moodle설치 및 환경설정. Developers Manual
이 문서는 Moodle(이하 “무들 ”)의 디자인에 대한 기술과 참여 하는 방법에 대해 기술 한다.

문서의 섹션 :
1. Moodle( 무들 )의 구조 아래의 사항은 기본적으로 OS(Linux나 *nix)가 설치된 상태라고 가정을 한다.
Linux 나 FreeBSD를 설치한다(OS 설치)
Fedora Core4 /Debian 나 FreeBSD 5.4R을 설치한다. (개인적으로 FreeBSD를 권장합니다.)

필요한 서비스(데몬)파일 구분Config
파일
비고
Apache2 .x(Web)기본Httpd.conf웹으로 교육환경을 구축할 것이므로 기본 서비스.
여기서는 apache2를 선택하는것으로 한다.
MySQL 4.1.12 (DBMS)기본My.conf데이터베이스 서버. 현재까지는 open source
PHP 5.x (Language)기본Php.ini웹에서 동적으로 사용자의 응답에 따라 처리하는 스크립트 언어
ZendOptimizer옵션PHP에 최적화된 가속기.
2. 기부 (기여)하는 방법
Learning Activities( 작동 법 배우기 )
테마
언어
데이터베이스 구조
코스 포맷
문서와 기사
버그트랙커 참여하기




무들 설치하기 무들의 구조

시스템 관리자 화면에서 무들은 다음의 기준에 따라 디자인 되어 있다.

무들은 다양한 플랫폼에서 돌아갈 수 있다.
웹 어플리케이션 플 랫폼으로서 PHP, MySQL로 조합된 대부분의 플랫폼에서 돌아간다. (무들은 리눅스, 윈도우, 맥OS X)에서 개발되어지고 있다) 무들은 또한 데이터베이스 추상화에ADOdb 라이브러리를 사용 하는데, 이것은 무들이 또한 다른 여러 브랜드의 데이터베이스(불행히도, 이런 DB에 대해 setup 시 테이블 작업이 되어 있지는 않지만, 추후에 추가 될 예정)도 사용 가능하다는 의미이다.
무들은 설치가 쉽고, 배우고 변경하기도 쉽다 .
1999년 이전 무들의 프로토타입은 Zope( 향상된 객체지향 웹 어플리케이션 서버 )를 사용하여 만들었다. 불행히도 비록 아주 훌륭한 기술일지라도 그것 은 아주 무리하게 learning curve(배움곡선???)를 가지며, 시스템 관리자에게 있어서 유연하지 못하다는 것을 알게 되었다. 다른 한편으로, PHP 스크립트 언어는 배우기 쉽다.(특히 다른 어떤 스크립트언어를 사용해서 프로그램을 해봤다면..) 그래서 클래스 지향적인 디자인 사용을 자제하기로 하고, 초보자들이 이해하기 쉽게 간단하게 만드는 것을 주안을 해서 디자인을 했다. 코드 재사용은 라이브러리를 사용하는 것 대신에 명백하게 명명된(이름지어진) 함수를 사용 하였고, 스크립트 파일의 일관성 있는 레이아웃을 유지할 수 있었다. PHP는 또한 설치하기 쉬우며(바이너리는 대부분의 플랫폼에서 사용 가능하다) 대부분의 웹호스팅 서비스가 표준으로 제공 하는 점이 널리 수용가능하게 하는 것이다.
다음버전으로 업그레이드가 쉽다.
무들은 모든 플러그인 모듈의 버전과 같이 버전이 있고, 그 메커니즘은 무들이 당연히 자신을 새로운 버전으로 업그레이드 할 수 있는 기능이 함께 내재되어 있다.(예를 들어, 데이터베이스 테이블의 이름변경이나 새로운 필드의 추가 같은 것 …) 만약 unix에서 CVS같은 것을 사용한다면, “cvs updated ” 실행하는 것으로 upgrade가 되고 그것으로 upgrade된 완전한 홈페이지에 방문할 수 있을것이다.
4. 무들은 성장하기위해(확장되기위해) 2.1 moodle을 설치하기 위해 http://moodle.org/ 에서 moodle 1.5.2를 다운 받는다.
다운 받는곳의 위치는 /usr/local/src/ 라는 곳이라 가정한다.
2.2 moodle1.5.2.tar.gz 압축을 푼다.
# tar –xvzf moodle1.5.2.tar.gz
=> moodle 디렉토리가 생성됨.
2.3 운영할 곳으로 이동시킨다.(mv moodle 이동할디렉토리/)
여기서 운영 방식에 따라 위치가 달라지게 된다.
2.3.1 호스팅 받을 경우 접속하는 계정 밑에 public_html/ 디렉토리가 웹서버의 root디렉토리가 되므로
그 하위디렉토리로 moodle을 이동한다.
# mv /usr/local/src/moode ~계정/public_html/
2.3.2 별도의 서버를 임대해서 사용할 경우
이때 기본 www의 root디렉토리가 /usr/local/www/data/ 라고 가정할 때 그 하위로 이동
# mv /usr/local/src/moodle /usr/ local /www/data/
2.4 moodle 이 사용할 DB계정생성/DB권한생성/DB생성하기
2.4.1 먼저 기존에 설치된 mysql에 root권한으로 접속을 하면 다음과 같이 mysql> 이라는 프롬프트가보인다.
이전까지의 작업이 제대로 되었다고 가정하고 이후의 작업을 설명하겠습니다.
아래의 사항은 MySQL4.1.x 대를 기준으로 설명하는 글입니다 .
Mysql> insert into db values('%', 'moodle', 'apecuser', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y'); 
Mysql> INSERT INTO user VALUES('localhost','apecuser',PASSWORD( 'apecmoodle' ),
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y', 'Y','Y','Y','Y','Y','Y','Y','','','',
'','0','0','0');
Mysql> INSERT INTO user VALUES('%','apecuser',PASSWORD( 'apecmoodle' ),
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','',
'','0','0','0');
M ysql> INSERT INTO host VALUES('localhost','moodle','Y','Y','Y','Y','Y','Y','Y','Y','Y',
'Y','Y','Y');
Mysql> INSERT INTO host VALUES('%','moodle','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
Mysql> create database moodle;
Mysql> flush privileges;

위의 사항은 보안에 대해서 일단 배제된 사항으로 DB보안에 대한 사항은 반영하여 추후
수정토록 하겟습니다.

2.5 moodle 설치작업
http://해당url혹은 ip/moodle /
처음 위 주소를 웹브라우저의 주소창에 입력을 하게 되면 설치화면으로 넘어가게 됩니다.
간단한 설정사항(현재 디렉토리/DBMS/데이터베이스명/DB사용자계정/비번)을 확인하고 설치
작업을 계속합니다. 해당사항을 읽어본 후 계속(continue)버튼을 누르거나 설정을 변경하신 후
계속(continue)버튼을 눌러 설치 작업을 진행/완료 하시면 됩니다.
완료 후 http://해당url혹은 ip/moodle /을 웹브라우저 주소창에 입력하면 무들 화면이 보이면
설치작업이 완료됩니다.


문서입력 규정

각 수강과목별 수강기간이 있다면 수강기간을 명기. (각 주차마다 배워야 할 범위기재. 혹은 주제별로해서 학습해야될 기간을 명시하지 않아도 됩니다./ 택일) 
각 과목의 제목과 내용을 별도로 명기 (가능하다면 목차도 표기하면 좋겠습니다.) 해당 기간에 배울 부분별로 분리해서 입력.
각 영역별/주제별로 분리해 입력.
입력범위는 1027*768을 기준으로 가급적 한 화면을 넘지않도록 함 (내용이 이어지면 한페이지를 넘겨서 스크롤로 볼 수 있게 처리).
이미지가 있는 경우 별도로 처리하는 것을 기준으로 함.
별도의 자료가 필요한 경우 파일로 작성된 경우 첨부파일로하며(가급적 크기는 10Mbyte내외) 웹상의 자료를 참조할 경우 별도의 참고자료로 링크를 걸어서 해당 페이지에서 링크를 눌러 이동할 수 있게 함.
문서상에서 웹주소(www.***.com/www.****.org)들은 ()묶고 그안에 URL(웹주소)을 표기하여 링크를 생성함.
간단한 질답은 일정분의 강의가 끝나고 다른 부분으로 넘어가는 중간에 존재할 수 있다.(생략가능합니다.) 질답의 형식은 간단한 선택형은 원칙으로 한다. (2개중 1개 택일 등등)
간단한 질답을 통과해야 다음 장으로 넘어갈 수 있는지 등을 명기 바랍니다.

강좌 생서 및 트레이너 (강사) 생성
Administrator가 등록된 사용자중 강의를 진행할 user를 트레이너(강사)로 지정할 수 한다.
Administrator로 할일
User를 강사로 지정할 때는 먼저 대분류의 강좌 종류를 생성
중분류의 강좌 생성


[강좌 대분류 생성화면]



[강좌-중분류 생성 화면1]


[강좌- 중분류 생성화면 2 (상세정보입력)]



[강좌 –해당 강좌의 강사 선택]
Add teacher 링크를 누르면 아래그림처럼 화면이 변경 되면서 강사가 추가됩니다.

[강좌 –해당 강좌의 강사 선택 후]


해당 강사가 로그인 한 후에 접하게 되는 해당 강좌의 내용 (?)이 보여집니다.


[강좌 - 강사아이디로 로그인시 해당 강좌를 선택하고 들어간 화면]

1번 버튼을 누르면 아래의 그림과 같이 강의 게시물을 등록할 수 있는 화면으로 전환된다.


[강좌 –강의 게시물을 등록할 수 있는 편집화면]

2번은 해당 강의기간에 보여지는 문구나 필요한 리소스, 웹사이트 등을 기술하는 곳이다.
손이 연필을 쥐고 있는 아이콘을 누르면 해당 편집화면으로 넘어가게 됩니다.


[강좌 – 강좌 기간의 요약글 입력화면] 


[강좌 –요약글 입력후 화면]






모듈을 허용한다.
무들은 많은 수의 모듈을 가지고 있고, 그중에는 테마, 활동, 언어 인터페이스, 데이터베이스 구조, 코스포맷 같은 것들을포함한다. 이것은 누구나 메인코드베이스에 추가 하는 것을 허용하거나, 별도로 배포도 가능하다는 것이다. 이 사항에 대한 더 많은 것 은 아래의 다음 섹션에서 소개된다.
5. 다른 시스 템과 결합되어서 사용가능하다.
무들은 하나의 코스에 서버상의 정상적인 디렉토리 하나에 모든 파일을 보관할 수 있다. 이것은 시스템관리자가 각 교사가 파일레벨액세스가 가능한 양식을 제공하는 것을 허락하는 것을 말한다. 마치 애플톡, SMB, NFS, FTP, WebDAV 와 마찬가지로. 인증모듈은 무들이 LDAP, IMAP, POP3, NNTP나 사용자 정보를 저장할 수 있는 다른 데이터베이스를 사용하는 것을 허용한다. 반면에 아직 적용되지 않은 것들도 있다. 향후 버전에는 개략적으로 다음과 같은 기능들이 포함될 것이다. :
XML-based 포맷을 사용하여 무들 데이터의 들여오기/내보내기(IMS와 SCORM을 포함해서) . 그리고 인터페이스 포맷인 스타일쉬트의 사용이 늘어날 것이다.

3. 기 여하는 방법

위에서 언급한 대로, 무들은 다양한 모듈이 존재한다. 심지어 프로그래머가 아니라도 도움을 주거나 변경을 가할 수 있다.

Learning Activities (작동법 배우기)
러한 모듈들 중에서 단연코 가장 중요한 모듈은 ‘mod ’디렉토리에 존재한다. 여기에는 7가지 기본 모 듈이 있다. :
Assignment, choice, forum, quiz, resource, survey. (근데 왜 6개만 나열되었을까???) 
각 모듈은 서브디렉토리로 구분되어져 있고, 다음의 위임된 요소들에 의해 구성된다.(각 모듈마다 유니크(독특한???)한 추가 스크립트가 더해질 수 있다.) :
Mod.html : 설정하는 양식 혹은 이 모듈에 대한 업데이트 인스턴스
Version .php : 약간의 메타정보를 정의하고 있고, 업그레이드 코드를 제공한다.
Icon.gif : 이 모듈을 위한 16 x 16 사이즈의 아이콘
db/ : 모든 필요한 db 테이블과 데이터에 대한 SQL 덤프 (각 DB타입별로다가)
index.php : 코스에서 모든 인스턴스의 리스트 페이지
view.php : 특정 인스턴스 보여주는 페이지
lib.php : 모듈에 의해서 규정된 펑션을 여기에서 정의. 만약 모듈명이 widget이라면, 다음과 같은 함수를 필요로 한다. : 
widget_add_instance() –widget에 새로운 인스턴스 더하는 코드
widget_update_instance() –widget의 인스턴스 업데이트하는 코드
widget_delete_instance() - widget의 인스턴스 삭제하는 코드
widget_user_outline() –주어진 인스턴스에 사용자의 기부에 대한 요약을 리턴
widget_user_competet() –주어진 인스턴스에 사용자의 기부에 대한 상세를 프린트
충돌가능한 문제를 회피하기 위해 어떤 모듈의 함수들은 widget_ 으로 이름을 시작하고 어떤 상수들은 WIDGET_ 으로 시작해서 정의하기도 한다.
마지막으로, 각 모듈은 해당언어에 대한 약간의 언어파일들을 포함하고 있다 .

새로운 모듈의 동작법을 배우는 가장 쉬운 방법은 mod/newmodule_template.zip 안에 있는 템플릿을 사용 해보는 것입니다. 압축을 풀고 그 안에 있는 README를 따라 하면 됩니다.


테마(Themes)
테마(혹은 스킨)은 사이트의 보이는 모습을 정의한다. 여러 개의 간단한 테마들이 배포본에 같이 제공되기는 하지만, 사용자는 자신의 고유한 테마(색상, 로고, 스타일, 그래픽)을 만들어서 적용하길 원한다.

각 테마는 “theme ”라는 서브 디렉토리에 있고, 이속에는 최소한 다음의 파일이 있다. :
Config.php : 사이트 전체에 통용되는 테마 색상을 규정한다.
Style.php : 스타일쉬트를 의미하고, 많은 무들 요소들과 같은 표준HTML요소들에 대한 CSS 정의
Header.html : 각 페이지의 상단에 포함되는 것이다. 예를 들자면, 각 페이지 상단에 로고를 더한다든지 할 때 사용한다.
Footer.html : 각 페이지의 하단에 포함되는것이다.
현재 무들 버전에 대한 자신의 테마 만들기 :
기존에 존재하는 테마 폴더중 하나를 새 이름으로 복사한다. Standard 테마를 복사하길 권장한다.(만든이)
config.php를 수정하고 자신이 원하는 색상을 넣기
style.php를 수정하고 CSS 스타일 변경하기.
header.html과 footer.html을 수정하고, 필요하면 새 로고 넣고, 레이아웃 변경하기
이러한 모든 절차는 옵션적이다. 사용자가 기본적으로 다 르게 보이는 자신의 사이트를 만들려면 간단히 config.php의 colours만 수정해도 변경이 된다.
또한 무들의 업그레이 드 릴리즈노트를 아주 세심하게 점검하므로써 사용자가 사용하는 일반적 테마에 대한 업그레이드 약간 불편하게 한다.
특히 무들 2.0 은 완전히 다른 display system을 가질 것 이며, 아마도 무 들은 XML에 기반을 둔 XSL  환방식을 가질 것이다. 이는 테마도 완전희 다른 포맷이 적용될 것이지만, 커스터마이제이션에 대한 훨씬 더 많은 이점이 있을것으로 생각됩니다.

언어(L anguages)
무들은 국제화를 고려해서 디자인 되어졌다. 각 텍스트의 ‘string ’또는 ’page ’는 설정된 언어파일로부터 끌어와서 각 인터페이스부분 에 보여지게 된다. 각 언어는 ‘lang ’디렉토리의 하부 디렉토리로 존재한다. Lang 디렉토리의 구조는 아래와 같다. :

Lang/en – 하나의 언어에 대한 모든 파일이 들어있다. (eg 영어)
moodle.php – 메인 인터페이스의 string
assignment.php –assignment 모듈의 string
choice.php –choice 모듈의 string
forum.php –forum 모듈의 stri ng
quiz.php - quiz모듈의 string
resource.php –resource 모듈의 string
survey.php – survey 모듈의 string
기타 추가 모듈 ….
이러한 파일들에서 string이라 불리는 것은 get_string()/print_string()함수에 사용된다. 각 string은 변수로 대체하는 것을지원하며, 대체된 변수는 다른 언어안에 있는 변수에 따른다.?????

Eg: $strdueby = get_string( “assignmentdueby ”, “assignment ”, userdate($date));

만약 string이 특정 언어에서 존재하지 않으면, 사용자가 지정한 것 대신에 자동적으로 영어에 있는 것을 사용하는 것을 기본으로 하게 된다.

Lang/en/help – 모든 help 페이지 를 포함한다.
메인 도움말은 이곳에 위치하고, 특정 도움말은 각 모듈이 위치한 곳에 해당 모듈의 이름을 가지고 위치한다. 
사용자는 페이지에 helpbutton을 htlpbutton함수로 삽입할 수 있다.
Eg helpbutton( “text ”, “Click here for help about text); 
모듈에 대한 것은 :
Helpbutton( “forumtypes ”, “Forum types ”, “forum ”);

사용자가 “check this language ”하의 관리자 웹툴을 사용하여 온라인상의 언어를 수정할 수 있다. 이것은 새로운 언어를 만들지 않지만 기존에 존재하는 것들을 다듬는데 쉽게 만들어 준다. 만약 새로운 언어 를 시작한다면, Martin Dougiamas에 연락 바랍니다.

용자는 또한 무들 사용에 대해 언어포럼에 글을 덧붙여도 좋습니다. 


데이터베이스 구조(DataBase Schemas)
정의된 테이블들로 주어진 데이터베이스 작업을 할 수 있으며, 무들에서는 다양한 종류의 데이터베이스에서 작업을 명확히 하기 위해 계획적으로 단순한 SQL문장을 사용할 것이다.

문제는 무들이 데이터베이스에 자동 으로 새로운 테이블을 생성함으로 써 최초 설지 작업을 시도한다는데 있다. 모든 데이터베이스는 서로 다르며, 플랫폼 독립적인 어떤 방법도 아직은 존재하지 않는다. 이런 자동화에 대 한 지원은 –각각의 데이터베이스 마다- 스키마(구조)는 특정 데이터베이스에서 SQL로서 무들테이블을 생성하는데 필요한 리스트를 만들 수 있다는데 있다. 이러한 파일들은 lib/db와 db라는 각 모듈의 서브디렉토리에 존재 한다. 

현재는 단지 MySQL과 PostgreSQL만 완전하게 지원하고 있다.


코스 포맷 (Course Formats)
무들은 현재는 3가지의 다른 형식의 코스포맷을 지원한다. : weekly, topics, social

Documentation and articles

사용자가 튜토리얼이나, 기사, 학술적인 문서 들을 작성하기를 좋아 한다거나 무들에 대한 어떤것이라도 만들기를 좋아한다면 그렇게 하면된다,

Installing_Moodle_En


Installing Moodle
Dont panic! 
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 document may look long and complicated. Don't panic, once you know how to do it you can install Moodle in minutes!
If you have problems please read this document carefully - most common issues are answered in here. If you still have trouble, you can seek help from Moodle Help 
Another option is to contact a web hosting company who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating!

Sections in this document:
Requirements 
Download and copy files into place 
Site structure 
Run the installer script to create config.php 
Check web server settings 
Creating a database 
Creating a data directory 
Go to the admin page to continue configuration 
Set up cron 
Create a new course 

1. Requirements
Moodle is primarily developed in Linux using Apache, MySQL and PHP (also sometimes known as the LAMP platform), but is also regularly tested with PostgreSQL and on Windows XP, Mac OS X and Netware 6 operating systems
The requirements for Moodle are as follows:
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 scripting language (version 4.1.0 or later). PHP 5 is supported as of Moodle 1.4.
a working database server: MySQL or PostgreSQL are completely supported and recommended for use with Moodle.
Most web hosts support all of this by default. If you are signed up with one of the few webhosts that does not support these features ask them why, and consider taking your business elsewhere.
If you want to run Moodle on your own computer and all this looks a bit daunting, then please see our guide: Installing Apache, MySQL and PHP . It provides some step-by-step instructions to install all this on most popular platforms.

2. Download and copy files into place
There are two ways to get Moodle, as a compressed package and via CVS. These are explained in detail on the download page: http://moodle.org/download/ 
After downloading and unpacking the archive, or checking out the files via CVS, you will be left with a directory called "moodle", containing a number of files and folders.
You can either place the whole folder in your web server documents directory, in which case the site will be located at http://yourwebserver.com/moodle , or you can copy all the contents straight into the main web server documents directory, in which case the site will be simplyhttp://yourwebserver.com .
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 "File Manager".

3. Site structure
You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:
config.php-contains basic settings. This file does not come with Moodle - you will create it.
install.php-the script you will run to create config.php
version.php-defines the current version of Moodle code
index.php-the front page of the site
admin/ - code to administrate the whole server
auth/ - plugin modules to authenticate users
blocks/ - plugin modules for the little side blocks on many pages
calendar/ - all the code for managing and displaying calendars
course/ - code to display and manage courses
doc/ - help documentation for Moodle (eg this page)
files/ - code to display and manage uploaded files
lang/ - texts in different languages, one directory per language
lib/ - libraries of core Moodle code
login/ - code to handle login and account creation
mod/ - all the main Moodle course modules are in here
pix/ - generic site graphics
theme/ - theme packs/skins to change the look of the site.
user/ - code to display and manage users

4. Run the Installer script to create config.php
To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access http://yourserver/install.php directly.
(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)
Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called config.php. 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 config.php into the main Moodle directory on the server.
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, look below for more information about some of common things that might be holding you up.
4.1 General web server settings
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:
DirectoryIndex index.php index.html index.htm
Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).
Secondly, if you are using Apache 2 , then you should turn on the AcceptPathInfo variable, which allows scripts to be passed arguments like http://server/file.php/arg1/arg2. 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.
AcceptPathInfo on
Thirdly, Moodle requires a number of PHP settings to be active for it to work. On most servers these will already be the default settings. However, some PHP servers (and some of the more recent PHP versions) may have things set differently. These are defined in PHP's configuration file (usually called php.ini):
magic_quotes_gpc = 1 (preferred but not necessary)
magic_quotes_runtime = 0 (necessary)
file_uploads = 1
session.auto_start = 0
session.bug_compat_warn = 0

If you don't have access to httpd.conf or php.ini on your server, or you have Moodle on a server with other applications that require different settings, then don't worry, you can often still OVERRIDE the default settings.
To do this, you need to create a file called .htaccess in Moodle's main directory that contains lines like the following. This only works on Apache servers and only when Overrides have been allowed in the main configuration.
DirectoryIndex index.php index.html index.htm

<IfDefine APACHE2>
AcceptPathInfo on
</IfDefine>

php_flag magic_quotes_gpc 1
php_flag magic_quotes_runtime 0
php_flag file_uploads 1
php_flag session.auto_start 0
php_flag session.bug_compat_warn 0
You can also do things like define the maximum size for uploaded files:
LimitRequestBody 0
php_value upload_max_filesize 2M
php_value post_max_size 2M

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:
cp lib/htaccess .htaccess

4.2 Creating a database
You need to create an empty database (eg " moodle ") in your database system along with a special user (eg "moodleuser") that has access to that database (and that database only). You could use the "root" 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.
If you are using a webhost, they will probably have a control panel web interface for you to create your database.
The Cpanel system is one of the most popular of these. To create a database in Cpanel,
Click on the " MySQL Databases " icon.
Type "moodle" in the database field and click " Add Database ".
Type a username and password (not one you use elsewhere) in the respective fields and click "Add User ".
Now use the " Add User to Database " button to give this new user account " ALL " rights to the new database.
Note that the username and database names may be prefixed by your Cpanel account name. When entering this information into the Moodle installer - use the full names.
If you have access to Unix command lines then you can do the same sort of thing by typing commands.
Here are some example Unix command lines for MySQL:
# mysql -u root -p
> CREATE DATABASE moodle;
> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON moodle.*
TO moodleuser@localhost IDENTIFIED BY 'yourpassword';
> quit
# mysqladmin -p reload

And some example command lines for PostgreSQL:
# su - postgres
> psql -c "create user moodleuser createdb;" template1
> psql -c "create database moodle;" -U moodleuser template1
> psql -c "alter user moodleuser nocreatedb;" template1

4.3 Creating a data directory
Moodle will also need some space on your server'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.
For security, it'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 then protect it by creating a file in the data directory called .htaccess, containing this line:
deny from all
To make sure that Moodle can save uploaded files in this directory, check that the web server software (eg Apache) 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 "nobody" or "apache", and then giving that user read, write and execute permissions.
On Cpanel systems you can use the "File Manager" to find the folder, click on it, then choose "Change Permissions". On many shared hosting servers, you will probably need to restrict all file access to your "group" (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 some sites that use a PHP feature known as "Safe Mode" may require the administrator to create this directory properly for you.
5. Go to the admin page to continue configuration
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 the "admin" page for the rest of the configuration.
The first time you access this admin page, you will be presented with a GPL "shrinkwrap" agreement with which you must agree before you can continue with the setup.
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 (in green or red) that look like this:
CREATE TABLE course ( id int(10) unsigned NOT NULL auto_increment, category int(10) unsigned NOT NULL default '0', password varchar(50) NOT NULL default '', fullname varchar(254) NOT NULL default '', shortname varchar(15) NOT NULL default '', summary text NOT NULL, format tinyint(4) NOT NULL default '1', teacher varchar(100) NOT NULL default 'Teacher', startdate int(10) unsigned NOT NULL default '0', enddate int(10) unsigned NOT NULL default '0', timemodified int(10) unsigned NOT NULL default '0', PRIMARY KEY (id)) TYPE=MyISAM
SUCCESS 
...and so on, followed by: Main databases set up successfully. 
If you don'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't in a restricted "Safe Mode" (commercial web hosts sometimes have safe mode turned on). You can check PHP variables by creating a little file containing <?php phpinfo() ?> and looking at it through a browser. Check all these and try this page again.
Scroll down the very bottom of the page and press the "Continue" link.
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'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 "Save changes".
If (and only if) you find yourself getting stuck on this page, unable to continue, then your server probably has what I call the "buggy referrer" problem. This is easy to fix: just turn off the "secureforms" setting, then try to continue again.
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 green .
Scroll down the very bottom of the page and press the "Continue" link.
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 "Save changes".
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 "Save changes". Not all the fields are required, but if you miss any important fields you'll be re-prompted for them.
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.
(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 "admin ", with password " admin ".)
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:
creating and deleting courses
creating and editing user accounts
administering teacher accounts
changing site-wide settings like themes etc
But you are not done installing yet! There is one very important thing still to do (see the next section on cron).

6. Set up cron -- IMPORTANT!
Some of Moodle's modules require continual checks to perform tasks. For example, Moodle needs to check the discussion forums so it can mail out copies of posts to people who have subscribed.
The script that does all this is located in the admin directory, and is called cron.php. However, it can not run itself, so you need to set up a mechanism where this script is run regularly (eg every five or ten minutes). This provides a "heartbeat" so that the script can perform functions at periods defined by each module. This kind of regular mechanism is known as a cron service .
Note that the machine performing the cron does not need to be the same machine that is running Moodle . For example, if you have a limited web hosting service that does not have a cron service, then you can might choose to run cron on another server or on your home computer. All that matters is that the cron.php file is called regularly.
The load of this script is not very high, so 5 minutes is usually reasonable, but if you're worried about it you can reduce the time period to something like 15 minutes or even 30 minutes. It's best not to make the time period too long, as delaying mail-outs can slow down activity within the course.
First, test that the script works by running it directly from your browser:
Now, you need to set up some of way of running the script automatically and regularly.
On Windows systems 
The simplest way is to use this little package moodle-cron-for-windows.zip which makes this whole thing very easy by installing a small Windows service. Run it and forget about it!
On web hosting services 
Your web-based control panel may have a web page that allows you to set up this cron process. For example, on Cpanel system, look for a button called "Cron jobs". In there you can put the same sort of Unix commands as listed below.
Using the command line on Unix
There are different command line programs you can use to call the page from the command line. Not all of them may be available on a given server.
For example, you can use a Unix utility like 'wget':
Note in this example that the output is thrown away (to /dev/null).
The same thing using lynx:
Alternatively you could use a standalone version of PHP, compiled to be run on the command line. The advantage with doing this is that your web server logs aren't filled with constant requests to cron.php. The disadvantage is that you need to have access to a command-line version of php.
/opt/bin/php /web/moodle/admin/cron.php


Using the crontab program on Unix
All that Cpanel does is provide a web interface to a Unix utility known as crontab. If you have a command line, you can set up crontab yourself using the command:
crontab -e
and then adding one of the above commands like:
*/5 * * * * wget -q -O /dev/null http://example.com/moodle/admin/cron.php
Usually, the "crontab" command will put you into the 'vi' editor. You enter "insert mode" by pressing "i", then type in the line as above, then exit insert mode by pressing ESC. You save and exit by typing ":wq", or quit without saving using ":q!" (without the quotes).

7. Create a new course
Now that Moodle is running properly, you can try creating a new course to play with.
Select "Create a new course" from the Admin page (or the admin links on the home page).
Fill out the form, paying special attention to the course format. You don'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.
Press "Save changes", 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 "Add a new user" on the Admin page.
Once done, the course is ready to customise, and is accessible via the "Courses" link on the home page.
See the " Teacher Manual " for more details on course-building.

Happy exploring and happy Moodling!
If you like Moodle, please consider donating to help us cover our costs! 

Moodle Documentation
Version: $Id: install.html,v 1.26.2.2 2005/07/15 19:44:42 moodler Exp $