Install Yclas on Debian 11: A Step‑by‑Step Guide
If you’ve ever wanted a lightweight classifieds platform that runs natively on your own server, Yclas is the answer. This walk‑through shows how to get it up and running on Debian 11 with all the right PHP extensions, database tweaks, and webserver settings—no fancy cloud wizardry involved.
Install Core Packages
sudo apt update && sudo apt install -y \
php8.0-fpm php8.0-mysql php8.0-xml php8.0-curl php8.0-gd \
mysql-server nginx git unzip
Yclas is a PHP‑based application, so you need the FPM worker and MySQL driver. Debian 11 ships with PHP 8.0, which Yclas supports out of the box. Nginx is lightweight but works fine; if you prefer Apache, swap it in and adjust the virtual host later.
Harden MySQL for PHP
sudo mysql_secure_installation
During this wizard set a strong root password and remove anonymous users. Yclas expects a clean MySQL installation that speaks UTF‑8; if you skip this, you’ll hit character‑set errors when populating the database.
Create the Yclas Database
sudo mysql -u root -p <<'EOSQL' CREATE DATABASE yclas CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; GRANT ALL PRIVILEGES ON yclas.* TO 'yclasuser'@'localhost' IDENTIFIED BY 'yourStrongPassword'; FLUSH PRIVILEGES; EOSQL
Yclas will run its migrations against this database. Using utf8mb4 ensures emojis and international characters work without a future migration headache.
Grab Yclas From GitHub
cd /var/www sudo git clone https://github.com/Yclas/yclas.git sudo chown -R www-data:www-data yclas
If you see a warning about “shallow” clones, just run git fetch --unshallow. I’ve seen folks hit that after cloning with the --depth flag and then trying to pull later.
Install Composer Dependencies
cd /var/www/yclas sudo -u www-data composer install
Composer pulls in PHP packages like Symfony components and Doctrine. Running it as www-data prevents permission issues when Yclas tries to write cache files.
Configure Environment
cp .env.example .env sudo -u www-data nano .env
Edit the database section:
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=yclas DB_USERNAME=yclasuser DB_PASSWORD=yourStrongPassword
Also set the app URL and key later. Yclas uses .env for all runtime settings, so keep that file secure (chmod 640 .env).
Run Migrations
sudo -u www-data php artisan migrate --seed
If you get “SQLSTATE[HY000] [2002] Connection refused” it usually means MySQL isn’t listening on the socket Yclas expects. Double‑check /etc/mysql/mysql.conf.d/mysqld.cnf for bind-address=127.0.0.1.
Set Up Nginx Virtual Host
sudo nano /etc/nginx/sites-available/yclas
Insert:
server {
listen 80;
server_name yclas.local;
root /var/www/yclas/public;
index index.php index.html;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.0-fpm.sock;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
Enable it:
sudo ln -s /etc/nginx/sites-available/yclas /etc/nginx/sites-enabled/ sudo nginx -t && sudo systemctl reload nginx
Yclas uses pretty URLs. The try_files directive tells Nginx to fall back to the front controller when a file isn’t found, which is how the application routes requests.
Final Touches
sudo -u www-data php artisan key:generate
Open your browser at http://yclas.local. If you hit a “404 – Page Not Found” after the bootstrap page, clear the cache:
sudo -u www-data php artisan config:clear sudo -u www-data php artisan route:clear
Common Pitfalls
- Missing PHP extensions: Yclas will choke on missing mbstring or openssl. Re‑run the apt install line if you get “Class not found” errors.
- File permissions: If you see “Permission denied” when uploading images, ensure /var/www/yclas/storage and /bootstrap/cache are owned by www-data.
- Database charset mismatch: Running migrations on a database that isn’t utf8mb4 will produce truncated names or broken emoji. Fix it with a dump/restore if you already used the wrong collation.
There, Yclas should be humming on your Debian 11 box. If anything feels off, double‑check the logs in /var/log/nginx/error.log and /var/www/yclas/storage/logs.