How to open a port on Centos 7

Today I need to open a port on my Centos 7 box and I’m glad I know nothing but iptables which is give me ‘silent’ result 🙂 . After digging a few command from Redhat documentation I found its extremely easy.

As usual I make my note here for my future reference in case I need copy and paste method :-).

Centos 7 comes with firewalld by default. Its use firewall-cmd . For my need to open port 8082 tcp then I just need to type :

firewall-cmd –get-active-zones

interfaces: eth0

Yes, I only have ‘public’ zone.

To open port 8082 :

firewall-cmd –zone=public –add-port=8082/tcp –permanent


Save it.

firewall-cmd –reload

To check if this port (8082) is opened :

firewall-cmd –zone=public –list-all

public (default, active)
interfaces: eth0
services: dhcpv6-client http ssh
ports: 3306/tcp 53/udp 8082/tcp
masquerade: no
rich rules:

Yes, 8082 listed.

Very neat in my opinion 🙂


systemctl status firewalld

firewall-cmd –state

for check if the service (firewalld) run

Fix error: could not open file /var/lib/pacman/sync/apricity-core.db: Unrecognized archive format error

I don’t know what I’ve done when I want to upgrade android studio on my apricity box. The error is clear :

error: could not open file /var/lib/pacman/sync/apricity-core.db: Unrecognized archive format

The solution actually easy 🙂

# rm -R /var/lib/pacman/sync/

and then

# pacman -Syuf

save and still see error 🙂

Well, all solved after follow this guide carefully.

Case closed!

Install Ionic on Apricity OS

I need to get the fastest solution for push notification and my preference tool for my case is Ionic. Being apricity os user then I try to test it with ‘edge’ resources 🙂

Install NodeJs Ionic

yaourt -S nodejs-ionic

Check its result :

npm -v

ionic -v

Dependency warning – for the CLI to run correctly,
it is highly recommended to install/upgrade the following:

Please install your Cordova CLI to version  >=4.2.0 `npm install -g cordova`


Ionic CLI is out of date:
* Locally installed version: 1.7.16
* Latest version: 2.0.0
* Run npm install -g ionic to update


Upgrade cordova

sudo npm install -g cordova

cordova -v

Test project

ionic start hello tabs

? (node:28243) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Creating Ionic app in folder /home/alamsyahr/ionic/hello based on tabs project
[=============================]  100%  0.0s
[=============================]  100%  0.0s
Updated the hooks directory to have execute permissions
Update Config.xml
Initializing cordova project

? ? ? ?  Your Ionic app is ready to go! ? ? ? ?

Ups, another problem.

Check version

npm info graceful-fs | grep version
version: ‘4.1.6’

Add android platform

ionic add platform android

? (node:30090) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

You must have bower installed to continue.
Type `npm install -g bower` (CLI v1.7.16)

Your system information:

Cordova CLI: 6.3.1
Ionic Framework Version: 1.3.1
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
OS: Distributor ID:    Arch Description:    Arch Linux
Node Version: v6.5.0

Ok, instal bower

sudo npm install -g bower

Back to android

ionic add platform android

WARN: ionic.project has been renamed to ionic.config.json, please rename it.
This command has been deprecate.  All resources are currently available in NPM and we recommend that you use NPM to manage these.
More information is available here:

Well, I think I should wait for Ionic 2 or using something else now 😉

Fix error install phalconphp 3

Since I use Apricity and its arch linux ‘blood’ make me use latest php version (php 7.0.9 in time of writing) then I can’t get latest phalconphp (version 2). Finally I see phalconphp 3 released. I got little problem to install it but at least i know the error is in my side.

/tmp/yaourt-tmp-alamsyahr/aur-php-phalcon/src/cphalcon-3.0.0/build/php5/64bits/phalcon.zep.c:203:30: fatal error: ext/spl/spl_heap.h: No such file or directory
#include <ext/spl/spl_heap.h>
compilation terminated.
make: *** [Makefile:164: phalcon.lo] Error 1
==> ERROR: A failure occurred in build().
==> ERROR: Makepkg was unable to build php-phalcon.
==> Restart building php-phalcon ? [y/N]
==> ————————————
==> y
==> Edit PKGBUILD ? [Y/n] (“A” to abort)
==> ————————————

==> php-phalcon dependencies:
– php>=5.5 (already installed)
– gcc (already installed) [makedepend]

==> Continue building php-phalcon ? [Y/n]
==> ————————————-
==> n

php-config –version
?  ~
?  ~ php -v
PHP 7.0.9 (cli) (built: Jul 20 2016 17:12:28) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
?  ~ whereis php-config
php-config: /usr/bin/php-config /usr/local/bin/php-config /usr/share/man/man1/php-config.1.gz
?  ~ /usr/bin/php-config –version
?  ~ /usr/local/bin/php-config –version

Need to fix 5.2.17 version 🙂

ls -l /usr/local/bin | grep php-config
-rwxr-xr-x 1 root root     2104 Apr 18 15:39 php-config

sudo rm /usr/local/bin/php-config
rm: remove write-protected regular file ‘/usr/local/bin/php-config’? y


php-config –version

Yes, the error came since the output of php-config –version is 5.2.17 just remove it and I can continue for the ride 🙂

in PHP | 255 Words

How to Install Kotlin Language in Apricity Linux

Today I stumble upon a new language that looks promising in the future. Yes, its Kotlin Language. The syntax very ‘industrial minded’ in my opinion but I like it. I have put these 2 books for my next to buy for future reference :

Kotlin for Android Developers: Learn Kotlin the easy way while developing an Android App

Published by Createspace, on demand book publisher from Amazon. So far the book got 3 average reviews but I believe its enough for newbie android developer that looking for ‘other’ way than facing java in beginning 🙂

Kotlin in Action

Published by Manning, well known publisher. So far the book not released yet but the book author also developer of Kotlin.

Ups, back to installation. Lets get start!

Install Kotlin in Linux

$ curl -s “” | bash

$ source “/home/alamsyahr/.sdkman/bin/”

$ sdk help

==== BROADCAST =================================================================
* 25/07/16: Groovyserv 1.1.0 released on SDKMAN! #groovyserv
* 21/07/16: Grails 3.2.0.M2 released on SDKMAN! #grailsfw
* 18/07/16: Gradle 2.14.1 released on SDKMAN! #gradle

Usage: sdk <command> [candidate] [version]
sdk offline <enable|disable>

install   or i    <candidate> [version]
uninstall or rm   <candidate> <version>
list      or ls   [candidate]
use       or u    <candidate> [version]
default   or d    <candidate> [version]
current   or c    [candidate]
outdated  or o    [candidate]
version   or v
broadcast or b
help      or h
offline           [enable|disable]
selfupdate        [force]
flush             <candidates|broadcast|archives|temp>

candidate  :  the SDK to install: groovy, scala, grails, akka, etc.
use list command for comprehensive list of candidates
eg: $ sdk list

version    :  where optional, defaults to latest stable if not provided
eg: $ sdk install groovy

$ sdk install kotlin
==== INTERNET NOT REACHABLE! ===============================

Some functionality is disabled or only partially available.
If this persists, please enable the offline mode:

$ sdk offline


This command is not available while offline.

$ sdk install kotlin

==== BROADCAST =================================================================
* 26/07/16: Gaiden 1.1 released on SDKMAN! #gaiden
* 25/07/16: Groovyserv 1.1.0 released on SDKMAN! #groovyserv
* 21/07/16: Grails 3.2.0.M2 released on SDKMAN! #grailsfw

Downloading: kotlin 1.0.3

In progress…

######################################################################## 100.0%

Installing: kotlin 1.0.3
Done installing!

Do you want kotlin 1.0.3 to be set as default? (Y/n): y

Setting kotlin 1.0.3 as default.

Testing if Kotlin Present in System

$ kotlin -version

Kotlin version 1.0.3 (JRE 1.8.0_102-b14)

$ kotlinc -version

info: Kotlin Compiler version 1.0.3

Looks great. I can follow next step in manual 🙂