Installation on Ubuntu using Git
Contents
Introduction
This page gives the basic steps to install LMS on Ubuntu using LMS code from Git. This is generally a better idea than using the Ubuntu ‘.deb’ package.
There was no intention to provide a fully secured production server. This just gets basic LMS working on ‘localhost’.
This should work on either Ubuntu Desktop or Server edition.
Install Ubuntu
- Install Ubuntu Desktop or Ubuntu Server using (if in doubt) default settings
Basic Setup
- Open a terminal window (from Applications>Accessories) on Desktop or log into the terminal on Server.
- become root (and stay there right through this), install some additional software (git and php extras LMS needs):
sudo su (you will need to enter your password) apt-get update apt-get install git git-core git-doc apt-get install php5-gd php5-curl php5-intl php5-xmlrpc apt-get install php5 mysql-server mysql-client apache2 php5-mysql apt-get install php5-json
- (on Desktop) open a web browser and go to http://localhost/ and make sure you see ‘It works!’.
- (on Server) open a web browser on a remote machine and go to http://name.or.ip.of.server/ and make sure you see ‘It works!’.
Install LMS code
We’re going to use Git to pull the latest code. You could just download it, but this is more fun! The checkout switches to the latest (weekly) of the 2.6 branch. The chmod (temporarily) allows the installation script to write the config file. Still as superuser (‘sudo su’ from before):
cd /var/www git clone https://github.com/lms/lms.git cd lms git checkout -t origin/LMS_26_STABLE chmod 0777 /var/www/lms
- The lms code location (for installation) is /var/www/lms
Create the data area
You can create this where you like (more or less) but I will do (assuming you are still superuser)…
mkdir /var/lmsdata chmod 0777 /var/lmsdata
- The lms data location (for installation) is /var/lmsdata
Create the database
You will need the root database password. Unless you have changed it, this is same as your login password (or whatever you set up when you installed MySQL above).
mysql -u root -p (asks for password here) mysql> create database lms default character set utf8; mysql> grant all on lms.* to lmsuser@localhost identified by 'mypassword'; mysql> exit
Notes:
- don’t type ‘mysql>’, that’s just the prompt from the mysql client.
- The grant command creates the MySQL account ‘lmsuser’ with the supplied password and gives it rights to the lms database all in one command.
- Set ‘mypassword’ to something you make up. This is the password for your lms database
- When you install lms the database is called ‘lms’, the database user ‘lmsuser’ and the password as above
Configure apache
The standard configuration of Apache on Ubuntu should work fine and will give you a LMS URL of http://name.or.ip.of.server/lms (or http://localhost/lms).
If you need other configurations or a different form of URL, now is the time to configure this. However, this is not covered here. There is lots of information online, although do note that the Ubuntu Apache configuration is rather different to the standard layout.
Install LMS
Open Firefox and go to address http://localhost/lms
You should be able to install LMS using the information indicated above
and finally
Don’t skip this step. This secures the LMS code, preventing it being overwritten by hackers.
chmod 0755 /var/www/lms exit
Don’t forget
- Set up Cron
- Check the Email settings
a quick note on updating
Because we installed using Git, updating LMS (on the same stable branch) becomes surprisingly simple. Using the repository we did gives you the latest weekly at any time. If it matters, do a backup first then:
sudo su chmod /var/www/lms git pull exit
Then go to the Site administration > Notifications page in LMS to complete the upgrade.
Troubleshooting
- If something goes wrong in the actual LMS installation – switch on Debugging. You can create LMS’s config.php file by copying config-dist.php to config.php and editing it. It is very well documented by comments. Well down in the file you will find the options to turn on debugging. See Configuration file. If you create the file by hand, the installation will pick up from the correct place automatically.
- Most errors will turn up in the web server logs. Always check there first – /var/log/apache2/errors.log
- If you need to change things like file upload sizes you need to edit /etc/php5/apache2/php.ini and then restart the web server with ‘sudo /etc/init.d/apache2 restart’