Install OJS on Ubuntu 18.04

Last updated on: Published by: Systems Librarian 1

Open Journal Systems (OJS) is a free open source software for managing and publishing scholarly journals. A single OJS installation can host multiple journals. It is written in PHP programming language and works with MySQL or PostgreSQL database and Apache2 or nginx web server.

This post is a record of the process I went through when setting up OJS on Ubuntu 18.04. It is assumed you have a vanilla Ubuntu 18.04 with sudo rights.

Update the System and Install PHP

sudo apt update && sudo apt upgrade -y

Then install PHP by running the following commands in succession. Note that Ondřej PPA repository has ended support for PHP on Ubuntu 16.04 as of June 2021, see this stackoverflow post.

sudo apt-get install python-software-properties
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php7.4 php7.4-xml php7.4-xml php7.4-mysql php7.4-mbstring php-xml 

Install Apache2

Use this command to install apache2

sudo apt install apache2

Set-up MySQL Database

sudo apt install mysql-server

Secure your MySQL installation by running the following command and answering the questions appropriately

sudo mysql_secure_installation

Create the OJS database, a database user and grant all privileges to the OJS database

mysql -u root -p

Here, use the password you created when you ran mysql_secure_installation in the previous step. You will be taken to mysql shell. Then create a database user.

CREATE USER 'ojs_user'@'localhost' IDENTIFIED BY 'ojs_user_password';

Now create the database

CREATE DATABASE `ojs_database`;

Now grant the new user all permissions on the new database

GRANT ALL PRIVILEGES ON ojs_database . * TO 'ojs_user'@'localhost';

Then flush PRIVILEGES for these changes to take effect


Now the database is all set and ready to be used by our OJS application. Exit MySQL shell by typing the following


Test that we can connect to the db with this new user by the following command

mysql -u ojs_user -p

Here, provide the password you used for ojs_user_password in a previous step. If successful, type \q again to exit MySQL shell and proceed to the next step. If not, then umechanganyikiwa !

Download and install OJS source code

You can download OJS source code from PKP website. We shall place the code inside /var/www/html directory so that we have a clean URL and our system is served at the root of our domain. Use the following command to “go to” /var/ww/html directory

cd /var/www/html

Then delete the default index.htm file.

sudo rm -f index.html

Next, download the source code with wget command. Change the download link to get the right version of OJS that you need. In this case I am using ojs-3.1.1-2

wget -c

Now extract the files

sudo tar -zxvf ojs-3.1.1-2.tar.gz

Move the files out of the extracted folder and into /var/www/html folder

sudo cp -r /var/www/html/ojs-3.1.1-2/* /var/www/html/

Then change permissions to give apache2’s www-data write permissions to /var/www/html folder

sudo chown www-data:www-data -R /var/www/html/

Next, configure OJS code to communicate with our database, but first create a configuration file where these settings are stored from a template file with the following command

sudo cp /var/www/html/ /var/www/html/

Open the new file with nano and change database connection settings

sudo nano /var/www/html/

Locate the following section and update accordingly.

; Database Settings ;


driver = mysql
host = localhost
username = ojs_user
password = ojs_user_password
name = ojs_database

Restart apache2 just to ensure all changes required take effect.

sudo service apache2 restart

When done, it is time to run the web installer. Open a web browser and access your server hostname i.e http://hostname. This should be the easy part. Provide a username, password and email for the administrator account for OJS. Then scroll down to provide the same database connection settings as you did in the previous step. Remember to uncheck Create new database because we already created a database.

Click on Install Open Journal Systems to finish the process. If errors occur at this stage, the web installer will accordingly report back and should be easy to resolve. When successful, you will see the following screen.

One Reply to “Install OJS on Ubuntu 18.04”

  1. ziad

    I am trying to install OJS.
    I followed your procedure, I just installed, mariadb-server instead of mysql-server.
    When I click on Install Open Journal Systems, i have a blank screen ?
    Do you have any idea about that.

    Thank you for help.
    Best regards.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.