Bash Script To Restart Linux Server Services

Here’s the command line code to create the file in nano:

sudo nano /opt/launch-crashed-services.sh

Here is the bash script.

#!/bin/bash

service mysql status | grep 'active (running)' > /dev/null 2>&1
if [ $? != 0 ]
then
sudo service mysql restart > /dev/null
fi

service nginx status | grep 'active (running)' > /dev/null 2>&1
if [ $? != 0 ]
then
sudo service nginx restart > /dev/null
fi

service php7.2-fpm status | grep 'active (running)' > /dev/null 2>&1
if [ $? != 0 ]
then
sudo service php7.2-fpm restart > /dev/null
fi

Read more

Share

Build an openDNS recursive resolver DNS using Bind

It’s a small thing, but someone might feel it to be useful of running a public DNS like google has 8.8.8.8. You actually can build a recursive DNS and serve to the world (instead to your network user only! 🙂 )

Install Bind

apt install bind9 bind9utils -y

It’s pretty simple, all you need is the have your bind package installed and some very basic configurations like below-

nano /etc/bind/named.conf
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
nano /etc/bind/named.conf.options

Read more

Share

Install Proxmox VE 7 on Debian 11 (Bullseye)

In this guide, we will cover a step-by-step installation of Proxmox VE 7 virtualization software on Debian 11 (Bullseye) Linux system. It’s recommended to deploy Proxmox VE server from a Bare-metal_ISO_Installer, but it’s sometimes inevitable to deploy it on a running instance of Debian 11 (Bullseye) server.

Setup Pre-requisites

For the installation of Proxmox VE 7 on Debian 11 (Bullseye), you need the following requirements to be met;

  • A running instance of Debian Bullseye
  • A 64-bit processor with support for the Intel 64 or AMD64 CPU extensions.
  • Access to Debian server terminal as root or standard user with sudo
  • Server needs internet access
  • Enough hardware resources to be used in Virtualizing other operating systems

Read more

Share

Install Netxtcloud on Debian 10

Install Apache, MariaDB and PHP

NextCloud runs on the webserver, written in PHP and uses MariaDB to store their data. So you will need to install Apache, MariaDB, PHP and other required packages on your system. You can install all of them by running the following command:

apt-get install apache2 libapache2-mod-php mariadb-server php-xml php-cli php-cgi php-mysql php-mbstring php-gd php-curl php-zip wget unzip -y

Once all the packages are installed, open the php.ini file and tweak some recommended settings:

nano /etc/php/7.3/apache2/php.ini

Change the following settings:

memory_limit = 512M
upload_max_filesize = 1024M
post_max_size = 1024M
max_execution_time = 300
date.timezone = Asia/Dhaka

Save and close the file when you are finished. Then, start the Apache and MariaDB service and enable them to start after system reboot with the following command:

Read more

Share

SSL on Debian 10 Apache2

Assuming you have an SSL certificate already downloaded and available on the server.

root@www:~#nano /etc/apache2/sites-available/default-ssl.conf
# line 3: change admin email

ServerAdminwebmaster@srv.world

# line 32,33: change to the certs gotten in section [1]

SSLCertificateFile /etc/letsencrypt/live/www.srv.world/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.srv.world/privkey.pem

# line 42: uncomment and change to the chain-file gotten in section

SSLCertificateChainFile /etc/letsencrypt/live/www.srv.world/chain.pem
root@www:~#a2ensite default-ssl
Enabling site default-ssl

Read more

Share

Install a Sectigo Domain Validation SSL certificate in Zimbra

We usually get the below four files from Sectigo in the certificate bundle. The file name may vary depending on the certificate type

  1. yourdomain.com.crt – main certificate
  2. AAACertificateServices.crt – Root Certificate
  3. USERTrustRSAAAACA.crt – Intermediate Certificate – 1
  4. SectigoRSADomainValidationSecureServerCA.crt – Intermediate Certificate – 2

Step 1: We shall create two files as below.

commercial_ca.crt (includes root certificate and two intermediate certificates)
commercial.crt (includes main certificate, root certificate and two intermediate certificates)

Step 2: Login to Zimbra server, move to directory /opt/zimbra/ssl/zimbra/commercial and create two files as below.

root@mail:~# cd /opt/zimbra/ssl/zimbra/commercial/
root@mail:/opt/zimbra/ssl/zimbra/commercial# touch commercial_ca.crt
root@mail:/opt/zimbra/ssl/zimbra/commercial# touch commercial.crt

Read more

Share

osTicket Automated Install Script

osTicket is one of the leading open source ticketing systems. Here’s an easy way to spin up an instance on Ubuntu.

Note:
This script is purely intended for use in short-lived demo systems. The passwords are obvious (password !?) and there is no hardening applied to any of this system. DO NOT USE THIS SCRIPT IN PRODUCTION.

Create Shell Script
Spin up an Ubuntu instance then create a new shell script and give it executable permissions:

touch osTicket.sh
chmod +x osTicket.sh

Script Content
Paste this into the script:

Read more

Share

Configuring SMTPS in Virtualmin

Under System Settings > Server Templates (and under the dropdown menu “Edit template section”) > Mail client auto-configuration. In the section Thunderbird auto-configuration XML, under the heading outgoingServer, I changed the port from $SMTP_PORT to $SMTPS_Port and selected XMLtemplate below as opposed to Automatically generated. My XML template is therefore as follows:

<?xml version="1.0" encoding="UTF-8"?>

<clientConfig version="1.1">
<emailProvider id="$SMTP_DOMAIN">
<domain>$SMTP_DOMAIN</domain>
<displayName>$OWNER Email</displayName>
<displayShortName>$OWNER</displayShortName>
<incomingServer type="imap">
<hostname>$IMAP_HOST</hostname>
<port>$IMAP_PORT</port>
<socketType>$IMAP_TYPE</socketType>
<authentication>$IMAP_ENC</authentication>
<username>$SMTP_LOGIN</username>
</incomingServer>
<outgoingServer type="smtp">
<hostname>$SMTP_HOST</hostname>
<port>$SMTPS_PORT</port>
<socketType>$SMTP_TYPE</socketType>
<authentication>$SMTP_ENC</authentication>
<username>$SMTP_LOGIN</username>
</outgoingServer>
</emailProvider>
</clientConfig>

If the variable $SMTPS_Port doesn’t work for you, you can try manually entering port 465.

Src: https://serverfault.com/questions/605090/configuring-smtps-in-virtualmin

Share

Mapping drives with Windows Explorer in Nextcloud

To map a drive using the Microsoft Windows Explorer:

  1. Open Windows Explorer on your MS Windows computer.
  2. Right-click on Computer entry and select Map network drive… from the drop-down menu.
  3. Choose a local network drive to which you want to map Nextcloud.
  4. Specify the address to your Nextcloud instance, followed by /remote.php/dav/files/USERNAME/.
    or example:
https://example.com/nextcloud/remote.php/dav/files/USERNAME/

Src: https://docs.nextcloud.com/server/latest/user_manual/en/files/access_webdav.html

Share

Install SmokePing on CentOS 7

This tutorial explains how to install Tobias Oetiker’s Smokeping into /opt/smokeping on a CentOS 7 box.

Features of Smokeping:
– Best of breed latency visualisation.
– Interactive graph explorer.
– Wide range of latency measurement plugins.
– Master/Slave System for distributed measurement.
– Highly configurable alerting system.
– Live Latency Charts with the most ‘interesting’ graphs.
– Free and open-source Software written in Perl written by Tobi Oetiker, the creator of MRTG and RRDtool

Read more

Share