Install Zoneminder on Ubuntu 18.04 with shell script

This will install Zoneminder by using a shell script with one basic command (how easy is that!).

You will need a Ubuntu 18.04 install with LAMP (Apache, MySQL and PHP) installed desktop or server. As an alternate you may use Mariadb in lieu of MySQL

Shell script file contents:

#!/bin/sh
clear
read -p "This script installs Zoneminder 1.32.x on Ubuntu 18.04 AMD64 with LAMP (MySQL) installed...
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "You must be logged in as root using sudo su ...
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "Next we will add the PPA repository, install and configure the system to run Zoneminder. 
Press enter to continue" nothing
apt install -y software-properties-common
clear
add-apt-repository ppa:iconnor/zoneminder-1.32
apt update
clear
awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.2/apache2/php.ini
clear
apt install -y zoneminder
systemctl enable zoneminder
service zoneminder start
adduser www-data video
a2enconf zoneminder
a2enmod rewrite
chown -R www-data:www-data /usr/share/zoneminder/
service apache2 reload
clear
read -p "Install complete.Press enter to continue" nothing
clear

Copy the contents of the script, open a terminal and run: Continue reading “Install Zoneminder on Ubuntu 18.04 with shell script” »

Share

SNMP Client Configuration for Observvium

This can be placed in /etc/snmp/snmpd.conf and will provide the required parameters for Observium. This example use version 2c snmp auth.

Community string: Replace community_string with your unique community string.

# Listen for connections on all interfaces (both IPv4 *and* IPv6)

agentAddress udp:161,udp6:[::1]:161

# Full view access
view all included .1

# system + hrSystem groups only
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1

# Default access to full view
rocommunity community_string default -V all

# Default access to basic system info
#rocommunity public default -V systemonly

# System contact and location
syslocation Rack/Room/Building, Street, City, Country [GPSX,Y]
syscontact Contact Person <your@email.address>

# Disk Monitoring
disk / 10000
disk /var 5%
includeAllDisks 10%

# Unacceptable 1-, 5-, and 15-minute load averages
load 12 10 5

# This line allows Observium to detect the host OS if the distro script is installed
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/local/bin/distro

# This lines allows Observium to detect hardware, vendor and serial
extend .1.3.6.1.4.1.2021.7890.2 hardware /bin/cat /sys/devices/virtual/dmi/id/product_name
extend .1.3.6.1.4.1.2021.7890.3 vendor /bin/cat /sys/devices/virtual/dmi/id/sys_vendor
extend .1.3.6.1.4.1.2021.7890.4 serial /bin/cat /sys/devices/virtual/dmi/id/product_serial

# This line allows Observium to collect an accurate uptime
extend uptime /bin/cat /proc/uptime

# This line enables Observium's ifAlias description injection
pass_persist .1.3.6.1.2.1.31.1.1.1.18 /usr/local/bin/ifAlias_persist

Continue reading “SNMP Client Configuration for Observvium” »

Share

Add a User To Group www-data ( Apache Group )

The procedure is as follows:

  • Open the terminal application.
  • Login to Ubuntu server using ssh.
  • Add a new user named foo to www-data group by running useradd -g www-data foo command.
  • Add an existing user bar to Apache’s www-data group on Ubuntu using usermod -a -G www-data bar command.
  • Verify new modification on Linux by using the id command.

Let us see all commands in details.

How to see a list of www-data members

To see list of all members of a group named www-data, run the following grep command on /etc/group file:

grep ^www-data /etc/group

Sample outputs:

www-data:x:33:

How do I add an existing user named vivek to group Apache group www-data? Continue reading “Add a User To Group www-data ( Apache Group )” »

Share

Install Laravel 5 Framework on Ubuntu 18.04 & 16.04

Below is the system requirements for the installation of latest Laravel application on your system.

PHP >= 7.2
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension
Ctype PHP Extension
JSON PHP Extension
BCMath PHP Extension

Step 1 – Install LAMP

To start with Laravel, we first need to set up a running LAMP server. If you have already running LAMP stack skip this step else use followings commands to set up the lamp on Ubuntu system.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.2 php7.2-mcrypt php7.2-gd php7.2-mbstring php7.2-xml

Install PHP Mcrypt Extension & Install Apache2

sudo apt-get install apache2 libapache2-mod-php7.2

Install MySQL

sudo apt-get install mysql-server php7.2-mysql

Step 2 – Install Composer

The composer is required for installing Laravel dependencies. So use below commands to download and use as a command in our Continue reading “Install Laravel 5 Framework on Ubuntu 18.04 & 16.04” »

Share

Resizing a VirtualBox Virtual Hard Disk

Prerequisites
Before you start this procedure you’ll need to do the following.

  • Make sure you have the VBoxManage command-line tool installed on your host system.
  • Download the ISO for a GParted Live CD or else a Linux Live CD using a Linux distribution that includes the GParted partition editor utility.
  • IMPORTANT: If the virtual disk you want to resize is attached to a virtual machine with snapshots, you will need to delete these snapshots so that all disk state information is merged into the base virtual disk VDI file.
  • Resize the virtual disk (VirtualBox version 4.0+ only)
    If you are using VirtualBox version 4.0 or later, you can resize the logical capacity of a virtual disk using the VBoxManage modifyhd –resize command.

On the host system, run the following command:

cd /path/to/vbox/disks
VBoxManage modifyhd OldDisk.vdi –-resize 30000

where OldDisk.vdi is the filename of the virtual disk VDI file you want enlarge and 30000 is the new maximum size (in megabytes) of the virtual disk.

If your host OS is Windows, then the commands you need to enter at the Command Prompt will look more like the following. Continue reading “Resizing a VirtualBox Virtual Hard Disk” »

Share

How to Setup a Multi-Protocol VPN Server Using SoftEther

SoftEther VPN is one of the world’s most powerful and easy-to-use multi-protocol VPN software, made by the good folks at the University of Tsukuba, Japan. It runs on Windows, Linux, Mac, FreeBSD and Solaris and is freeware and open-source. You can use SoftEther for any personal or commercial use free of charge.

Step 1: Create a Virtual Server

First, you need to create a DigitalOcean Droplet. As mentioned in SoftEther’s website, SoftEther will work on almost every Linux distro with kernel v2.4 or above,; however it’s recommended to choose one of these distributions: CentOS, Fedora, or Red Hat Enterprise Linux.

Personally I have tried it on Ubuntu, CentOS and Fedora, both 32 and 64 bit editions, and it has worked perfectly.

Step 2: Update your Server Software

Using the command below, update and upgrade your server software packages to the latest version:

Debian / Ubuntu:

apt-get update && apt-get upgrade

CentOS / Fedora:

yum upgrade

Step 3: Download SoftEther

You can download the latest SoftEther server package for Linux from their website:

Download SoftEther

Unfortunately, there is no way of getting the latest version through package managers (or even using a single url) at the moment. Therefore you have to browse their website using a desktop browser to download the package. There are a couple of ways of dealing with this: First, browse their website on your own computer and then depending on your server configuration (OS, x86/x64, etc.) find the link to the appropriate package then use wget to download the package to your server. Alternatively, you can use a terminal based web browser such as lynx to browse the SoftEther website and download the right package. Continue reading “How to Setup a Multi-Protocol VPN Server Using SoftEther” »

Share

Using NGinx to serve static files and Apache for dynamic

Apache is a great web-server, but it has a pretty heavy memory footprint. It can get quite restrictive quite quickly, especially if you’re on a system will limited resources (given how many people now run on a VPS, and the poor disk IO of these systems it’s all the more important – swapping is slow).

The way around it, is to configure your system to use NGinx as a reverse-proxy. Depending how many virtualhosts you have, you can make the changes almost completely transparently within about 10 minutes.

Pre-Requisites

First, we need to be able to install NGinx, which means setting up the EPEL repo (if you already have it enabled, skip this step)

CentOS 6.x

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Now that the repo is installed, we need to install NGinx

yum install nginx

Configuring NGinx

Now that NGinx is installed we need to create a VirtualHost (actually NGinx calls them Server Blocks) for each site we are hosting.

nano /etc/nginx/conf.d/virtual.conf
#Insert one of these for each of the virtualhosts you have configured in Apache
server {
listen 80;
root /path/to/site/root; 
index index.php index.html index.htm;
server_name www.yourdomain.com yourdomain.com;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}

location ~ /\.ht {
deny all;
}
}

This configuration tells NGinx to try and serve the requested file, but to pass the request onto Apache if it’s unable to do so. Requests for PHP files should be forwarded automatically. Apache will be told who requested the file in the ‘X-Forwarded-For’ header. Continue reading “Using NGinx to serve static files and Apache for dynamic” »

Share

Configuring Postfix to block outgoing mail to all but one domain

This is so simple to do, but I have to look it up every time I need it (not something that comes up regularly!);

When configuring a development server, you may find you have a need to ensure that emails will not be sent to any domain except those you explicitly permit (for example if you’re using real-world data to do some testing, do you want to send all those users irrelevant emails?).

This documentation details how to configure Postfix on a Linux server to disregard any mail sent to domains that are not explicitly permitted.

Don’t use IPTables

You could, of course, add two IPTables rules to the outgoing chain. The first of which would allow connections on Port 25 to the domain you wish to allow, the second blocking connection to any server on Port 25.

It’ll block the mail from being sent, but will mean that every one of those messages sits in the mail queue for 60 days until it’s disregarded. You could reconfigure the timeout, but given the ease of the steps below, what’s the point?

Use Transport Mapping

Using this method, we can tell Postfix to either reject the mail, or disregard it. The latter is generally the preferred method as we want the sending application to believe the mail has been sent. Continue reading “Configuring Postfix to block outgoing mail to all but one domain” »

Share

Monitor and Manage your services with Monit on CentOS 6 / RHEL 6

Install Monit

For Debian/Ubuntu

Monit is easiest to install through apt-get:

sudo apt-get install monit

For RHEL:

Configure EPEL repo to download the latest Monit package.

[root@server ~]# rpm -Uvh http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
[root@server ~]# yum -y install monit

Once monit downloads, you can add programs and processes to the configuration file:

sudo nano /etc/monit/monitrc

Monit can be started up with a command that then keeps it running in the background

monit

Typing monit status displays monit’s details:

The Monit daemon 5.3.2 uptime: 1h 25m
System 'myhost.mydomain.tld'
status Running
monitoring status Monitored
load average [0.03] [0.14] [0.20]
cpu 3.5%us 5.9%sy 0.0%wa
memory usage 26100 kB [10.4%]
swap usage 0 kB [0.0%]
data collected Thu, 30 Aug 2012 18:35:0

Configure Monit

Monit is very easy to use nearly out of the box. By default, it is set up to check that services are running every 2 minutes and stores its log file in “/var/log/monit.log”. Continue reading “Monitor and Manage your services with Monit on CentOS 6 / RHEL 6” »

Share