Category: RaspberryPi

Install and Configure Go/Golang on Raspberry Pi

An easy step by step guide to install and configure #Go #Golang on #Raspberry #Pi also applicable to #Linux distributions such as #Debian #Ubuntu

Advertisements

Let’s use letsencrypt

Few folks told me that while they try to access my website vinaybabu.in they get nasty message from browsers that its unsafe to browse through my website. That’s because I was using self-signed certificate to encrypt the internet traffic. I didn’t want to go with CA vendors who charge more than the cost of my #raspberrypi.

After googling got to know about letsencrypt which provides free trusted SSL certificates. I would like to thank below tech blog / link from techmint for installing letsencrypt on my pi. Only catch is that we need to renew certificate within 90 days.

letsencrypt-logo-horizontal

http://www.tecmint.com/install-free-lets-encrypt-ssl-certificate-for-apache-on-debian-and-ubuntu/

To automate renewal of letencrypt (certbot) certificate we can use below script taken from the link https://www.upcloud.com/support/install-lets-encrypt-apache/

 #!/bin/sh
if ! /usr/local/letsencrypt/letsencrypt-auto certonly -tvv --keep --webroot -w <web root folder> -d vinaybabu.in > /var/log/letsencrypt/renew.log 2>&1 ; then
   echo Automated renewal failed:
   cat /var/log/letsencrypt/renew.log
   exit 1
fi
apachectl graceful

Note: Do change the <web root folder> with actual path

Save the above script in /root folder. I’ve saved this script as auto_renew.sh

Finally, create a new crontab entry as under to run the script every 80 days. Threshold to renew Letsencrypt (certbot) certificate is 30 days.

#crontab -e <run as root>

0 0 */80 * * /root/auto_renew.sh

To check crontab entries use below command

#crontab -l <run as root>

That’s it! folks can access my website from any type of device or browser without any issues. I’ve got free trusted certificate and enabled secure and encrypted traffic while accessing my website.

2016-09-24-19_36_59-welcome-to-vinays-website

Thanks much @letsencrypt and @tecmint.

Disclaimers:

Image’s courtesy: letsencrypt.org

Squirrelmail IMAP 111 : Connection refused

After I started using K-9 Mail on my Oneplus 2, I hardly accessed webmail service hosted on my #RaspberryPi. I wanted to send an urgent note but when I tried to login, got a error message as under.

Error connecting to IMAP server: localhost 111 : Connection refused

As usual, I googled for hours in between my office work 😛 but could not find out the solution. I started rewinding myself to recall the changes made to the Pi, then suddenly remembered that a change was made to /etc/hosts by replacing ‘localhost’ with my server name…

Alas! I ran squirrelmail-configure command and updated server settings which resolved the issue.

Now I realize change management plays an important role in any level be it organization or personal use since the task of managing change is not an easy one!!

Happy Pi-ing!!

 

Personal Cloud Storage on Raspberry Pi

I’m a big fan of Dropbox and using its services from past few years. I’ve referred few of my friends there by increasing my personal cloud storage capacity to about 12 GB! Off late file syncing stopped because of lack of space in my Dropbox account. I wanted to sync photos and other important files from my phone to Dropbox and sync it on my personal laptop.

To avoid buying cloud storage, started googling for setting up personal cloud storage and sync tools. After reading multiple blogs and comparisons, I’ve decided to go with Seafile. Though Owncloud was very close competitor, I did prefer Seafile for client side encryption feature. We do not have apt package for Seafile yet, but installation was simple, thanks to the readily available script which takes care of install and configuration of Seafile. It took roughly 10 mins to setup on my Raspberry Pi.

Prerequisites:
a. Working Raspberry Pi running Raspbian OS
b. Install MySQL  > Follow steps from here https://pimylifeup.com/raspberry-pi-mysql-phpmyadmin/
c. Public IP or Dynamic DNS account to access Cloud from external network / internet

Installation Steps:
1. Download latest version of Seafile for Raspberry Pi from https://github.com/haiwen/seafile-rpi/releases

#wget https://github.com/haiwen/seafile-rpi/releases/seafile-server_xxx.tar.gz [Replace xxx with actual filename]
2. I’m using an external hard drive of size 500GB mounted as /usbstore. Change directory  #cd /usbstore
3. Copy downloaded seafile tarball

#cp seafile-server_xxx.tar.gz /usbstore [Replace xxx with actual filename]
4. Extract file

#tar -xvzf seafile-server_xxx.tar.gz
5. Change directory

#cd seafile-server*
6. Enable execution of script if not already

#chmod +x setup-seafile-mysql.sh
7. Run the script

#./setup-seafile-mysql.sh
8. Installation will start. Script will start collecting information required. Give a good name to your server 🙂 like “limitlesscloud”
9. When it prompts for IP address, Enter the IP address of Raspberry Pi
10. Ports 8000 and 8082 are used by Seafile. Accept the default ports unless you want to change
11. Creating admin account: Provide your email address for account name
12. Enter the password for the account
13. Database configuration: Choose option ‘1’ at the prompt to create new database for Seafile configuration
14. Since MySQL is running locally leave the default option “localhost” as is
15. By default username for the database will be ‘root’. Let’s change it as ‘seafile’
16. Enter password for ‘seafile’ database user account
17. Accept the default database names and continue
18. At the end; it prompts “Enter” to continue and showing the configuration details. Hit enter!
19. Congratulations!!! Seafile installation is completed. Unlike other software, Seafile wont start by itself
20. Start the Cloud Storage services

#cd /usbstore/seafile-server-latest && ./seafile.sh && ./seahub.sh
21. Install Seafile from playstore on Android and use the respecitve methods on other platforms (Sorry Windows ‘Smartphone’ users 😛 ). We do have clients for Linux, Mac and Windows…
22. Enter Public IP details http://10.11.12.13:8000 Provide Username user@somesite.com and Password
23. Create Library / Libraries and enable encryption with password protection
24. Now I’ve about 500GB of personal ‘secure’ cloud storage capacity with encryption enabled. Seafile is flexible to further configure it to suit my requirements.

Enjoy your personal cloud storage. I love my Raspberry Pi ~ Small but orotund!!!

Connect external USB HD to Raspberry Pi

 

I wanted to connect the external USB disk to backup logs, configuration files and other critical data which are running on Raspberry Pi internal SD card.

I was trying to connect external USB HD to Raspberry Pi. Though the LED was lit, disk was not detected by Pi. I felt something wrong with the disk so for testing it, connected USB disk to laptop. Disk was detected successfully and was able to read write some files to it. After googling for a while found that the root issue was inadequate power from Pi to USB Disk.

I bought an external powered USB Transcend TS-HUB3K from the local computer shop. It worked like a charm 🙂

Now, I’ve connected two USB disks instead of one and still two more ports left to connect USB stick or any other USB device without worries about lack of power supply from Pi.