OpenBSD4.2+moodle搭建安全高效网上教学服务器
Moodle是全球排名第一的开放源代码 CMS(LMS)学习管理系统。如果您的业务是提供教学或培训服务,并且想把这种服务延伸到Internet上,那么 Moodle正适合您。
这一高价值的应用程序,易于安装、实施和使用,并且免费!
无论您是培训机构、个人培训者还是传统的学校,只要您的目标是寻找一个网络教学环境,Moodle都可能适合您。
本文讲述如何在OpenBSD4.2上搭建一个安全高效的moodle服务器。
# pkg_add -v ftp://ftp.freebsdchina.org/pub/O ... l-server-5.0.45.tgz
mysql-server-5.0.45:parsing mysql-client-5.0.45
mysql-server-5.0.45:mysql-client-5.0.45complete mysql-server-5.0.45:parsing p5-DBD-mysql-3.0008
mysql-server-5.0.45:parsing p5-DBI-1.53
mysql-server-5.0.45:parsing p5-Net-Daemon-0.39
mysql-server-5.0.45:p5-Net-Daemon-0.39: complete
mysql-server-5.0.45:p5-PlRPC-0.2018p0: complete
mysql-server-5.0.45:p5-DBI-1.53: complete
mysql-server-5.0.45:p5-DBD-mysql-3.0008: complete
adding group _mysql
adding user _mysql
mysql-server-5.0.45: complete
--- mysql-server-5.0.45 -------------------
You can find detailed instructions on how to install a database
in /usr/local/share/doc/mysql/README.OpenBSD.
#
# pkg_add -v ftp://ftp.freebsdchina.org/pub/O ... php5-core-5.2.3.tgz
php5-core-5.2.3:libiconv-1.9.2p3: complete
php5-core-5.2.3:parsing gettext-0.14.6p0
php5-core-5.2.3:parsing libxml-2.6.29
php5-core-5.2.3:libxml-2.6.29: complete
php5-core-5.2.3: complete
--- php5-core-5.2.3 -------------------
To finish the install, enable the php5 module with:
/usr/local/sbin/phpxs -s
To enable parsing of PHP scripts, add the following to
#i/var/www/conf/httpd.conf:
AddType application/x-httpd-php .php
#cp /usr/local/share/examples/php5/php.ini-recommended /var/www/conf/php.ini
#mkdir /var/www/tmp
Don't forget that the default OpenBSD httpd is chrooted
into /var/www by default, so you may need to create support
directories such as /var/www/tmp for PHP to work correctly.
#
# pkg_add -v ftp://ftp.freebsdchina.org/pub/O ... 86/php5-extensions-
5.2.3.tgz
php5-extensions-5.2.3: complete
--- php5-extensions-5.2.3 -------------------
This is a place-holder package to inform you that the PHP port is
now split into small sub-packages, designed to allow you to install
modules independently of the main PHP engine.
For example, to install the IMAP module, just pkg_add the
php5-imap-5.2.3.tgz package and activate it using the
'phpxs' command.
This package contains no files or dependencies and may be
safely uninstalled.
#
# pkg_add -v ftp://ftp.freebsdchina.org/pub/O ... pMyAdmin-2.10.1.tgz
phpMyAdmin-2.10.1:parsing jpeg-6bp3
found libspec c.41.0 in /usr/lib
phpMyAdmin-2.10.1:jpeg-6bp3: complete
phpMyAdmin-2.10.1:parsing png-1.2.18
phpMyAdmin-2.10.1:png-1.2.18: complete
phpMyAdmin-2.10.1:php5-gd-5.2.3: complete
phpMyAdmin-2.10.1:parsing php5-mbstring-5.2.3
phpMyAdmin-2.10.1:php5-mbstring-5.2.3: complete
phpMyAdmin-2.10.1:parsing php5-mcrypt-5.2.3
phpMyAdmin-2.10.1:parsing libltdl-1.5.22p2
phpMyAdmin-2.10.1:libltdl-1.5.22p2: complete
hpMyAdmin-2.10.1:parsing libmcrypt-2.5.7p1
phpMyAdmin-2.10.1:parsing mhash-0.9.1p1
phpMyAdmin-2.10.1:mhash-0.9.1p1: complete
phpMyAdmin-2.10.1:libmcrypt-2.5.7p1: complete
phpMyAdmin-2.10.1:php5-mcrypt-5.2.3: complete
phpMyAdmin-2.10.1:parsing php5-mysql-5.2.3
Dependencies for php5-mysql-5.2.3 resolve to: php5-core-5.2.3, mysql-client-5.0.45
phpMyAdmin-2.10.1:php5-mysql-5.2.3: complete
installed/var/www/phpMyAdmin/config.inc.phpfrom /var/www/phpMyAdmin/config.sample.inc.php
phpMyAdmin-2.10.1: complete
--- php5-gd-5.2.3 -------------------
Enable this module in php.ini using the following command:
/usr/local/sbin/phpxs -a gd
--- php5-mbstring-5.2.3 -------------------
Enable this module in php.ini using the following command:
/usr/local/sbin/phpxs -a mbstring
--- php5-mcrypt-5.2.3 -------------------
Enable this module in php.ini using the following command:
/usr/local/sbin/phpxs -a mcrypt
--- php5-mysql-5.2.3 -------------------
Enable this module in php.ini using the following command:
/usr/local/sbin/phpxs -a mysql
--- phpMyAdmin-2.10.1 -------------------
The phpMyAdmin has been installed into /var/www/phpMyAdmin
You should point this to the DocumentRoot of your web-server:
# ln –s /var/www/phpMyAdmin /var/www/htdocs/phpMyAdmin
(make sure you use a relative symlink since Apache is chrooted)
You can ensure you have a working install by accessing:
http://<localhost>/phpMyAdmin/index.php
#
# pkg_add -v ftp://ftp.freebsdchina.org/pub/O ... p5-curl-5.2.3p0.tgz
php5-curl-5.2.3p0:parsing libidn-0.6.1
php5-curl-5.2.3p0: complete
--- php5-curl-5.2.3p0 -------------------
Enable this module in php.ini using the following command:
/usr/local/sbin/phpxs -a curl
#/usr/local/bin/mysql_install_db
#/etc/sysctl.conf: 添加以下一行
kern.maxfiles=4096
#vi /etc/login.conf 添加以下几行
mysql:\
penfiles-cur=1024:\
penfiles-max=2048:\
:tc=daemon:
# cap_mkdb /etc/login.conf
#vi /etc/rc.local
if [ -x /usr/local/bin/mysqld_safe ] ; then
su -c mysql root -c '/usr/local/bin/mysqld_safe >/dev/null 2>&1 &'
echo -n ' mysql'
fi
# vi /etc/my.cnf 添加以下几行
bind-address = 127.0.0.1
open-files-limit=8192
open-files=1000
#reboot
#/usr/local/bin/mysqladmin -u root password 123456
#vi /var/www/phpMyAdmin/config.inc.php
找到以下行添加密码,原来为‘‘ 加上123456错误提示就取消了
$cfg['blowfish_secret'] = '123456'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */^M
用浏览器进行测试
htpp://59.74.71.77/
http://59.74.71.77/test.php
http://59.74.71.77/phpMyAdmin/index.php
用ftp或ssh将moodle程序复制到#/var/www/htdocs/下解压缩
# tar zxvf moodle-1.8.3.tar
在浏览器里输入htpp://59.74.71.77/moodle/index.php
# mkdir /var/www/moodledata
# chown www /var/www/moodledata
# chgrp www /var/www/moodledata
# 在http://59.74.71.77/phpMyAdmin/index.php 里建立数据库moodle
先下载http://download.moodle.org/lang16/.zip
手动把它复制到“/var/www/moodledata/lang”您的服务器上。
#chmod 777 /var/www/moodledata
#chomd –R 777 /var/www/htdocs/moodle