Moodle LMS on Ubuntu server 22.04 Installation of required packages: sudo apt install -y mysql-client mysql-server apache2 php php-mysql php-mbstring php-xml php-curl php-zip php-gd php-intl php-soap
Installing Moodle on Ubuntu 22.04
The content of the provided text file outlines a step-by-step guide for installing Moodle on an Ubuntu 22.04 server. Below is a structured summary of the installation process:
1. Initial Setup
- Connect to Server: Use SSH to connect to your Ubuntu server.
- Update Server: Ensure the server is up to date.
2. Install Required Software
- Install Apache, MySQL, and PHP: Use a single command to install Apache web server, MySQL, PHP, and necessary PHP extensions.
3. Download Moodle
- Access Moodle Website: Go to moodle.org and navigate to the Downloads section.
- Download Using wget: Copy the download link for the latest version (e.g., 4.2.2) and use
wget
to download it directly to the server.
4. Move and Extract Moodle Files
- Move Files: Move the downloaded
.tgz
file to/var/www/html
. - Extract Files: Use the
tar
command to extract the contents.
5. Configure Moodle Directory
- Access Moodle via Browser: Open the server’s IP address followed by
/moodle
. - Set Up Data Directory: Create a data directory (e.g.,
/var/www/moodledata
) and change its ownership towww-data
for proper permissions.
6. Database Setup
- Create MySQL Database: Open MySQL and create a new database for Moodle.
- Create MySQL User: Set up a user with appropriate privileges for the database.
7. Complete Moodle Configuration
- Fill in Database Details: During installation, input the database user and password.
- Create config.php File: Manually create this file in the Moodle directory if permissions prevent automatic creation.
8. Adjust PHP Settings
- Restart Apache Server: Use
systemctl restart apache2
if any PHP extensions are missing. - Modify php.ini File: Change
max_input_vars
from 1000 to 5000 as required by Moodle.
9. Finalize Installation
- Complete Installation Steps: Follow on-screen prompts to set up admin credentials and finalize configuration.
Conclusion
After completing these steps, your Moodle site will be installed and ready for use, allowing you to manage courses and users effectively.
https://www.perplexity.ai перескажи текст
Тimecodes
0:00 – Introduction to installing Moodle on Ubuntu 22.04
0:06 – Compatibility with older and newer Ubuntu versions
0:10 – Connecting to the Ubuntu server using SSH
0:17 – Ensuring the server is up to date
0:24 – Starting the installation process
0:28 – Installing Apache, MySQL, and PHP
0:35 – Installing necessary PHP extensions
0:41 – Command for installing all required software
0:52 – Navigating to moodle.org for downloads
1:11 – Selecting the Moodle version (4.2.2) for download
1:25 – Choosing the tgz option for download
1:37 – Copying download link for direct server installation
1:54 – Using wget to download Moodle directly to the server
2:14 – Confirming Moodle is downloaded successfully
2:20 – Moving the tgz file to /var/www/html
2:50 – Extracting the contents of the tgz archive
3:18 – Accessing Moodle installation via web browser
3:44 – Choosing a language for installation
3:49 – Setting up the data directory for Moodle
4:07 – Creating the Moodle data folder on the server
4:25 – Changing ownership of the Moodle data directory to www-data
5:32 – Creating a database for Moodle in MySQL
5:51 – Opening MySQL and creating a new database
6:02 – Creating a MySQL user for Moodle database access
6:39 – Granting privileges to the new user on the Moodle database
7:21 – Returning to Moodle setup page and selecting MySQL as database type
7:45 – Completing configuration and generating config.php file
8:34 – Restarting Apache server due to GD PHP extension warning
9:06 – Adjusting PHP settings for Max input vars requirement
10:38 – Restarting Apache server again after making changes
11:01 – Completing Moodle installation process and filling in final details
https://www.perplexity.ai сделай таймкоды
Расшифровка видео
Поиск по видео
0:00
Let’s install Moodle on Ubuntu 22.04 I’m going to install on Ubuntu 22.04
0:06
but it should work for older or newer versions of Ubuntu as well.
0:10
Let’s start by connecting to our Ubuntu server using SSH
0:17
and let’s make sure that the server is up to date.
0:24
So, the server is up to date and we can go ahead and start with the installation itself.
0:28
So what we basically need to install is Apache, the Apache web server, MySQL and PHP.
0:35
The thing is that on top of PHP we also have to install several PHP extensions.
0:41
So, instead of going over them one by one I just paste the command
0:44
that installs everything we need and I’ll make sure to also include this command
0:48
in the description box of this video.
0:52
So here it is and as you can see we’re going to install MySQL, Apache 2, PHP,
0:56
and also several extensions for PHP. So let’s go ahead and install everything
1:03
and while it’s being installed let’s go to moodle.org
1:11
Here I’m going to choose from the options Downloads
1:15
and I click on the green button where it says module 4.2.2 now when you are
1:20
watching this video this version might be a bit newer but it doesn’t really matter.
1:25
And we’re going to go with a tgz option
1:28
so: download tgz and it’s being installed to a local computer
1:33
but I stopped this installation because we do not want it in our local computer.
1:37
We want it on the server. So what I’m going to do instead
1:40
is right click here where it says click here to download manually
1:44
and then I’m going to copy this link. This will allow me to download moodle
1:49
directly to the server. So let’s wait for the installations on the server to finish
1:54
Okay, so everything was installed on the server
1:57
and now we’re going to use wget to download Moodle directly to the server.
2:02
So wget
2:04
and now I paste the link that I just copied from here
2:07
and let’s run this command and this will download model to the server.
2:14
So Moodle is being downloaded, so this is great, and if we list our files now
2:20
we can see the tgz archive we just downloaded here.
2:24
I’m now going to move this file to VAR www HTML
2:28
So to do that we’ll use the move command
2:33
So this is the folder to which we want to move the tgz archive
2:38
and it was moved and now let’s change directory to this folder.
2:44
So that’s great, and if we list the files here we can see here the tgz archive.
2:50
We now want to extract the contents of this archive and to do that we’ll use the tar command.
2:55
So tar, then dash XF for extract file and then the name of the tgz archive itself.
3:04
And let’s run this command as root
3:08
And the contents of the archive were extracted and if we list the files now
3:13
we can see that we now have the Moodle folder. So this folder is going to allow us
3:18
to access the Moodle installation. So let’s go to our web browser
3:22
and here I want to access the IP address of the server. So let’s run IPA
3:28
to check the IP address of the server and here we can see it, so let’s copy it
3:34
and let’s access our server and then forward slash Moodle
3:41
and you can see the response from Moodle on the server.
3:44
We need to choose a language
3:45
choose any language you want I’ll go with English for this demonstration
3:49
and then click on next and here if we scroll down
3:53
we can see a web address and the Moodle directory and we cannot change these two
3:58
but what we need to take care of is the data directory. So as you can see the default
4:03
is VAR www Moodle data. So let’s create this folder on our server.
4:07
So I’ll copy the name of the folder and here I go one level up
4:13
and now I’m in the www folder and I can create the moodle data folder.
4:17
So let’s create the directory here
4:21
and it was created. Now, there is another thing we need to change here
4:25
so if we list the files we have here
4:29
we can see that the owner of the Moodle data folder is root. We need to change it
4:34
because Moodle needs full access to this directory. So we’re going to change the owner of the directory
4:40
from root to www dash data. Now www dash data is the default user
4:45
for the Apache web server but this is the user that will actually interact with Moodle.
4:50
So this is the user that needs to be the owner of this directory
4:53
and to change the owner of a directory we can use the change owner command.
4:58
So, sudo change owner and as we said the name of this user is
5:03
www dash data
5:07
and now we need to specify which file or folder we want it to be the owner of
5:12
So in our case this folder Moodle data
5:17
and let’s run the command and if we list the files again
5:22
we can see that now the owner of this folder is www data so this should work
5:27
and we can click on next. Next, we need the database for Moodle.
5:32
So let’s get back to moodle.org and now from the options
5:36
I’m going to choose Documentation and let’s click on installation quick guide
5:41
and if we scroll down a bit we can find a section
5:44
that talks about creating the database. So first let’s open MySQL
5:51
and to create a database we need to run this command
5:54
so let’s copy it and paste it
5:57
and then Moodle database was created and next we need a MySQL user
6:02
to interact with this database. So this is how you do it for other versions of MySQL
6:07
but that’s not what we’re going to do. We are going to use these commands.
6:10
Okay so let’s start with the first one and notice that right now I’m creating a user
6:16
called Moodle user and the password is going to be your password.
6:20
Now I highly recommend that you change both of them. Don’t use this default username and
6:25
definitely don’t use this password. ‘Your password’ is probably one of the worst passwords
6:30
you can choose so go with something a bit more secure. As for the username
6:34
you can go with Moodle user but again, I recommend to change it as well.
6:39
For this demonstration I’ll go with this username and this password
6:42
but you should not do it and you should change at least your password.
6:46
Next, we want to Grant privileges to this new user on the Moodle database
6:51
and we can do it with this command and of course if you used any other name
6:56
that’s different than Moodle user, you’re going to have to change it here as well.
7:00
But since I used model user I don’t have to change it. So let’s run this command
7:05
and let’s also run this command. To be honest it’s going to work
7:09
even if you don’t run it but let’s run it anyway and that’s it about MySQL, so let’s quit.
7:17
Let’s now get back to our Moodle setup page
7:21
and of course we’ll choose MySQL because that’s what we installed. So next,
7:26
and here we need to provide a database user we created so I’ll copy the user
7:30
I created from here
7:33
and we also need the password for this user so I’ll copy what I have here.
7:39
And that’s it for this page so let’s click on next
7:42
and as you can see the configuration was completed
7:45
now Moodle generated a config.php file
7:48
but because of permission issues
7:50
it cannot write it directly to the server so we need to help it.
7:54
So, what we need to do is get back to our Moodle folder
7:58
and here we need to create the config.php file.
8:02
To create the file I’ll use Nano.
8:09
And I’m simply going to copy the text from here
8:13
and paste it in my file and I now save the file with Ctrl s
8:18
and exit with Ctrl X. And let’s click on next
8:24
and we need to confirm the license terms so let’s click on continue
8:29
and as you can see we got the warning that we do not have the GD PHP extension.
8:34
But it’s not true, we actually have it installed on the server so all we need to do
8:38
is to restart the Apache server. So, to do that, we’re going to use the system CTL command.
8:46
And you want to restart the service, so restart and now we need to specify the service
8:51
we want to restart, in our case Apache 2.
8:56
So, let’s refresh the page and now this warning is gone
9:02
but if we scroll to the very bottom we can see that we still have one problem here.
9:06
So it says that PHP setting Max input vars must be at least five thousand.
9:12
So, let’s change it in our server to fulfill this requirement and to do that
9:16
we need to edit the file so we’ll use Nano again and this file can be found at etc
9:24
PHP and then the version of PHP you have on your server.
9:28
In most cases you’re only going to have one version of PHP
9:31
so tab again and in this folder you’re going to have
9:34
an Apache two folder and inside this folder
9:39
as you can see we have this file php.ini This is the file we want to edit
9:44
so php.ini and let’s edit this file
9:49
and this is a very long file and we need to find something very specific inside it.
9:53
So instead of just scrolling through the file we’re going to look specifically
9:56
for what we need to change. So let’s copy the name of the variable
10:00
from here and now I’ll click here and as you can see
10:04
it says where is and the shortcut is Ctrl W. So Ctrl W, and here I’ll paste the name
10:10
that I just copied from here max input vars and let’s hit enter
10:15
and it found the line for us. So as you can see right now this line is commented out
10:19
and I know that because of the semicolon at the beginning.
10:22
So let’s delete this semicolon and now I’ll change the value from 1000 to 5000
10:28
because that’s what it says here.
10:33
And let’s save this file with Ctrl s and exit with Ctrl X.
10:38
And once again we need to restart our Apache server.
10:43
And if we refresh the page now we can see that this error disappeared.
10:48
It does say that we’re not using https but it is to be expected
10:53
because I’m using a server on my local network So if you don’t use https
10:57
you’re going to have this warning. I’m fine with that, so let’s click on continue
11:01
and moodle is being installed on the server it shouldn’t take more than 5 minutes or so.
11:08
okay, so the installation is done, let’s click on continue
11:12
and we’re almost done, we just need to fill in a few more details.
11:16
So, for the username I’ll go with admin, you can change it if you want
11:19
and we need to provide the password
11:23
and then email address
11:28
and update profile. And let’s give a name to the website
11:36
and here we need to provide a support email
11:44
and our Moodle website is up and running ready for use