Install Open Classifieds on Debian 9

Open Classifieds is a free, powerful, open-source web platform that allows users to easily create and build classifieds, advertisement, and listings sites. Let’s begin with the installation. In this tutorial, we will show you how to install Open Classifieds on your Debian 9 server.

installing open classifieds on debian 9

Requirements

  • For the purposes of this tutorial, we will be using a Debian 9 Server.
  • Full SSH root access or a user with sudo privileges is also required.
  • Apache web server with mod_rewrite
  • PHP version 5.5 or newer with the GD, Mcrypt, Gettext and CURL extensions enabled
  • MySQL database server

Step 1: Connect via SSH

Connect to your server via SSH as the root user using the following command:

ssh root@IP_ADDRESS -p PORT_NUMBER

Remember to replace “IP_ADDRESS” and “PORT_NUMBER” with your actual server IP address and SSH port number. Replace “root” with your admin username if you’re not planning on using the root account.

Before starting with the installation, we need to update the OS packages to their latest versions.

We can do this by running the following commands:

$ apt-get update 
$ apt-get upgrade

Once the upgrade is complete, we can move on to the next step.

Step 2: Install MariaDB

We will use MariaDB as a database engine. We can install the MariaDB server from the Debian 9 base repository using the following commands:

$ apt-get install mariadb-server-10.1 mariadb-server-core-10.1

If desired, you can further improve the security of your MariaDB server by running a command that will go through a few questions.

$ mysql_secure_installation

We suggest answering every question with the character ‘Y’ for yes.

Step 3: Create a Database for Open Classifieds

Create a MySQL database for the Open Classifieds website:

$ mysql -u root -p
MariaDB [(none)]> CREATE DATABASE openclassifieds;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON openclassifieds.* TO 'openclassifieds'@'localhost' IDENTIFIED BY 'Password';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;

Don’t forget to replace ‘Password’ with an actual strong password.

Step 4: Apache Web Server Installation

To install the Apache web server, run the following command:

$ apt-get install apache2

After the installation is complete, you should enable Apache to start automatically upon server boot with:

$ systemctl enable apache2

You can also check the status of your Apache service with the following command:

systemctl status apache2

Output:

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: active (running)
  Process: 11021 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
 Main PID: 9185 (apache2)
    Tasks: 8 (limit: 4915)
   CGroup: /system.slice/apache2.service
           ├─ 9185 /usr/sbin/apache2 -k start
           ├─11062 /usr/sbin/apache2 -k start
           ├─11063 /usr/sbin/apache2 -k start
           ├─11064 /usr/sbin/apache2 -k start
           ├─11065 /usr/sbin/apache2 -k start
           ├─11066 /usr/sbin/apache2 -k start
           ├─11585 /usr/sbin/apache2 -k start
           └─15964 /usr/sbin/apache2 -k start

Step 5: Install PHP

Now that Apache is set up, we need to install PHP 7.0 (the default PHP version that comes with Debian 9 default repositories) as well as some PHP extensions required by Open Classifieds:

apt-get install php7.0 php7.0-gd php7.0-cli php7.0-zip php7.0-soap php7.0-curl php7.0-mbstring php7.0-common php7.0-gd php7.0-json php7.0-opcache

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:

nano /etc/php/7.0/apache2/php.ini

short_open_tag = On

Restart Apache for the changes to take effect.

systemctl restart apache2

Step 6: Download Open Classifieds

First, download the latest stable release of the software to your server. At the time of writing this tutorial, the latest stable version of Open Classifieds is 2.9.0

wget https://sourceforge.net/projects/openclassifieds/files/openclassifieds2-2.9.0.zip

Once it is downloaded, unpack the downloaded ZIP archive to the document root directory of your server

unzip openclassifieds2*.zip -d /var/www/html

Rename the directory to something simpler (this is optional, however, it makes it easier to type and memorize where your files are):

cd /var/www/html && mv openclassifieds2* openclassifieds

Set the Apache user to be the owner of all Open Classifieds files:

chown -R www-data:www-data openclassifieds

Step 7: Configure Apache Open Classifieds Site

Now we will configure the Apache configuration file for Open Classifieds. Create a new virtual host with the following content by creating a file in the directory /etc/apache2/sites-available:

$ nano /etc/apache2/sites-available/your_domain.com.conf
<VirtualHost *:80>
     ServerAdmin admin@your_domain.com
     DocumentRoot /var/www/html/openclassifieds
     ServerName your_domain.com
     ServerAlias www.your_domain.com

     <Directory /var/www/html/openclassifieds/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Once you are done, save the file and close it.

Activate the server block by creating a symbolic link:

$ ln -s /etc/apache2/sites-available/your_domain.com.conf /etc/apache2/sites-enabled/your_domain.com.conf

And finally, restart Apache for the changes to take effect.

systemctl restart apache2

Step 8: Installing Open Classifieds Using the Web Interface

You can now go to your http://your_domain.com and follow the on-screen instructions to complete the Open Classifieds installation.

install open classifieds on debian 9

Once the installation is completed, it is recommended to remove the ‘install’ directory for security reasons.

sudo rm -rf /var/www/html/openclassifieds/install/

That’s it! Open Classifieds has been successfully installed on your Debian 9 server.


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

set up open classifieds on debian 9

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

2 thoughts on “Install Open Classifieds on Debian 9”

  1. Asking questions are actually fastidious thing if you
    are not understanding anything totally, however this paragraph gives good understanding yet.

    Reply
  2. Woah! I’m really digging the template/theme of this site. It’s simple, yet effective.
    A lot of times it’s difficult to get that “perfect balance” between user friendliness and visual appeal.

    I must say you have done a great job with this.
    In addition, the blog loads super quick for me on Chrome.
    Outstanding Blog!

    Reply

Leave a Comment