Archive

Archive for March, 2017

Kodi – Your One Stop Entertainment Solution On Linux

March 29th, 2017 No comments

Linux – The open-source OS we’ve all come to use and love and then use some more. I’ve been using Linux since 2009 at least and I have got to say, it’s capabilities have always managed to one-up my expectations. This is one operating system where I learn something new every other day. Across the years I’ve used various builds of Red Hat, Fedora, Ubuntu, Xubuntu, Mint, Debian and many more and I’m still not through. In fact, my love for Linux gets stronger with each day.

“It’s Not Meant For Entertainment”

Or so they say. Keeping Linux’s technical superiority aside, one of the most common criticisms directed towards Linux is its lack of compatibility with third party software. The general belief of an average user like me that is Linux is an absolute fit for developers and programmers but lacks that entertainment aspect for a normal user.

If it were 2012 when I was still struggling with it, I would have agreed. Not today though. The criticism is not really applicable anymore because today, Linux also supports one of the best free and open-source media player, Kodi.

“So, What is Kodi?”

Kodi is an impressive free multi platform media player that has also emerged as a great resource to watch films and TV for free. Kodi was introduced on Xbox as the Xbox Media Center (or XBMC), but that didn’t last for much long and now, the software exists in more than 65 languages, over a great number of platforms, and blending the work of hundreds of programmers.

Kodi as a free open-source media player plays all sorts of digital media comprising of TV (live and recorded), films, other videos, music, podcasts, photos, and slideshows. It’s also highly regarded for watching free ‘pirated’ copyrighted content.

“Is It Compatible With Linux?”

The Kodi application is available on multiple operating systems and hardware platforms such as Linux, OS X, Windows, iOS, and Android, featuring a 10-foot user interface for use with televisions and remote controls. It allows users to play and view most videos, music, podcasts, and other digital media files from local and network storage media and the internet.

How to install Kodi on Linux

Installing Kodi on Linux is a piece of cake. Just add the PPA to your system, update the local repository index and install the Kodi package:

  • $ sudo add-apt-repository ppa:team-xbmc/ppa
  • $ sudo apt-get update
  • $ sudo apt-get install kodi

Or, use the below command to install audio codecs and other addons as well:

  • $ sudo apt-get install –install-suggests kodi

Optional, to remove kodi, do:

  • $ sudo apt-get remove kodi*

These installation instructions support Ubuntu 16.10 Yakkety Yak, Ubuntu 16.04 Xenial Xerus, Ubuntu 14.04 Trusty Tahr, Linux Mint 18.x, Linux Mint 17.x, Elementary OS 0.3 Freya and other Ubuntu derivative systems.

Moreover Kodi permits you to install third-party plugins that may grant access to free content available on the official content provider website. Team Kodi does not endorse the usage of illegal or pirated content which would otherwise need to be paid.

“One More Thing”

Since listening and watching pirated content can constitute trouble for the user it is recommended to employ a VPN which would hide your activities from the concerned authorities. Your online freedom is important. Stay out of the radar of data snoopers and online spies with the best VPN for Kodi. You are as vulnerable in the digital world as you are in the real world. Use a VPN to stay secure & safe online.

Despite the piracy linked criticisms, Kodi media player has established itself as a very popular application. Version 17 of Kodi has been released recently and is now available to be installed on Linux computers.

Brad is a tech blogger fascinated by technology, gadgets, latest developments the geek culture. Much as he loves writing about technological innovations and IoT, when he’s not, he can found playing games on his Xbox or hanging out with his beloved pets.

Categories: Brad H, Linux Tags:

Alternative software: QupZilla Browser

March 19th, 2017 No comments

I’m back at it, looking for the latest open source alternative software gem. This time around I’m trying out the QupZilla web browser. Never heard of QupZilla before? Well it’s another alternative web browser but this one is built on top of Qt WebEngine, comes with a built in ad blocker and strives to have a native look and feel for whichever distribution/desktop environment you’re running.

QupZilla on first launch

QupZilla supports a number of extensions that expands the browser’s capabilities. These are presented in an easy to use settings dialog.

Extensions for you! And you! And You!

I figured that it would be a good test to quickly see memory usage when loading up a number of tabs:

Number of tabs Memory Usage
1 184.4MB
2 238.8MB
3 275.3MB

While it’s hard to say if that’s a lot of memory usage or not it does seem like quite a bit of RAM to use up for just a single tab. The other thing I noticed was that the browser seems to use quite a bit of CPU when initially rendering the web page. I don’t know if that’s just related to my particular configuration or what but I regularly saw spikes up to ~70% CPU which seems excessive.

Overall though QupZilla seemed to work fine for the websites I tried in it. I suppose if you’re looking to run a browser that no one else is then this one is for you but just like Midori and Konqeror I don’t have a compelling reason to recommend this for every day use.

How To Install Linux Step-By-Step

March 18th, 2017 No comments

How To Install Linux? By Video

Before we dig into how to install Linux lets review what We’ve talked about choosing the best Linux distro that fits your need on this post

Best Linux Distro

and hope you choose the one that is suitable for you

If you want to install Linux there are 2 ways to do that

First way is to download the Linux distribution you want and burn it to a DVD or USB stick and boot your machine with it and complete the installation process

The second way is to install it virtually on a virtual machine like VirtualBox or VMware and continue working on your windows or mac system without rebooting so your Linux system will be contained in a window you can minimize it and continue working on your system.

For me I prefer VirtualBox it’s a free and runs fast on my PC than VMware and natively support installing windows Linux mac OS with all versions

Let’s choose any Linux distro and install it using both 2 ways

Ok I’m going to choose Linux mint they call it the mac os of Linux

It is good distro for laptops and desktops for personal use

The version we are going to install is 18.1 “Serena” at the time of writing that article.

Go to this link and download it

https://www.linuxmint.com/download.php

I prefer Cinnamon desktop version it is promising and elegant

Once you download the iso file you will have to burn it on DVD or the easy way copying it on USB stick using a program called universal USB installer from that link

https://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/

After downloading the program open it and choose from the list the distro you want to install in our case Linux mint and make sure you put your memory stick on the computer and click next and wait till copying process is finished.

how to install linux using usb
how to install Linux using USB

how to install linux mint

install linux choose iso

Now Finally we click create to create bootable USB

create bootable usb install linux

And now you can boot with this memory stick

Then Restart you PC and go to BIOS settings  and select boot options and make sure the USB is the first one then it will show the installation screen press Enter it will load the live CD content which is on the USB or DVD

boot linux

install linux boot menu

Then desktop will appear like that

linux boot complete

Click install Linux mint

Then choose the language used for installation

choose language

install third party

Then choose the installation type and TAKE CARE if you are installing Linux on a disk that contains another system you MUST choose the option called something else

delete partitions

But if you installing it on new disk choose the option Erase disk

Linux requires 2 partitions to work on root partition and swap partition

Now we will create them by clicking the plus button and choose about 12 GB or more as you need but not less than that for root partition and choose mount type as / which stands for root and of course format will be Ext4

linux create partitions

Now we create swap partition choose the remaining free space and click the plus button and choose swap area as shown

create root partition

choose free space

Then Create swap area

create swap area

Then click install now and agree about writing changes to disk

click install linux

confirm install

Now you choose the time zone and click continue the choose the language

choose timezone

choose linux language

Now you write your username and password and click continue

choose username

Finally, installation started

linux installlation started

After finishing installation it will prompt you to reboot the machine and remove the installation media DVD or USB

linux installation finished

And yes this is how to install Linux on Physical machine

linux welcome screen

linux start menu

The second way it to install Linux is to install it on VirtualBox First download VirtualBox from here

https://www.virtualbox.org/wiki/Downloads

Then install it easy steps then

there are 2 ways to use Linux on VirtualBox

The first way is easy it like the normal installation process

Open VirtualBox and click new and choose Linux and ubuntu 64

linux virtualbox create vm

Then choose the RAM required not less than 1 GB and choose the disk file type or leave it as VDI and dynamically allocated and the size not less than 12 GB and hit ok

linux virtualbox assign ram

linux virtualbox hdd type

linux virtualbox hdd file

linux virtualbox dynamic allocated
Then file location for disk to be used

linux virtualbox hdd size

So now the VirtualBox is created we just need to make it boot from the DVD we’ve downloaded

Choose from settings > Storage and choose the iso image and click ok.

linux virtualbox settings
Then choose the iso image
linux virtualbox boot iso
Then Click start

linux virtualbox start

After loading the desktop click install Linux mint and the rest of the steps are as the mentioned above without any change And this is how to install Linux on a virtual machine.

This post was originally published on Like Geeks site here.

Categories: LikeGeeks, Linux Tags:

Blast from the Past: Create a GTK+ application on Linux with Objective-C

March 15th, 2017 No comments

This post was originally published on December 8, 2010. The original can be found here.

Note that while you can still write GTK+ applications on Linux using Objective-C as outlined in this post you may want to check out my little project CoreGTK which makes the whole experience a lot nicer 🙂


As sort of follow-up-in-spirit to my older post I decided to share a really straight forward way to use Objective-C to build GTK+ applications.

Objective-what?

Objective-C is an improvement to the iconic C programming language that remains backwards compatible while adding many new and interesting features. Chief among these additions is syntax for real objects (and thus object-oriented programming). Popularized by NeXT and eventually Apple, Objective-C is most commonly seen in development for Apple OSX and iOS based platforms. It ships with or without a large standard library (sometimes referred to as the Foundation Kit library) that makes it very easy for developers to quickly create fast and efficient programs. The result is a language that compiles down to binary, requires no virtual machines (just a runtime library), and achieves performance comparable to C and C++.

Marrying Objective-C with GTK+

Normally when writing a GTK+ application the language (or a library) will supply you with bindings that let you create GUIs in a way native to that language. So for instance in C++ you would create GTK+ objects, whereas in C you would create structures or ask functions for pointers back to the objects. Unfortunately while there used to exist a couple of different Objective-C bindings for GTK+, all of them are quite out of date. So instead we are going to rely on the fact that Objective-C is backwards compatible with C to get our program to work.

What you need to start

I’m going to assume that Ubuntu will be our operating system for development. To ensure that we have what we need to compile the programs, just install the following packages:

  1. gnustep-core-devel
  2. libgtk2.0-dev

As you can see from the list above we will be using GNUstep as our Objective-C library of choice.

Setting it all up

In order to make this work we will be creating two Objective-C classes, one that will house our GTK+ window and another that will actually start our program. I’m going to call my GTK+ object MainWindow and create the two necessary files: MainWindow.h and MainWindow.m. Finally I will create a main.m that will start the program and clean it up after it is done.

Let me apologize here for the poor code formatting; apparently WordPress likes to destroy whatever I try and do to make it better. If you want properly indented code please see the download link below.

MainWindow.h

In the MainWindow.h file put the following code:

#import <gtk/gtk.h>
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>

//A pointer to this object (set on init) so C functions can call
//Objective-C functions
id myMainWindow;

/*
* This class is responsible for initializing the GTK render loop
* as well as setting up the GUI for the user. It also handles all GTK
* callbacks for the winMain GtkWindow.
*/
@interface MainWindow : NSObject
{
//The main GtkWindow
GtkWidget *winMain;
GtkWidget *button;
}

/*
* Constructs the object and initializes GTK and the GUI for the
* application.
*
* *********************************************************************
* Input
* *********************************************************************
* argc (int *): A pointer to the arg count variable that was passed
* in at the application start. It will be returned
* with the count of the modified argv array.
* argv (char *[]): A pointer to the argument array that was passed in
* at the application start. It will be returned with
* the GTK arguments removed.
*
* *********************************************************************
* Returns
* *********************************************************************
* MainWindow (id): The constructed object or nil
* arc (int *): The modified input int as described above
* argv (char *[]): The modified input array modified as described above
*/
-(id)initWithArgCount:(int *)argc andArgVals:(char *[])argv;

/*
* Frees the Gtk widgets that we have control over
*/
-(void)destroyWidget;

/*
* Starts and hands off execution to the GTK main loop
*/
-(void)startGtkMainLoop;

/*
* Example Objective-C function that prints some output
*/
-(void)printSomething;

/*
********************************************************
* C callback functions
********************************************************
*/

/*
* Called when the user closes the window
*/
void on_MainWindow_destroy(GtkObject *object, gpointer user_data);

/*
* Called when the user presses the button
*/
void on_btnPushMe_clicked(GtkObject *object, gpointer user_data);

@end

MainWindow.m

For the class’ actual code file fill it in as show below. This class will create a GTK+ window with a single button and will react to both the user pressing the button, and closing the window.

#import “MainWindow.h”

/*
* For documentation see MainWindow.h
*/

@implementation MainWindow

-(id)initWithArgCount:(int *)argc andArgVals:(char *[])argv
{
//call parent class’ init
if (self = [super init]) {

//setup the window
winMain = gtk_window_new (GTK_WINDOW_TOPLEVEL);

gtk_window_set_title (GTK_WINDOW (winMain), “Hello World”);
gtk_window_set_default_size(GTK_WINDOW(winMain), 230, 150);

//setup the button
button = gtk_button_new_with_label (“Push me!”);

gtk_container_add (GTK_CONTAINER (winMain), button);

//connect the signals
g_signal_connect (winMain, “destroy”, G_CALLBACK (on_MainWindow_destroy), NULL);
g_signal_connect (button, “clicked”, G_CALLBACK (on_btnPushMe_clicked), NULL);

//force show all
gtk_widget_show_all(winMain);
}

//assign C-compatible pointer
myMainWindow = self;

//return pointer to this object
return self;
}

-(void)startGtkMainLoop
{
//start gtk loop
gtk_main();
}

-(void)printSomething{
NSLog(@”Printed from Objective-C’s NSLog function.”);
printf(“Also printed from standard printf function.\n”);
}

-(void)destroyWidget{

myMainWindow = NULL;

if(GTK_IS_WIDGET (button))
{
//clean up the button
gtk_widget_destroy(button);
}

if(GTK_IS_WIDGET (winMain))
{
//clean up the main window
gtk_widget_destroy(winMain);
}
}

-(void)dealloc{
[self destroyWidget];

[super dealloc];
}

void on_MainWindow_destroy(GtkObject *object, gpointer user_data)
{
//exit the main loop
gtk_main_quit();
}

void on_btnPushMe_clicked(GtkObject *object, gpointer user_data)
{
printf(“Button was clicked\n”);

//call Objective-C function from C function using global object pointer
[myMainWindow printSomething];
}

@end

main.m

To finish I will write a main file and function that creates the MainWindow object and eventually cleans it up. Objective-C (1.0) does not support automatic garbage collection so it is important that we don’t forget to clean up after ourselves.

#import “MainWindow.h”
#import <Foundation/NSAutoreleasePool.h>

int main(int argc, char *argv[]) {

//create an AutoreleasePool
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

//init gtk engine
gtk_init(&argc, &argv);

//set up GUI
MainWindow *mainWindow = [[MainWindow alloc] initWithArgCount:&argc andArgVals:argv];

//begin the GTK loop
[mainWindow startGtkMainLoop];

//free the GUI
[mainWindow release];

//drain the pool
[pool release];

//exit application
return 0;
}

Compiling it all together

Use the following command to compile the program. This will automatically include all .m files in the current directory so be careful when and where you run this.

gcc `pkg-config –cflags –libs gtk+-2.0` -lgnustep-base -fconstant-string-class=NSConstantString -o “./myprogram” $(find . -name ‘*.m’) -I /usr/include/GNUstep/ -L /usr/lib/GNUstep/ -std=c99 -O3

Once complete you will notice a new executable in the directory called myprogram. Start this program and you will see our GTK+ window in action.

If you run it from the command line you can see the output that we coded when the button is pushed.

Wrapping it up

There you have it. We now have a program that is written in Objective-C, using C’s native GTK+ ‘bindings’ for the GUI, that can call both regular C and Objective-C functions and code. In addition, thanks to the porting of both GTK+ and GNUstep to Windows, this same code will also produce a cross-platform application that works on both Mac OSX and Windows.

Source Code Downloads

Source Only Package
File name: objective_c_gtk_source.zip
File hashes: Download Here
File size: 2.4KB
File download: Download Here

Originally posted on my personal website here.

Blast from the Past: How to migrate from TrueCrypt to LUKS file containers

March 13th, 2017 No comments

This post was originally published on June 15, 2014. The original can be found here. Note that there are other direct, compatible, alternatives and proper successors to TrueCrypt these days, including VeraCrypt. This post is simply about a different option available to Linux users.


With the recent questions surrounding the security of TrueCrypt there has been a big push to move away from that program and switch to alternatives. One such alternative, on Linux anyway, is the Linux Unified Key Setup (or LUKS) which allows you to encrypt disk volumes. This guide will show you how to create encrypted file volumes, just like you could using TrueCrypt.

The Differences

There are a number of major differences between TrueCrypt and LUKS that you may want to be aware of:

  • TrueCrypt supported the concept of hidden volumes, LUKS does not.
  • TrueCrypt allowed you to encrypt a volume in-place, without losing data, LUKS does not.
  • TrueCrypt supports cipher cascades where the data is encrypted using multiple different algorithms just in case one of them is broken at some point in the future. As I understand it this is being talked about for the LUKS 2.0 spec but is currently not a feature.

If you are familiar with the terminology in TrueCrypt you can think of LUKS as offering both full disk encryption and standard file containers.

How to create an encrypted LUKS file container

The following steps borrow heavily from a previous post so you should go read that if you want more details on some of the commands below. Also note that while LUKS offers a lot of options in terms of cipher/digest/key size/etc, this guide will try to keep it simple and just use the defaults.

Step 1: Create a file to house your encrypted volume

The easiest way is to run the following commands which will create the file and then fill it with random noise:

# fallocate -l <size> <file to create>
# dd if=/dev/urandom of=<file to create> bs=1M count=<size>

For example let’s say you wanted a 500MiB file container called MySecrets.img, just run this command:

# fallocate -l 500M MySecrets.img
# dd if=/dev/urandom of=MySecrets.img bs=1M count=500

Here is a handy script that you can use to slightly automate this process:

#!/bin/bash
NUM_ARGS=$#

if [ $NUM_ARGS -ne 2 ] ; then
    echo Wrong number of arguments.
    echo Usage: [size in MiB] [file to create]

else

    SIZE=$1
    FILE=$2

    echo Creating $FILE with a size of ${SIZE}MB

    # create file
    fallocate -l ${SIZE}M $FILE

    #randomize file contents
    dd if=/dev/urandom of=$FILE bs=1M count=$SIZE

fi

Just save the above script to a file, say “create-randomized-file-volume.sh”, mark it as executable and run it like this:

# ./create-randomized-file-volume.sh 500 MySecrets.img

Step 2: Format the file using LUKS + ext4

There are ways to do this in the terminal but for the purpose of this guide I’ll be showing how to do it all within gnome-disk-utility. From the menu in Disks, select Disks -> Attach Disk Image and browse to your newly created file (i.e. MySecrets.img).

Don't forget to uncheck the box!

Don’t forget to uncheck the box!

Be sure to uncheck “Set up read-only loop device”. If you leave this checked you won’t be able to format or write anything to the volume. Select the file and click Attach.

This will attach the file, as if it were a real hard drive, to your computer:

attachedindisksNext we need to format the volume. Press the little button with two gears right below the attached volume and click Format. Make sure you do this for the correct ‘drive’ so that you don’t accidentally format your real hard drive!

Please use a better password

Please use a better password

From this popup you can select the filesystem type and even name the drive. In the image above the settings will format the drive to LUKS and then create an ext4 filesystem within the encrypted LUKS one. Click Format, confirm the action and you’re done. Disks will format the file and even auto-mount it for you. You can now copy files to your mounted virtual drive. When you’re done simply eject the drive like normal or (with the LUKS partition highlighted) press the lock button in Disks. To use that same volume again in the future just re-attach the disk image using the steps above, enter your password to unlock the encrypted partition and you’re all set.

But I don’t even trust TrueCrypt enough to unlock my already encrypted files!

If you’re just using TrueCrypt to open an existing file container so that you can copy your files out of there and into your newly created LUKS container I think you’ll be OK. That said there is a way for you to still use your existing TrueCrypt file containers without actually using the TrueCrypt application.

First install an application called tc-play. This program works with the TrueCrypt format but doesn’t share any of its code. To install it simply run:

# sudo apt-get install tcplay

Next we need to mount your existing TrueCrypt file container. For the sake of this example we’ll assume your file container is called TOPSECRET.tc.

We need to use a loop device but before doing that we need to first find a free one. Running the following command

# sudo losetup -f

should return the first free loop device. For example it may print out

/dev/loop0

Next you want to associate the loop device with your TrueCrypt file container. You can do this by running the following command (sub in your loop device if it differs from mine):

# sudo losetup /dev/loop0 TOPSECRET.tc

Now that our loop device is associated we need to actually unlock the TrueCrypt container:

# sudo tcplay -m TOPSECRET.tc -d /dev/loop0

Finally we need to mount the unlocked TrueCrypt container to a directory so we can actually use it. Let’s say you wanted to mount the TrueCrypt container to a folder in the current directory called SecretStuff:

# sudo mount -o nosuid,uid=1000,gid=100 /dev/mapper/TOPSECRET.tc SecretStuff/

Note that you should swap your own uid and gid in the above command if they aren’t 1000 and 100 respectively. You should now be able to view your TrueCrypt files in your SecretStuff directory. For completeness sake here is how you unmount and re-lock the same TrueCrypt file container when you are done:

# sudo umount SecretStuff/
# sudo dmsetup remove TOPSECRET.tc
# sudo losetup -d /dev/loop0

This post originally appeared on my personal website here.

Best Linux Distro For 2017 That Fits Your Needs

March 11th, 2017 No comments

What Is The Best Linux Distro For 2017?

So what is the best Linux distro? If you know Linux you may know that there are a lot and a lot of Linux distros out there and you can check most of them from distro watch website

https://distrowatch.com/

 

You may try few of them so what is the difference between them and which one of them suitable for you and what is the best Linux distro?

Well that question needs you to walk around and what other provide and Pros and Cons of everyone but I gather some information from the web about the most used and loved distros that you might use and fit yourself with one of them

I’m going to walk through every one of those distros and you will choose the best Linux distro yourself according to your needs

 

Elementary OS: Elegant Looking and fast speed

best linux distro elementary-os
best Linux distro elementary-os

Elementary OS is a Linux distribution based on Ubuntu. It uses Pantheon desktop environment which gives the distro the beautiful looking and lightweight on your PC

So if your concern about the best looking this is the best Linux distro for you

https://elementary.io/

 

Linux Mint: Best Distro for Desktop Computers

best linux distro linux mint

They call this distro Mac OS X of the Linux because it is the best Linux distro for laptops and desktops some people might say they do not prefer it because of the desktop environment which is called Cinnamon But now it is LTS (long term support) and is more stable than ever and developers of that desktop spend a lot of time to make it better than ubuntu so if you are searching about powerful computing this is the best Linux distro that you might need

https://www.linuxmint.com/

 

Tails: Best Distro for Privacy

best linux distro tails os

Nothing beats tails distro in privacy and security because that was the purpose of that distro It’s a Debian-based distribution that gives you privacy

So if your privacy matters this is the best Linux distro you should choose

https://tails.boum.org/

 

CentOS: Best Distro for Servers

best linux distro centos

If you check the servers around the world you will notice that the huge percent of servers uses centos specially and this is because of one very important thing

The famous and cool hosting control panel cPanel runs only on CentOS

And for many people that might let them choose it

So for Servers CentOS is the best distro that you should go with

https://www.centos.org/

 

Arch Linux: Simplicity and Customization

best linux distro arch linux

Arch Linux is the best Linux distro for those who want to learn everything about Linux

Experts categorize this distro as the most customizable Linux distro on the web and with the rich documentation on their website that makes it the best one Geeks

https://www.archlinux.org/

 

Lubuntu and Xubuntu: old hardware compatible

best linux distro lubuntu

If your hardware is a bit old then you might need something light that you can run without problems and Hang

For this sake, there is a lightweight desktop environment like LXDE and XFCE

Lubuntu comes with LXDE and Xubuntu comes with XFCE and both are lightweight

So if the old hardware is your limit these might be the best one that you should try

http://lubuntu.net/

http://xubuntu.org/

 

Steam OS: Linux Gaming

best linux distro steamOS

Many gamers use windows for gaming and if they love Linux they may dual boot with Linux till coming to that distro of Linux which is dedicated for gamers and games so if you are a gamer this is the best one for you

http://store.steampowered.com/steamos/

 

Keep in mind that all the mentioned distros are the best when writing that article, the world is changing everyday who knows what will be the best next? see you then

This post was originally published on Like Geeks site here.

Categories: LikeGeeks, Linux Tags:

Using a swap file instead of a swap partition in linux

March 11th, 2017 2 comments

Historically linux distributions have created a dedicated partition to be used as swap space and while this does come with some advantages there are other issues with it as well. Being a fixed size partition means it is relatively difficult to later change your mind about how much swap your system actually needs.

Thankfully there is another way: using a swap file instead of a swap partition.

To do this all you need to do is create a file that will hold your swap, set the right permissions to it, format it and use it. The ArchWiki has an excellent guide on the whole process here but I’ve re-created my steps below.

I like to use fallocate but you could also use dd or whatever. For example the following will create a 2GB swap file in the root directory:

sudo fallocate -l 2G /swapfile

Next up set the permissions:

sudo chmod 600 /swapfile

Format it:

sudo mkswap /swapfile

Use it:

sudo swapon /swapfile

That’s pretty much it. At this point you have the ability to add as much swap (via swap files) as you’d like. If you ever want to stop using swap, for example to get rid of the file when you’re done, simply issue the following command:

sudo swapoff /swapfile

One other thing to note is that every time you reboot your system you will have to re-run the swapon command above. To avoid this you can add it to your fstab file so that it is done on startup.

/swapfile none swap defaults 0 0

The nice thing about using swap files is that they are really flexible, allowing you to allocate as much or as little as you need at any given time.

Categories: Linux, Tyler B Tags: ,

KWLUG: Roundtable (2017-03)

March 10th, 2017 No comments

This is a podcast presentation from the Kitchener Waterloo Linux Users Group on the topic of Roundtable published on March 6th 2017. You can find the original Kitchener Waterloo Linux Users Group post here.

To subscribe to the podcast add the feed here or listen to this episode by clicking here or choose from one of the following direct links:

You can find the original Kitchener Waterloo Linux Users Group post here.

Categories: Linux, Podcast, Tyler B Tags: ,

Blast from the Past: My Search for the Best Audio Editing Software

March 8th, 2017 No comments

This post was originally published on October 6, 2010. The original can be found here.


Lately, I’ve been doing some audio recording. In addition to a couple of podcasts that I work on, I occasionally like to record my own musical compositions. While there seems to be no shortage of high-end audio editing applications on either Windows or Mac, the situation on Linux is a bit more sparse. Faced with some frustration, I went out and downloaded a number of linux-based audio editors. I used Wikipedia to find the software in the tests below, and following are my totally subjective and highly biased reviews of each.

Each piece of software was used to edit some raw recordings from a podcast that I have been involved with lately. This source material is almost 100% spoken word, with some music and sound effects sprinkled throughout. It’s important to note these details, as your needs may vary drastically depending on the type of audio project that you’re working on.

Audacity:

The Audacity Project is kind of the Linux standard for non-professional audio editing. It was the first application that I tried to use, mainly because I was familiar with earlier versions of the program that I had once used back in my Windows days. Audacity includes a great number of features that make it ideal for post-processing of any audio project, including a wide array of effects, some great noise generators, and a few analysis tools that make it perfect for cleaning up your finished file before publication.

Audacity audio editor with a demo project loaded

Audacity audio editor with a demo project loaded

Unfortunately, I found that it lacked a usable GUI for editing podcast material. In particular, it seems to be missing the ability to edit a single track in a multi-track project without unduly affecting the other tracks.By default, if you use the selection tool to grab a portion of audio that ought to be deleted from one track in the project, it seems to delete that portion of audio from all tracks in the project.

I found this out the hard way when I played back the master track that I had assembled my finished podcast on, only to find out that significant portions of the audio had mysteriously gone missing at some point during the editing process.

To make matters worse, I closed the application, lost the undo record for the project, and had to start the editing process from the beginning.

This lack of GUI polish also exhibits itself in the way that you can interact with the audio tracks themselves. Unlike in most DAW solutions, a portion of audio that has been clipped out of a larger track cannot seemingly be moved around in the project by clicking on it and dragging it across the stage with the mouse. At least I couldn’t figure out how to do it, and ended up relying heavily on my cut, copy, and paste functions to edit my project. This is a poor way to work on a project of any kind of complexity, and makes projects that rely on audio loops a pain to assemble.

Ardour:

Where Audacity is suited more towards hobbyist recording setups, Ardour aims to be a professional audio solution that is capable of competing with mainstream software like ProTools. It is a fully featured audio suite that can allegedly do most everything that you may require, but as such, can also confuse the hell out of first-time users with its complicated GUI and lengthy manual.

Granted, this is hardly a slight to the project, because it really isn’t suited to my needs. It is a pro-level audio environment that can be used as the centrepiece to a full recording studio or stage

Ardour wants sole control of my audio interface

Ardour wants sole control of my audio interface

show. If you just want to edit a podcast, it may not be the tool for you. As such, if the GUI seems challenging and you find the documentation to be long-winded, you may just be using the wrong tool for the job.

The biggest issue that I had with this piece of software was getting it to run at all on my machine. It uses JACK to attach itself to your audio interfaces in the name of providing a perfect sampling environment that doesn’t get slowed down by having to share the interface with other pieces of software.

Unfortunately, this means that in order to use it, I had to quit all other processes that are capable of generating sound, including this web browser. This is a pain if you are trying to run Ardour in a multi-application environment, or need to reference the internet for anything while working.

After reading the introductory documentation and adjusting the settings in the startup dialog for about 15 minutes, I simply gave up on Ardour without ever managing to get into a workspace. It seems to be far too complicated for my needs, and doesn’t seem worth my time. Your mileage may vary.

Jokosher:

From the moment that I started reading about this project, I like the sound of it. Jokosher is a multi-track recoding and editing environment built on top of Python and GStreamer that was

Jokosher may look cartoony, but it may be exactly what you need for small projects

Jokosher may look cartoony, but it may be exactly what you need for small projects

created by a podcaster who was unsatisfied with the audio editing tools that were available on Linux. The application focuses on being easy enough to use that non-technical people like musicians can pick it up and get their ideas down with minimal hassle. Think of it as Garage Band for Linux.

Indeed, just as the website promised, I was able to get a working environment set up in a matter of minutes. The editing tools allow for splitting the audio, grabbing it and moving it around, and non-destructively editing multiple tracks at the same time (I’m looking at you, Audacity). The GUI also has a beautiful polish to it that, although a tad cartoony, really makes the program look and feel simple. For editing something like a podcast, I’m not sure that this application can be beat.

The only issue that I encountered in my short time using Jokosher was with its support of LADSPA plugins. These are free audio plugins that can be used to apply effects to the different tracks of your audio project. When I tried to use them from within the application, it instructed me to download some from my repositories. Upon checking Synaptic, I saw that I already had a number of them downloaded. Even after installing more, the program did not seem to pick them up.

All in all, this project lived up to its hype, and I will most certainly take some time to break it in, and may write a more in-depth review once I get used to it. If you’re doing podcasting, you owe it to yourself to check this app out.

In Conclusion:

Each of the three applications that I tried to work with while writing this piece deserve your respect. The underlying audio framework of most Linux systems is a veritable rats’ nest of subsystems, platforms, daemons, plugins and helper applications. I would wager a significant amount of money on this situation as the reason that we don’t have ProTools and its ilk on our platform of choice. I’ve done a little bit of work with GStreamer, and even it, as perhaps the prettiest and best supported of all audio libraries on the platform, left me scratching my head at times.

When choosing audio software, it’s important to keep in mind that you need a tool that’s uniquely suited to your project. Since I’m editing podcasts and fooling around with drum loops and samples of my guitars, Jokosher does just about everything that I need and more. I may use Audacity for post-production, or to record my source audio (simply because I haven’t tried recording in Jokosher yet – I know that Audacity works), because it falls somewhere in between a simple editing tool and an advanced platform. Ardour, meanwhile, is probably suited towards the more hard-core audio engineer slash system administrator types who are so fanatic about recording quality that they are willing to sacrifice an entire box for running their DAW software. It’s simply more power than the majority of hobbyist enthusiasts really needs.

Blast from the Past: Do something nice for a change

March 5th, 2017 No comments

This post was originally published on October 6, 2010. The original can be found here.


Open source software (OSS) is great. It’s powerful, community focused and, lets face it, free. There is not a single day that goes by that I don’t use OSS. Between Firefox, Linux Mint, Thunderbird, Pidgin, Pinta, Deluge, FileZilla and many, many more there is hardly ever an occasion where I find myself in a situation where there isn’t an OSS tool for the job. Unfortunately for all of the benefits that OSS brings me in my daily life I find, in reflection, that I hardly ever do anything to contribute back. What’s worse is that I know I am not alone in this. Many OSS users out there just use the software because it happens to be the best for them. And while there is absolutely nothing wrong with that, many of these individuals could be contributing back. Now obviously I don’t expect everyone, or even half for that matter, to contribute back but I honestly do think that the proportion of people who do contribute back could be much higher.

Why should I?

This is perhaps the easiest to answer. While you don’t have to contribute back, you should if you want to personally make the OSS you love even better.

How to I contribute?

Contributing to a project is incredibly easy. In fact in the vast majority of cases you don’t need to write code, debug software or even do much more than simply use the software in question. What do I mean by this? Well the fact that we here on The Linux Experiment write blog posts praising (or tearing to shreds supplying constructive criticism) to various OSS projects is one form of contributing. Did I lose you? Every time you mention an OSS project you bring attention to it. This attention in turn draws more users/developers to the project and grows it larger. Tell your family, write a blog post, digg stories about OSS or just tell your friends about “this cool new program I found”.

There are many other very easy ways to help out as well. For instance if you notice the program is doing something funky then file a bug. It’s a short process that is usually very painless and quickly brings real world results. I have found that it is also a very therapeutic way to get back at that application that just crashed and lost all of your data. Sometimes you don’t even have to be the one to file it, simply bringing it up in a discussion, such as a forum post, can be enough for others to look into it for you.

Speaking of forum posts, answering new users’ questions about OSS projects can be an excellent way to both spread use of the project and identify problems that new users are facing. The latter could in turn be corrected through subsequent bug or feature requests. Along the same lines, documentation is something that some OSS projects are sorely missing. While it is not the most glamorous job, documentation is key to providing an excellent experience to a first time user. If you know more than one language I can’t think of a single OSS project that couldn’t use your help making translations so that people all over the world can begin to use the software.

For the artists among us there are many OSS projects that could benefit from a complete artwork makeover. As a programmer myself I know all to well the horrors of developer artwork. Creating some awesome graphics, icons, etc. for a project can make a world of difference. Or if you are more interested in user experience and interface design there are many projects that could also benefit from your unique skills. Tools like Glade can even allow individuals to create whole user interfaces without writing a single line of code.

Are you a web developer? Do you like making pretty websites with fancy AJAX fluff? Offer to help the project by designing an attractive website that lures visitors to try the software. You could be the difference between this and this (no offense to the former).

If you’ve been using a particular piece of software for a while, and feel comfortable trying to help others, hop on over to the project’s IRC channel. Help new users troubleshoot their problems and offer suggestions of solutions that have work for you. Just remember: nothing turns off a new user like an angry IRC asshat.

Finally if you are a developer take a look at the software you use on a daily basis. Can you see anything in it that you could help change? Peruse their bug tracker and start picking off the low priority or trivial bugs. These are often issues that get overlooked while the ‘full time’ developers tackle the larger problems. Squashing these small bugs can help to alleviate the 100 paper cuts syndrome many users experience while using some OSS.

Where to start

Depending on how you would like to contribute your starting point could be pretty much anywhere. I would suggest however that you check out your favourite OSS project’s website. Alternatively jump over to an intermediary like OpenHatch that aggregates all of the help postings from a variety of projects. OpenHatch actually has a whole community dedicated to matching people who want to contribute with people who need their help.

I don’t expect anyone, and certainly not myself, to contribute back on a daily basis. I will however personally start by setting a recurring event in my calendar that reminds me to contribute, in some way or another, every week or month. If we all did something similar imagine the rapid improvements we could see in a short time.

Blast from the Past: VOIP with Linode, Ubuntu, Asterisk and FreePBX

March 1st, 2017 No comments

This post was originally published on October 29, 2010. The original can be found here.


Overview and Introduction

I’ve been dabbling with managing a VOIP server for the past year or so, using CentOS, Asterisk and FreePBX on a co-located server. Recently Dave and I needed to move to our own machine, and decided to use TEH CLOUD to reduce management and get a fresh start. There are hundreds of hosts out there offering virtual private servers (VPS’s). We’ve standardized on Linode for our small business for a few reasons. While I don’t want to sound like a complete advertisement, I’ve been incredibly impressed with them:

  • Performance. The host systems at Linode run at least 4-way 2GHz Xeon dual-core CPUs (I’ve seen higher as well) and you’re guaranteed the RAM you pay for. Pricing is generally based on how much memory you need.
  • Pricing. For a 512MB Linode, you pay $19.95 US per month. Slicehost (a part of Rackspace, and a Linode competitor) charges the same amount for a 256MB slice. Generally you want at least 512MB RAM for a Linux machine that’s not a test/development box.
  • Features. If you have multiple VMs in the same datacenter, you can assign them private IPs and internal traffic doesn’t count toward your bandwidth allowance. Likewise, bandwidth is pooled among all your VMs; so buying two VMs with 200GB bandwidth each gives 400GB for all your systems.

With full root access and the Linux distribution of your choice, it’s very easy to set up and tear down VMs.

Why VOIP?
When people hear VOIP, they generally assume either a flaky enterprise system with echoing calls or something like Skype. Properly configured, a VOIP system offers a number of really interesting features:

  • Low-cost long distance and international calling. The provider we use, voip.ms, offers outgoing calls for $0.0052 per minute to Canada and $0.0105/minute to the US on their value route.
  • Cheap phone numbers – direct inward dialing – are available for $0.99 per month in your region. These phone numbers are virtual and can be configured to do nearly anything you want. Incoming calls are $0.01/minute, and calls between voip.ms numbers are free.
  • Want to take advantage of cheap long distance from your cell phone? Set up a Direct Inward System Access path, which gives you a dial tone for making outgoing calls when you call a local number. Put your DID number on your My5 list, and you’re set to reduce bill overages.
  • Voicemail becomes much more useful when the VOIP server sends you an email with a WAV attachment and caller ID information.
  • Want to set up an interactive voice response menu, time conditions, blacklist telemarketers, manage group conferences or have witty hold music? All available with FreePBX and Asterisk.

Continue reading for server setup details and security best practices…

Configuration
I opted to use Ubuntu 10.04 LTS on the server, since there are handy directions for configuring Asterisk and FreePBX. The guide is pretty handy, but some adjustments had to be made to the article for the latest versions of Ubuntu and Asterisk:

  • When installing Asterisk, make sure to install the sox package for additional sound and recording support.
  • Back up your /etc/asterisk/modules.conf file before installing FreePBX, and then restore it after the installation is complete. The FreePBX installation seems to clobber this file.
  • Replace all instances of the asteriskcdr database with asteriskcdrdb for proper call reporting functionality. Likewise, you’ll have to recompile and install the asterisk-addons package as per Launchpad bug 560656:
    cd /usr/src
    apt-get build-dep asterisk-mysql
    apt-get -b source asterisk-mysql
    dpkg -i asterisk-mysql*.deb
  • Don’t use the amportal script for managing Asterisk/FreePBX; use
    /etc/init.d/asterisk [start|stop|restart]

    instead.

Let It Ring
There’s plenty of great FreePBX documentation available online – you shouldn’t have a problem getting up and running once the installation is finished. As always, you should follow best server security practices:

  • Enforce username/password authentication with .htaccess and htpasswd and HTTPS for your management console, or only expose FreePBX administration over localhost/127.0.0.1 and tunnel in. There are plenty of articles on configuring OpenSSL and Apache2.
  • Consider running SSH on an alternate port (not 22), and denying direct logins from the root user account. Enforce strong passwords and use tools such as fail2ban and DenyHosts to limit SSH attacks.
  • Use a firewall. Ubuntu’s ufw is very simple to manage. For an Asterisk server, you’ll want to allow UDP ports 5060 and 10000-20000 (for voice traffic), or a range defined in
    /etc/asterisk/rtp.conf

Feel free to post comments here on server setup or general VOIP questions, and I’ll do my best to help out!