University of Skövde Code Viewer and Course Organization System
To install LenaSYS on your computer, you first need to install XAMPP or Docker.
Press this link: docker desktop.
In the Docker website press Choose plan
-button.
Choose Docker Personal.
Press Continue with GitHub
-button.
Sign in with your school-email and password.
Now you are in Docker Home and press the Go to download
-button.
Select which operating software (OS) that you are using.
When you have selected OS and installed the installer according to your OS, follow the installer and then open a Docker desktop program/app.
Congratulations, you have installed the Docker desktop! If account doesn't appear in Docker desktop, then sign in your GitHub account.
When you have installed your Docker desktop, you can run Docker containers, but first you need to get a LenaSYS repository.
Open your terminal which can be bash, powershell or command. You can also use vscode terminal.
When you have opened the terminal, change directory to where you want the LenaSYS repository. To do that you need to type cd path/to/folder
. When using Windows I typed: cd .\Downloads\
if you use a different OS then type: cd <foldername>\
.
When you have chosen a folder, type this command: git clone https://github.com/HGustavs/LenaSYS.git
and wait for the download to finish. When done you will have the LenaSYS repository.
Now you have the LenaSYS repository, so you need to access the new directory in the terminal by typing: cd LenaSYS/dockerenv/
.
Now you need to choose which script to run based on your operating system. The scripts are located at: LenaSYS/dockerenv/
.\setup.bat
. NOTE: You need to keep open Docker desktop program/app and do not turn off, otherwise this command will show an error and will not work.setup.sh
script and run one of the following commands: sudo ./setup.sh
or, if the the first command doesn't work, then run sudo bash ./setup.sh
. If you can't run the script, make sure it is executable. To do so, type sudo chmod +x setup.sh
. Then try running the script again. The ./setup.sh
script does changes file permissions and ownership for entire LenaSYS folder and builds the Docker containers. If none of them steps work, then try to follow to change the file permissions here, and then run the script again.
Docker has finished building images and containers and you need to wait for 10 seconds to allow the script to set the permissions and ownerships. Once the terminal stops printing output and shows the message Now you can use the website!
, then you can proceed to the next step. NOTE: To shutdown and remove the Docker containers run: docker compose down
. Make sure you are in the LenaSYS/dockerenv/
directory when running this command.
Now go to Docker desktop and you can see a menu which says images and containers. Press the containers from the menu and here you can see there are three containers and each one has green-circle which means they are running. If you can not see three containers, then you need to press drop-down
-button
There are two ports which are apache-php and phpmyadmin server. The apache-php has a port 80:80
which can be clicked, this opens the LenaSYS website. The phpmyadmin also has a port 8080:80
which opens the phpmyadmin website. There you can manipulate sql-data, user permission and more. You need to press the 80:80
link to open the LenaSYS website.
In order to download LenaSYS you need to navigate to LenaSYS/newinstaller/installer.php
this will lead you to the new installer. In case the new installer does not work for you, you can access the old installer at LenaSYS/install/install.php
.
Congratulations, you can now use the LenaSYS website!
Before you install the LenaSYS, it is good to know that the text-input which says Hostname
, needs to be db
, not localhost
and you need check/turn on Use Distributed Environment
-checkbox. Also when entering root user credentials, type in root user: root
and root password: password
, because all default values is set in docker-compose-yml.
To install the LenaSYS, you need to follow instructions for new LenaSYS installer or old LenaSYS installer.
Make sure you set the appropriate file permissions for LenaSYS. The easiest way to do this is to run the command sudo chmod -R 777 LenaSYS
.
After changing the file permissions recursively over the repository, all the files may show up as changes. To fix this, run git config core.fileMode false
in the root of the repository.
To stop the running containers, open a terminal and navigate to the LenaSYS/dockerenv/
directory and run: docker stop $(docker ps -aq)
.
If you go back to Docker desktop and go to containers, you can see three containers are not running, shown by the gray circles. Now containers are not running.
If you want remove all containers, then first stop running containers which you can follow this step stop containers in Docker.
To remove the containers, open a terminal and navigate to the LenaSYS/dockerenv/
directory and run: docker compose down
. Now your terminal says removed which means containers are removed.
You can check in Docker desktop and press containers. Here you can see that all containers are gone.
To remove all images to free up space, you need to press images in Docker desktop and select all checkboxes. When all selected, press Delete
-button and it will show a pop-up if you want to delete, press Delete forever
-button. Now you have successful removed all containers and images.
pause
-button to pause docker or Quit Docker Desktop
-button to stop running docker. Now your Docker desktop is paused or stopped.
macOS Specifics You may receive a warning saying Apple cannot verify that XAMPP is free from malware. To fix this:
htdocs
Folder/XAMPP/xamppfiles/htdocs
).Open the PHP configuration file php.ini
located at:
/XAMPP/xamppfiles/etc/php.ini
Modify the following settings:
upload_max_filesize
to 128M
.Enable the necessary PHP drivers by uncommenting the following lines (or adding them manually if not present):
extension=php_pdo.dll
extension=php_pdo_mysql.dll
extension=php_pdo_odbc.dll
extension=php_pdo_sqlite.dll
On macOS/Linux:
setup.sh
script which located at: LenaSYS/xampp/
and run one of the following commands: sudo ./setup.sh
or, if the the first command doesn't work, then run sudo bash ./setup.sh
. If you can't run the script, make sure it is executable. To do so, type sudo chmod +x setup.sh
. Then try running the script again. The ./setup.sh
script does changes file permissions and ownership for entire LenaSYS folder. If none of them steps work, then try to follow to change the file permissions here, and then run the script again.xamppfiles
. xamppfiles
folder and select Get Info (or press Cmd + I
).This section contains more information about what information and what options should be provided for each page in the new installer.
This page is used to select your operating system. This is only used to determin wether your system uses file permissions. Both Mac OS and Linux use file permissions, meaning each file has access modifiers. For the lenasys installer to work, you need to set allow the www-data
user access to the LenaSYS directory and its parent directory. The easiest way to do this is to run the command: sudo chmod 777 <path to lenaSYS>
where <>
are not part of the command.
Due to the difference in permissions handling, this page is used to select wether or not the installer should check for permissions, and notify the user if it detects missing permissions.
If you are unsure about what this option means, you should most likely leave it default (both options checked).
Unchecking Create new MySQL DB
means that the installer will not create a new database, and will instad attempt to use an already existing database. This means that the installer will fail if there is no existing database by the name later given in step 3.
The same principles hold true for Create new MySQL user
. Unchecking this option means that the installer will attempt to use an existing user by the name given in step 3. Most of the time you do not want to disable this option.
Database name:
The database name will be used to create a new database (or use an existing database if the option to create database was not set to enabled in step 2), meaning that the specific value is not important and does not matter. (Unless you want to use an existing database). But you should avoid using special characters.
MySQL user:
The MySQL user value will be used to either create a new user or use an existing one (depending on the option Create new MySQL user
in step 2). If you are creating a new user, its value does not matter and can be set to anything (avoid special characters).
Hostname:
The hostname is very important to set correctly or the installation will not be successful. The most common value for this option is localhost
. But depending on your configuration and local environment it may be different. For example, if your database is located on another machine. (or on another vm / container) you will need to supply the correct IP of that machine. Since this value is used by LenaSYS to locate the database. If you are using Docker, then value for this option is db
.
MySQL user password:
This password will not be used by you personally. It will be used to LenaSYS to connect to the database. Meaning that the value is not important, and you do not need to remember it. Its value will be stored in ../coursesyspw.php
.
This page also contains the options:
All the supplied values from this section will be stored in the file ../coursesyspw.php
which is then used by LenaSYS to establish a db connection from every page.
In this step you need to supply the root credentials for your database. This information will only be used once, and will not be stored. The installer asks for this information since it will otherwise not gain sufficient access to MySQL to be able to create new users, grant permissions etc.
In most cases the default root username you should use is: root
. And if you are using XAMPP, the default password is blank (`), or
password` if you are using Docker.
This page is used to select what sample data should be included in the installation. If you are installing this as a student, you should most likely leave this default (All options enabled). This data will show up in the system when installed as various courses, users and sample files.
This page also conatins the options:
This section covers the various options available in the installer.
Enabling this option will allow the created MySQL user to connect from anywhere. The default is for the created MySQL user to only be allowed to connect from the same hostname as supplied in step 3. This option is useful if you have your database hosted on another machine, or you are using a containerized dev environment such as docker.
The verbose mode of the installer will print alot more information, such as the individual queries it runs to install the system, and all the files it copies during installation. This is useful for debugging, but should be left off in most cases.
If you want to reinstall the system there is already an existing user and database. Enabling this option will first remove the database and user to ensure that a new user and database can be created.
This will include a test course.
This will include a demo course containing all existing duggas.
This option will ensure that all existing sample files will be copied over from the installer to the courses
directory so they can be used in the system.
Selecting various languages here will enable keywords from the selected languages to be used for syntax highlighing in the LenaSYS code viewer.
This link leads to information about how the new installer works.
Make sure you have a working install of apache2 and other needed packages. Look at the wiki page for this at Configuring web server for LenaSYS installation for further information.
To install a fresh copy of LenaSYS on your system an installer has been created called 'install.php'. This installer is located in the LenaSYS directory. What the installer will do is help you create a new user in the MySQL database and a new database and fill it with some test data (if desired) to help you get started.
1. To start the installation, put the LenaSYS directory at the place you want the system located.
2. When the the directory is in the right place, go to the installer from a web browser of your choosing.
3. Set permissions for Apache.
4. Database credentials used by the system
The box should be checked if you provided an existing database or/and user and wish to overwrite this. (WARNING! THIS WILL DESTROY ALL PREVIOUS INFORMATION IN THIS DATABASE).
There is also an option to run the installer as an transaction. If something goes wrong this can be unticked to find the exact SQL-query that's causing trouble.
The installation should now be completed and the website should be linked to the database.
If LenaSYS is still not functional, possible errors may be found in \apache2\logs. It is very possible that the installer promts you to change upload_max_filesize in ini.php. Make sure that the webserver is restarted after any changes to php.ini. Another issue commonly encountered is ": PHP Fatal error: Uncaught PDOException:could not find driver...". To solve this, enbale the following drivers in the ini.php file by uncommenting them: php_pdo.dll, php_pdo_mysql.dll, php_pdo_odbc.dll and php_pdo_sqlite.dll.
If the zip function to work your server needs to have to zip plugin installed and activated. on linux you need to do: sudo apt-get install php7.2-zip (if the server is running a different php install the right version or ZIP-ARCHIVE) sudo /etc/init.d/apache2 restart
for windows: should be built in to php. please google ZIP-ARCHIVE if it still don't work.
The you need to give the LenaSYS directory enough permissions to read and write for this you can do "chmod -R 777 folder"
Note: For the push notification system to work the server needs to use https, so make sure that is set up and valid.
To set up https, look at the guide on this wiki page: Getting a free ssl certificate and installing it when not having access to port 80
Note: Only install if there is no other push notifications installation on the system already, if an installation already exists follow the guide further below for instructions for that.
sudo apt-get install php7.0-curl php7.0-gmp php7.0-mbstring
Install composer in your LenaSYS folder ( https://getcomposer.org/ )
Go into the LenaSYS folder run the following command. This command will download all the packages listed in the 'composer.json' file and download them to the 'vendor/' folder.
php composer.phar install
define("PUSH_NOTIFICATIONS_VAPID_PUBLIC_KEY", "Insert your public key here");
define("PUSH_NOTIFICATIONS_VAPID_PRIVATE_KEY", "Insert your private key here");
define("PUSH_NOTIFICATIONS_VAPID_EMAIL", "Insert your email address here");
If you do not have a private and public key already, you can use the tool at /DuggaSys/pushnotifications.php?action=genkeys to generate keys locally for usage. You need to be logged in as an administrator in LenaSys to use the tool. These keys should be shared to every installation on the same server.
If another installation of LenaSys has push notification installed it is much simpler to copy that.
Find another installation of LenaSys with push notifications installed. In the following steps we will assume an installation exists at /[groupname]/[username]/LenaSYS
Copy the folder vendor/ from /[groupname]/[username]/LenaSYS to /[groupname]/[YOURusername]/LenaSYS
Open the file /[groupname]/[username]/coursesyspw.php and locate the rows containing code like this
define("PUSH_NOTIFICATIONS_VAPID_PUBLIC_KEY", "Insert your public key here");
define("PUSH_NOTIFICATIONS_VAPID_PRIVATE_KEY", "Insert your private key here");
define("PUSH_NOTIFICATIONS_VAPID_EMAIL", "Insert your email address here");