How to Install Chibisafe on Clear Linux Latest
Chibisafe is a PHP-based file hosting script that allows you to upload, host, and share files online. In this tutorial, we will show you how to install Chibisafe on Clear Linux Latest.
Prerequisites
Before we begin, make sure you have the following:
- Clear Linux Latest installed on your system
- A static IP address for your server
- Root access or sudo privileges
Step 1: Install Required Packages
First, we need to make sure that our system is updated and all the required packages are installed. We can do this using the following commands:
sudo swupd update
sudo swupd bundle-add php-basic web-server-basic
The first command will update the system, and the second command will install PHP and the basic web server packages.
Step 2: Install MariaDB
Chibisafe requires a database to store its data. We will install MariaDB, a popular database management system, using the following command:
sudo swupd bundle-add mariadb
After the installation is complete, start and enable the MariaDB service:
sudo systemctl start mariadb
sudo systemctl enable mariadb
Step 3: Configure MariaDB
To configure MariaDB, run the following command:
sudo mysql_secure_installation
This command will prompt you to set a root password, remove anonymous users, and other security-related tasks. Follow the instructions on the screen.
Next, log in to MariaDB using the following command:
sudo mysql -u root -p
Enter the root password you just set to log in to the database.
Now, create a database and user for Chibisafe, and grant the user all privileges on the database:
CREATE DATABASE chibisafeDb;
CREATE USER 'chibisafeUser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON chibisafeDb.* TO 'chibisafeUser'@'localhost';
FLUSH PRIVILEGES;
Replace your_password with a secure password of your choice.
Exit the mysql shell by typing exit.
Step 4: Download and Configure Chibisafe
To download Chibisafe, navigate to the directory where you want to install it and run the following command:
sudo git clone https://github.com/Tygs/Chibisafe.git
This will download the latest version of Chibisafe from the GitHub repository.
Next, navigate to the Chibisafe directory and copy the config.sample.php file to config.php:
cd Chibisafe
sudo cp config.sample.php config.php
Now, open the config.php file in your favorite text editor and modify the following lines:
$config['upload_dir'] = '/path/to/your/upload/folder';
$config['base_url'] = 'http://your.domain.com';
$config['db_type'] = 'mysqli';
$config['db_hostname'] = 'localhost';
$config['db_database'] = 'chibisafeDb';
$config['db_username'] = 'chibisafeUser';
$config['db_password'] = 'your_password';
Replace /path/to/your/upload/folder with the path to the directory where you want to store uploaded files. For example, you can create a directory called uploads in the Chibisafe directory and set the upload_dir to __DIR__ . '/uploads'.
Replace http://your.domain.com with the URL to your Chibisafe website, without the trailing slash.
Save and close the file.
Step 5: Set up Virtual Host and SSL
To serve Chibisafe over HTTPS, we need to set up a virtual host and obtain an SSL certificate. We will use Let's Encrypt for this purpose.
First, install the certbot package:
sudo swupd bundle-add letsencrypt
Next, create a virtual host file for Chibisafe:
sudo nano /etc/nginx/sites-available/chibisafe
Add the following contents to the file:
server {
listen 80;
server_name your.domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name your.domain.com;
ssl_certificate /etc/letsencrypt/live/your.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/your.domain.com/privkey.pem;
root /path/to/your/chibisafe/directory;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
}
}
Replace your.domain.com with your actual domain name, and /path/to/your/chibisafe/directory with the path to your Chibisafe directory.
Save and close the file.
Next, enable the virtual host and reload the Nginx server:
sudo ln -s /etc/nginx/sites-available/chibisafe /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Finally, obtain an SSL certificate for your domain using the following command:
sudo certbot --nginx -d your.domain.com
Follow the instructions on the screen and enter the required information. When prompted, choose to redirect all HTTP traffic to HTTPS.
Step 6: Start Chibisafe
Restart the PHP-FPM service to apply the changes:
sudo systemctl restart php-fpm
Now, you can visit your Chibisafe website in your browser by navigating to https://your.domain.com.
Congratulations! You have successfully installed and configured Chibisafe on Clear Linux Latest.