Web Server Setup & Applications
- MariaDB Installation and Configuration
- Apache Web Server Installation and Configuration
- BookStack Installation and Configuration on wiki.deome.net
- Piwigo Installation and Configuration on gallery.deome.net
MariaDB Installation and Configuration
MariaDB Installation and Configuration
Overview
This page provides step-by-step instructions for installing MariaDB on buzz.deome.net and configuring it to work with applications like BookStack and the photo gallery.
1. Installing MariaDB
-
Update the System:
- Ensure all packages are up-to-date.
sudo apt update && sudo apt upgrade -y
- Ensure all packages are up-to-date.
-
Install MariaDB Server:
- Use the following command to install MariaDB:
sudo apt install mariadb-server -y
- Use the following command to install MariaDB:
-
Start and Enable MariaDB:
- Start the MariaDB service and enable it to start on boot:
sudo systemctl start mariadb sudo systemctl enable mariadb
- Start the MariaDB service and enable it to start on boot:
-
Verify Installation:
- Check the MariaDB version to confirm it is installed:
mysql --version - You should see output confirming the MariaDB version, as shown in your initial check.
- Check the MariaDB version to confirm it is installed:
2. Initial MariaDB Configuration
-
Run the Security Script:
- MariaDB provides a security script to help you configure common security settings.
sudo mysql_secure_installation - This script will prompt you to:
- Set a root password.
- Remove anonymous users.
- Disallow remote root login.
- Remove test databases.
- Answer each prompt as needed to secure the installation.
- MariaDB provides a security script to help you configure common security settings.
-
Log in as the Root User:
- After configuring security, log in to MariaDB:
sudo mysql -u root -p
- After configuring security, log in to MariaDB:
-
Create a New Database and User for Each Application:
-
Database for BookStack:
CREATE DATABASE bookstackdb; CREATE USER 'bookstackuser'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON bookstackdb.* TO 'bookstackuser'@'localhost'; FLUSH PRIVILEGES; -
Database for Photo Gallery:
CREATE DATABASE gallerydb; CREATE USER 'galleryuser'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON gallerydb.* TO 'galleryuser'@'localhost'; FLUSH PRIVILEGES; - Replace
your_passwordwith secure passwords.
-
Database for BookStack:
-
Exit MariaDB:
- Once databases and users are set up, exit MariaDB:
EXIT;
- Once databases and users are set up, exit MariaDB:
3. Basic MariaDB Configuration Options
-
Optimize Settings (Optional):
- Open the MariaDB configuration file:
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf - Modify settings under
[mysqld]as needed. Example optimizations:max_connections = 100 innodb_buffer_pool_size = 256M - Save and close the file.
- Open the MariaDB configuration file:
-
Restart MariaDB:
- Apply changes by restarting the MariaDB service:
sudo systemctl restart mariadb
- Apply changes by restarting the MariaDB service:
4. Testing and Verification
-
Verify Databases and Users:
- Log in as root and list the databases to confirm they were created:
sudo mysql -u root -p SHOW DATABASES;
- Log in as root and list the databases to confirm they were created:
-
Connect Using Each Application’s Credentials:
- Use the created usernames and passwords to confirm access for BookStack and the gallery:
mysql -u bookstackuser -p mysql -u galleryuser -p
- Use the created usernames and passwords to confirm access for BookStack and the gallery:
-
Connection from Applications:
- Ensure that BookStack and the photo gallery application can connect to MariaDB using the specified database names and credentials.
5. Maintenance and Backup
-
Automate Backups:
- Create a cron job to back up each database:
mysqldump -u root -p bookstackdb > /path/to/backup/bookstackdb.sql mysqldump -u root -p gallerydb > /path/to/backup/gallerydb.sql
- Create a cron job to back up each database:
-
Update MariaDB:
- Periodically check for updates to keep MariaDB secure and optimized:
sudo apt update && sudo apt upgrade mariadb-server
- Periodically check for updates to keep MariaDB secure and optimized:
Apache Web Server Installation and Configuration
Apache Web Server Installation and Configuration
Overview
This page provides instructions for setting up and configuring Apache on buzz.deome.net. It includes steps for installing Apache, configuring virtual hosts for multiple sites, securing with SSL certificates, and basic performance tuning.
1. Apache Installation
-
Update System Packages:
- Start by updating the package list and upgrading existing packages:
sudo apt update && sudo apt upgrade -y
- Start by updating the package list and upgrading existing packages:
-
Install Apache:
- Install Apache with the following command:
sudo apt install apache2 -y
- Install Apache with the following command:
-
Start and Enable Apache:
- Start the Apache service and enable it to run on boot:
sudo systemctl start apache2 sudo systemctl enable apache2
- Start the Apache service and enable it to run on boot:
-
Verify Installation:
- Check the Apache status to ensure it’s running:
sudo systemctl status apache2
- Check the Apache status to ensure it’s running:
2. Basic Apache Configuration
-
Main Configuration File:
- The main Apache configuration file is located at:
/etc/apache2/apache2.conf
- The main Apache configuration file is located at:
-
Enable Recommended Modules:
- Enable commonly used modules:
sudo a2enmod rewrite ssl headers - Restart Apache to apply the changes:
sudo systemctl restart apache2
- Enable commonly used modules:
3. Setting Up Virtual Hosts
-
Create a New Virtual Host:
- For each site, create a configuration file in
/etc/apache2/sites-available/. For example, for wiki.deome.net:sudo nano /etc/apache2/sites-available/wiki.deome.net.conf - Add the following configuration:
<VirtualHost *:80> ServerName wiki.deome.net DocumentRoot /var/www/wiki <Directory /var/www/wiki> AllowOverride All </Directory> ErrorLog ${APACHE_LOG_DIR}/wiki_error.log CustomLog ${APACHE_LOG_DIR}/wiki_access.log combined </VirtualHost>
- For each site, create a configuration file in
-
Enable the Virtual Host:
- Use
a2ensiteto enable each virtual host:sudo a2ensite wiki.deome.net.conf - Reload Apache to apply changes:
sudo systemctl reload apache2
- Use
-
Repeat for Additional Sites:
- Create similar configuration files for gallery.deome.net, buzz.deome.net, and any other sites you plan to host.
4. SSL Configuration with Let’s Encrypt
-
Install Certbot:
- Install Certbot to automate SSL certificate generation:
sudo apt install certbot python3-certbot-apache -y
- Install Certbot to automate SSL certificate generation:
-
Generate SSL Certificates:
- Use Certbot to obtain SSL certificates for each virtual host:
sudo certbot --apache -d wiki.deome.net sudo certbot --apache -d gallery.deome.net - Certbot will automatically configure SSL for the specified domains.
- Use Certbot to obtain SSL certificates for each virtual host:
-
Set Up Auto-Renewal:
- To ensure certificates renew automatically:
sudo certbot renew --dry-run
- To ensure certificates renew automatically:
5. Performance and Optimization
-
Adjust Apache Settings:
- Open the main Apache configuration file:
sudo nano /etc/apache2/apache2.conf - Consider modifying these settings under the
mpm_prefork_moduleormpm_worker_module:KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 5
- Open the main Apache configuration file:
-
Enable Caching:
- Install and enable Apache caching modules if desired:
sudo a2enmod cache sudo a2enmod cache_disk sudo systemctl restart apache2
- Install and enable Apache caching modules if desired:
-
Optimize Logging:
- Adjust log levels or configure centralized logging if needed. Logging configuration is in each virtual host file and
/etc/apache2/apache2.conf.
- Adjust log levels or configure centralized logging if needed. Logging configuration is in each virtual host file and
6. Maintenance and Monitoring
-
Monitor Apache Status:
- Check Apache’s status periodically:
sudo systemctl status apache2
- Check Apache’s status periodically:
-
Check Logs:
- Access logs for each virtual host in
/var/log/apache2/, e.g.:sudo tail -f /var/log/apache2/wiki_access.log sudo tail -f /var/log/apache2/wiki_error.log
- Access logs for each virtual host in
-
Restarting Apache:
- Restart Apache after any configuration changes:
sudo systemctl restart apache2
- Restart Apache after any configuration changes:
This wiki page provides a thorough guide for Apache installation, virtual host setup, SSL configuration, and performance tuning. Let me know if you’d like any additional details or further customization for your setup!
BookStack Installation and Configuration on wiki.deome.net
Overview
This page provides a complete guide to setting up BookStack on wiki.deome.net, including installation, configuration, database setup, and SSL configuration with Let’s Encrypt.
1. Prerequisites
- Web Server: Apache (refer to the Apache wiki page for installation).
- Database: MariaDB (refer to the MariaDB wiki page for installation and configuration).
-
PHP: BookStack requires PHP 7.3 or higher. Install necessary PHP modules.
sudo apt install php php-mysql php-xml php-mbstring php-zip php-gd -y
2. Download and Install BookStack
-
Create the Document Root Directory:
- Create a directory for BookStack:
sudo mkdir -p /var/www/wiki
- Create a directory for BookStack:
-
Download BookStack:
- Navigate to the web root and download the latest version:
cd /var/www/wiki sudo git clone https://github.com/BookStackApp/BookStack.git ./ sudo git checkout release
- Navigate to the web root and download the latest version:
-
Set File Permissions:
- Ensure Apache can read/write to the BookStack files:
sudo chown -R www-data:www-data /var/www/wiki sudo chmod -R 755 /var/www/wiki
- Ensure Apache can read/write to the BookStack files:
3. Configure the Database
-
Log in to MariaDB:
sudo mysql -u root -p -
Create Database and User:
- Create a database for BookStack:
CREATE DATABASE bookstackdb; CREATE USER 'bookstackuser'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON bookstackdb.* TO 'bookstackuser'@'localhost'; FLUSH PRIVILEGES; EXIT;
- Create a database for BookStack:
4. Configure Environment Variables
-
Copy the Environment File:
- BookStack uses an
.envfile for configuration. Copy the example:sudo cp .env.example .env
- BookStack uses an
-
Edit the .env File:
- Open the
.envfile to configure your database and site settings:sudo nano .env - Update the following lines:
# Database configuration DB_HOST=localhost DB_DATABASE=bookstackdb DB_USERNAME=bookstackuser DB_PASSWORD=your_password # Application URL APP_URL=https://wiki.deome.net
- Open the
-
Save and Close: Press
Ctrl + X, thenY, andEnterto save changes.
5. Set Up Apache Virtual Host for wiki.deome.net
-
Create the Virtual Host File:
sudo nano /etc/apache2/sites-available/wiki.deome.net.conf -
Configure the Virtual Host:
- Add the following configuration:
<VirtualHost *:80> ServerName wiki.deome.net DocumentRoot /var/www/wiki/public <Directory /var/www/wiki/public> AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/wiki_error.log CustomLog ${APACHE_LOG_DIR}/wiki_access.log combined </VirtualHost>
- Add the following configuration:
-
Enable the Site and Rewrite Module:
sudo a2ensite wiki.deome.net.conf sudo a2enmod rewrite sudo systemctl reload apache2
6. Set Up SSL with Let’s Encrypt
-
Install Certbot:
- If Certbot is not already installed:
sudo apt install certbot python3-certbot-apache -y
- If Certbot is not already installed:
-
Generate SSL Certificate:
sudo certbot --apache -d wiki.deome.net -
Auto-Renewal Setup:
- Certbot will auto-renew SSL certificates by default. To verify:
sudo certbot renew --dry-run
- Certbot will auto-renew SSL certificates by default. To verify:
7. Complete BookStack Setup
-
Run the BookStack Installation Commands:
- Navigate to the BookStack directory and run the following commands to finish the setup:
cd /var/www/wiki sudo -u www-data php artisan key:generate --force sudo -u www-data php artisan migrate --force
- Navigate to the BookStack directory and run the following commands to finish the setup:
-
Set Permissions (again, if necessary):
- Ensure permissions are still correct after setup:
sudo chown -R www-data:www-data /var/www/wiki sudo chmod -R 755 /var/www/wiki
- Ensure permissions are still correct after setup:
8. Testing and Verification
-
Access BookStack:
- Go to
https://wiki.deome.netin your web browser. - Follow the on-screen instructions to set up the admin account.
- Go to
-
Check Logs:
- Monitor Apache logs if there are any issues:
sudo tail -f /var/log/apache2/wiki_access.log sudo tail -f /var/log/apache2/wiki_error.log
- Monitor Apache logs if there are any issues:
9. Ongoing Maintenance
-
Database Backups:
- Set up a cron job to regularly back up the BookStack database:
mysqldump -u root -p bookstackdb > /path/to/backup/bookstackdb.sql
- Set up a cron job to regularly back up the BookStack database:
-
Updating BookStack:
- Periodically pull the latest updates from the BookStack repository:
cd /var/www/wiki sudo -u www-data git pull origin release sudo -u www-data php artisan migrate --force
- Periodically pull the latest updates from the BookStack repository:
This setup guide for BookStack covers installation, configuration, and basic maintenance. Let me know if you'd like additional details or specific troubleshooting steps included!
Piwigo Installation and Configuration on gallery.deome.net
Overview
This page provides step-by-step instructions to install and configure Piwigo as a photo gallery on gallery.deome.net. This includes setting up the Apache virtual host, database configuration, and SSL with Let’s Encrypt.
1. Prerequisites
- Web Server: Apache (see Apache wiki page).
- Database: MariaDB (refer to MariaDB setup page).
-
PHP: Ensure PHP is installed along with the necessary modules:
sudo apt install php php-mysql php-xml php-mbstring php-gd php-curl -y
2. Download and Install Piwigo
-
Create the Document Root Directory:
- Create a directory for Piwigo:
sudo mkdir -p /var/www/gallery
- Create a directory for Piwigo:
-
Download Piwigo:
- Navigate to the gallery directory and download the latest Piwigo release:
cd /var/www/gallery sudo wget https://piwigo.org/download/dlcounter.php?code=latest -O piwigo.zip sudo unzip piwigo.zip sudo mv piwigo/* ./ sudo rm -rf piwigo piwigo.zip
- Navigate to the gallery directory and download the latest Piwigo release:
-
Set File Permissions:
- Make sure Apache has the correct permissions to access and modify the files:
sudo chown -R www-data:www-data /var/www/gallery sudo chmod -R 755 /var/www/gallery
- Make sure Apache has the correct permissions to access and modify the files:
3. Configure the Database
-
Log in to MariaDB:
sudo mysql -u root -p -
Create a Database and User for Piwigo:
CREATE DATABASE piwigodb; CREATE USER 'piwigouser'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON piwigodb.* TO 'piwigouser'@'localhost'; FLUSH PRIVILEGES; EXIT;
4. Configure Apache Virtual Host for gallery.deome.net
-
Create the Virtual Host File:
- Open a new virtual host configuration file for gallery.deome.net:
sudo nano /etc/apache2/sites-available/gallery.deome.net.conf
- Open a new virtual host configuration file for gallery.deome.net:
-
Add the Virtual Host Configuration:
- Use the following configuration:
<VirtualHost *:80> ServerName gallery.deome.net DocumentRoot /var/www/gallery <Directory /var/www/gallery> AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/gallery_error.log CustomLog ${APACHE_LOG_DIR}/gallery_access.log combined </VirtualHost>
- Use the following configuration:
-
Enable the Site and Rewrite Module:
- Enable the virtual host and rewrite module, then reload Apache:
sudo a2ensite gallery.deome.net.conf sudo a2enmod rewrite sudo systemctl reload apache2
- Enable the virtual host and rewrite module, then reload Apache:
5. Set Up SSL with Let’s Encrypt
-
Install Certbot:
- If Certbot is not already installed:
sudo apt install certbot python3-certbot-apache -y
- If Certbot is not already installed:
-
Generate SSL Certificate:
- Use Certbot to obtain an SSL certificate for gallery.deome.net:
sudo certbot --apache -d gallery.deome.net
- Use Certbot to obtain an SSL certificate for gallery.deome.net:
-
Enable Auto-Renewal:
- Certbot will automatically handle renewal. Test the setup with:
sudo certbot renew --dry-run
- Certbot will automatically handle renewal. Test the setup with:
6. Complete Piwigo Setup
-
Access the Piwigo Installation Wizard:
- Open a browser and go to
https://gallery.deome.net. You should see the Piwigo setup wizard.
- Open a browser and go to
-
Follow the Setup Wizard:
- Enter the database information:
-
Database Name:
piwigodb -
Database User:
piwigouser -
Database Password:
your_password
-
Database Name:
- Configure the admin account and complete the setup.
- Enter the database information:
7. Testing and Verification
-
Access Piwigo:
- Verify that Piwigo loads correctly at
https://gallery.deome.net.
- Verify that Piwigo loads correctly at
-
Check Logs:
- Monitor the Apache logs if any issues arise:
sudo tail -f /var/log/apache2/gallery_access.log sudo tail -f /var/log/apache2/gallery_error.log
- Monitor the Apache logs if any issues arise:
8. Maintenance and Updates
-
Database Backup:
- Set up regular database backups:
mysqldump -u root -p piwigodb > /path/to/backup/piwigodb.sql
- Set up regular database backups:
-
Updating Piwigo:
- Periodically check for updates in the Piwigo admin dashboard.
This setup should get Piwigo running smoothly on gallery.deome.net. Let me know if you need any specific configurations or additional settings!