How to Install Open Classifieds on a Debian 8 VPS

openclassifieds vpsIn this tutorial, we will show you how to install Open Classifieds on a Debian 8 VPS with Apache, PHP and MySQL installed on it. OpenClassifieds is a free open source script used to create a website for classifieds, advertisement or listings within few minutes.

This tutorial was tested and written for a Debian 8 VPS, but it should work on any Linux distribution.


At the time of writing this tutorial, the latest stable version of Open Classifieds is 2.6.0 and it requires:

  • PHP 5.5 or higher with the GD graphics library version 2.0.x+, mcrypt, gettext, curl and mysql/mysqli PHP extensions and short tags option enabled;
  • Apache Web Server >= 2.0 compiled with mod_rewrite module and with the following directives allowed: RewriteEngine, RewriteBase, RewriteCond and RewriteRule.;
  • MySQL 5 or higher installed on your virtual server.

Let’s start with the installation.
Update your OS packages:

sudo apt-get update

Install Apache, MySQL, PHP and required extensions on your virtual server:

apt-get install apache2 libapache2-mod-php5 php5-cli php5-common php5-gd php5-mcrypt php5-curl php5-mysql mysql-server unzip

To enable Apache2 mod_rewrite module, run the following command:

sudo a2enmod rewrite

Download the latest version of Open Classifieds available at http://open-classifieds.com/download to the ‘opt’ directory on your server and extract it to the ‘/var/www/html/openclassifieds2/’ directory on your server using the following commands:

cd /opt
unzip -o openclassifieds2-2.6.0.zip -d /var/www/html/
mv /var/www/html/openclassifieds2-2.6.0 /var/www/html/openclassifieds2/

Create a new MySQL database for Open Classifieds and assign a MySQL user to it with full permissions:

mysql -u root -p
mysql> CREATE DATABASE classifiedsdb;
mysql> GRANT ALL PRIVILEGES ON classifiedsdb.* TO 'classifieds'@'localhost' IDENTIFIED BY 'y0ur-passw0rd' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> quit

Do not forget to replace ‘your-password’ with a strong password.
Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘openclassifieds2.conf’ on your virtual server:

touch /etc/apache2/sites-available/openclassifieds2.conf

Then, run the following commands:

ln -s /etc/apache2/sites-available/openclassifieds2.conf /etc/apache2/sites-enabled/openclassifieds2.conf
rm /etc/apache2/sites-enabled/000-default.conf

Or, use the a2ensite command to enable the ‘openclassifieds2.conf’ configuration in Apache:

sudo a2ensite openclassifieds2.conf
sudo a2dissite 000-default.conf

Edit the ‘openclassifieds2.conf’ configuration file:

vi /etc/apache2/sites-available/openclassifieds2.conf

add the following lines to it:

<VirtualHost *:80>
ServerAdmin admin@yourdomain.com
DocumentRoot /var/www/html/openclassifieds2/
ServerName yourdomain.com
ServerAlias www.yourdomain.com
<Directory /var/www/html/openclassifieds2/>
Options FollowSymLinks
AllowOverride All
</Directory>
ErrorLog /var/log/apache2/yourdomain.com-error_log
CustomLog /var/log/apache2/yourdomain.com-access_log common
</VirtualHost>

Open Classifieds uses the short tag ‘short cut’ syntax, so in order to enable short_open_tag directive in PHP, edit the php.ini configuration file and add/modify the following line:

vi /etc/php5/apache2/php.ini
short_open_tag = On

Set the proper file permissions for the Apache web server:

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

Restart the Apache web server for the changes to take effect:

service apache2 restart

Open your favorite web browser, navigate to http://yourdomain.com and follow the easy instructions:
If all checks on the first page of the installation are green, click ‘Start installation’, enter the database name, username and password, uncheck ‘sample data’ and click ‘Continue’. On the next page, set the site name, time zone, administrator email and password and click ‘install’.
For security reason, make sure to remove the ‘install/’ directory after installation:

rm -rf /var/www/html/openclassifieds2/install

Log in at http://yourdomain.com/oc-panel using your administrator login credentials and start using Open Classifieds, create some categories, locations etc.

openclassifieds back-end

That is it. The Open Classifieds installation is now complete.
Of course you don’t have to do any of this if you use one of our Debian VPS Hosting services, in which case you can simply ask our expert Linux admins to install Open Classifieds for you. They are available 24×7 and will take care of your request immediately. You might also like to read How to Install Dotclear on a Debian 8 VPS.

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.

1 thought on “How to Install Open Classifieds on a Debian 8 VPS”

Leave a Comment