Backup Your DVD Collection with Linux

By | All Linux HowTo's, Scripting HowTo's | No Comments

This post will show you how create a self contained machine that will backup your DVD collection without any effort from you (apart from placing the disc in the drawer). This is just a quick and simple script that was designed to help convert a 500+ strong collection of DVDs into media files I can enjoy around the house on any device.

Credit for the software goes to the teams at Makemkv and Handbrake without them this machine would do nothing, I recommend if you set this machine up that you should contribute to both of those projects you can find them using the links below.

Handbrake Website
MakeMKV Website

You will be able to backup blu-ray discs for 30 days using Makemkv after that point you will need to purchase the software, normal DVDs do not have this restriction, I would recommend purchasing the software anyway however it can be expensive so if you can’t afford to purchase it you will just need to work around the restrictions.

I have documented building this system on Gentoo as this was the quickest way to get it done, you can however use Redhat or Debian and get the same result.

The hardware for this does not have to be anything fantastic, I recently built one of these on a simple Intel Celeron machine with 4GB of RAM and a 300gb hard disk drive. The only hardware that I would consider a must is a disc drawer that is not designed to close if it is left open for a long period of time, the reason that I make this suggestion is that if you place a disc in the machine over night you could end up backing it up multiple times if the disc drawer closes on it’s own.

Use the documentation here to get a base installation of Gentoo on your hardware and then come back here.

Now that you have a working Gentoo installation lets get started,

First thing lets sync so that you get the latest version of the applications

emerge --sync

Now we can begin installing the software that we need, first we need to accept the license etc. Keep in mind that these version numbers may change in time so if in doubt just run the next command and follow the prompts.

echo "=media-video/makemkv-1.9.8-r1 ~amd64" >> /etc/portage/package.accept_keywords ; echo "=media-video/handbrake-0.10.2-r1 ~amd64" >> /etc/portage/package.accept_keywords ; echo "=media-libs/fdk-aac-0.1.3 FraunhoferFDK" >> /etc/portage/package.license ; echo ">=media-video/makemkv-1.9.8-r1 MakeMKV-EULA" >> /etc/portage/package.license

Now we can run emerge,

emerge --ask -jv handbrake makemkv

Once that is installed we can start creating the other items that we need,

mkdir -vp /workbench/{"todo","done"} ; mkdir -vp /var/log/dvdbackups ; mkdir -vp /root/bin ; touch /var/log/dvdbackups/mount.log ; touch /root/bin/dvdmount.sh ; touch /root/bin/dvdrip.sh

read more

Install and Test Tomcat7 on CentOS7 and RHEL7

By | All Linux HowTo's | No Comments

This is a quick HowTo for Tomcat7 on Redhat Enterprise Linux and CentOS 7. The shortest answer to how to install Tomcat7 is to download it, extract it and start it. It runs natively on port 8080 so adjust your firewall accordingly or change the port that Tomcat wants to use.

Download Tomcat7 from:

wget http://www.us.apache.org/dist/tomcat/tomcat-7/v7.0.67/bin/apache-tomcat-7.0.67.tar.gz -O /tmp/tomcat7.tar.gz

The above location can change. In that case navigate to “http://www.us.apache.org/dist/tomcat/tomcat-7/” and then find the version you want.

Extract it:

tar -xzf /tmp/tomcat7.tar.gz -C /usr/local/
mv /usr/local/apache-tomcat-7.0.67 /usr/local/tomcat7

Set the password and permissions in the “/usr/local/tomcat7/conf/tomcat-users.xml” file. You can remove the contents of this file and replace is with the following. Change the password to something secret:

<tomcat-users>
<role rolename="manager-gui" />
<user username="manager" password="MySecretPassword" roles="manager-gui" />
<role rolename="admin-gui" />
<user username="admin" password="MySecretPassword" roles="manager-gui,admin-gui" />
</tomcat-users>

read more

Reset the root password in CentOS/Redhat 7

By | All Linux HowTo's, Security HowTo's | No Comments

The process to reset the root password when you’ve forgotten it has changed in version 7 of Redhat and CentOS Linux.

First you need to reboot and temporarily edit the Grub2 boot loader. Add the following to the end of the line starting with “Linux16”:

rd.break enforcing=0

Boot using your changes by pressing:

Control+x

The changes you’ve just made are not permanent.

Once booted, issue the following:

read more

Installing and using VNCServer with only SSH open

By | All Linux HowTo's, Security HowTo's | No Comments

This tutorial demonstrations how to install and use VNC without direct access to the VNC server. In this article we only have SSH access to the server. This means we have no option but to use VNC in a secure manner – via SSH.

Install VNCServer and the desktop environment on the remote server:

yum clean all
yum groupinstall 'Server with GUI'
yum install tigervnc-server

I haven’t configured X to start on boot though as this is a server and rarely will be accessed using the GUI. Start X from the command line prior to connecting:

startx

We still need to configure the VNC server and our VNC access. CentOS and Redhat 7 have a new way of configuring VNC. The file you should start with is “/etc/sysconfig/vncserver” which will refer you to “/lib/systemd/system/vncserver@.service”. Open that file (/lib/systemd/system/vncserver@.service). You need to make two changes to that file which is simply replaving USER with your real username. Here’s an example with my username “myuser”:

[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l mysuer -c "/usr/bin/vncserver %i"
PIDFile=/home/myuser/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

Now we need to run the following commands:

cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
systemctl daemon-reload
systemctl enable vncserver@:1.service
systemctl start vncserver@:1.service

read more

SSH Tunnelling – Access services behind a firewall indirectly

By | All Linux HowTo's, Security HowTo's | No Comments

This one-liner illustrates how to use SSH to tunnel through a firewall that allows only SSH. In this example, we’ll access the website on the other side of that server.

Why do this? If the remote server “remote.server” has a firewall on it or between your workstation and that server and you want to access a web-site on the remote.server, you will have trouble unless you use a very nice feature of SSH – tunnelling.

read more

Create a ZFS filesystem & Extend it over a new disk on CentOS or Redhat

By | All Linux HowTo's | No Comments

In this tutorial we’re going to create a ZFS filesystem on Disk1 and then extend it to Disk2. We’re not going to worry about redundancy because this is a tutorial but ZFS does support common RAID types. We’ll configure ZFS for RAID0 (no parity, no redundancy). In the real world, you’d almost certainly use a RAID with redundancy unless your joining disks from a SAN perhaps.

This tutorial is for Redhat or CentOS 7.x.

yum upgrade
yum localinstall --nogpgcheck https://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
yum localinstall --nogpgcheck http://archive.zfsonlinux.org/epel/zfs-release.el7.noarch.rpm
yum install zfs 

List your current ZFS filesystems. I don’t have any so none appear in the results:

zfs list

If you have problems with modules at this point, try running “yum install kernel*”. Otherwise the “yum upgrade” at the top of this tutorial should help. You may need to reboot to load the new kernel after an upgrade.

Let’s create the first ZFS filesystem where “/dev/sdb” is your first ZFS disk:

zpool create -f zfs_volume /dev/sdb

TIP: You can use create these kinds of RAID:

# RAID0 - striped
zpool create -f zfs_volume /dev/sdb /dev/sdc /dev/sdd

# RAID1 - mirror
zpool create mirror -f zfs_volume /dev/sdb /dev/sdc

# RAID5 - striped with parity
zpool create raidz -f zfs_volume /dev/sdb /dev/sdc /dev/sdd

# RAID6 - striped with two parity
zpool create raidz2 -f zfs_volume /dev/sdb /dev/sdc /dev/sdd /dev/sde

# RAID10 - striped over mirror
zpool create mirror -f zfs_volume /dev/sdb /dev/sdc
zpool add mirror -f zfs_volume /dev/sdd /dev/sde

read more

Chrooting SCP (Rsync) with SELinux Enabled on Redhat/CentOS

By | All Linux HowTo's, Security HowTo's | No Comments

This article demonstrates how to Chroot users for SSH file copies (SCP and RSYNC) on a CentOS or Redhat server. The same process can be used for SSH logins but there needs to be some dependancies in place for that. Try the following site for more details on those dependancies “http://www.techrepublic.com/blog/linux-and-open-source/chroot-users-with-openssh-an-easier-way-to-confine-users-to-their-home-directories/”.

read more

Contact AGIX Support

Level 2, 170 Greenhill Road
Parkside 5063 South Australia
Phone: (08) 7324 4429
or 0422 927 598
support@agix.com.au