Monthly Archives: May 2016

Find Your Computer’s MAC Address In Ubuntu 16.04 Xenial Xerus

NetworkIP

Finding the MAC address of your Ubuntu computer takes a few clicks of the mouse when you do it in the graphical interface. However, it’s actually quite a bit easier to find your computer’s MAC address from the Terminal, Ubuntu’s command-line interface. To find the MAC address from the Terminal, first launch the Terminal by going to the Dash, searching for “Terminal”, and then clicking on the icon for Terminal when it appear. You can also launch the Terminal by hitting the CTRL+ALT+T keys simultaneously.

Once the Terminal launches, type this command and then hit the ENTER key:

ifconfig

The ifconfig command will generate an output with a great deal of information.

Fortunately, most of it is useful. The “eth0″ refers to the first Ethernet connection on your system. The “indet addr” displays your system’s IP address, while “Mask” shows the subnet mask. “HWaddr” shows your Ethernet adapter’s MAC (Media Access Control) address, which is (theoretically) unique to each adapter. (Some wireless networks require you to supply your MAC address before allowing your system to connect.)

You can pipe the output from the ifconfig command to grep to quickly find the specific item you want. Let’s say you just want to find the MAC address:

ifconfig | grep HWaddr

This time, the output will limit itself to just the MAC address.

Was this post helpful? These books might be useful:

The Ubuntu Beginner’s Guide

The Linux Command Line Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

-JM

Install And Configure Samba File Sharing In Ubuntu 16.04 Xenial Xerus

Ubuntu1510Terminal

Here we’ll show you how to set up and configure a basic Samba server on Ubuntu 16.04 Xenial Xerus with one user.

First, you’ll need to install Samba. Make your way to a command prompt and type this command:

sudo apt-get install samba

Enter your password to authenticate, and apt will download and install Samba and its attendant utilities for you.

A key thing to understand about Samba is that it stores its own set of user accounts, separate from the main accounts, in the /etc/samba/smbpasswd file. That means you’ll need to create a separate Samba password for every user you want to access your file shares. You create this password using the smbpasswd command. For example, using an account named camalas, here’s how the command should look:

sudo smbpasswd -a camalas

Be sure to give camalas’s Samba account an appropriately strong password (including uppercase, lowercase, punctuation, and numbers). Once camalas’s password is created, the next step is to create a directory for her to share. Begin by creating a folder named ‘test’ in camalas’s folder, which we’ll use for our first shared folder:

mkdir /home/camalas/test

(NOTE: DO NOT use sudo to create the folder, because then the owning user and group will be set as ‘root’, which means you won’t be able to access the folder using your Samba username and password.)

The next step is to edit the /etc/samba/smb.conf file, the main configuration file for Samba. As always, make a safe backup copy of the original smb.conf file to your home folder, in case you make an error:

sudo cp /etc/samba/smb.conf ~

Now use vi to edit the /etc/samba/smb.conf file:

sudo vi /etc/samba/smb.conf

The smb.conf file is long and rather complex, but for the purposes of this demonstration, you can ignore most of it. Key down to the very end of the file and insert this text:

[test]

path = /home/camalas/test

available = yes

valid users = camalas

read only = no

browseable = yes

public = yes

writable = yes

(There should be no spaces between the lines, and note also that there should be a single space both before and after each of the equal signs.)

Here’s what some of the more important configuration options mean.

-The “[test]” gives the name of the file share.

-The “path” option specifies the location of the folder to be shared.

-The “available” option specifies that the file share is available to clients on the network.

-The “valid users” option details the users that are allowed to access the file share. In this case, we’ve set it so that only the camalas account can access it. You can add additional accounts here, if you prefer.

-The “read only” option specifies whether nor not clients will be allowed to write to the file share.

-The “writable” option specifies that data can be written to the file share.

The settings specified above will share the test folder we created earlier, and give the camalas username and the camalas username alone permission to read and write to the folder. Once you have input the changes, save smb.conf, exit vi, and restart Samba with this command:

sudo /etc/init.d/samba restart

(This will force Samba to restart, re-reading its configuration files and activating the share you just created.)

Once Samba has restarted, use this command to check your smb.conf for any syntax errors:

sudo testparm

If you pass the testparm command, Samba should be working. Try accessing the share from another client on your LAN.
Was this post helpful? These books might be useful:

Install Google’s Chrome Browser On Ubuntu 16.04 Xenial Xerus

Ubuntu1510Terminal

To install Google’s Chrome web browser on Ubuntu 16.04 Xenial Xerus, first launch the Firefox web browser and visit the Google Chrome website:

http://www.google.com/chrome

Click on the Download button, which will take you to the download page. Select the 32-bit or the 64-bit version for Ubuntu, depending upon your system’s processor architecture. Hit the accept and install button, and the Chrome installer will download.

Once the download is complete, you’ll have a *.deb installer package for Chrome in your Downloads folder. Double-click on it to launch the installer. You’ll be taken to the Ubuntu Software applications. Click on the Install button to begin the installation of Chrome.

You’ll need to enter your password to authenticate, and then follow the default prompts to install Chrome.

After the installation is complete, the first time you launch Chrome you will have to do so from the command line. It will not appear in the Dash or the Launcher until you launch Chrome from the command line for the first time. To launch Chrome from the command line, summon a Terminal window by hitting the CTRL+ALT+T keys simultaneously, and typing this command into the Terminal prompt:

google-chrome-stable

Chrome will then launch and ask if you wish to set it as the default browser. After this first run, you can launch Chrome by clicking on the Dash (the Ubuntu icon on the upper-left hand corner of your screen), searching for Chrome, and clicking on the Chrome icon.

Was this post helpful? These books might be useful:

The Ubuntu Beginner’s Guide

The Linux Command Line Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

-JM

Install Handbrake For Video Ripping On Ubuntu 16.04 Xenial Xerus

Handbrake

 

 

 

 

 

The popular Handbrake video conversion application has sometimes had difficulty running on new versions of Ubuntu Linux, but the current version of Handbrake, 0.10.5, works just fine on Ubuntu 16.04 Xenial Xerus. Best of all, the installation only takes a few Terminal commands.

First, you’ll need to add Handbrake’s PPA (personal package archive) to your system. Go to a Terminal window and type this command:

sudo add-apt-repository http://ppa.launchpad.net/stebbins/handbrake-releases

Enter your password to authenticate, and the PPA will be added to your system.

Next, update your system’s listings of its software sources with this command:

sudo apt-get update

After the listings have been updated, install Handbrake itself with this command:

sudo apt-get install handbrake-gtk

After the installation is complete, you can launch Handbrake by going to the Dash, searching for “Handbrake”, and clicking on the program’s icon.

Was this post helpful? These books might be useful:

The Ubuntu Beginner’s Guide

The Linux Command Line Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

-JM

Install And Configure WordPress On Ubuntu 16.04 Xenial Xerus

XenialXerusMySQL

Installing WordPress in Ubuntu 16.04 Xenial Xerus requires a few different steps than on previous versions of Ubuntu, so we’ll go over them one by one.

First, install Ubuntu 16.04 Xenial Xerus into your machine of choice. Once Ubuntu is installed and updated, you will need to install five pieces of software: the Apache web server, the MySQL database server version 5.7, PHP version 7, the MySQL module for PHP, and finally the WordPress software itself.

First, install the Apache web server. To install Apache, go to a Terminal window or a command prompt and type this command:

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. You’ll remember that this is the “local loopback” address, basically the address the 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.

The next step to install WordPress is to install the MySQL database server. Return to the Terminal and type this command:

sudo apt-get install mysql-server-5.7

(As of this writing, MySQL Server version 5.7 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 like the root user in Linux, 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, 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_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 enable the plugin for password validation, which enforces a minimum level of complexity for MySQL passwords. Hit Y if you want to activate the plugin, or any other key to continue.

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.

The next step to installing WordPress is to install PHP version 7:

sudo apt-get install php

Next, install the libapache2-mod-php7.0 library, which allows PHP to communicate properly with Apace:

sudo apt-get install libapache2-mod-php7.0

Then install the MySQL module for PHP:

sudo apt-get install php-mysql

http://wordpress.org/latest.tar.gz

If you’re working exclusively from the command line, you can use this command to download the WordPress software:

wget http://wordpress.org/latest.tar.gz

Use this command to unpack the WordPress files:

tar -xzvf latest.tar.gz

Make a directory in /var/www for the WordPress files:

sudo mkdir /var/www/html/wordpress

Finally, move the WordPress files over to the /var/www/wordpress directory. (In this command, I’ll assume you unpacked the WordPress files to your home directory; you will have to adjust the command if you unpacked them in a different directory.)

sudo cp -r ~/wordpress/* /var/www/html/wordpress

Now that we’ve got our software installed and downloaded, we’ll need to configure it. We’ll start with Apache.

First, it’s always a good idea to make a backup of a system configuration file before you alter it, so start by making a backup of Apache’s configuration file. Use this command to back up Apache’s configuration file to your home directory:

cp /etc/apache2/apache2.conf ~

Next, you’ll need to add a line to your /etc/apache2/apache2.conf file, so Apache will properly interpret WordPress’s PHP files. (Note that this is only necessary if you install WordPress in a subdirectory of /var/www, as we are doing in this example. If you install WordPress in /var/www, you don’t need to add this line, but you do need to delete or move the original index.html file.) To edit apache2.conf, fire up the vi editor:

sudo vi /etc/apache2/apache2.conf

Once you are in vi, scroll to the end of the file, switch to Insert mode, and add the following line (note that there is a space between the final “p” of “php” and the period before “html”):

AddType application/x-httpd-php .html

Return vi to Command mode, save the file, and then exit vi. Restart Apache with this command, so it re-reads its configuration file:

sudo /etc/init.d/apache2 restart

Now we’ll need to prepare MySQL for use with WordPress. WordPress requires a database and a database user, and full permission for its database user to access its database. To start the MySQL command-line client, use this command:

mysql -u root -p

Enter the password for the MySQL root user, and you’ll find yourself at the MySQL command prompt, which will look like this:

mysql>

Our next steps are to create a WordPress database, create a user to access that database, and grant our new user all rights to the WordPress database.

(An important note before we continue, though. All commands made from the MySQL prompt must end with a semicolon to denote the end of the statement. Any commands that do not end with a semicolon will not work. With that in mind, let’s first create a database.)

To create a database for WordPress, use this command at the mysql> prompt:

CREATE DATABASE wordpress;

The MySQL client will respond with a message that should say “Query OK, 1 row affect (0.00 sec).” This means the command was successful, and a new database named “newdatabase” has been created.

Next, you’ll create a user who will access that database:

CREATE USER wordpressuser;

You should get the “Query OK” message again. Once the new user is created, we’ll need to set a password for the user before we can assign any permissions. In this example, we’ll assign a password of “1234”. However, in real life, just as with the root user, you’ll want to assign a strong password. (This database user won’t have full control over the MySQL user as the root user does, but we will give it full control over the database we just created, and a malicious user who guesses the password could cause all kinds of trouble.) To create the password, use this command:

SET PASSWORD FOR wordpressuser= PASSWORD(“1234”);

Again you should get the “Query OK” confirmation message. The final step is to assign all privileges on the “wordpress” database to the “wordpressuser” user. Use this command to assign the permissions:

GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser IDENTIFIED BY ‘1234′;

That isn’t a typo – those are single quote marks (‘) instead of the usual double quote marks (“) that were used in the command to set the password. MySQL’s internal syntax, alas, isn’t always consistent. Anyway, if you typed the command correctly, you should get the “Query OK” confirmation again.

Once you are done, use this command to quit the MySQL command-line interface:

exit

Then type exit to quit the MySQL local command-line client. Now that we have MySQL prepared, we can now configure WordPress itself. Specifically, we’ll have to configure WordPress to talk to the database we just created. To do so, you must create a wp-config.php file in the WordPress directory. Fortunately, WordPress includes a handy wp-config-sample.php you can use as a template.

Type this command to create a wp-config file (assuming you installed WordPress in the www/wordpress directory):

sudo cp /var/www/html/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php

Next, use vi to edit the newly created wp-config file:

sudo vi /var/www/html/wordpress/wp-config.php

You’ll see that the wp-config.php file contains a number of variables. Change the following three variables:

-Change putyourdbnamehere to wordpress.

-Change usernamehere to wordpressuser.

-Change yourpassword here to 1234.

Once you have your changes made (after double-checking the spelling, of course), switch vi to Command mode, and save your changed file.

Everything should now be ready. Open up a web browser, and navigate to http://ifconfi127.0.0.1/wordpress. (If you want to access it from a different machine, of course, use the IP address of the WordPress server, for instance – http://192.168.1.100/wordpress ) If you configured everything correctly, you should then be greeted by the WordPress configuration page. You’ll pick a username, and WordPress will assign you a password. Follow the prompts, and you will have a functional WordPress blog installed on a Ubuntu machine. Congratulations!

One final note: if you configure your blog from a local browser, it will probably set your blog’s address as http://127.0.0.1/wordpress. This is fine if you only want to view it from the host machine, but if you want to view it over the network, you’ll need to change it. Fortunately, you can do so quickly by going Options in the WordPress admin interface, and then to General, and changing the blog’s URL.

Was this post helpful? These books might be useful:

The Ubuntu Beginner’s Guide

The Linux Command Line Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide

-JM