Saturday, October 18, 2014

OSX Yosemite Automount NAS Share

Saturday, October 18, 2014 Posted by Andre Broers 1 comment
On my fresh installed Yosemite on my Macbook Air I want a mounted folder in my homedir when I am at home near my NAS. When I'm not at home it must not bother me with the none existing share. And when I'm back home it must silently reconnect.

This can be done by using autofs.

edit the file /etc/auto_master

## Automounter master map
#
+auto_master # Use directory service
/net -hosts -nobrowse,hidefromfinder,nosuid
/home auto_home -nobrowse,hidefromfinder
/Network/Servers -fstab
/Users/broersa/Documents/Shares auto_resources
/- -static 


The line starting with /Users is added. This will automount on the path selected. It will pick the resources from auto_resource. This is a new file we have to create:

all -fstype=smbfs ://username:password@192.168.2.254/all 

This will automount the share all on the path /Users/broersa/Documents/Shares/all

do a "chmod 600 auto_resource" to protect the username password from other users then root.

reload the config.

automount -vc

Don't forget to do everything as sudo.

Now you have your share always available when in range.

OSX Yosemite Calibre with books on NAS

Saturday, October 18, 2014 Posted by Andre Broers No comments
I want my book library on the NAS and the database on my local disk.

First start calibre and make a regular library on the NAS. (see my other post on how to mount an autofs (auto mounted) shared folder in your OS X home directory).

Now close calibre.

Set the environment variable CALIBRE_OVERRIDE_DATABASE_PATH.

To do this on Yosemite create an applescript script with the following content:

do shell script "launchctl setenv CALIBRE_OVERRIDE_DATABASE_PATH /Users/broersa/Documents/calibre/metadata.db"

change the path to your own local path. Don't forget to add metadata.db

and save this as an application.

Now go to System Preferences - Users & Groups and click on the tab Login Items. Click on the + and add the saved application as a login item.

Now move the file metadata.db from the library path on the NAS to your local directory.

Now log off and log in again to OS X. This will set the environment setting.

Start calibre and it will use the (faster) local database with the book library on the NAS,



Thursday, October 16, 2014

Create Mysql database and user for PHP applications

Thursday, October 16, 2014 Posted by Andre Broers 1 comment
I always struggle with the syntax to create a new mysql database and user for a php installation.

Hereby a quick reminder.


azureuser@myhost:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 157
Server version: 5.5.40-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database prestashop;
Query OK, 1 row affected (0.00 sec)

mysql> create user 'prestashopuser'@'localhost' identified by 'xxxxxxxxx';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on prestashop.* to 'prestashopuser'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
azureuser@myhost:~$ mysql -u prestashopuser -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 158
Server version: 5.5.40-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| prestashop         |
+--------------------+
2 rows in set (0.00 sec)

mysql>




Tuesday, September 9, 2014

Mono Trusted Root Certificates missing

Tuesday, September 09, 2014 Posted by Andre Broers No comments
When you receive the following exception in mono it means mono wants to make a secure SSL connection but the certificate it gets is not trusted. Most of the time this means the root certificates are not installed in the mono environment.

System.Net.WebException: Error: SendFailure (Error writing headers) ---> System.Net.WebException: Error writing headers ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a

Use the following command to import the current root certificates. (I find it useful to do this only for the current user so that is what the command imports)

 $ mozroots --import --ask-remove

Tuesday, August 19, 2014

Add swap space to Azure Ubuntu IaaS VM

Tuesday, August 19, 2014 Posted by Andre Broers , , , No comments
By default Azure doesn't add swap space to it's Linux Virtual Machines. I don't know why but luckily it's easy to turn it on.

Follow these steps to enable swap:

edit the file /etc/waagent.conf

Toggle the option ResourceDisk.Format from 'n' to 'y'
Toggle the option ResourceDisk.EnableSwap from 'n' to 'y'
Add the swapspace size to the option ResourceDisk.SwapSizeMB. In my case 1000 for 1000MB.


# Format if unformatted. If 'n', resource disk will not be mounted.
ResourceDisk.Format=y

# File system on the resource disk
# Typically ext3 or ext4. FreeBSD images should use 'ufs2' here.
ResourceDisk.Filesystem=ext4

# Mount point for the resource disk
ResourceDisk.MountPoint=/mnt

# Create and use swapfile on resource disk.
ResourceDisk.EnableSwap=y

# Size of the swapfile.
ResourceDisk.SwapSizeMB=1000


Also edit the file /etc/fstab and remove the line:

/dev/sdb1 /mnt auto defaults,nobootwait,comment=cloudconfig 0 2

Now after a reboot the waagent starts creating a swap file and after a while it is enabled:

swapon -s
Filename Type Size Used Priority
/mnt/swapfile                           file 1023996 0 -1

Friday, June 20, 2014

Install Mono 3.4.0 in Ubuntu 14.04 LTS from a repo

Friday, June 20, 2014 Posted by Andre Broers , , 3 comments
This one is not what I'm using anymore! I follow the instructions on:

http://www.mono-project.com/docs/getting-started/install/linux/

------------------------------

This is what I did to install Mono 3.4.0 in Ubuntu 14.04 LTS

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:inizan-yannick/mono
sudo apt-get update
sudo apt-get install mono-devel
or
sudo apt-get install mono-runtime

mono --version
Mono JIT compiler version 3.6.1 (tarball Sat May 31 16:07:15 UTC 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS:           __thread
SIGSEGV:       altstack
Notifications: epoll
Architecture:  amd64
Disabled:      none
Misc:          softdebug 
LLVM:          supported, not enabled.

GC:            sgen

Install ElasticSearch in Ubuntu 14.04 server

Friday, June 20, 2014 Posted by Andre Broers , , 7 comments

This is how I installed ElasticSearch on my Ubuntu box

sudo apt-get install openjdk-7-jre-headless -y
sudo wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -

Add the following line to /etc/apt/sources.list

deb http://packages.elasticsearch.org/elasticsearch/1.3/debian stable main

sudo apt-get update
sudo apt-get install elasticsearch
sudo update-rc.d elasticsearch defaults 95 10
sudo /etc/init.d/elasticsearch start

curl http://127.0.0.1:9200
{
  "status" : 200,
  "name" : "Kiber the Cruel",
  "version" : {
    "number" : "1.3.2",
    "build_hash" : "dee175dbe2f254f3f26992f5d7591939aaefd12f",
    "build_timestamp" : "2014-08-13T14:29:30Z",
    "build_snapshot" : false,
    "lucene_version" : "4.9"
  },
  "tagline" : "You Know, for Search"

}