Monthly Archives: November 2015

Burn Data Discs In Linux Mint 17

Mint17

If your Linux Mint computer includes an optical disc drive with burning capability, you can use Linux Mint to create “data discs” – optical discs that contain files and folders. You can create CD-R or DVD-R discs, discs that are burned once and then permanent. You can also create CD-RW or DVD-RW discs, discs that can be rewritten and erased (though note that rewritable discs can only be rewritten ten to twenty times before they break down).

To burn data discs, you use the Brasero disk-burning application, which comes included in the default Linux Mint install. To launch Brasero, click on the mintmenu, search for “brasero”, and then click on the icon for Brasero. When Brasero launches, click on the Data Project button.

Brasero will then open the New Data Disc Project window. Click on the Plus sign in the upper-left hand corner to add files to your data disc. Brasero will then let you navigate through your files and folders to select the files you wish to burn to your disk.

Note that the combined size of your files cannot exceed 700 megabytes for a data CD and 4.4 gigabytes for a data DVD. Once you have finished selecting the files, insert a burnable CD or DVD, and select the Burn button at the lower right-hand corner of the Brasero window.

Note that you must insert a burnable disc into your drive before hitting Burn, otherwise Brasero will create an image file based on your data, rather than actually burning a disc. Once the burning is done, you can eject the disc from your drive, and use it to transfer information to a different computer.

-JM

Format Removable Media In Linux Mint 17

Mint17

Linux Mint lets you connect removable media without much muss or fuss. Assuming your computer has the necessary USB ports you can connect any number of USB flash drives or hard drives, or even SD cards if your system has a card reader. However, to prepare removable media for use (or to erase it quickly), you need to format it. “Formatting” a removable drive simply means that the computer writes it with a filesystem in preparation for use. A filesystem is a method of organization information stored on a disk so the computer can find it again – NTFS, FAT, and ext4 are the most commonly used filesystems with removable Linux Mint computers.

To format a removable disk, first connect it to your computer. Once Linux Mint has recognized the device, an icon will appear for it on the Desktop. Click on the icon, and a Nemo window will appear. Your device will appear under the Devices category in the left-hand pane of the Nemo window. Right-click on the device’s link in that pane, and select Format from the menu.

The Format dialog box will then appear. You can select what kind of filesystem to use on the formatted drive. You have three options:

-A FAT32 drive will be readable and writable on almost all Windows, Linux, and Mac OS X systems.

-A NTFS drive will be readable and writable on almost all Windows systems and most Linux systems. Certain kinds of Linux systems may not be able to read from or write to an NTFS drive. Additionally, Mac OS X computers can read an NTFS drive, but they cannot write to it.

-An ext4 drive is compatible with all Linux systems. Note that neither Windows computers nor Macs will be able to read the drive.

In the Volume Label field, you can enter a volume label for the drive. After it is formatted, Linux Mint will use that name to list the device in Nemo.

After you have made your selections, click on the Format button, and Linux Mint will format the drive. Note that this will destroy all data currently on the drive – it is possible to recover data, but the recovery requires special software tools, and once the drive is overwritten the data is lost forever.

Check File & Folder Size In Linux Mint

Hard drives have gotten bigger over the years, but it’s still important to monitor your hard disk space usage, lest you accidentally fill up your hard drive. This is even more important on removable media, since it is much easier to fill up a four gigabyte flash drive than a one terabyte hard drive. Fortunately, there are a number of different ways to check the size of a file or a folder in Linux Mint.

To check the size of a file or folder, first launch Nemo file manager by clicking on the button for the mintmenu. By default, the mintmenu has an icon for Nemo pinned to it in the left-hand column, below the icon for the Terminal and above the button that locks the screen. Click on that icon, and Nemo will open to your home folder.

After Nemo has launched, navigate to the file or folder whose size you want to check. Right-click on the file or folder, and select Properties from the context menu. A dialog box will appear showing the size of the file or folder in question in the Contents line. If you right-clicked and selected Properties for a folder, the dialog box will also show the entire size of every single item contained within the folder.

You can also check the size of a folder from the Terminal command-line interface. To launch the Terminal, either go to the mintmenu, search for “terminal”, and click on the icon for Terminal, or hit the CTRL+ALT+T keys simultaneously. Once at the Terminal, use du command with the –s and the –h switches to determine the size of a file or folder. For instance, this command will display the size of your home folder:

du –sh ~

-JM

The $50 Kindle Fire

I got one of the new $50 Kindle Fire tablets.

First, a pet peeve. I dislike it when reviewers say it costs “only” $50. Fifty dollars is a lot of money!

However, it is a lot less than the $400 to buy a new iPad Mini. The new Kindle Fire is only an average tablet, but for $50, it is an amazing tablet. By way of comparison, the original iPad Mini from 2012 had roughly the same specifications as the new Kindle Fire, and that cost $329.

Because of that, I’m comfortable using the $50 Kindle Fire in public the way I wouldn’t with, say, an iPad. If your $399 iPad is stolen or broken, it’s a catastrophe. If your $50 Kindle Fire is stolen or broken, it’s bad, but not $399 bad.

Anyway, it’s a good little tablet, and provides good value for the money. Especially for $50! (It also seems to have excellent battery life.)

-JM

Back UP A MySQL Database In Ubuntu 15.10 Wily Werewolf

Ubuntu1510Terminal

MySQL databases are often used to power web applications such as WordPress or Moodle, which means that those MySQL databases often wind up holding vital information. Therefore, it is important to back them up on a regular basis. A quick and easy way to backup a MySQL database is with the mysqldump command-line tool. This tool downloads the database into a single SQL file, which you can store as a backup or use to transfer the database to another MySQL server.

To use mysqldump, you will need to know the root password of the MySQL server (or a user with permissions to the database you need to download).

In this example, we will dump a database named data into a file named data.sql:

mysqldump -u root -p data > data.sql

Enter the root password, and mysqldump will dump the database information into the data.sql file.

To transfer the database to a new server, first create a blank database on the server from the MySQL command prompt. In this example, this command will create a new database named datanew:

CREATE DATABASE datanew;

Then transfer the data.sql file to the new server and write it onto the new database with this command:

mysql -u root -p datanew < data.sql

The datanew database will receive all the tables and columns contained in the data.sql file. Note that this command completely overwrites the target database with the information in the SQL file, so make sure to select the correct database!

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide

Install MySQL Server On Ubuntu 15.10

Ubuntu1510Terminal

To install MySQL Server on Ubuntu, make your way to a Terminal window or a command prompt, and type this command:

sudo apt-get install mysql-server-5.6

(As of this writing, MySQL Server version 5.6 is the latest version available in the Ubuntu repositories, though future versions of Ubuntu may receive the newer versions of MySQL.)

Enter your password to authenticate, and apt will download the MySQL files and install them for you. It’s a big set of files, so depending on the speed of your Internet connection, it might take a while to download. After the files are downloaded and are installing, the installer will ask you for a password for MySQL’s root user. Just as the root user in Linux has complete control over the system, the root user in MySQL has absolute control over all databases, tables, permissions, and users. For obvious security reasons, you’ll want to create an extremely strong password (a mixture of uppercase, lowercase, numbers, and punctuation, the longer the better) for your MySQL root user.

(Note that in the password dialog box, if you can’t get the <OK> field selected, you can use the tab key to jump from the text input line to the <OK> field.)

After you enter the root password, the installer will finish working with the MySQL files, and return you to the command line. You’ll then need to activate MySQL with the following command:

sudo mysql_install_db

This will set up MySQL Server for use with your Ubuntu system. Next, you’ll want to run the mysql_secure_installation script to tighten up security on your new MySQL server. Run this command from the prompt:

sudo mysql_secure_installation

First, the mysql_secure_installation script will ask you to enter the current password for the MySQL root user. After you do that, it will ask if you want to change the root password. Since you already set a root password, you can hit “n” (unless you want to change it again for some reason).

Next, the script will ask if you want to remove the anonymous user. The anonymous user, like anonymous access in FTP, lets someone log into MySQL without having a proper user account. For security reasons, it’s always best to remove the anonymous user, so hit “y” to continue.

After that, the script will ask if you want to prevent the MySQL root user from logging in remotely to the MySQL server. Always hit “y” to forbid root remote access, since if an attacker guesses your root password, he can destroy your databases or steal the information they contain.

After this, the script will ask if you want to remove the test database. MySQL includes a test database that anyone can access. Again, this is a security hole, so you’ll want to hit “y” to remove the test database.

The script will then ask to reload the privilege tables so the changes take effect. Hit “y”, and the mysql_secure_installation script will conclude and return you to the command line.

MySQL server is now installed on your Ubuntu system.

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide

Configure Apache Virtual Hosts On Ubuntu 15.10 Wily Werewolf

Ubuntu1510Terminal

It is easy to set up a simple web server with Apache. However, you might need a more complex web server, one that can host multiple separate websites, rather than subdirectories within a larger website.

How do you do this?

Apache has a feature called “virtual hosts” that lets you run separate websites, with completely different domain names, on the same physical server. Fortunately, implementing virtual hosts for Apache is actually quite simple to do. In this example, we’ll show you how to set up a new website called “examplename.com” on an Apache web server.

First, you’ll need to set a location for your new web site’s files. Apache, you might recall, by default stores the web files in /var/www. For this example, create a new folder for the website with this command:

sudo mkdir /var/w2

Next, you’ll need to create a configuration file for the new website in the /etc/apache2/sites-available directory. Fortunately, that directory contains a default file you can simply copy and use as a template with this command:

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/examplename

The next step is to edit the new configuration file with the correct settings. You can do this using the vi text editor:

sudo vi /etc/apache2/sites-available/examplename

Once editing the file with vi, you’ll need to make a few changes.

Change the “Document Root” directive from /var/www to the proper location of your new website, in this case, /var/w2.

Also change the “Directory” directive from /var/www to /var/w2.

Finally, under the line that begins “ServerAdmin”, add a new line for the new website’s domain name. For our website named “examplename.com”, add a line like this:

ServerName examplename.com

Save changes to the configuration file, and then exit vi.

Now you’ll need to modify Apache to display the new domain names to web visitors. Fortunately, you can do this with the a2ensite command:

sudo a2ensite examplename

(Note that “examplename” would change depending upon what you named your configuration file.)

One final step – restart Apache to force it to re-read its configuration files and start serving the new website:

sudo /etc/init/d apache2 restart

Make sure you have some sort of index.html file in /var/w2, and the examplename.com website should now be working.

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide

Install Apache Web Server On Ubuntu 15.10 Wily Werewolf

Ubuntu1510Terminal

To install Apache, type this command at a Terminal window or a command prompt:

sudo apt-get install apache2



(Technically, you’ll be installing Apache 2, the latest version.)

Enter your password to authenticate, follow the default prompts, and apt will download and install the Apache web server for you.

And that’s it! Apache should now be working. To test it from the web server itself, go to a web browser and visit the address http://127.0.0.1. This is the “local loopback” address, basically the IP address the local computer uses to refer to itself. Alternatively, you could test it from another computer on the same subnet. For instance, if you installed Apache on a computer with an IP address of 192.168.1.100, you could test it by going to another computer on the same subnet and visiting http://192.168.100 from the web browser.

Regardless, if Apache is working properly, you should see a web page with only two words on it:

It works!

Apache is now operational.

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide

Install ffmpeg For Media Conversion On Ubuntu 15.10 Wily Werewolf

Ubuntu1510Terminal

From time to time you may need to extract the sound from a video file. Fortunately, using the ffmpeg program, it’s quite simple to take the sound from any video file and store it as a separate file. The ffmpeg utility can convert back and forth between multiple formats of both video and sound. Even better, in keeping with the overall theme of this book, ffmpeg is a command-line utility.

Here’s how to install and use ffmpeg on Ubuntu.

First, you’ll need to install the Ubuntu Restricted Extras package.

After you’ve installed the Ubuntu Restricted Extras, use this command to install ffmpeg:

sudo apt-get install ffmpeg



After the installation is complete, you can use ffmpeg to extract the audio from a video file. Say, for example, you have a video file named test.avi. To extract the audio to a file named audio.mp3, use ffmpeg with these options and arguments:

ffmpeg -i test.avi audio.mp3

This will create an audio file named audio.mp3 containing the sound from the video file. However, by default ffmpeg creates audio files with a bitrate of 64 kbps, which results in very low-quality audio. To force ffmpeg to create the mp3 file at the 256 kbps bitrate, add the -ab option to the command:

ffmpeg -i test.avi -ab 256k audio.mp3

This will create a higher-quality mp3 file, and you can use this modified command to extract the audio from any compatible video file.

The ffmpeg utility can do many other conversions as well – be sure to read the entire manual page for ffmpeg with this command:

man ffmpeg

-JM

ADDITIONAL READING:

Ubuntu: 101 Tips & Tricks

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

The Linux Command Line Beginner’s Guide