Friday, November 13, 2015

[FreeNAS Alert]: Setting up FreeNAS to alert for Raid Failure via e-mail.

Setting up FreeNAS to alert for Raid Failure via e-mail.


The scope of this script is to check the disk status on schedule and to send a SMS(like) e-mail to sysadmin only if Only if something is MISSING.

Now everything you need is on one file, using the PHPMailer code implemented on FreeNAS .
The image below shows you the information’s that you have to change in order to make the script working for you.





Once you finish customizing the script with your email configuration, you have to set a “cron job”(scheduled task) to check the disks status at predetermined time.

The image below shows an example for a “cron job” scheduled to run every hour at 10 minutes after hour. 





An example (old) of the script in action. 
As you can see the script collect only important information, the host name (computer name, test250.mod in this example), and the disk status(ONLINE in this example, was running in test mode(old style, now even the test-mode will show MISSING)), date and time.



Download emailalert_2.1.tgz

Or from FreeNAS shell:
#fetch http://www.freenaskb.info/kb_upload/File/scripts/emailalert_2.1.tgz
#tar xzf emailalert_2.1.tgz
#nano emailalert.php

[FreeNAS Alert]: Setting up FreeNAS to use gmail for email service

Setting up FreeNAS to use gmail for email service


If you choose to use FreeNAS S.M.A.R.T service then you will want to make sure you have an email service to use for sending emails. I choose to use gmail for this service since it’s rocks. This explains what settings to use.
  1. Using the FreeNAS WebGUI go to System -> Advanced and select the Email tab.
  2. Fill in the following fields:
    1. From Email: youremail@gmail.com
    2. Outgoing Mail Server: smtp.gmail.com
    3. Port: 465
    4. Security: SSL
    5. Authentication: Check Enable SMTP Authentication
    6. Username: youremail@gmail.com
    7. Password: xxxxxxxx
    8. Authentication Method: Login
Once this is done send yourself a test email by clicking the button and you should have no issue getting an email….. however….
I did have an issue where it couldn’t find the server smtp.gmail.com which appeared to be a dns issue. To fix this I appended google’s dns server to my/etc/resolv.conf (which unfortunately this files gets overridden after every reboot, but it didn’t matter since this command kicked it in the butt to get it working).
If you go into System -> Advanced menu, there is option to set commands to be executed after every reboot. I just added new postinit command:
echo "nameserver 8.8.8.8" >> /etc/resolv.conf

Also make sure that root has your mail id where you want to receive mail. pls check below for details
To configure email on FreeNAS 9.3, do the following steps.
Login to FreeNAS web interface and go to System | Email.
email setup on freenas 9.3 step1
Enter your email address in From email section. For example: fitri@gmail.com. Next, specify the Outgoing mail server. If you are using gmail, it would be smtp.gmail.com. Type 465 on Port to connect to, TLS/SSL set to SSL. Check the Use SMTP Authentication option. Enter your gmail username and password. Save it.
Because the email will be sent to root account, we need to setup email for root account. Go to Users and click View Users. Click root username and press Change email. You can
setup email on freenas
Type the root email and press OK
change email freenas
Now any important log will be sent to your root email address.

[OneDrive]: How to Sync Microsoft OneDrive in Linux

How to Sync Microsoft OneDrive in Linux


Install onedrive-d on Linux

1. Open the terminal window and install git using this command:
sudo apt-get install git
2. Clone the source code from git using the following command:
git clone https://github.com/xybu92/onedrive-d.git
3. Now change directory to the onedrive-d folder:
cd onedrive-d
4. Here run the install script to download and install the required dependencies. Accept all packages to install.
./install.sh install
Once the installation has completed, you’ll be prompted to enter the “onedrive-pref”command in the terminal. From there on you would need to follow the on-screen instruction.
Copy the URL provided and paste it on the browser address bar. Enter your OneDrive username and password on the “Sign in” page.
Sync-Microsoft-OneDrive-in-Linux-picture-7
Then grant onedrive-d read/write access to your OneDrive.
Sync-Microsoft-OneDrive-in-Linux-picture-5
Now Copy the URL provided after you have click on Yes button and and paste it on the terminal:
Sync-Microsoft-OneDrive-in-Linux-picture-4
Sync-Microsoft-OneDrive-in-Linux-picture-3
Now create a local folder inside the Home folder to be used to sync OneDrive.
Once created, paste the path in the terminal on step 2/4.
Sync-Microsoft-OneDrive-in-Linux-picture-2
On step 3/4 and 4/4 select no.
Sync-Microsoft-OneDrive-in-Linux-picture-1
Then run the following command to start syncing.
onedrive-d start
Sync-Microsoft-OneDrive-in-Linux-picture-31
That is it!!
If you find yourself  having  problems with onedrive-d, there is an issue tracker where you can find help.

Monday, November 2, 2015

[UEFI Boot]: Installation of Ubuntu 15.04 (Vivid Vervet) Desktop on UEFI Firmware Systems

Installation of Ubuntu 15.04 (Vivid Vervet) Desktop on UEFI Firmware Systems

Ubuntu 15.04, codename Vivid Vervet, non-LTS, has finally been released for Desktops, Servers, Cloud and other instances and flavours. This version comes with nine months support and some interesting changes, the most notable ones being the replacement of Upstart init service with Systemd service, Linux 3.19 Kernel, MariaDB 10.0, LXC 1.1 and LXD 0.17.

This article will guide you on how you can install Ubuntu 15.04, single boot, on UEFI Firmware machines with a manual default partition layout in order to preserve free space for future Operating System installations in dual-boot.
Be aware that all system installations made from UEFI booting sequence assumes that your hard drive will be partitioned in GPT style, regardless of the size of your disks. Also, try do disable Secure Boot andFast Boot options from UEFI settings (if supported), especially if you are trying to boot from a USB UEFIcompatible bootbale drive made with Rufus utility.

Requirements

Download Ubuntu 15.04 ISO image, which can be obtained from the following link:
  1. http://releases.ubuntu.com/15.04/

Ubuntu 15.04 Desktop Installation Guide


The installation of Ubuntu 15.04 it pretty simple and straightforward as its previous releases. However, if you are booting and installing the system on a UEFI Firmware machine, besides the classical partitions you need to assure that you create a standard EFI partition required for the boot loader to pass the further instructions to Linux Grub.
1. The first step you need to take in order to install Ubuntu 15.04 is to burn an Ubuntu ISO image or create a compatible UEFI USB drive, place the bootable media into your appropriate drive, then enter UEFI settings and disable Secure Boot and Fast Boot options and instruct your machine to restart in UEFI with the appropriate bootable CD/USB drive.
2. After the machine boots the media, the Grub screen should appear on your screen. From here choose Install Ubuntu and press Enter key to continue.
Booting Screen
Booting Screen
Ubuntu Grub Menu
Ubuntu Grub Menu
3. On the next step, choose the Language for your system and press Continue button to move forward.
Select Install Language
Select Install Language
4. Next, the installer checks if your system has Internet connectivity and inspects your hard drive required space. After all the requirements are met, just press Continue button again to proceed further. The installation can continue without an Internet connection also.
Preparing to Install Ubuntu
Preparing to Install Ubuntu
5. On the next step you must choose an Installation type. To ensure that Ubuntu doesn’t eat all your hard disk space while installing the system using the first option, Erase disk and Install Ubuntu, choose the last option with Something else and hit Continue button.
This option is the most safest and flexible in case you might want to preserve some disk space and install other Operating Systems in dual-boot after you install Ubuntu.
Select Installation Type
Select Installation Type
6. On this step you must create a Partition Table in case you have a blank drive and slice-up your disk. Select your hard-disk in case your machine has more than one disks, hit New Partition Table button andContinue button from the pop-up warning in order to create the GPT partition table.
Select Partition
Select Partition
Partition Confirmation
Partition Confirmation
7. Now it’s time to create the system partitions manually. The partition table will have the following scheme:
  1. EFI System Partition – 650 MB
  2. Mount Point /(root) Partition – min 10 GB – Formatted EXT4 journaling file system.
  3. Swap Partition – min 1GB (or double RAM size).
  4. Mount Point /home Partition – custom space (or all remaining space) – Formatted EXT4 journaling file system.
  5. All partitions should be Primary and At the beginning of this space.
To begin, select free space and hit the Plus + button to create the first partition. This first partition will be the EFI standard partition. Enter 650 MB as its size and choose Use as EFI System Partition, then OKbutton to confirm and create the partition.
Create EFI System Partition
Create EFI System Partition
Enter EFI Partition Size
Enter EFI Partition Size
8. Next, chose free space again, hit the + button and create the /(root) partition. Make sure the partition has at least 10GB of space and will be formatted as EXT4 journaling file system.
Create Root Partition
Create Root Partition
9. Next, using the same steps as for previous partitions, create a swap partition with minimum 1 GB. The recommendations are to use double size of your RAM, but 1GB is enough for new machines with a lot of RAM (actually the swapping slows down your machine considerably on non-SSD hard drives).
Create Swap Partition
Create Swap Partition
10. The final partition that you need to make it should be the /home partition. So, select free space again, hit + button and enter the desired size for mount point /home partition. Use EXT4 journaling file system and press OK to create the partition.
Create Home Partition
Create Home Partition
11. After all the partitions are created hit the Install Now button to begin the installation process and confirm the hard disk changes by hitting the Continue button from the pop-up warning. In case a new warning window appears with Force UEFI Installation, hit both Continue buttons again as illustrated on the below screenshots.
Partition Table: Install Now
Partition Table: Install Now
Confirm Partition Changes
Confirm Partition Changes
Force UEFI Installation
Force UEFI Installation
12. After the installation process starts, choose your system Keyboard layout and hit Continue to move on the next step.
Select Keyboard Layout
Select Keyboard Layout
13. On the final step regarding your system configurations, enter the name for the system administrative user with root privileges, type a name for your computer and choose a password to protect the admin user. Select Require my password to log in and hit Continue to finish the system configuration. After this step wait for the installation process to finish.
Create New User Account
Create New User Account
Installation Process
Installation Process
14. Finally, after the installation process has reached its end, reboot your machine, eject the bootable media and login to Ubuntu 15.04 using the credentials configured during the installation process.
Installation Complete
Installation Complete
User Login
User Login
Ubuntu 15.04 Desktop
Ubuntu 15.04 Desktop
That’s all! Enjoy the last release of Ubuntu 15.04 on your UEFI machine. Please stay tuned for the next article concerning Ubuntu 15.04 where we will be discussing what to do after you have installed Ubuntu on your machine.