<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Z-Proj]]></title><description><![CDATA[Tips, Tricks and Troubleshooting]]></description><link>http://blog.z-proj.com/</link><generator>Ghost 0.11</generator><lastBuildDate>Tue, 04 Nov 2025 19:48:29 GMT</lastBuildDate><atom:link href="http://blog.z-proj.com/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Microsoft Office 2010 Professional Pro x32 on Wine 1.6 (Ubuntu)]]></title><description><![CDATA[<blockquote>
  <p>Disclaimer: This tutorial is not for the soft-hearted people. It takes patience and multiple retries to accomplish this.</p>
</blockquote>

<p>Despite LibreOffice/OpenOffice being awesome, sometimes we get a word document that does not look good on these software packages and would require to open them using Microsoft Word. In this tutorial,</p>]]></description><link>http://blog.z-proj.com/microsoft-office-2010-professional-pro-on-wine-1-6/</link><guid isPermaLink="false">8e497062-d710-48f7-86a0-930d43231e69</guid><category><![CDATA[wine]]></category><category><![CDATA[microsoft]]></category><category><![CDATA[ubuntu]]></category><category><![CDATA[office]]></category><dc:creator><![CDATA[Zaid Daba'een]]></dc:creator><pubDate>Tue, 20 Sep 2016 21:46:18 GMT</pubDate><media:content url="http://blog.z-proj.com/content/images/2016/09/Screenshot-from-2016-09-20-23-49-06.png" medium="image"/><content:encoded><![CDATA[<blockquote>
  <img src="http://blog.z-proj.com/content/images/2016/09/Screenshot-from-2016-09-20-23-49-06.png" alt="Microsoft Office 2010 Professional Pro x32 on Wine 1.6 (Ubuntu)"><p>Disclaimer: This tutorial is not for the soft-hearted people. It takes patience and multiple retries to accomplish this.</p>
</blockquote>

<p>Despite LibreOffice/OpenOffice being awesome, sometimes we get a word document that does not look good on these software packages and would require to open them using Microsoft Word. In this tutorial, I'll show how I managed to install <em>Microsoft Office 2010 Professional Pro x32</em> on <em>Wine 1:1.6.2-0ubuntu14</em> and <em>Ubuntu 16.04</em>.</p>

<p>Do you need a fresh wineprefix? <strong>NO</strong>, you do not need to create a new fresh wine prefix for this to work (at least I did not need it). You just need to have a x32 wine prefix environment set up. If you don't, here is how to create one:  </p>

<pre><code>WINEARCH=win32 WINEPREFIX=/home/$USER/.wine32 winecfg  
</code></pre>

<p>All of the steps in this tutorial are <strong>mandatory</strong>. Otherwise the installation will fail. Do not slack.</p>

<blockquote>
  <p>Throughout this tutorial, this wine prefix will be used. Always be explicit and define the WINEPREFIX before running wine or winetricks.</p>
</blockquote>

<p>Install a few system dependencies:  </p>

<pre><code>sudo apt-get install wine-mono0.0.8  
sudo apt-get install winbind  
</code></pre>

<p>Install dlls for your wine prefix using winetricks:  </p>

<pre><code>WINEPREFIX=/home/$USER/.wine32 winetricks ie6 msxml6 dotnet20 windowscodecs corefonts  
</code></pre>

<p>Download <code>wic_x86_enu</code> which is Windows Imaging Component from Microsoft's website at <a href="https://www.microsoft.com/en-us/download/details.aspx?id=32">https://www.microsoft.com/en-us/download/details.aspx?id=32</a>.</p>

<p>This provides <code>windowscodecs</code> which we have already installed using winetricks, however we need the dll to be in our <code>system32</code> folder. So using Ubuntu's file manager, extract the .exe file (yes you can do that), and find windowscodecs dll file. Copy it to <code>system32</code> in your wineprefix.  </p>

<pre><code>cp windowscodecs.dll /home/$USER/.wine/drive_c/windows/system32  
</code></pre>

<p>Make sure your wineprefix is set to Windows XP. You can make sure by running <code>Configure Wine</code> from your dash.</p>

<p>And that's about it.</p>

<p>Go find that <code>setup.exe</code> file, run it and install it. I was able to install what I needed: Word, Powerpoint and Excel (as well as Equations browser from Shared section).</p>

<p>And here it is running on my Ubuntu Gnome! <br>
<em>(Never mind the badly scaled windows)</em></p>

<p><img src="http://blog.z-proj.com/content/images/2016/09/Screenshot-from-2016-09-20-23-49-06.png" alt="Microsoft Office 2010 Professional Pro x32 on Wine 1.6 (Ubuntu)"></p>

<p><strong>One more thing to thank (me) for:</strong>
You'll notice on opening files with Microsoft Office, <code>.lnk</code> files are created in each directory. To prevent this, create a folder named <code>Recent</code> in <code>.wine/users/$USER/</code>. Credits go to <a href="https://bugs.winehq.org/show_bug.cgi?id=15480#c17">this person</a>.</p>

<p>If the installation failed and an error occurred, please make sure that you have did all of the steps above. If it still didn't work, run the setup from terminal and comment down here showing the log. Also have a look at <a href="https://appdb.winehq.org/objectManager.php?sClass=version&amp;iId=17336">WineHQ</a>.</p>]]></content:encoded></item><item><title><![CDATA[Spotify for Ubuntu]]></title><description><![CDATA[<p>If you wanted to download Spotify for Ubuntu and you noticed that the instructions given by Spotify on this <a href="https://www.spotify.com/nl/download/linux/">page</a> do not work, here are the right commands to install the latest spotify client:</p>

<pre><code># 1. Add the Spotify signing key repository to be bootable to verify, downloaded packages
sudo apt-key</code></pre>]]></description><link>http://blog.z-proj.com/spotify-for-linux/</link><guid isPermaLink="false">d8075665-7856-427d-a46c-2de744091e70</guid><category><![CDATA[spotify]]></category><dc:creator><![CDATA[Zaid Daba'een]]></dc:creator><pubDate>Sun, 18 Sep 2016 14:13:01 GMT</pubDate><content:encoded><![CDATA[<p>If you wanted to download Spotify for Ubuntu and you noticed that the instructions given by Spotify on this <a href="https://www.spotify.com/nl/download/linux/">page</a> do not work, here are the right commands to install the latest spotify client:</p>

<pre><code># 1. Add the Spotify signing key repository to be bootable to verify, downloaded packages
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886

# 2. Add the Spotify repository
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list

# 3. Update list of available packages
sudo apt-get update

# 4. Install Spotify
sudo apt-get install spotify-client  
</code></pre>

<blockquote>
  <p>Tested on Ubuntu Gnome 16.04</p>
</blockquote>]]></content:encoded></item><item><title><![CDATA[Use Java Runtime SE in Wine]]></title><description><![CDATA[<p>Upon attempting to run <a href="http://fluxicon.com/disco/">Disco</a> on my Ubuntu 16.10 machine using Wine 1.6.2, the installation was successful however Java Runtime SE was required to run the program itself.</p>

<p>To run Java Runtime SE on Wine, you cannot use Java 8. Instead, install Java 7 from <a href="http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html">Oracle</a> matching</p>]]></description><link>http://blog.z-proj.com/use-java-runtime-se-in-wine/</link><guid isPermaLink="false">1891e70c-8078-452b-adc4-abf7b669c746</guid><category><![CDATA[java]]></category><category><![CDATA[disco]]></category><category><![CDATA[wine]]></category><dc:creator><![CDATA[Zaid Daba'een]]></dc:creator><pubDate>Sat, 10 Sep 2016 13:51:21 GMT</pubDate><content:encoded><![CDATA[<p>Upon attempting to run <a href="http://fluxicon.com/disco/">Disco</a> on my Ubuntu 16.10 machine using Wine 1.6.2, the installation was successful however Java Runtime SE was required to run the program itself.</p>

<p>To run Java Runtime SE on Wine, you cannot use Java 8. Instead, install Java 7 from <a href="http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html">Oracle</a> matching your Windows OS architecture.</p>

<p>This was tested on x32 Windows architecture.</p>]]></content:encoded></item><item><title><![CDATA[Enabling L2TP over IPSec on Ubuntu 16.04]]></title><description><![CDATA[<p>Ubuntu has stopped shipping L2TP over IPSec support for Ubuntu since Precise. A workaround for this exists using <code>network-manager-l2tp</code>.</p>

<blockquote>
  <p><em>Update (23 Oct 2017) -</em> Many users of Ubuntu 17.xx have reported it to be working as is, and some needed more hacks to get it running. If the <a href="http://blog.z-proj.com/enabling-l2tp-over-ipsec-on-ubuntu-16-04/#using-ppa">Using</a></p></blockquote>]]></description><link>http://blog.z-proj.com/enabling-l2tp-over-ipsec-on-ubuntu-16-04/</link><guid isPermaLink="false">f9f55a63-7b61-4d47-b379-189c4d508dab</guid><category><![CDATA[L2TP]]></category><category><![CDATA[VPN]]></category><category><![CDATA[Xenial]]></category><dc:creator><![CDATA[Zaid Daba'een]]></dc:creator><pubDate>Mon, 22 Aug 2016 18:47:08 GMT</pubDate><media:content url="http://blog.z-proj.com/content/images/2016/08/Screenshot-from-2016-08-22-20-54-20-1.png" medium="image"/><content:encoded><![CDATA[<img src="http://blog.z-proj.com/content/images/2016/08/Screenshot-from-2016-08-22-20-54-20-1.png" alt="Enabling L2TP over IPSec on Ubuntu 16.04"><p>Ubuntu has stopped shipping L2TP over IPSec support for Ubuntu since Precise. A workaround for this exists using <code>network-manager-l2tp</code>.</p>

<blockquote>
  <p><em>Update (23 Oct 2017) -</em> Many users of Ubuntu 17.xx have reported it to be working as is, and some needed more hacks to get it running. If the <a href="http://blog.z-proj.com/enabling-l2tp-over-ipsec-on-ubuntu-16-04/#using-ppa">Using PPA - Update (29 Mar 2017)</a> does not work for you, there are plenty of hacks specific for different Linux distributions that are available in the <a href="http://blog.z-proj.com/enabling-l2tp-over-ipsec-on-ubuntu-16-04/#comments-section">comments section</a> by the amazing community here.</p>
</blockquote>

<h4 id="anameusingppaausingppaupdate29mar2017"><a name="using-ppa"></a>Using PPA - Update (29 Mar 2017)</h4>

<p><code>network-manager-l2tp</code> now exists in a PPA. You can install it using</p>

<pre><code>sudo add-apt-repository ppa:nm-l2tp/network-manager-l2tp  
sudo apt-get update  
sudo apt-get install network-manager-l2tp  
</code></pre>

<h4 id="buildfromsourcewithoutusingppa">Build from Source / Without using PPA</h4>

<p>First you must install the prerequisites:</p>

<pre><code>sudo apt install \  
intltool \  
libtool \  
network-manager-dev \  
libnm-util-dev \  
libnm-glib-dev \  
libnm-glib-vpn-dev \  
libnm-gtk-dev \  
libnm-dev \  
libnma-dev \  
ppp-dev \  
libdbus-glib-1-dev \  
libsecret-1-dev \  
libgtk-3-dev \  
libglib2.0-dev \  
xl2tpd \  
strongswan  
</code></pre>

<p>Then build the network manager again:  </p>

<pre><code>git clone https://github.com/nm-l2tp/network-manager-l2tp.git  
cd network-manager-l2tp  
autoreconf -fi  
intltoolize  
</code></pre>

<blockquote>
  <p>Make sure no errors have occurred.</p>
</blockquote>

<p>Configure the build:  </p>

<pre><code>./configure \
  --disable-static --prefix=/usr \
  --sysconfdir=/etc --libdir=/usr/lib/x86_64-linux-gnu \
  --libexecdir=/usr/lib/NetworkManager \
  --localstatedir=/var \
  --with-pppd-plugin-dir=/usr/lib/pppd/2.4.7
</code></pre>

<blockquote>
  <p>Make sure no errors occurred.</p>
</blockquote>

<p>Then make it:  </p>

<pre><code>make  
sudo make install  
</code></pre>

<p>Remove AppArmor settings for IPSec:  </p>

<pre><code>sudo apparmor_parser -R /etc/apparmor.d/usr.lib.ipsec.charon  
sudo apparmor_parser -R /etc/apparmor.d/usr.lib.ipsec.stroke  
</code></pre>

<p>Replace x2ltpd with libpcap:  </p>

<pre><code>sudo apt remove xl2tpd  
sudo apt install libpcap0.8-dev

wget https://github.com/xelerance/xl2tpd/archive/v1.3.6/xl2tpd-1.3.6.tar.gz  
tar xvzf xl2tpd-1.3.6.tar.gz  
cd xl2tpd-1.3.6  
make  
sudo make install  
</code></pre>

<p>Now restart your machine.</p>

<p>Network Manager should now have an option to use a L2TP VPN connection.</p>

<p><img src="http://blog.z-proj.com/content/images/2016/08/Screenshot-from-2016-08-22-20-54-20.png" alt="Enabling L2TP over IPSec on Ubuntu 16.04"></p>

<p><a name="comments-section"></a></p>]]></content:encoded></item><item><title><![CDATA[Migrating instances]]></title><description><![CDATA[Migrating Instances from AWS to Azure]]></description><link>http://blog.z-proj.com/moving-ec2-instances-from-aws-to-azure/</link><guid isPermaLink="false">87502418-fe30-48a3-84b6-fe478f428f8f</guid><category><![CDATA[migrate]]></category><category><![CDATA[ec2]]></category><category><![CDATA[aws]]></category><dc:creator><![CDATA[Zaid Daba'een]]></dc:creator><pubDate>Thu, 14 Apr 2016 15:29:08 GMT</pubDate><content:encoded><![CDATA[<blockquote>
  <p>This is a fast solution that should never be performed for a production environment.</p>
</blockquote>

<p>In this tutorial, a source virtual machine will be migrated by copying all files to the destination virtual machine.</p>

<h3 id="summary">Summary</h3>

<p>The following will be accomplished:</p>

<ol>
<li>Setup SSH on destination instance to allow root access.  </li>
<li>Install <code>screen</code> to ensure uninterrupted copying.  </li>
<li>Copy all necessary files from source to destination instance.</li>
</ol>

<h3 id="steps">Steps</h3>

<p>Perform the following:</p>

<ul>
<li>Create a new instance with the same OS as the source's instance</li>
<li>SSH into the destination instance</li>
<li>Edit SSH configuration to allow root login</li>
</ul>

<pre><code class="language-sh">sudo vim /etc/ssh/sshd_config  
</code></pre>

<p>Look for <code>PermitRootLogin</code> and remove the <code>#</code> character, or for short perform this: <code>/Permit [Enter] [i] [Remove hash]</code></p>

<ul>
<li>Restart SSH service</li>
</ul>

<pre><code class="language-sh"># Redhat
sudo service ssh restart  
# Debian
sudu service sshd restart  
</code></pre>

<ul>
<li>Set a password for root user</li>
</ul>

<pre><code class="language-sh">sudo passwd root  
</code></pre>

<blockquote>
  <p>You will be prompted to enter password twice.</p>
</blockquote>

<ul>
<li>SSH to destination instance with root credentials in another terminal to make sure you have root access</li>
</ul>

<pre><code class="language-sh">ssh root@&lt;destination-address&gt;  
</code></pre>

<ul>
<li><p>SSH to your source instance</p></li>
<li><p>Create a new file called <code>excludes.conf</code> with the following contents:</p></li>
</ul>

<pre><code class="language-sh">/boot
/proc
/sys
/tmp
/dev
/var/lock
/etc/fstab
/etc/mtab
/etc/resolv.conf
/etc/conf.d/net
/etc/network/interfaces
/etc/networks
/etc/sysconfig/network*
/etc/sysconfig/hwconf
/etc/sysconfig/ip6tables-config
/etc/sysconfig/kernel
/etc/hostname
/etc/HOSTNAME
/etc/hosts
/etc/modprobe*
/etc/modules
/net
/lib/modules
/etc/rc.conf
/usr/share/nova-agent*
/usr/sbin/nova-agent*
/etc/init.d/nova-agent*
</code></pre>

<p>Add all other folders that you do not wish to migrate such as <strong>log</strong> files.</p>

<ul>
<li>Install <code>screen</code> to be able to continue with the migration process should your SSH connection fail</li>
</ul>

<pre><code class="language-sh"># Redhat
sudo yum install screen -y  
# Debian
sudu apt-get install screen  
</code></pre>

<ul>
<li>Start the migration process</li>
</ul>

<pre><code class="language-sh">screen  
sudo rsync -azPx --exclude-from="excludes.conf" / root@&lt;ip-address&gt;  
</code></pre>

<ul>
<li><p>Restart destination instance.</p></li>
<li><p>Remove the SSH key used for the destination's VM as it now uses the source's VM SSH credentials.</p></li>
</ul>

<pre><code class="language-sh">ssh-keygen -R &lt;ip-address&gt;  
</code></pre>

<ul>
<li>SSH again to destination instance.</li>
</ul>

<p>All should be working fine.</p>]]></content:encoded></item><item><title><![CDATA[Setting up a Load-Balanced Cassandra Cluster v3 (Ubuntu Server 14.04 LTS VMs) on Microsoft Azure]]></title><description><![CDATA[<p>Contents:</p>

<ul>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#introduction">Introduction</a></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#system_architecture">System Architecture</a></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#first_template">Create your first template VM</a>
<ul><li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#install">Installing Cassandra 3</a></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#initial_configure">Configuring Cassandra for clustering</a></li></ul></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#deploy_dups">Deploying duplicate VMs on Azure</a>
<ul><li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#deploy_dups_first">Deploying first VM</a></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#deploy_dups_three">Deploying three more VMs</a></li></ul></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#configure">Configuring the nodes</a></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#testing">Testing the Cassandra Cluster</a></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#load_balancing">Load-Balancing the Cassandra Cluster</a></li>
</ul>

<h3 id="anameintroductionintroductiona"><a name="introduction">Introduction<a></a></a></h3>

<p>Apache Cassandra is a highly available and a very scalable</p>]]></description><link>http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/</link><guid isPermaLink="false">a61a86a7-ac01-42de-9fc9-d9abbc9bd8d2</guid><category><![CDATA[load-balancer]]></category><category><![CDATA[cassandra]]></category><category><![CDATA[azure]]></category><category><![CDATA[cluster]]></category><dc:creator><![CDATA[Zaid Daba'een]]></dc:creator><pubDate>Mon, 04 Apr 2016 10:24:40 GMT</pubDate><content:encoded><![CDATA[<p>Contents:</p>

<ul>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#introduction">Introduction</a></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#system_architecture">System Architecture</a></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#first_template">Create your first template VM</a>
<ul><li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#install">Installing Cassandra 3</a></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#initial_configure">Configuring Cassandra for clustering</a></li></ul></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#deploy_dups">Deploying duplicate VMs on Azure</a>
<ul><li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#deploy_dups_first">Deploying first VM</a></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#deploy_dups_three">Deploying three more VMs</a></li></ul></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#configure">Configuring the nodes</a></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#testing">Testing the Cassandra Cluster</a></li>
<li><a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#load_balancing">Load-Balancing the Cassandra Cluster</a></li>
</ul>

<h3 id="anameintroductionintroductiona"><a name="introduction">Introduction<a></a></a></h3>

<p>Apache Cassandra is a highly available and a very scalable NoSQL database. In this article, I'll demonstrate how to deploy a Cassandra Cluster on Microsoft Azure platform.</p>

<p>At the time of writing, due to the fact that there are no articles online about setting up a cluster node for Cassandra <strong>v3</strong>, I have decided to write this. Also, this article is up to date with Azure new CLI tools and provides a full solution.</p>

<p>This articles assumes you are familiar with Azure, Azure CLI tools and Ubuntu OS.</p>

<p>This article is for deploying a <strong>small scale Cassandra Cluster</strong> of 2-8 nodes. If it is required to deploy a bigger scale Cassandra Cluster, you should use <a href="http://chef.io">Chef</a> or <a href="http://saltstack.com">Salt Stack</a> to automate the same process.</p>

<h3 id="anamesystem_architecturesystemarchitecturea"><a name="system_architecture">System Architecture</a></h3>

<p>The architecture consists of a cluster of 4 Cassandra nodes that are load balanced as shown in the figure below: <br>
<img src="http://blog.z-proj.com/content/images/2016/03/load-balanced-set.png" alt="load balanced cassandra virtual machines">
<center><sub>This is just a demonstration (not a real flowchart)</sub></center></p>

<p>The subnet used for this example will be maximally <code>10.0.0.0/24</code>. <br>
The nodes will have the following static IP addresses:</p>

<ul>
<li><code>10.0.0.4</code> and <code>10.0.0.6</code> for <strong>seeds</strong></li>
<li><code>10.0.0.8</code> and <code>10.0.0.10</code> for nodes</li>
</ul>

<p>The seeds are responsible for broadcasting the available nodes to the other nodes.</p>

<h3 id="creatingthefirsttemplatevm">Creating the first template VM</h3>

<ul>
<li>Create a new resource group, I named it "cassandra-group".</li>
<li>Using the resource manager, add a new <strong>Ubuntu Server 14.04 LTS</strong> VM. I named it "cass-tmp".</li>
<li>Set it up under subnet <code>10.0.0.0/24</code>. I gave it the static IP address of <code>10.0.0.12</code>.</li>
<li>Allow inbound traffic and outbound traffic at port <code>tcp:9042</code>.</li>
<li>Deploy it.</li>
<li>SSH to it.</li>
</ul>

<h4 id="anameinstallinstallingcassandra3a"><a name="install">Installing Cassandra 3</a></h4>

<p>Oracle Java 8 and JNI are prerequisites for Cassandra v3.</p>

<ul>
<li>Install Oracle Java 8 using :</li>
</ul>

<pre><code class="language-bash">sudo apt-add-repository ppa:webupd8team/java  
sudo apt-get update  
sudo apt-get install oracle-java8-installer

# Check that java is properly installed
java -version  
</code></pre>

<blockquote>
  <p>You might need to setup JAVA_HOME path variable export <code>JAVA_HOME=/usr/lib/jvm/java-8-oracle</code> if <code>java -version</code> failed.</p>
</blockquote>

<ul>
<li>Install JNA using:</li>
</ul>

<pre><code class="language-bash">sudo apt-get install libjna-java -y  
</code></pre>

<ul>
<li>Install Cassandra:</li>
</ul>

<p>This will set up the PPAs for Cassandra and the keys for verification.  </p>

<pre><code class="language-bash">echo "deb http://www.apache.org/dist/cassandra/debian 30x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list  
echo "deb-src http://www.apache.org/dist/cassandra/debian 30x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list

gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D  
gpg --export --armor F758CE318D77295D | sudo apt-key add -  
gpg --keyserver pgp.mit.edu --recv-keys 2B5C1B00  
gpg --export --armor 2B5C1B00 | sudo apt-key add -  
gpg --keyserver pgp.mit.edu --recv-keys 0353B12C  
gpg --export --armor 0353B12C | sudo apt-key add -

sudo apt-get update  
sudo apt-get install cassandra  
</code></pre>

<ul>
<li>Check if Cassandra is running and discover nodes:</li>
</ul>

<pre><code class="language-bash">sudo service cassandra status  
sudo nodetool status  
</code></pre>

<blockquote>
  <p>You should only see one node connected at <em>localhost</em> with status <em>UN</em>. <em>U</em> is for <em>Up</em> and <em>N</em> is for <em>Normal</em></p>
</blockquote>

<h4 id="anameinitial_configureconfiguringcassandraforclusteringa"><a name="initial_configure">Configuring Cassandra for clustering</a></h4>

<ul>
<li>Stop Cassandra using <code>sudo service cassandra stop</code>.</li>
<li>Find your ethernet card interface ID using <code>ifconfig</code>, it should be <code>eth(x)</code>.</li>
<li><p>Edit Cassandra's configuration <code>cassandra.yaml</code>:</p>

<ul><li>Change the cluster name.</li>
<li>Add the IP addresses of the seed nodes.</li>
<li>Comment out the listen_address.</li>
<li>Add the listen interface.</li>
<li>Start the RPC service.</li>
<li>Set the RPC interface.</li>
<li>Set the broadcast RPC address.</li>
<li>Set the endpoint snitch.</li></ul>

<p>By editing the file:
<code>sudo vim /etc/cassandra/cassandra.yaml</code></p></li>
</ul>

<pre><code class="language-yaml">cluster_name: 'My Cluster'  
seeds: "10.0.0.4,10.0.0.6"

# listen_address:     
listen_interface: eth0 

start_rpc: true  
# rpc_address: 
rpc_interface: eth0  
broadcast_rpc_address: 10.0.0.12

endpoint_snitch: GossipingPropertyFileSnitch  
</code></pre>

<ul>
<li>Delete all Cassandra system configurations <code>sudo rm -rf /var/lib/cassandra/data/system/</code>.</li>
<li>Start Cassandra <code>sudo service cassandra start</code>, check the nodes using <code>sudo nodetool status</code>. You should see your own node listed under your interface IP rather than localhost.


<blockquote>
  <p>Nodetool takes time to bootstrap and find the nodes. If you receive a Java error, then restart Cassandra.</p></blockquote></li>
  </ul>
  Now Cassandra is installed and is cluster operational.<p></p>


<h3 id="anamedeploy_dupsdeployingduplicatevmsonazurea"><a name="deploy_dups">Deploying duplicate VMs on Azure</a></h3>



<h4 id="anamedeploy_dups_firstdeployingfirstvma"><a name="deploy_dups_first">Deploying first VM</a></h4>

To deploy a duplicate of the VM, the VM must be generalized, captured into a JSON template, and redeployed as many times as needed.

<ul>
<li>To generalize the VM:</li>
</ul>

<pre><code class="language-bash">sudo waagent -deprovision+user  
</code></pre>

<p>And accept when prompted. This will remove all user related configurations on the machine.</p>

<ul>
<li><p>Stop the VM.</p></li>
<li><p>Capture VM into JSON template onto your local machine.</p></li>
</ul>

<pre><code class="language-bash">azure vm capture "cassandra-group" -n "cass-tmp" -p "cass-vhd" -t "cass-template.json"  
</code></pre>

<p>This will create a JSON file containing your VM settings.</p>

<blockquote>
  <p>You should have <a href="https://azure.microsoft.com/en-us/documentation/articles/xplat-cli-install/">Azure CLI tools installed</a> and must be logged in.</p>
</blockquote>

<ul>
<li>Create four new public IP addresses and four new NICs.</li>
</ul>

<pre><code class="language-bash">azure network public-ip create "cassandra-group" "cass-ip-1"  
azure network public-ip create "cassandra-group" "cass-ip-2"  
azure network public-ip create "cassandra-group" "cass-ip-3"  
azure network public-ip create "cassandra-group" "cass-ip-4"  
</code></pre>

<pre><code class="language-bash">azure network nic create "cassandra-group" "cass-nic-1" -k "cass-subnet" -m "cass-vnet" -p "cass-ip-1" -a "10.0.0.4"  
azure network nic create "cassandra-group" "cass-nic-2" -k "cass-subnet" -m "cass-vnet" -p "cass-ip-2" -a "10.0.0.6"  
azure network nic create "cassandra-group" "cass-nic-3" -k "cass-subnet" -m "cass-vnet" -p "cass-ip-3" -a "10.0.0.8"  
azure network nic create "cassandra-group" "cass-nic-4" -k "cass-subnet" -m "cass-vnet" -p "cass-ip-4" -a "10.0.0.10"  
</code></pre>

<ul>
<li><a name="list_nics">List all your NICs IDs</a>.</li>
</ul>

<pre><code>azure network nic list --json | grep "cass-nic"  
</code></pre>

<ul>
<li>Deploy your first VM.</li>
</ul>

<pre><code class="language-bash">azure group deployment create "cassandra-group" -n "cass01" -f "cass-template.json"  
</code></pre>

<p><a name="before">You will be asked for</a>:</p>

<ol>
<li>VM name "cass01"  </li>
<li>Admin username and password  </li>
<li>NIC ID for "cass-nic-1" as mentioned in <a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#list_nics">List all your NICs IDs</a></li>
</ol>

<h4 id="anamedeploy_dups_threedeployingthreemorevmsa"><a name="deploy_dups_three">Deploying three more VMs</a></h4>

<p>The template image created before cannot be used anymore to deploy more of that image due to the osDisk URI, it has already been used. We'll create more templates with different osDisk URIs, and deploy again.</p>

<ul>
<li>Copy the template thrice</li>
</ul>

<pre><code class="language-bash">cp cass-template.json cass-template2.json  
cp cass-template.json cass-template3.json  
cp cass-template.json cass-template4.json  
</code></pre>

<ul>
<li><p>Edit each <em>new</em> template's osDisk VHD URI <code>https://clixxxxxxxxxxxxx.blob.core.windows.net/vmcontainer1cd54367-xxxx-xxxx-xxxx-xxxxxxxxx/osDisk.xxxxxx-xxxx-xxxx-xxxx-xxxxx....</code>. Just change the word <code>osDisk</code> to <code>osDisk2</code> or <code>osDisk3</code> or <code>osDisk4</code>.</p></li>
<li><p>Deploy three VMs.</p></li>
</ul>

<pre><code class="language-bash">azure group deployment create "cassandra-group" -n "cass02" -f "cass-template2.json"  
azure group deployment create "cassandra-group" -n "cass03" -f "cass-template3.json"  
azure group deployment create "cassandra-group" -n "cass04" -f "cass-template4.json"  
</code></pre>

<p>Enter the information you are asked for like mentioned <a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#before">before</a>.</p>

<h3 id="anameconfigureconfiguringthenodesa"><a name="configure">Configuring the nodes</a></h3>

<p>SSH to every node, and edit the <code>etc/cassandra/cassandara.yaml</code> as mentioned in <a href="http://blog.z-proj.com/setting-up-a-cassandra-cluster-on-azure/#configuration">Configuring Cassandra for clustering</a> to edit the <code>broadcast_rpc_address</code> to match the IP address given to every node.</p>

<pre><code>broadcast_rpc_address: 10.0.0.4  
broadcast_rpc_address: 10.0.0.6  
broadcast_rpc_address: 10.0.0.8  
broadcast_rpc_address: 10.0.0.10  
</code></pre>

<p>Make sure to restart cassandra.</p>

<pre><code class="language-bash">sudo service cassandra restart  
</code></pre>

<p>Using any node, check the status of cluster:</p>

<pre><code class="language-bash">sudo nodetool status  
</code></pre>

<p>The output should be similar to the following:</p>

<pre><code class="language-bash">Datacenter: datacenter1  
=======================
Status=Up/Down  
|/ State=Normal/Leaving/Joining/Moving
--  Address      Load       Tokens       Owns    Host ID                               Rack
UN  10.0.0.4   223.37 KB  256          ?       211af4a7-eb3b-45de-91d3-225ec2c55ba6  rack1  
UN  10.0.0.6   232.37 KB  256          ?       2663c92f-7b82-4633-b481-fa52023ecdc7  rack1  
UN  10.0.0.8   260.06 KB  256          ?       cb20c567-66e9-402b-9776-90d52d706f76  rack1  
UN  10.0.0.10  180.22 KB  256          ?       e0ffd0b6-11e4-4870-9185-a683018555e5  rack1  
</code></pre>

<p><br>  </p>

<h3 id="anametestingtestingthecassandraclustera"><a name="testing">Testing the Cassandra Cluster</a></h3>

<p>To test our Cassandra cluster, we will create a keyspace, a table and a row to one of the nodes, and then we will expect it to be added on the other nodes. Enter Cassandra's command line client:</p>

<pre><code class="language-bash">cqlsh 10.0.0.4  
</code></pre>

<blockquote>
  <p>Note: You may enter the IP address of any of the nodes.</p>
</blockquote>

<pre><code class="language-SQL">CREATE KEYSPACE test WITH replication = {  
    'class': 'SimpleStrategy',
    'replication_factor': '1'
   };

USE test;

CREATE TABLE users (  
 name text, 
 PRIMARY KEY (name));

INSERT INTO users (name) VALUES ('John');  
</code></pre>

<pre><code class="language-SQL">SELECT * FROM users;

 name
------
 John

(1 rows)
</code></pre>

<p>Now check the others nodes:</p>

<pre><code class="language-bash">cqlsh 10.0.0.8  
</code></pre>

<pre><code class="language-SQL">USE test;

SELECT * FROM users;

 name
------
 John

(1 rows)
</code></pre>

<p>The user exists, the cluster is working!</p>

<h3 id="anameload_balancingloadbalancingthecassandraclustera"><a name="load_balancing">Load-Balancing the Cassandra Cluster</a></h3>

<p>An internal load balancer that can be only accessed through your other VMs will be created.</p>

<blockquote>
  <p>The following steps can be done through <a href="https://azure.microsoft.com/en-us/documentation/articles/load-balancer-get-started-ilb-arm-cli/">Azure CLI tools</a> too, but it is less cumbersome using the portal.</p>
</blockquote>

<ol>
<li>Using <strong>Browse</strong>, look for <strong>Load Balancers</strong>.  </li>
<li><p>Click on <strong>Add</strong>. Add a name, choose <strong>Internal</strong> schema, and make sure to choose the right <em>Resource Group</em>.  </p>

<blockquote>
  <p>You might need to refresh the list to see the new load balancer. </p>
</blockquote></li>
<li><p>Click on the new load balancer to browse it.  </p></li>
<li>Select <strong>Probes</strong>. Click on <strong>Add</strong>. Choose the settings you prefer according to the level of service you wish to attain. Make sure to choose <strong>TCP</strong> on port <strong>9042</strong>.  </li>
<li>Choose <strong>Backend Pools</strong>. Click on <strong>Add</strong>. If your virtual machines lie in an availability set, choose it and skip step 6. If not, just press <strong>Save</strong> and perform step 6.  </li>
<li><p>Using Azure CLI we will add the VMs to the load balancer backend pool. Find the load balancer backend pool ID using <code>azure network lb address-pool list --json</code>, then run the following:</p>

<pre><code>azure network nic address-pool add -g "cassandra-group" -n "cass-nic-1" -i "&lt;backend-pool-id&gt;" -l "cassandra-ilb"
azure network nic address-pool add -g "cassandra-group" -n "cass-nic-2" -i "&lt;backend-pool-id&gt;" -l "cassandra-ilb"
azure network nic address-pool add -g "cassandra-group" -n "cass-nic-3" -i "&lt;backend-pool-id&gt;" -l "cassandra-ilb"
azure network nic address-pool add -g "cassandra-group" -n "cass-nic-4" -i "&lt;backend-pool-id&gt;" -l "cassandra-ilb"
</code></pre>

<p>The VMs are now added to the internal load balancer backend pool.</p></li>
<li>Select <strong>Load Balancing Rules</strong>. Click on <strong>Add</strong>. Choose the protocol <strong>TCP</strong> for port and backend ports of <strong>9042</strong>. Choose the probe you created and the backend pool you created.</li>
</ol>

<p>Congratulations. You may now use the internal load balancer IP address at port 9042 to load balance traffic to your Cassandra cluster.</p>]]></content:encoded></item><item><title><![CDATA[Reconfiguing Azure CLI Mode]]></title><description><![CDATA[<p>If by mistake you have changed Azure mode to an unsupported mode, you will not be able to perform any other command until you fix that mode. A message such as this will show:</p>

<pre><code>warn:    No existing command metadata files. Command will run slow.  
error:   ENOENT: no such file or</code></pre>]]></description><link>http://blog.z-proj.com/reconfiguing-azure-cli-mode/</link><guid isPermaLink="false">3d0143cf-d0e9-4823-88e3-1fc9dd3d394b</guid><category><![CDATA[azure]]></category><category><![CDATA[cli]]></category><category><![CDATA[mode]]></category><dc:creator><![CDATA[Zaid Daba'een]]></dc:creator><pubDate>Sun, 06 Mar 2016 11:32:15 GMT</pubDate><content:encoded><![CDATA[<p>If by mistake you have changed Azure mode to an unsupported mode, you will not be able to perform any other command until you fix that mode. A message such as this will show:</p>

<pre><code>warn:    No existing command metadata files. Command will run slow.  
error:   ENOENT: no such file or directory, scandir '/usr/local/lib/node_modules/azure-cli/lib/commands/ARM'  
</code></pre>

<p>To fix this, all what is needed to do is to change the configuration back. This cannot be done using Azure CLI, however it can be done by editing the <code>config.json</code> file.</p>

<pre><code>vim ~/.azure/config.json  
</code></pre>

<p>Change the mode back to <code>arm</code> or <code>asm</code>.</p>]]></content:encoded></item><item><title><![CDATA[Running Ghost with Node v5 (Ubuntu 14.04LTS)]]></title><description><![CDATA[<p><strong>Updated: 13 Apr 16</strong></p>

<p>Ghost is a blogging platform that makes it so easy to set up a really beautiful blog.</p>

<p>As I was setting this up, I went through trouble as Node v5 <a href="http://support.ghost.org/supported-node-versions/">is not supported by Ghost</a>.</p>

<p>I am running node <code>v5.6.0</code> and npm <code>v3.7.</code></p>]]></description><link>http://blog.z-proj.com/running-ghost-with-node-v5/</link><guid isPermaLink="false">7b2c0eb9-2625-436f-8017-27821454e3a4</guid><category><![CDATA[ghost]]></category><category><![CDATA[node]]></category><category><![CDATA[v5]]></category><dc:creator><![CDATA[Zaid Daba'een]]></dc:creator><pubDate>Sat, 27 Feb 2016 13:16:21 GMT</pubDate><content:encoded><![CDATA[<p><strong>Updated: 13 Apr 16</strong></p>

<p>Ghost is a blogging platform that makes it so easy to set up a really beautiful blog.</p>

<p>As I was setting this up, I went through trouble as Node v5 <a href="http://support.ghost.org/supported-node-versions/">is not supported by Ghost</a>.</p>

<p>I am running node <code>v5.6.0</code> and npm <code>v3.7.5</code> which are currently the latest.</p>

<p>To set up Ghost with Node v5, do the following:</p>

<blockquote>
  <p>Use <code>sudo</code> when needed</p>
</blockquote>

<ol>
<li><p>Move to your web directory and create a folder for the blog:</p>

<pre><code>cd /var/www
mkdir blog
cd blog
</code></pre></li>
<li><p>Get the latest Ghost and unzip it:</p>

<pre><code>wget https://ghost.org/zip/ghost-latest.zip
unzip ghost-latest.zip
</code></pre></li>
<li><p>Install for production mode without checking for node version:</p>

<pre><code>GHOST_NODE_VERSION_CHECK=false npm install --production
</code></pre></li>
<li><p>Install <code>sqlite3</code> v3.1.0 locally:  </p>

<blockquote>
  <p>Note: In Ghost >=0.7.8, step 4 is not needed anymore.</p>
</blockquote>

<pre><code>npm install sqlite3@3.1.0
</code></pre></li>
<li><p>Run your Ghost in production mode without checking for node version:</p>

<pre><code>GHOST_NODE_VERSION_CHECK=false npm start --production
</code></pre></li>
<li><p>It should run fine, as it just did with me. Copy the configuration and edit it as needed:</p>

<pre><code>cp config.example.js config.js
vim config.js
</code></pre></li>
<li><p>To run it in a service deamon:</p>

<pre><code>GHOST_NODE_VERSION_CHECK=false NODE_ENV=production forever start index.js
</code></pre></li>
</ol>

<h3 id="settingupnginxserverblockforghost">Setting up nginx server block for Ghost</h3>

<p>After setting up Ghost over a port, one could use nginx to proxy pass the port to a subdomain.</p>

<ol>
<li><p>Create a new server block in <code>conf.d</code> or <code>sites-available</code> (depending on what you use):</p>

<pre><code>cd /etc/nginx/conf.d
touch blog.conf
</code></pre></li>
<li><p>Edit your server block as follows:</p>

<pre><code>server {
   listen 80;
   server_name blog.z-proj.com;
   access_log /var/log/nginx/blog.log;


   location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header HOST $http_host;
      proxy_set_header X-NginX-Proxy true;
      proxy_pass http://127.0.0.1:3010;
      proxy_redirect off;
   }
}
</code></pre>

<p>Edit the subdomain and the port as needed.</p></li>
<li><p>Reload nginx configuration:</p>

<pre><code>sudo nginx -s reload
</code></pre></li>
</ol>

<p>Your blog should be now available at your subdomain. </p>

<h3 id="settingupserviceupstart">Setting up service upstart</h3>

<p>To set the service to start when your server boots up, do the following:</p>

<ol>
<li><p>Create a new <code>init.d</code> script:</p>

<pre><code>sudo curl https://raw.githubusercontent.com/TryGhost/Ghost-Config/master/init.d/ghost \
-o /etc/init.d/ghost
</code></pre></li>
<li><p>Allow it to run as a script:</p>

<pre><code>sudo chmod +x /etc/init.d/ghost
</code></pre></li>
<li><p>Edit the contents to match your directories:</p>

<pre><code>sudo vim /etc/init.d/ghost


GHOST_ROOT=/var/www/blog
GHOST_GROUP=www-data
GHOST_USER=ubuntu
export GHOST_NODE_VERSION_CHECK=false NODE_ENV=production
</code></pre></li>
<li><p>Stop forever if it is still running, and start the blog using the <code>init.d</code> script:</p>

<pre><code>sudo service ghost start
</code></pre></li>
<li><p>Set it to run at system start:</p>

<pre><code>sudo update-rc.d ghost defaults
sudo update-rc.d ghost enable
</code></pre></li>
</ol>

<p>Your blog setup is now complete.</p>

<blockquote>
  <p>I have also written a Ghost init.d script for Centos 7.0. You can find it <a href="https://gist.github.com/zaiddabaeen/5bcf60d47ae0c903cfd5">here</a>.</p>
</blockquote>]]></content:encoded></item></channel></rss>