Install Osclass on a CentOS 7 VPS

osclass-allOsclass is a popular open source project that allows you to easily create and manage your own classifieds website without any technical knowledge. This PHP application is used by thousands of users around the world for creating job listing, sales listing, real estate and other similar listing websites. In this tutorial we will guide you through the installation of Osclass on a CentOS 7 VPS with Apache, PHP and MariaDB.

To start the Osclass installation, login to your CentOS 7 server as user root

ssh root@IP

and run the following command from the terminal to update all installed packages

yum -y update

Next, install Apache web server

yum -y install httpd

Once the installation of the Apache web server is completed, start it and make it to start automatically on boot.

systemctl start httpd
systemctl enable httpd

Osclass is written in the PHP programming language, so we need to install PHP and a few PHP extensions

yum -y install php php-mysql

Run the following command on your terminal to install MariaDB server on your CentOS 7 server

yum -y install mariadb mariadb-server

Once the installation of the database server is completed start the MariaDB server and set it to start on system boot

systemctl start mariadb
systemctl enable mariadb

Then, run the mysql_secure_installation script. This script will help you improve the security of your MariaDB installation and set your MariaDB root password.

Osclass requires an empty database, so login to the MariaDB server with the root user and create a new user and database that will be used by Osclass to store information

mysql -u root -p

CREATE DATABASE osclass;
CREATE USER 'osclassuser'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON `osclass`.* TO 'osclassuser'@'localhost';
FLUSH PRIVILEGES;
exit

Don’t forget to replace ‘PASSWORD’ with an actual strong password of your choice.

Go to the official Osclass website and download the latest release of their application

wget https://static.osclass.org/download/osclass.3.6.1.zip

Create a new directory for Osclass in the document root directory on your server and unpack the downloaded ZIP archive to the that directory

mkdir /var/www/html/osclass
unzip osclass.3.6.1.zip -d /var/www/html/osclass

Set the Apache user to be owner of the Osclass files and directories

chown -R apache: /var/www/html/osclass

On the next step we will create Apache virtual host for your Osclass based website. Create a ‘/etc/httpd/conf.d/vhosts.conf’ file with the following content:

IncludeOptional vhosts.d/*.conf

Create a ‘vhosts.d/’ directory:

mkdir /etc/httpd/vhosts.d/

and create the virtual host with the following content:

vim /etc/httpd/vhosts.d/yourdomain.com.conf

<VirtualHost YOUR_SERVER_IP:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot "/var/www/html/osclass/"
ServerName yourdomain.com
ServerAlias www.yourdomain.com
ErrorLog "/var/log/httpd/yourdomain.com-error_log"
CustomLog "/var/log/httpd/yourdomain.com-access_log" combined

<Directory "/var/www/html/osclass/">
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Save the changes and restart the Apache web server for the changes to take effect.

systemctl restart httpd

With this step the installation of Osclass from the command line is completed. We need to access the Osclass installation script at  http://yourdomain.com/index.php and follow the on-screen instructions to finish the Osclass installation.


Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Osclass for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment