Tutorial: Install OJS on a Server
Role: Site Administrator
Time: 60โ120 minutes
OJS Version: 3.5+
This tutorial walks through a complete OJS 3.5+ installation on an Ubuntu/Debian Linux server with Nginx and MySQL.
Before You Startโ
You will need:
- A Linux server (Ubuntu 22.04 LTS or Debian 12 recommended)
- Root or sudo access
- A registered domain name pointing to the server's IP
- Basic familiarity with the Linux command line
Server Requirementsโ
| Component | Minimum | Recommended |
|---|---|---|
| PHP | 8.1 | 8.2+ |
| MySQL | 8.0 | 8.0+ |
| PostgreSQL | 14 | 15+ |
| Web Server | Apache 2.4 / Nginx 1.20 | Latest stable |
| RAM | 2 GB | 4 GB+ |
| Disk | 10 GB | 50 GB+ |
Required PHP Extensionsโ
mbstring xml json zip gd intl curl mysqli
Step 1 โ Update the Serverโ
sudo apt update && sudo apt upgrade -y
Step 2 โ Install PHP 8.2โ
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install -y php8.2 php8.2-fpm php8.2-mysql php8.2-xml \
php8.2-mbstring php8.2-intl php8.2-curl php8.2-zip \
php8.2-gd php8.2-json
Verify installation:
php -v
Step 3 โ Install Nginxโ
sudo apt install -y nginx
sudo systemctl enable nginx
sudo systemctl start nginx
Step 4 โ Install MySQL 8โ
sudo apt install -y mysql-server
sudo systemctl enable mysql
sudo systemctl start mysql
sudo mysql_secure_installation
Follow the prompts to set a root password and secure the installation.
Step 5 โ Create the OJS Databaseโ
sudo mysql -u root -p
Inside the MySQL shell:
CREATE DATABASE ojs CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'ojsuser'@'localhost' IDENTIFIED BY 'StrongPassword123!';
GRANT ALL PRIVILEGES ON ojs.* TO 'ojsuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 6 โ Download OJSโ
cd /tmp
wget https://pkp.sfu.ca/ojs/download/ojs-3.5.0.tar.gz
(Check pkp.sfu.ca/software/ojs/download/ for the latest version.)
Verify the checksum:
sha256sum ojs-3.5.0.tar.gz
Extract and move to the web root:
tar -xzf ojs-3.5.0.tar.gz
sudo mv ojs-3.5.0 /var/www/html/ojs
Step 7 โ Create the Files Directoryโ
OJS stores uploaded files outside the web root for security:
sudo mkdir -p /var/www/ojs-files
sudo chown -R www-data:www-data /var/www/ojs-files
sudo chmod -R 755 /var/www/ojs-files
Step 8 โ Set File Permissionsโ
sudo chown -R www-data:www-data /var/www/html/ojs
sudo chmod -R 755 /var/www/html/ojs
sudo chmod -R 775 /var/www/html/ojs/cache
sudo chmod -R 775 /var/www/html/ojs/public
Step 9 โ Configure config.inc.phpโ
cd /var/www/html/ojs
sudo cp config.TEMPLATE.inc.php config.inc.php
sudo nano config.inc.php
Key settings to edit:
; Application base URL
base_url[default] = "https://journal.yourdomain.com"
; Database settings
driver = mysqli
host = localhost
username = ojsuser
password = StrongPassword123!
name = ojs
conn_charset = utf8mb4
; Files directory (outside web root)
files_dir = /var/www/ojs-files
; Enable scheduled tasks
scheduled_tasks = On
Save and exit (Ctrl+X, Y, Enter).
Step 10 โ Configure Nginxโ
Create an Nginx server block:
sudo nano /etc/nginx/sites-available/ojs
Paste the following (replace journal.yourdomain.com):
server {
listen 80;
server_name journal.yourdomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name journal.yourdomain.com;
root /var/www/html/ojs;
index index.php;
ssl_certificate /etc/letsencrypt/live/journal.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/journal.yourdomain.com/privkey.pem;
client_max_body_size 40M;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
location ~ /\.ht {
deny all;
}
}
Enable the site and test the configuration:
sudo ln -s /etc/nginx/sites-available/ojs /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Step 11 โ Install an SSL Certificateโ
Use Certbot (Let's Encrypt) for a free SSL certificate:
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d journal.yourdomain.com
Follow the prompts. Certbot will automatically update your Nginx configuration with the certificate paths.
Step 12 โ Run the Web Installerโ
- Open a browser and navigate to
https://journal.yourdomain.com. - The OJS web installer will load.
- Follow the on-screen steps:
- Review the settings detected from
config.inc.php. - Set the Administrator Username, Password, and Email.
- Select your Default Locale (language).
- Review the settings detected from
- Click Install Open Journal Systems.
- Wait for the installer to complete (may take 30โ60 seconds).
Step 13 โ Post-Installation Setupโ
Remove the install lock fileโ
OJS creates a lock file after installation. Verify it exists:
ls /var/www/html/ojs/config.inc.php
grep install_complete /var/www/html/ojs/config.inc.php
Set up the cron jobโ
sudo crontab -u www-data -e
Add:
0 * * * * php /var/www/html/ojs/lib/pkp/tools/scheduler.php run >> /dev/null 2>&1
Configure email (SMTP)โ
Edit config.inc.php to set your SMTP provider. See Tutorial: Configure Email in OJS.
Take a backupโ
mysqldump -u ojsuser -p ojs > /var/backups/ojs-initial.sql
tar -czf /var/backups/ojs-files-initial.tar.gz /var/www/ojs-files
Checklistโ
- PHP 8.2 and required extensions installed
- MySQL/PostgreSQL configured
- OJS files extracted and permissions set
-
config.inc.phpconfigured - Nginx configured with HTTPS
- SSL certificate installed
- OJS web installer completed
- Cron job configured
- Email configured
- Initial backup created
Troubleshootingโ
| Problem | Solution |
|---|---|
| 502 Bad Gateway | PHP-FPM is not running โ sudo systemctl start php8.2-fpm |
| 403 Forbidden | File permissions issue โ check chown -R www-data on the OJS directory |
| White screen / PHP error | Enable PHP error logging: display_errors = On in php.ini temporarily |
| Database connection error | Verify MySQL credentials in config.inc.php; test with mysql -u ojsuser -p |
| SSL certificate fails | Ensure the domain resolves to this server's IP before running Certbot |
| File upload fails | Check files_dir permissions; increase client_max_body_size in Nginx |
Next Stepsโ
- Server Configuration Reference โ advanced server settings
- Security Hardening โ harden your OJS installation
- Tutorial: Set Up a New Journal โ configure your first journal
- Multi-journal Setup โ host multiple journals