How to Install Osclass on CentOS 7

Updated on June 30, 2017
How to Install Osclass on CentOS 7 header image

##Introduction Osclass is an open source project that can be used to create and manage your own classifieds website without any technical knowledge. It is fully customizable and allows you to create a site with real estate ads, job listings, car classifieds, and rentals using dozens of templates, themes, and plugins.

In this tutorial, you will learn how to install Osclass on a CentOS 7 server.


  • A Vultr CentOS 7 server instance.
  • A sudo user with root privileges.

##Step 1: System update Before starting, you will need to install the EPEL repository and update the system to the latest stable state.

sudo yum install epel-release -y
sudo yum update -y
sudo shutdown -r now

Once the system has rebooted, you may proceed to the next step.

##Step 2: Install LEMP server Install Nginx, PHP, MariaDB and other required modules on your system. Install them by running the following command:

sudo yum install nginx mariadb mariadb-server php php-mysql php-gd php-ldap php-xml php-xmlrpc php-mbstring php-mcrypt curl zlib -y

Once the installation is complete, start Apache and MariaDB service and enable them both to start on boot:

sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl start mariadb
sudo systemctl enable mariadb

##Step 3: Configure MariaDB for Osclass First, you will need to improve the security of your MariaDB installation and set your MariaDB root password. You can do this by running the mysql_secure_installation script:

sudo mysql_secure_installation

Answer all of the questions as shown below.

Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Log into the MariaDB console and create a blank database for Osclass:

mysql -u root -p

Enter your MariaDB root password and hit enter, then create a database for your Osclass installation:

MariaDB [(none)]>CREATE DATABASE osclassdb;
MariaDB [(none)]>CREATE USER 'osclass'@'localhost' IDENTIFIED BY 'password';
MariaDB [(none)]>GRANT ALL PRIVILEGES ON `osclassdb`.* TO 'osclass'@'localhost';
MariaDB [(none)]>\q

##Step 4: Install Osclass First, you will need to download the latest version of the Osclass from the official website. You can download it with the wget command:


Once the download has finished, unzip the Osclass archive to the apache web root directory:

sudo mkdir /var/www/html/osclass
sudo unzip -d /var/www/html/osclass

Next, change permission of the osclass directory:

sudo chown -R nginx:nginx /var/www/html/osclass

##Step 5: Configure Nginx for Osclass You will need to create an Nginx virtual host for your Osclass website.

sudo nano /etc/nginx/conf.d/osclass.conf

Populate the file with these lines:

server {
    listen  80;

    location / {
        root  /var/www/html/osclass;
        index  index.html index.htm;

    error_page  500 502 503 504  /50x.html;
    location = /50x.html {
        root  /var/www/html/osclass;

Save and close the file, then restart the Nginx service for the changes to take effect.

sudo systemctl restart nginx

##Step 6: Access Osclass web interface Before accessing the Osclass web interface, you need to allow the Apache port 80 through firewalld.

sudo firewall-cmd --permanent --add-port=80/tcp

Reload the firewall service for the changes to take effect.

sudo firewall-cmd --reload

Finally, open your favorite web browser and navigate to the URL http://your-server-ip/index.php or Complete the required the steps to finish the installation.