Note: You are currently viewing documentation for Moodle 3.7. Up-to-date documentation for the latest stable version of Moodle may be available here: FreeBSD Installing.

FreeBSD Installing

From MoodleDocs

Using Ports

Ports are FreeBSB software package system, you can use to install, uninstall, update your softwares packages.

If you didn't install it along the basic system, you can do it now:

portsnap fetch

:portsnap extract

If you already have it installed, just update:

portsnap fetch update

Using Ports, the package system itself will verify dependencies, download (if necessary), compile and install them all.

You can use binary packages avaliables at install media (like CD, USB or FTP) as well.

Quick install

You could install Moodle using Ports:

cd /usr/ports/www/moodle26/

make install clean

Step by step install

Install Apache

Apache will be your http server.

cd /usr/ports/www/apache22

make install clean

Now, configure Apache to start at boot:

echo 'apache24_enable="YES"' >> /etc/rc.conf

/usr/local/etc/rc.d/apache24 start

Point your web browser to the host name or IP address and you should see the venerable “It Works”.

Install MySQL

MySQL will be your SQL database server.

cd /usr/ports/databases/mysql56-server/

make install clean

Now, configure MySQL to start at boot:

echo 'mysql_enable="YES"' >> /etc/rc.conf

/usr/local/etc/rc.d/mysql-server start

For increase security, set a password for the MySQL root user:

/usr/local/bin/mysqladmin -u root password 'your-password'

Install PHP

PHP is the scripting language in which Moodle is developed

cd /usr/ports/lang/php5

Before we proceed, we need to add a configuration option so that PHP build includes support for the Apache server:

make config

Select “Build Apache module”:

make install clean

Copy the recommended configuration file for production server:

cp /usr/local/etc/php.ini-development /usr/local/etc/php.ini

Create a mod_php configuration file at "/usr/local/etc/apache24/Includes/mod_php.conf":

<IfModule mod_php5.c>

DirectoryIndex index.php index.html

</IfModule>

<IfModule mod_php5.c>

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

</IfModule>

Moodle require somes additional PHP extensions.

cd /usr/ports/lang/php5-extensions/

Check (if not checked already) this extensions at menu and install: CTYPE, CURL, DOM, GD, HASH, ICONV, JSON, MBSTRING, MYSQL, MYSQLI, OPENSSL, SOAP, SIMPLEXML, TOKENIZER, XMLRPC, XSL, ZIP, ZLIB:

make config

Then install this extensions:

make install clean

Install GIT

GIT is a tool to download, update and contribe code to Moodle.

cd /usr/ports/devel/git

make install clean

Preparing Moodle

Read Installing documentation before follow this steps.

Download Moodle

Using GIT, you can download, update, upgrade moodle to Apache www public diretory

cd /usr/local/www/apache26/data/

git clone -b MOODLE_26_STABLE git://git.moodle.org/moodle.git

Set Apache user as owner of all Moodle directory and files:

chown -R www:www moodle

Create Moodledata

mkdir /usr/local/www/apache24/moodledata

Give Apache user total privilegies to this directory

chown -R /usr/local/www/apache24/moodledata

chmod -R 777 /usr/local/www/apache24/moodledata

Create Moodledb

Access MySQL console

mysql -u root -p

Then execute following SQL statments, replacing "yourpassword" for some password you want:

mysql> CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

mysql> GRANT ALL ON moodle.* TO moodle@localhost IDENTIFIED BY 'yourpassword';

Installing Moodle

You can choose two methods, using command line interface (CLI) or web installer.

CLI

Execute Moodle CLI Installer:

cd /usr/local/www/apache26/data/moodle

su www -c '/usr/bin/php-cli admin/cli/install.php'

Follow the instructions and if you need more information:

su www -c '/usr/bin/php-cli admin/cli/install.php --help'

Web Installer

Open your web browser to the host name or IP address plus "/moodle", like exemple.com/moodle or 127.0.0.1/moodle. Then, follow the instructions.

Post-installation

Configure a cronjob

Use server crontab to automaticly execute Moodle Cron each 5 minutes:

crontab -u www -e

*/5 * * * * cd /usr/local/www/apache24/data/moodle ; /usr/bin/php-cli admin/cli/cron.php > /dev/null

Check Moodle configurations

  • Settings > Site administration > Reports > Security overview: Overview details of your environment security
  • Settings > Site administration > Courses > Backups > Automated backup setup: Setup Moodle to automatic backup your courses
  • Settings > Site administration > Server > HTTP: If you need to set up proxy credentials
  • Settings > Site administration > Plugins > Message Outputs > Email: Set your smtp server and authentication if required (so your Moodle site can send emails). The support contact for your site is also set on this page.


See also

  1. Installation
  2. Installation_FAQ
  3. Unix_or_Linux_Installation


References

  1. http://www.freebsd.org/doc/handbook/ports.html
  2. http://www.freebsd.org/doc/handbook/packages-using.html
  3. http://www.freebsd.org/doc/en/books/handbook/network-apache.html
  4. http://dev.mysql.com/doc/refman/5.6/en/freebsd-installation.html
  5. https://docs.moodle.org/37/en/PHP
  6. http://git.moodle.org/
  7. https://docs.moodle.org/37/en/Installing_Moodle
  8. https://docs.moodle.org/37/en/Git_for_Administrators
  9. https://docs.moodle.org/37/en/Cron