How to Install Yclas on Debian 11

how to install yclas on debian 11

Yclas (formally known as Open Classifieds) is a free, powerful, open-source web platform that allows users to easily create and build classifieds, advertisements, and listings sites. Let’s begin with the installation.

In this tutorial, we will show you how to install Yclas on your Debian 11 server.

Requirements

  • For the purposes of this tutorial, we will be using a Debian 11 Server.
  • SSH root access or a user with sudo privileges is also required.

Step 1: Connect to your server 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 Apache webserver

Yclas needs a web server to serve its content, and we will use Apache webserver which is one of the most popular web servers in the World.

Apache webserver can be installed with the following command:

apt-get install apache2

Once, the installation is complete you can check the status of the Apache service:

systemctl status apache2

You should get the following output:

● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running)
Docs: https://httpd.apache.org/docs/2.4/
Main PID: 1144 (apache2)
Tasks: 55 (limit: 2301)
Memory: 8.9M
CPU: 131ms
CGroup: /system.slice/apache2.service
├─1144 /usr/sbin/apache2 -k start
├─1146 /usr/sbin/apache2 -k start
└─1147 /usr/sbin/apache2 -k start

Step 3: Install PHP

To install PHP and the required PHP extensions required by Yclas, run the following command:

apt-get install php php-gd php-cli php-mysql php-imagick php-zip php-soap php-curl php-mbstring php-common php-json php-opcache

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

nano /etc/php/7.4/apache2/php.ini

short_open_tag = On

Restart Apache for the changes to take effect.

systemctl restart apache2

Step 4: Install MariaDB

We will use MariaDB as a database engine. Run the following command to install the latest MariaDB server from the official Debian 11 base repository :

apt-get install mariadb-server

To verify if the MariaDB service is up and running, run the following command:

systemctl status mariadb

You should receive the following output

● mariadb.service - MariaDB 10.5.12 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-02-16 15:24:54 EST; 2min 13s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 1860 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 1861 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 1863 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && s>
Process: 1922 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 1924 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
Main PID: 1910 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 10 (limit: 2301)
Memory: 80.9M
CPU: 634ms
CGroup: /system.slice/mariadb.service
└─1910 /usr/sbin/mariadbd

To enable the MariaDB service to start on system reboot execute the following command:

systemctl enable mariadb.service

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 5: Create a Database for Open Classifieds

Create a MySQL database for the Yclas 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 6: Download Open Classifieds

Download the latest stable release of the software to your server. At the time of writing this tutorial, the latest stable version of Yclas is 4.4.0.

cd /tmp
wget https://github.com/yclas/yclas/archive/master.zip

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

unzip master.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 yclas-master yclas

Set the Apache user to be the owner of all Yclas files:

chown -R www-data:www-data yclas

Step 7: Configure Apache Yclas Site

Now we will configure the Apache configuration file for Yclas. 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/yclas
     ServerName your_domain.com
     ServerAlias www.your_domain.com

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

     ErrorLog ${APACHE_LOG_DIR}/yclas_error.log
     CustomLog ${APACHE_LOG_DIR}/yclas_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, enable the Apache rewrite module and restart the Apache service for the changes to take effect.

a2enmod rewrite
systemctl restart apache2

Step 8: Installing Yclas Using the Web Interface

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

Next, enter your database name, username, and password and continue.

On the next screen, you will have the site configuration and create the administrator user.

You will have two buttons that will take you to the newly created website and the administration panel respectively.

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

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

That’s it! Yclas (Open Classifieds) has been successfully installed on your Debian 11 server.

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

PS. If you liked this post on how to install Yclas (Open Classifieds) on Debian 11, please share it with your friends on social networks or simply leave a reply below. Thanks.

Leave a Comment