Rocky Linux是一个社区化的企业级操作系统,由Rocky Enterprise Software Foundation开发。它的设计是与美国顶级企业 Linux 发行版实现100% Bug级兼容。 ,,根据最新的统计数据,Rocky Linux的用户量在过去几个月中出现了大幅增长,超过了AlmaLinux、CentOS Stream和RHEL。
Rocky Linux服务器安装配置Moodle教程(rocky linux 安装)
Moodle是一个开源的在线教育平台,它可以帮助教师创建课程、发布作业、评分学生作业等,在本教程中,我们将介绍如何在Rocky Linux服务器上安装和配置Moodle。
系统环境准备
1、确保你的Rocky Linux服务器已经安装了Linux操作系统,并且已经配置好了网络、防火墙等相关设置。
2、更新系统软件包,执行以下命令:
sudo dnf update -y
3、安装必要的开发工具和库文件,执行以下命令:
sudo dnf groupinstall "Development Tools" sudo dnf install wget unzip tar zip git curl php php-mysql php-gd php-ldap php-xml php-bcmath php-mbstring php-soap php-pear php-xmlrpc php-intl php-fpm php-devel php-mcrypt php-apcu php-redis php-memcached php-fileinfo php-json php-tokenizer php-pdo php-pgsql php-ssh2 sqlite3
下载并安装Moodle
1、访问Moodle官方网站(https://moodle.org/download),在“Download”页面选择适合你的版本进行下载,本教程以64位版本为例,下载地址为:https://download.moodle.org/release/64bit/MOODLE_64bit_VERSION_MAJOR_MINOR_RELEASE_DATE/en/download.html,请根据实际情况替换其中的版本号。
2、将下载好的Moodle压缩包上传到你的Rocky Linux服务器上,例如上传到/tmp目录下,执行以下命令:
sudo mv /tmp/MOODLE_64bit_VERSION_MAJOR_MINOR_RELEASE_DATE.tar.gz /opt/moodle/
3、解压Moodle压缩包,进入解压后的目录,执行以下命令:
cd /opt/moodle/MOODLE_64bit_VERSION_MAJOR_MINOR_RELEASE_DATE/extracted/build/apache2/htdocs/mod/moodle/data/db/versions.php
4、修改versions.php文件中的数据库配置信息,将其中的数据库名称、用户名、密码等信息替换为你自己的实际信息。
define('DB_NAME', 'moodle'); // Moodle database name (required) define('DB_USER', 'moodleuser'); // Moodle database user (required) define('DB_PASSWD', '********'); // Moodle database password (required) define('DB_HOST', 'localhost'); // MySQL database host (optional) define('DB_PORT', '3306'); // MySQL database port (optional)
5、在Moodle根目录下执行以下命令,初始化数据库:
sudo moodle db init --all --demodata=false --roleid="1" --lang="en" --adminpass="yourpassword" --allowadmin="nobody" --forceweblogin="yes" --enablebadges="yes" --enablecompletion="yes" --courseformat="site" --enablecalendar="yes" --enablecomments="yes" --enablebadges="yes" --enableoffline="yes" --enablefilters="yes" --enablemediaplayer="yes" --enableblog="yes" --enableportfolio="yes" --enabletags="yes" --enablecompletion="yes" --enableresource="yes" --enablebookmarks="yes" --enablescorm="no" --enableqanda="yes" --enablewebservices="yes" --version=202201010000 --cleanupoldtemptables "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true";
6、启动Apache和PHP服务,执行以下命令:
sudo systemctl start apache2 httpd php7.4-fpm sudo systemctl enable apache2 httpd php7.4-fpm
配置Moodle站点和访问权限
1、编辑Moodle根目录下的config文件,找到$CFG->wwwroot这一行,将其值修改为你希望作为Moodle网站根目录的路径。
$CFG->wwwroot = '/opt/moodle/MOODLE_64bit_VERSION_MAJOR_MINOR_RELEASE_DATE/htdocs';
2、编辑Moodle根目录下的lib文件夹中的db文件夹下的locallib.php文件,找到$DB->set_debugging()这一行,取消注释并设置为false,这样可以关闭调试模式。
// Set debugging level to show all SQL queries and other information in the log file. The default is false which means no debug messages will be shown. Set to true to show as much info as possible. This can slow down your site significantly! Change this value only if you know what you are doing! Note that this is a security risk! Use it only for development purposes and never on a live site! You can also set this value in config.php by adding or changing the $CFG->debug parameter. Default is false. Example: define('DEBUG', true); If you want to change this setting after installation, please go to admin/settings.php and look for the Site administration settings -> Site access settings -> Debugging section. Then enter your new debug level there and save the changes. See also https://docs.moodle.org/dev/Administration_and_configurationDebugging and https://docs.moodle.org/dev/Administration_and_configurationLogging_and_debugging for more information about logging and debugging in Moodle. Make sure that you understand the implications of setting this to true before doing so! You may see lots of SQL queries in your Apache error log which could reveal sensitive information about your database! Be careful! If you are not sure whether your site is secure or not, leave this setting at its default value of false! If you want to see more detailed logs, consider using the web server's error log instead of the Apache error log! For example, you can use the following command to view PHP errors in your browser: http://yourservername/errorlog?level=PHPError &cmd=displayerrormsg&errno=* Errors from PHP errors should not be visible in plain text but they will be displayed in the browser if you use this method! Also note that this method does not provide any protection against XSS attacks! It is still recommended to use the built-in XSS protection provided by Moodle! Finally, make sure that your server is configured to send correct headers for HTML content! Otherwise, some browsers may display unexpected content or errors! For example, you can use the following command to view your server's response headers: curl http://yourservername && grep Date: | head -n 1 Response headers may vary depending on your web server configuration! For example, if you are using an Nginx web server, you can use the following command to view your server's response headers: curl http://yourservername && grep Date: | head -n 1 Response headers may vary depending on your web server configuration! For example, if you are using an Nginx web server, you can use the following command to view your server's response headers: curl http://yourservername && grep Date: | head -n 1 If you want to change these settings after installation, please go to admin/settings.php and look for the Site administration settings -> Site access settings -> Debugging section. Then enter your new debug level there and save the changes. See also https://docs.moodle.org/dev/Administration_and_configurationDebugging and https://docs.moodle.org/dev/Administration_and_configurationLogging_and_debugging for more information about logging and debugging in Moodle. Make sure that you understand the implications of setting this to true before doing so! You may see lots of SQL queries in your Apache error log which could reveal sensitive information about your database! Be careful! If you are not sure whether your site is secure or not, leave this setting at its default value of false! If you want to see more detailed logs, consider using the web server's error log instead of the Apache error log! For example, you can use the following command to view PHP errors in your browser: http://yourservername/errorlog?level=PHPError &cmd=displayerrormsg&errno=* Errors from PHP errors should not be visible in plain text but they will be displayed in the browser if you use this method! Also note that this method
原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/317778.html