Category Archives: installing

Installing Comodo Positive SSL Certs on Apache

Recently, I purchased Comodo Positive SSL for one of my web. Since this is my new experience on installing SSL onto Apache, I write this article so that anyone can refer to this step and also as my personal note.

  1. Before you install the certificates, you need to set up your virtual hosts and Apache configuration.
    In /etc/apache2/ports.conf add this line:
NameVirtualHost *:443

So the ports.conf will be something like this:

NameVirtualHost *:80
Listen 80

NameVirtualHost *:443
  1. Then in your vhost file which is usually located at /etc/apache2/sites-enabled/default-ssl, edit or make sure this line is there:
<VirtualHost _default_:443>

SSLEngine on
SSLCertificateFile    /etc/ssl/crt/www_your_domainname_org.crt
SSLCertificateKeyFile /etc/ssl/crt/private.key
SSLCACertificatePath /etc/ssl/crt/
SSLCACertificateFile /etc/ssl/crt/www_your_domainname_org.cer

SSLCertificateFile
This is the actual SSL certificate. Comodo will name it after your domain e.g. www_your_domainname_org.crt. So just copy the file into the correct directory /etc/ssl/crt/ and make sure your vhost file points to it.

SSLCertificateKeyFile
When you first generated your CSR to send to the commercial SSL issuer you should have gotten a key file. You just need to move it into the same folder as your SSL cert if it’s not there already and point the line to your vhost config.

SSLCACertificateFile
Comodo sends you that zip file with 3 individual CRT files in it you need to combine a couple of them into one file. You can ignore the file named after your domain and just focus on the other two. You need to combine them into one file in a very specific order.

Run this command to generate a file that matches your vhost config, remembering to change the file names to whatever the SSL issuer has given you:

cat PositiveSSLCA2.crt AddTrustExternalCARoot.crt > www_your_domainname_org.cer

Then, restart your server:

sudo a2enmod ssl
sudo service apache2 restart

ODROID U2 – Flashing Images on Mac OS X

  1. Download the image of the OS you want to boot on your ODROID to the local disk of your Mac

  2. If the Image is compressed, unpack it (if it is in ‘.xz’ format you need a tool like The Unarchiver to be able to unpack it)

  3. Insert your SD card and check the currently mounted filesystems

gh0st:Downloads zer0$ df -h
Filesystem      Size   Used  Avail Capacity  iused    ifree %iused  Mounted on
/dev/disk0s2   371Gi  270Gi  100Gi    73% 70913436 26254530   73%   /
devfs          200Ki  200Ki    0Bi   100%      694        0  100%   /dev
map -hosts       0Bi    0Bi    0Bi   100%        0        0  100%   /net
map auto_home    0Bi    0Bi    0Bi   100%        0        0  100%   /home
/dev/disk1s1   7.4Gi  2.5Mi  7.4Gi     1%        0        0  100%   /Volumes/UNTITLED

*Note the name of the filesystem that Mac OS X assigned to the mounted SD card (in my case /dev/disk2s1)

  1. Unmount that filesystem so that you will be allowed to overwrite the disk:
gh0st:Downloads zer0$ sudo diskutil unmount /dev/disk1s1
Volume UNTITLED on disk1s1 unmounted
  1. Using the device name of the filesystem work out the raw device name for the entire SD card, by omitting the final “s1” and replacing “disk” with “rdisk” (Important: you will lose all data on the hard drive on your computer if you get the wrong device name). Make sure the device name is the name of the whole SD card as described above, not just a partition of it (for example, rdisk3, not rdisk3s1. Similarly you might have another SD drive name/number like rdisk2 or rdisk4, etc. — recheck by using the df -h command both before & after you insert your SD card reader into your Mac if you have any doubts!):
    In my case, since the device name of the mounted filesystem is /dev/disk2s1 the entire SD card has the device name /dev/rdisk2

  2. Write the image to the card with the dd command, using the raw disk device name from above (read carefully the above step, to be sure you use the correct rdisk# here!)

gh0st:Downloads zer0$ sudo dd bs=1m if=odroid-debian-wheezy-u2.img of=/dev/rdisk1
7260+0 records in
7260+0 records out
7612661760 bytes transferred in 709.578823 secs (10728423 bytes/sec)

*(note that dd will not output any information until there is an error or it is finished)

  1. When dd finished successfully it will display some information and the SD card will be re-mounted. You can now eject the card:
gh0st:Downloads zer0$ sudo diskutil eject /dev/rdisk1
Disk /dev/rdisk1 ejected
  1. Remove the SD card from the card reader and put it in the ODROID to boot your new OS image

MongoDB on Raspberry Pi

Recently, I want to install MongoDB in my Rasp Pi. But unfortunately, I can’t install MongoDB via apt-get because Rasp Pi is using ARM architecture.

Maybe we can compile it from source code. Yes. We can. But MongoDB source is very x86 specific, meaning the newest version isn’t available for ARM architecture.

But… Thanks to this owsem patches from Per Ola Ingvarsson on Github at https://github.com/skrabban/mongo-nonx86, now we can compile MongoDB on Rasp Pi. Yeay!

So, to build MongoDB on your RaspberryPi:
Install the required packages:

sudo apt-get install git-core build-essential scons libpcre++-dev xulrunner-dev libboost-dev libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev

Clone the Github repo:

git clone https://github.com/skrabban/mongo-nonx86

Now let’s compile it! (*Note that these two steps take a very very long time on a Rasp Pi. So I left mine for 1 day for this.)

cd mongo-nonx86
scons
sudo scons --prefix=/opt/mongo install

Done! You have MongoDB installed on your Rasp Pi.

This will install mongo in /opt/mongo, to get other programs to see it, you can add this dir to your $PATH:

PATH=$PATH:/opt/mongo/bin/
export PATH

Installing Nginx, MySQL & PHP5 (PHP5-FPM) on Ubuntu 12.04 LTS

Installing Nginx, MySQL & PHP5 (And PHP5-FPM) a.k.a (LEMP) On Ubuntu 12.04 LTS

1. Update & upgrade your OS first;

apt-get update
apt-get upgrade

  1. Install Myssql & PHP5-FPM;

apt-get install mysql-server mysql-client php5-fpm

  1. Install Nginx webserver

apt-get install nginx

  1. Start your Nginx!

/etc/init.d/nginx start

or

service nginx start

Try access your web via localhost or via ip
e.g. 127.0.0.1, 192.168.1.1

5. Edit nginx config file;

vi /etc/nginx/nginx.conf

Adjust worker proc & keepalive accordingly;

[…]
    worker_processes    4;
[…]
    keepalive_timeout    2;
[…]

  1. Edit the virtual host config;

vi /etc/nginx/sites-available/default

[…]
server {
        listen   80; ## listen for ipv4; this line is default and implied
        listen   [::]:80 default ipv6only=on; ## listen for ipv6 if any

        root /usr/share/nginx/www; # you can change to any path you want
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to index.html
                try_files $uri $uri/ /index.html;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location /doc/ {
                alias /usr/share/doc/;
                autoindex on;
                allow 127.0.0.1;
                deny all;
        }

        # Only for nginx-naxsi : process denied requests
        #location /RequestDenied {
                # For example, return an error code
                #return 418;
        #}

        #error_page 404 /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/www;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ .php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+.php)(/.+)$;
                #fastcgi_pass fastcgi_pass 127.0.0.1:9000;
                fastcgi_pass unix:/tmp/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache’s document root
        # concurs with nginx’s one
        #
        location ~ /.ht {
                deny all;
        }
}
[…]

  1. Reload the config file

/etc/init.d/nginx reload

  1. Install nessary file

apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-xcache

  1. Now reload PHP-FPM:

/etc/init.d/php5-fpm reload

  1. Test your nginx;

vi /usr/share/nginx/www/info.php

Paste this line below;

phpinfo();
?>

  1. Try access that file via web browser
    http:///info.php

    It will show info include mysql module

    Making PHP-FPM Use A Unix Socket
    By default PHP-FPM is listening on port 9000 on 127.0.0.1. It is also possible to make PHP-FPM use a Unix socket which avoids the TCP overhead. To do this, open /etc/php5/fpm/pool.d/www.conf.

    12. Edit file

vi /etc/php5/fpm/pool.d/www.conf

… and make the listen line look as follows:

[…]
;listen = 127.0.0.1:9000
listen = /tmp/php5-fpm.sock
[…]

  1. Then reload PHP-FPM:

/etc/init.d/php5-fpm reload

Done!. Hope it helps. 🙂

Monitor your Ubuntu system with conky

Conky can display this info either as text, or using simple progress bars and graph widgets, with different fonts and colours.

So here I want to share steps required to install & configure conky. Here I’m using Ubuntu 10.04 as my OS.

First, install conky via apt-get.

sudo apt-get install conky
Then, create new conky configuration file
gedit ~/.conkyrc

Paste the code below to .conkyrc file

# UBUNTU-CONKY
# A comprehensive conky script, configured for use on
# Ubuntu / Debian Gnome, without the need for any external scripts.
#
# Based on conky-jc and the default .conkyrc.
# INCLUDES:
# – tail of /var/log/messages
# – netstat connections to your computer
#
# — Pengo ([email protected])
#

# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# fiddle with window
use_spacer yes
use_xft no

# Update interval in seconds
update_interval 3.0

# Minimum size of text area
# minimum_size 250 5

# Draw shades?
draw_shades no

# Text stuff
draw_outline no # amplifies text if yes
draw_borders no
font arial
uppercase no # set to yes if you want all text to be in uppercase

# Stippled borders?
stippled_borders 3

# border margins
border_margin 9

# border width
border_width 10

# max width conky
maximum_width 220

# Default colors and also border colors, grey90 == #e5e5e5
default_color black

own_window_colour brown
own_window_transparent true

# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
gap_x 10
gap_y 20

# stuff after ‘TEXT’ will be formatted on screen

TEXT
$color
${color orange}SYSTEM ${hr 2}$color
$nodename $sysname $kernel on $machine

${color orange}CPU ${hr 2}$color
${freq}MHz Load: ${loadavg} Temp: ${acpitemp}
$cpubar
${cpugraph 000000 ffffff}
NAME ${alignr} PID% ${alignr} CPU% ${alignr} MEM%
${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}

${color orange}MEMORY / DISK ${hr 2}$color
RAM: $memperc% ${membar 6}$color
Swap: $swapperc% ${swapbar 6}$color

root: ${fs_free_perc /}% ${fs_bar 6 /}$color
sda1: ${fs_free_perc /dev/sda1}% ${fs_bar 6 /dev/sda1}$color

${color orange}NETWORK (${addr eth1}) ${hr 2}$color
Down: $color${downspeed eth1}k/s ${alignr} Up: ${upspeed eth1}k/s
${downspeedgraph eth1 25,100 000000 ff0000} ${alignr} ${upspeedgraph eth1 25,100 000000 00ff00}$color
Total: ${totaldown eth1} ${alignr} Total: ${totalup eth1}
Inbound: ${tcp_portmon 1 32767 count} ${alignr} Outbound: ${tcp_portmon 32768 61000 count}
#Total: ${tcp_portmon 1 65535 count}

${color orange}LOGGING ${hr 2}$color
${execi 30 tail -n3 /var/log/messages | fold -w50}

#${color orange}FORTUNE ${hr 2}$color
#${execi 120 fortune -s | fold -w50}

After that, save that file.
On the terminal, type in “conky“, it’ll appear something like this:

Then, we want to make this conky autorun when login.
Go to System/Preferences/Startup Applications.Click on Add, type a name as you want e.g. “Conky” and “/usr/bin/conky” in command area (without quotes).

After that, try restart & login to your account. See your conky on your desktop.

Diskscrub – Erase your drive until unable to recover

Diskcrub

scrub overwrites hard disks, files, and other devices with repeating patterns intended to make recovering data from these devices more difficult. Although physical destruction is unarguably the most reliable method of destroying sensitive data, it is inconvenient and costly. For certain classes of data, organizations may be willing to do the next best thing which is scribble on all the bytes until retrieval would require heroic efforts in a lab.

So, here I share with you the step to install & use this software.
First, get latest diskscrub from code.google.com/p/diskscrub/downloads/list

Then, extract the file using this command;

Then, change the directory to the scrub folder;

To use it, just type into the terminal;

–> where sda2 is point to your drive that you want to erase.
Carefull with your drive name!

You can check you drive using command;
Unix = diskutil list
Linux = fdisk -l

Cara menggunakan SpiceFuse AJAX Shoutbox Beta dekat MyBB v1.6

Bagi sapa-sapa yang selalu setup/bermain-main dengan forum, korang ada tak guna plugin ni?
Korang pernah tak nak try plugin ni? Plugin ni gunanya untuk letakkan shoutbox kat index forum kita. So kawan-kawan kita boleh ‘terjerit-jerit’ kat situ.
Juga nak mempercepatkan pertanyaan. Kalau tak nak kene bukak thread, nak kena tunggu orang reply. Tak ke leceh tu.

Tapikan.. Plugin ni untuk mereka yang setup kan MyBB diorang dengan menggunakan MyBB version 1.4++. Adoi.. Habis bagi mereka yang pakai MyBB versi 1.4 > keatas macam mana?
Mesti tak best kan sebab tak dapat guna. So, kat sini saya nak share kan macam mana kita nak guna SpiceFuse ni kat MyBB versi yang latest-latest. Saya test kat MyBB versi 1.6.

Pertama korang upload dulu plugin ni mengikut tempat dia..
Lepas tu korang edit file “spicefuse_shoutbox.php” ni.
Cari line yang ada tulis macam ni..

Lepas tu korang tukarkan no. 14* tu ke 16*.
Maksudnya 14* tu dia just compatible dengan MyBB versi 1.4 je. Kalau korang tukar 16*, jadi dia compatible dengan MyBB versi 1.6.. :p
Lepas tu korang save kan file tu.

Pergi kat Template Sets, AfreshBlack Templates (ikut theme yang korang pakai), klik kat Options, Expand Templates, dekat Index Page Templates tu korang klik Expand kat belah kanan tu, Cari Index, lepas tu klik Full Edit.
Dekat-dekat situ cari line:

Betul-betul bawah dia tu korang bubuh code ni;

Lepas tu korang save kan file tu. Lepas tu korang try aktifkan plugin tersebut.
Tada.. Da boleh guna da shoutbox korang.. Kalau tak boleh jugak, cuba check bebetul.

Netspeed kat panel Ubuntu.

Assalamualaikum & Salam sejahtera.
Rasanya agak lama juga aku tak jenguk ke blog aku ni.
Kesian dia. Ditinggalkan begitu saja.
Bukan sengaja nak buat macam tu.
Tapi maklumlah. Banyak sangat kerja nak dibuat.
So masa tu kurang nak ada la untuk update blog ni.

Apa-apa pun, untuk entri kali ni,
aku nak sharekan ngan korang macam mana nak install Netspeed ni.
Kalo korang tak tau apa itu Netspeed ni,
korang boleh tengok kat sini.

So, memula sekali kita tulis macam ni.

sudo apt-get install netspeed

dia akan kuar banyak-banyak tulisan kat terminal korang tu.
Maknanya Ubuntu korang tu tengah install Netspeed tu la..

Lepas dah install benda tu,
korang klik kanan kat panel korang tu,
klik kat Add to Panel,
Cari Network Monitor Netspeed Applet.
Pastu korang add kan ke panel korang.

Lepas ni korang dah boleh tengok bape laju speed internet korang.
Tak kiralah samada Wireless or Broadband or LAN.

Bridging Joomla with MyBB

Assalamualaikum dan Salam Sejahtera semua..

Korang pernah tak terpikir macam mana kalau korang ada dua jenis website yang berbeza,
tapi korang nak user2 korang kat kedua-dua belah site tu sama?
Pernah tak korang fikir?

Benda ni jadi kat aku baru-baru ni.
Lepas aku launch kan portal dan forum group aku.
Lepas tu ada kawan aku tanya kat aku soalan macam ni.
So, aku pun terpikir jugak macam mana caranya dan cuba cari la solution nya.

Akhirnya, aku jumpa benda ni.
JFusion.
Plugin untuk memudahkan korang integrate/bridging site korang.
So, pada entry kali ini aku nak share ngan korang semua macam mana nak integrate kan Joomla ngan MyBB.
Sebenarnya korang boleh jugak nak integrate kan dengan benda lain.
Contohnya, Joomla ngan phpBB3, Joomla ngan SMF, Joomla ngan vBulletin.
Tapi aku just nak tunjukkan kali ni cara nak bridging Joomla ngan myBB.

So, langkah pertama, korang download dulu plugin yang bernama JFusion.
Download lah yang paling latest.

Lepas korang dah download, korang login ke Joomla administrator.
Pegi ke tab Extension, dan klik Install/Uninstall.
Kat tempat bertulis “Upload Package File”, korang klik “browse”, dan cari file JFusion yang korang download tadi(bentuk .zip file). Pastu korang klik “Upload File & Install”.


So, tunggulah kejap sementara dia upload kan file tu & install.
Lepas dah selesai sume tu, die akn keluar page macam ni (lebih kuranglah).


Korang pegi kat bahagian configure.
Edit configuration untuk myBB.



Description Biarkan default
Full URL to Software http://... (url mybb)
Full Path to Software /home/public_html/... (path ke mybb folder)
Cookie Domain .www.url_mybb... (yang korang letak masa install mybb)
Cookie Path /mybb*/ (*kat mana mybb di install)
Cookie Prefix Biarkan default (empty)

Database Type (ie mysql) mysql(biasanya)
Database Host localhost(biasanya)
Database Name nama database mybb tu
Database Username username database mybb tu
Database Password password database mybb tu
Table Prefix mybb_ (biasanya)
Database Charset (defaults to utf8) Biarkan default

Login Identifier Pilih macam mana user korang nak dikenal-pasti

Default Usergroup Registered(biasanya)
Usergroup for users awaiting activation Guest(biasanya)

Auto Update Activation Yes
Auto Update Bans Yes
Auto Update Email Yes
Create new user in this software for inactive users? Yes
Create new user in this software for blocked users? Yes

Lepas dah configure, korang save benda tu.
Lepas tu kita configure pulak Current Joomla Site(joomla_int).

Lepas dah configure kedua-duanya, kita kenalah enable kan plugin ni.
So, kita pilih kat master untuk joomla_int dan slave untuk mybb.
Dia akan jadi macam ni la.


Lepas korang dah configure benda alah ni,
Dan configuration tu ada masalah, dia akan bagitau kat bahagian atas sekali.

So, kalo configuration pun da betul, memang akan keluar 1 error mengatakan kat slave tu korang kena disable kan registration.

So, korang login ke mybb punya admin,
Pergi kat tab Configuration, Settings, User Registration and Profile Options.
Pastu tick kan Yes.


Lepas korang da disable kan registration kat mybb,
Barulah korang enable kan plugin JFusion ni.


Selepas korang dah enable plugin ni,
Korang synchronize la user-user korang.
Tapi sebelum korang start meng-synchronize-kan  table user korang,
Back-up la dulu ye sebelum apa-apa perkara yang korang ‘sangat suka’ berlaku.

Synchronization ni ada dua cara.
1. Import slave users ke master database
2. Synchronize kan master user database dengan slave databases.

Step 1 tu kalo korang da ada user sebelum ni kat mybb/slave db korang.
So korang pilih step 1 tu untuk import kan user dari slave ke master db.
Senang cite, korang run je la dua-dua step tu.
Baru balance sikit user korang untuk kedua-dua belah punya db.. :p

So, sampai sini je la tutorial aku ye.
Aku pun dapat benda ni masa dok cari kat Google.
Tapi yang itu cara dia lain.
Maybe sebab dia pakai JFusion version lama kot.
Tapi tak pa. Tak da apa-apa masalah pun.

Nak Tanya apa-apa, komen je la kat sini ye.

*Credit to ZoomCities! untuk tutorial ni.