1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
NEW INSTALLS
0 Check to see if webapp-config automatically installed
moodle for you in /var/www/localhost/htdocs. You should
see a directory in there called moodle. If it didn't
install it manually:
webapp-config -d moodle -I moodle X.Y.Z
Replace X.Y.Z with whatever version you just emerged.
1 Edit the config.php file found at
/var/www/localhost/htdocs/moodle/config.php
You should probably change the database password,
$CFG->dbpass = 'moodle_pass' to something more
obscure. Also, if your system has a FQDN, change
the $CFG->wwwroot = 'http://localhost/moodle'
to match the URL of your moodle installation.
IF YOU ARE USING MYSQL, do step 2a
IF YOU ARE USING POSTGRESQL, do step 2b
2a Create a new mysql database and account with the
appropriate privileges. Make sure the username,
password and database match their values in
config.php from step 1.
Connect to your mysql server using
mysql -p -u root
and at the mysql> prompt issue the following commands
CREATE DATABASE moodle_db;
GRANT ALL ON moodle_db.*
TO moodle_user@localhost
IDENTIFIED BY 'moodle_pass';
flush privileges;
2b Issue the following commands at a shell, making sure
the username, password and database match their values
in config.php from step 1.
su - postgres
psql -c "create user moodle_user createdb;" template1
psql -c "alter user moodle_user with encrypted password 'moodle_pass';" template1
psql -c "create database moodle_db with encoding 'unicode';" -U moodle_user template1
psql -c "alter user moodle_user nocreatedb;" template1
su - root
/etc/init.d/postgresql-X.Y reload
Replace X.Y with your version postgresql.
NOTE: Moodle docs say that moodle only works with
postgresql-7, but I've used it with 8 no problems.
3 Direct your browser to the URL in step 1. You should see
the license agreement. Click "Yes" to continue.
4 You are now about to install. Click the checkbox for
"Unattended operation" and "Continue" to start. Follow
the wizard as you "Setup administrator account" and configure
the "Front Page settings".
5 You now have a working installation. Before putting it
into production, you'll probably want to check that
everything is sane. In the "Site Administration" block,
click on
Server -> Environment
Make sure that you've got the green okay on all the
Server Checks. If you don't, click on the ? icons for
popup help.
6 Add a cron-job to root's crontab.
su - root
crontab -e # fcrontab -e if you use fcron
then add the line
*/30 * * * * root php -q /var/www/localhost/htdocs/moodle/admin/cron.php > /dev/null
7 For more information on installing moodle, see
http://docs.moodle.org/en/Installing_Moodle
For information on working with moodle, see
http://moodle.org/support/
=================================================================
UPGRADES
0 Before any upgade you should backup your database in case you have
to roll back. The moodle dirroot directory ($CFG->dirroot in the
config.php file) isn't as critical since you can always reinstall
that with web-apps. The moodle data root ($CFG->dataroot in config.php),
where files are uploaded, will not be touched. But the upgrade will
probably change your db schema, and the new format may not be backward
compatible. For mysql use
mysqldump -u moodle_user -p -C -Q -e --create-options moodle_db > moodle-backup.sql
or for postgresql use
su - postgres
pg_dump moodle_db > moodle-backup.sql
If you have to fall back, you can do so using
mysql -p -u moodle_user moodle_db < moodle-backup.sql
or
su - postgres
psql moodle_db < moodle-backup.sql
TEST THIS! PRACTICE THIS! Make sure it will work for you if you
have to fall back.
1 Emerge the new moodle ebuild. Be prepared to add USE flags for
php and re-emerge it since upgrades may require new functionality
from php. Remember to restart apache after re-emerging php!
2 If the ebuild didn't do it for you, update using
webapp-config -d moodle -U moodle X.Y.Z
3 Aim your browser to the URL in the config.php file defined
by $CFG->wwwroot. You will get a message that you are about
to automatically upgrade your server and cannot go back.
This is why you backed up your db in step 1. You can go back
if you use webapp-config to install the older version AND
drop the new db and restart the old one. You did practice
restoring, right?
4 Click "Continue" and follow through with the upgrade.
=================================================================
UNINSTALL
1 Make sure you really want to do this. I mean REALLY!
After step 3 you will be past the point of no return.
2 If you just want to uninstall the webapp, do the following
and no more!
emerge --unmerge moodle
Your data is still in the db and in the moodledata dir.
!!!!!!!!! POINT OF NO RETURN !!!!!!!!!
3 Uninstall the uploaded files
rm -rf /var/lib/moodledata
IF YOU ARE USING MYSQL, do step 4a
IF YOU ARE USING POSTGRESQL, do step 4b
4a Connect to your mysql server using 'mysql -p -u root' and
at the mysql> prompt issue the following commands:
DROP DATABASE moodle_db;
DROP USER moodle_user@localhost ;
4b Issue the following commands
su - postgres
psql -c "drop database moodle_db;" template1
psql -c "drop user moodle_user;" template1
5 Remove the root cron-job
su - root
crontab -e # fcrontab -e if you use fcron
and delete the line added above.
=================================================================
ADDITIONAL PHP REQUIREMENTS
Moodle allows for many method of authentication. To see
what these are, in the "Site Administration" block, click
on
Users -> Authentication -> Manage Authentication
Moodle will try to authenticate by each method in order
until it either succeeds or exhausts the list and fails.
In order to use some of these methods, you need to make
sure PHP was compiled with the correct support. You will
know that you do not have the correct support compiled in
if authentication by all previous methods fails, and you
encounter a method for which PHP does not have support.
An error will be thrown and reported in the web page.
Currently, the ebuild has support for the following
Auth Method USE flag
IMAP(S) or POP3(S) imap
LDAP or CAS ldap
External database odbc
RADIUS radius
|