<?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[Linux - All your code are belong to us]]></title><description><![CDATA[Thoughts, stories and ideas on code and technology in general.<br>Blog title inspired by <a href="https://en.wikipedia.org/wiki/All_your_base_are_belong_to_us" target="_blank">this meme</a>]]></description><link>https://allurcode.com/</link><image><url>https://allurcode.com/favicon.png</url><title>Linux - All your code are belong to us</title><link>https://allurcode.com/</link></image><generator>Ghost 4.48</generator><lastBuildDate>Tue, 09 Jun 2026 08:52:01 GMT</lastBuildDate><atom:link href="https://allurcode.com/tag/linux/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Install any version of NodeJS and npm on Raspberry Pi]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>Or simply put, easily switch between versions of NodeJS on any Linux based system. There are two most popular Node version managers. One, my personal favourite is <a href="https://github.com/tj/n">n package</a>, the other one is <a href="https://github.com/nvm-sh/nvm">nvm</a>.</p>
<h2 id="n">n</h2>
<p>For me the easiest way is to use <code>n</code> package. Just install whatever Node version</p>]]></description><link>https://allurcode.com/install-any-version-of-nodejs-and-npm-on-raspberry-pi/</link><guid isPermaLink="false">5b7b0aa2b52b43084c9ea14c</guid><category><![CDATA[nodejs]]></category><category><![CDATA[Raspberry Pi]]></category><category><![CDATA[npm]]></category><category><![CDATA[Linux]]></category><dc:creator><![CDATA[Wojtek]]></dc:creator><pubDate>Sat, 20 Jun 2020 17:51:00 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>Or simply put, easily switch between versions of NodeJS on any Linux based system. There are two most popular Node version managers. One, my personal favourite is <a href="https://github.com/tj/n">n package</a>, the other one is <a href="https://github.com/nvm-sh/nvm">nvm</a>.</p>
<h2 id="n">n</h2>
<p>For me the easiest way is to use <code>n</code> package. Just install whatever Node version your official distribution ships with.</p>
<pre><code class="language-bash">sudo yum install nodejs
</code></pre>
<p>or, depending on what Linux you&apos;re using.</p>
<pre><code class="language-bash">sudo apt-get install nodejs
</code></pre>
<p>Then install <code>n</code> as a global package.</p>
<pre><code class="language-bash">sudo npm install -g n

/usr/local/bin/n -&gt; /usr/local/lib/node_modules/n/bin/n
+ n@6.5.1
added 1 package from 4 contributors in 0.201s
</code></pre>
<p>Done, it was that easy. Now install the version of node you want to use:</p>
<pre><code class="language-bash">sudo n lts &lt;--- latest LTS official release
sudo n latest &lt;--- latest official release
sudo n stable &lt;--- stable official release
sudo n 10.16.0 &lt;--- specific version
</code></pre>
<p>Execute <code>n</code> on its own to view your downloaded versions, and install the selected one.</p>
<pre><code class="language-bash">n

    node/8.11.2
    node/10.14.2
    node/10.15.0
    node/10.16.0
  &#x3BF; node/12.18.1

Use up/down arrow keys to select a version, return key to install, d to delete, q to quit
</code></pre>
<h2 id="nvm">nvm</h2>
<p>Run the official <a href="https://github.com/nvm-sh/nvm/blob/v0.35.3/install.sh">install script</a> by executing one of below commands:</p>
<pre><code class="language-bash">curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
</code></pre>
<pre><code class="language-bash">wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
</code></pre>
<p>Rerun Profile script to start NVM</p>
<pre><code class="language-bash">source ~/.bashrc
</code></pre>
<p>Now <code>nvm</code> should be running and you can confirm it by running below</p>
<pre><code class="language-bash">nvm

Node Version Manager (v0.35.3)
</code></pre>
<p>If everything went fine, make <code>nvm</code> use your currently installed Node version</p>
<pre><code class="language-bash">nvm use system

Now using system version of node: v8.11.2 (npm v6.9.0)
</code></pre>
<p>List available versions using</p>
<pre><code class="language-bash">nvm ls-remote
</code></pre>
<p>Install the latest release of node</p>
<pre><code class="language-bash">nvm install node &lt;--- latest version
nvm install 10.16.0 &lt;--- specific version
</code></pre>
<p>If after exiting console and logging in again <code>nvm</code> is not a recognised command, you&apos;ll need to add <code>source ~/.bashrc</code> to your <code>.profile</code> or <code>.bash_profile</code> file to make sure it&apos;s automatically run on every login. A good explanation of what&apos;s going on, can be found <a href="https://apple.stackexchange.com/questions/12993/why-doesnt-bashrc-run-automatically#comment13715_13019">here</a>.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[How to make sure service is running after restart]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>If you want to avoid situation when after server restart you have to start lots of services manually, a little thing like <code>chkconfig</code> would come in handy.<br>
First you might want to take a look at a list of services handled by <em>chkconfig</em>:</p>
<pre><code class="language-bash">chkconfig --list
</code></pre>
<p>You should see something like</p>]]></description><link>https://allurcode.com/how-to-make-sure-service-is-running-after-restart/</link><guid isPermaLink="false">5b7b0aa2b52b43084c9ea11c</guid><category><![CDATA[bash]]></category><category><![CDATA[chkconfig]]></category><category><![CDATA[Linux]]></category><dc:creator><![CDATA[Wojtek]]></dc:creator><pubDate>Wed, 24 Mar 2010 20:18:09 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>If you want to avoid situation when after server restart you have to start lots of services manually, a little thing like <code>chkconfig</code> would come in handy.<br>
First you might want to take a look at a list of services handled by <em>chkconfig</em>:</p>
<pre><code class="language-bash">chkconfig --list
</code></pre>
<p>You should see something like this:</p>
<pre><code class="language-bash">mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
named 0:off 1:off 2:off 3:on 4:off 5:off 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
</code></pre>
<p>To add for example mysql to autostart list simply type:</p>
<pre><code class="language-bash">chkconfig --add mysql on
</code></pre>
<p>To remove a service from autostart list type:</p>
<pre><code class="language-bash">chkconfig --del mysql
</code></pre>
<p>For full list of <code>chkconfig</code> options go <a href="http://linuxcommand.org/man_pages/chkconfig8.html">here</a>.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[How to run memcache in PHP]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>After installing <a href="https://allurcode.com/how-to-install-memcached-on-centos/"><strong>memcached</strong></a> daemon, we have to install memcache PHP extension.</p>
<pre><code class="language-bash">yum install php-pecl-memcache
</code></pre>
<p>or</p>
<pre><code class="language-bash">apt-get install php5-memcache
</code></pre>
<p>If above is not an option try below method.</p>
<pre><code class="language-bash">pecl install memcache
</code></pre>
<p>After successful installation add <code>memcache.so</code> extension to your <code>php.ini</code> file.</p>
<pre><code class="language-bash">vim /etc/php.ini
</code></pre>
<p>Add this line:</p>
<pre><code>extension=</code></pre>]]></description><link>https://allurcode.com/how-to-run-memcache-in-php/</link><guid isPermaLink="false">5b7b0aa2b52b43084c9ea11a</guid><category><![CDATA[CentOS]]></category><category><![CDATA[Linux]]></category><category><![CDATA[memcache]]></category><category><![CDATA[PHP]]></category><dc:creator><![CDATA[Wojtek]]></dc:creator><pubDate>Sat, 13 Mar 2010 01:51:11 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>After installing <a href="https://allurcode.com/how-to-install-memcached-on-centos/"><strong>memcached</strong></a> daemon, we have to install memcache PHP extension.</p>
<pre><code class="language-bash">yum install php-pecl-memcache
</code></pre>
<p>or</p>
<pre><code class="language-bash">apt-get install php5-memcache
</code></pre>
<p>If above is not an option try below method.</p>
<pre><code class="language-bash">pecl install memcache
</code></pre>
<p>After successful installation add <code>memcache.so</code> extension to your <code>php.ini</code> file.</p>
<pre><code class="language-bash">vim /etc/php.ini
</code></pre>
<p>Add this line:</p>
<pre><code>extension=memcache.so
</code></pre>
<p>Restart web server</p>
<pre><code class="language-bash">service httpd restart
</code></pre>
<p>Test out our installation.</p>
<pre><code class="language-bash">&lt;?php
$memcache = new Memcache;
$memcache-&gt;connect(&apos;localhost&apos;, 11211) or die (&apos;Can\&apos;t connect!&apos;);
$version = $memcache-&gt;getVersion();
echo &apos;Server version: &apos;.$version;
</code></pre>
<p>You should see your server&#x2019;s version number. If you see a blank page make sure that <a href="https://allurcode.com/how-to-install-memcached-on-centos/">memcached</a> daemon is working. If you&#x2019;re getting &quot;Can&#x2019;t connect!&quot; message despite running daemon try changing &apos;localhost&apos; to &apos;127.0.0.1&apos;.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[How to install memcached on CentOS]]></title><description><![CDATA[<!--kg-card-begin: markdown--><h3 id="installdependancy">Install dependancy</h3>
<p>Before we install <strong>memcached</strong> we need a dependency library <strong>libevent</strong>. Check for latest stable version at <a href="https://monkey.org/~provos/libevent/">https://monkey.org/~provos/libevent/</a></p>
<pre><code class="language-bash">cd /usr/local/src
wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz
tar -xzvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure --prefix=</code></pre>]]></description><link>https://allurcode.com/how-to-install-memcached-on-centos/</link><guid isPermaLink="false">5b7b0aa2b52b43084c9ea119</guid><category><![CDATA[bash]]></category><category><![CDATA[CentOS]]></category><category><![CDATA[libevent]]></category><category><![CDATA[Linux]]></category><category><![CDATA[memcached]]></category><dc:creator><![CDATA[Wojtek]]></dc:creator><pubDate>Sat, 13 Mar 2010 01:28:50 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h3 id="installdependancy">Install dependancy</h3>
<p>Before we install <strong>memcached</strong> we need a dependency library <strong>libevent</strong>. Check for latest stable version at <a href="https://monkey.org/~provos/libevent/">https://monkey.org/~provos/libevent/</a></p>
<pre><code class="language-bash">cd /usr/local/src
wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz
tar -xzvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure --prefix=/usr/local
make
make install
cd ..
</code></pre>
<h3 id="installmemcached">Install memcached</h3>
<p>Check for latest stable version at <a href="https://memcached.org/">https://memcached.org/</a></p>
<pre><code class="language-bash">wget http://memcached.googlecode.com/files/memcached-1.4.4.tar.gz
tar -xzvf memcached-1.4.4.tar.gz
cd memcached-1.4.4
LDFLAGS=&apos;-Wl,--rpath /usr/local/lib&apos;
./configure --prefix=/usr/local
make
make install
</code></pre>
<p>More information about LDFLAGS <a href="https://en.wikipedia.org/wiki/Linker">https://en.wikipedia.org/wiki/Linker</a></p>
<h3 id="runmemcachedasadaemon">Run memcached as a daemon</h3>
<p>Basic options: d = daemon, m = memory, u = user, l = IP to listen to, p = port</p>
<pre><code class="language-bash">memcached -u root -d
</code></pre>
<p>or</p>
<pre><code class="language-bash">memcached -u root -d -m 512 -l 127.0.0.1 -p 11211
</code></pre>
<p>To stop daemon type</p>
<pre><code class="language-bash">pkill memcached
</code></pre>
<p>Now we&#x2019;re off to installing <a href="https://allurcode.com/how-to-run-memcache-in-php/">php extension memcache</a>.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Install xmpppy on CentOS]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>xmpppy is a Python library allowing you to send messages from your server to any Jabber enabled communicator.<br>
Firstly download and unpack <a href="http://xmpppy.sourceforge.net/">xmpppy</a> to a local directory. Next go into the unpacked directory and run:</p>
<pre><code class="language-bash">python setup.py install
</code></pre>
<p>Next you need a script that will do the sending. Use</p>]]></description><link>https://allurcode.com/install-xmpppy-on-centos/</link><guid isPermaLink="false">5b7b0aa2b52b43084c9ea113</guid><category><![CDATA[bash]]></category><category><![CDATA[jabber]]></category><category><![CDATA[Linux]]></category><category><![CDATA[xmpppy]]></category><dc:creator><![CDATA[Wojtek]]></dc:creator><pubDate>Thu, 23 Apr 2009 17:27:01 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>xmpppy is a Python library allowing you to send messages from your server to any Jabber enabled communicator.<br>
Firstly download and unpack <a href="http://xmpppy.sourceforge.net/">xmpppy</a> to a local directory. Next go into the unpacked directory and run:</p>
<pre><code class="language-bash">python setup.py install
</code></pre>
<p>Next you need a script that will do the sending. Use your favourite text editor to create file i.e.:</p>
<pre><code class="language-bash">vim xsend.py
</code></pre>
<p>Just paste below script which was taken from original site. Create another jabber account that you&#x2019;ll send messages from and remember to change values in line 20 to those new login details.</p>
<pre><code class="language-python">#!/usr/bin/python
# $Id: xsend.py,v 1.8 2006/10/06 12:30:42 normanr Exp $ 
import sys,os,xmpp,time
if len(sys.argv) &lt; 2:
    print &quot;Syntax: xsend JID text&quot;
    sys.exit(0)

tojid=sys.argv[1]
text=&apos; &apos;.join(sys.argv[2:])

jidparams={}
if os.access(os.environ[&apos;HOME&apos;]+&apos;/.xsend&apos;,os.R_OK):
    for ln in open(os.environ[&apos;HOME&apos;]+&apos;/.xsend&apos;).readlines():
        if not ln[0] in (&apos;#&apos;,&apos;;&apos;):
            key,val=ln.strip().split(&apos;=&apos;,1)
            jidparams[key.lower()]=val
for mandatory in [&apos;jid&apos;,&apos;password&apos;]:
    if mandatory not in jidparams.keys():
        open(os.environ[&apos;HOME&apos;]+&apos;/.xsend&apos;,&apos;w&apos;).write(&apos;#Uncomment fields before use and type in correct credentials.\n#JID=romeo@montague.net/resource (/resource is optional)\n#PASSWORD=juliet\n&apos;)
        print &apos;Please point ~/.xsend config file to valid JID for sending messages.&apos;
        sys.exit(0)

jid=xmpp.protocol.JID(jidparams[&apos;jid&apos;])
cl=xmpp.Client(jid.getDomain(),debug=[])

con=cl.connect()
if not con:
    print &apos;could not connect!&apos;
    sys.exit()
print &apos;connected with&apos;,con
auth=cl.auth(jid.getNode(),jidparams[&apos;password&apos;],resource=jid.getResource())
if not auth:
    print &apos;could not authenticate!&apos;
    sys.exit()
print &apos;authenticated using&apos;,auth

#cl.SendInitPresence(requestRoster=0)   # you may need to uncomment this for old server
id=cl.send(xmpp.protocol.Message(tojid,text))
print &apos;sent message with id&apos;,id

time.sleep(1)   # some older servers will not send the message if you disconnect immediately after sending

#cl.disconnect()
</code></pre>
<p>All you need to do now is to run the script &#x1F642; First run will create a file in your home directory which should contain username and password from line 20. Second run should accually send the message.</p>
<pre><code class="language-bash">./xsend.py your_main_jabber@your_jabber.com Hello world!
</code></pre>
<p>Now set up your monitoring scripts that will send you jabber messages when something goes wrong.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item></channel></rss>