Wednesday, December 31, 2014

Install Nagios from Sources in CentOS 6.X

Nagios is software monitoring. It can monitor server uptime, service, and so on. For more details, you can go here.

To install nagios, follow step below:

Wednesday, December 24, 2014

Set and Remove Proxy for Git

To set Proxy into git, do this step
  1. Open git console
  2. Type this
git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080
git config --global https.proxy https://proxyuser:proxypwd@proxy.server.com:8080
 Where:
  • proxyuser is username for proxy
  • proxypwd is proxy password for the username
  • proxy.server.com is address of the proxy. It can be IP address.
  • 8080 is proxy port. You can change it based on your proxy configuration
If you don't use username and password, you just need to use this format:
git config --global http.proxy http://proxy.server.com:8080
git config --global https.proxy https://proxy.server.com:8080
 If you want to unset proxy, just do this:
 git config --global --unset http.proxy
 git config --global --unset https.proxy

Saturday, December 13, 2014

Import Mysql Dump into PostgreSQL Ubuntu

First, you must dump mysql with command below
mysqldump --compatible=postgresql --default-character-set=utf8 -r nama_file.sql -u root -p db_name
 If you don't need mysql password, please remove "-p"

After that, you need to convert sql into psql. You can go github repository here.

After you get psql format, than you can import with
psql -U postgres -h localhost -d database_name -f nama_file.psql

Friday, November 14, 2014

Check File With High Disk Usage On Debian / Ubuntu

In server with limited disk space, high size file is very annoying if we can not find what file it is. So this command will show you what file that has high size
find / -type f -size +10000k -exec ls -lh {} \
"/" show that it will search in the root directory and 10000k means that the file must have > 10.000k (10MB) in size. You can change it based on your need.

Source:
http://www.cyberciti.biz/faq/find-large-files-linux/

Saturday, October 25, 2014

Change Hostname Permanently CentOS 6.5

To change hostname permanently, you need to do this
  • nano /etc/sysconfig/network
  • Change "HOSTNAME=yourNewDesiredHostname"
And the next step is
  • nano /etc/hosts
  • Change "127.0.0.1 yourDesiredHostname.com"
Finally reboot to take effect

Source: http://unix.stackexchange.com/questions/145019/how-to-change-hostname-on-centos-6-5

Tuesday, September 23, 2014

Resize Multiple Image Ubuntu

If you have many big size image and want to resize into smaller size, you can resize all image with just 1 command in terminal. This tutorial take example if you have many image with .JPG extension and you want to resize 25% of the original dimension

Sunday, September 21, 2014

Create Virtual Host Apache Ubuntu

Virtual host make a server can handle many domain on it. To make virtual host on apache, follow steps below. This tutorial needs prerequisite an apache installed.

Saturday, September 20, 2014

How To Check TUN/TAP or PPP is Enabled

To check if TUN/TAP is enabled on your server, type this
cat /dev/net/tun
If the result is
cat: /dev/net/tun: File descriptor in bad state
your module has been enabled on your server.

To check if PPP is enabled, do this
cat /dev/ppp
if you receive message
cat: /dev/ppp: No such device or address
the module has been enabled successfully.

Source:
http://forum.host1plus.com/vps-support/428-how-check-if-tun-tap-ppp-enabled-your-vps.html

Friday, September 19, 2014

Fix Owncloud High CPU Usage Ubuntu

Owncloud is the best free cloud storage software that can be installed on your server for now. But there are some bugs. The most annoying bug is owncloud client use about 50% of your cpu usage. To fix this, I just use a little tricky step, using little program named cpulimit. That program can limit cpu usage used by background program

Install squid33 in FreeBSD 9.2

  1. Add package squid33
  2. pkg_add -r squid33
  3. Masuk ke directory squid
  4. cd /usr/ports/www/squid33 
  5. Compile and choose some option that fit with your requirement
  6. make install clean
  7. You can edit your squid configuration in /usr/local/etc/squid/squid.conf
  8. Make squid cache
  9. squid -z
  10. Insert squid to system boot. Open /etc/rc.conf and add squid_enable="YES"
  11. Start your squid
  12. service squid start

Source:
http://wiki.squid-cache.org/KnowledgeBase/FreeBSD

Force Using https Instead of http Ubuntu 14.04

The main idea for this forcing is redirect your http://yourdomain.com to https://yourdomain.com. This tutorial use apache web server. To do this, follow this step:
  1. Open your web server configuration
  2. nano /etc/apache2/sites-available/000-default.conf
  3. Add this line before </VirtualHost>
  4. Redirect permanent / https://yourdomain.com
  5. Save and restart your apache
  6. service apache2 restart

Sumber:
https://wiki.apache.org/httpd/RedirectSSL

Install Comodo SSL Ke Apache Ubuntu 14.04

Sekilas tentang SSL
Istilah gampangnya adalah SSL memungkinkan kita untuk mengubah akses ke website dari http menjadi https. Keungguan https adalah adanya enkripsi dari komputer kita ke web server. Kalo mengirim password tanpa https, maka password akan dapat dengan mudah dibaca, sedangkan kalo pake https, maka semua data yang dikirim ataupun yang diterima akan di enkripsi, sehingga tidak mudah untuk disadap. Untuk tutorial kali ini, apache web server harus sudah terinstall dan IP yang digunakan adalah IP global yang static.

Hal yang perlu dilakukan untuk memasang ComodoSSL adalah sebagai berikut:

Friday, August 22, 2014

Enable Root Login Over SSH in FreeBSD 10.0

By default, we cannot login to FreeBSD over ssh. So, we must enable it from openSSH configuration.

Open /etc/ssh/sshd_config with your 'ee' text editor
ee /etc/ssh/sshd_config
Find this
#PermitRootLogin no
Change to
PermitRootLogin yes
Press escape, and then choose yes for save confirmation.

Finally, restart your ssh daemon
 service sshd restart
 ...and done. You can login with root remotely over ssh.

Source:
http://blog.bobbyallen.me/2011/07/22/how-to-enable-root-login-over-ssh-on-freebsd-8-2/

Thursday, August 7, 2014

Installing Flash Player Ubuntu In Single Step

Close all running Firefox

Open your terminal

Type "sudo apt-get install flashplugin-nonfree"

Now flash player should be working.

Source:
http://www.cyberciti.biz/faq/ubuntu-linux-how-to-install-flash-player-for-firefox/

Thursday, July 17, 2014

Deleting Single Iptables Rule

I look at my iptables rules
iptables -L
and get this
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere           
ACCEPT     all  --  anywhere             anywhere           

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination        

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

For example I make rule to accept port 80, so I do this
iptables -I INPUT 3 -p tcp --dport 80 -j ACCEPT
and then iptables -L give us this
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere           
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:http
ACCEPT     all  --  anywhere             anywhere
Look at third line, there is rule for accepting connection from port 80. The rule inserted in third line because I use 3 in this rule
 iptables -I INPUT 3 -p tcp --dport 80 -j ACCEPT
If we want to delete this single rule, do
iptables -D INPUT 3
So iptables -L give us
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere           
ACCEPT     all  --  anywhere             anywhere
Source:
http://major.io/2007/02/09/delete-single-iptables-rules/

Upgrade Ubuntu 12.04 to Ubuntu 14.04

Ensure that your Ubuntu is up to date
sudo apt-get update && sudo apt-get upgrade -y
Install update manager core
sudo apt-get install update-manager-core -y
 Upgrade your Ubuntu
sudo do-release-upgrade -d
And follow next instruction carefully.....

Source:
http://www.namhuy.net/2853/upgrade-ubuntu-12-04-lts-ubuntu-14-04-lts.html

Wednesday, July 16, 2014

Grant Root Access To Additional User FreeBSD

Just add user to group wheel with this
pw user mod username -G wheel
For example I add user akhfa to wheel group
pw user mod akhfa -G wheel
If you do it well, if you type
groups akhfa
you will get
akhfa       wheel
Source:
http://www.cyberciti.biz/tips/freebsd-becoming-super-user-su-or-enabling-su-access-to-user.html

Install Nano On FreeBSD

Go to nano directory
cd /usr/ports/editors/nano
Compile and install nano
make install clean
Make symbolic link
ln -s /usr/local/bin/nano /usr/bin/nano
Source:
http://blog.bobbyallen.me/2012/05/28/how-to-install-nano-on-freebsd/

Updating FreeBSD

To update your FreeBSD, do this
freebsd-update fetch
freebsd-update install
If something wrong, you can cancel update by
freebsd-update  rollback
Source:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-upgrading-freebsdupdate.html

Tuesday, July 8, 2014

Install Htop On CentOS

Htop, a process manager based on command line interface, is a powerful tool to manage process from terminal.


Sunday, July 6, 2014

Enable Remote Access To Mysql Database Server Or On VPS Ubuntu

If you want to make application with remote database, you will need to grant database on your server to be accessed by your application. Now I will tell you how to grant access so your application can use mysql from your server.

Friday, July 4, 2014

Fix GPG Error Ubuntu

Sometimes you can find like this on terminal when updating repository
W: There is no public key available for the following key IDs:
3B4FE6ACC0B21F32
If you found it, fix with this
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
And then try "apt-get update" again

Install Dropbear And Change Dropbear Port On Ubuntu

Make sure that your Ubuntu is up to date
sudo apt-get update && sudo apt-get upgrade -y
To install Dropbear, run this on terminal
sudo apt-get install dropbear
 To start and change dropbear port, make sure nano was installed and do this

Sunday, June 29, 2014

Change Boot Splash Ubuntu To Kubuntu

If you are boring on your boot splash and want to change into Kubuntu boot splash, you can do it by
sudo apt-get install plymouth-theme-kubuntu-logo
To change back to Ubuntu boot splash, do this
update-alternatives --config default.plymouth
and then choose by inserting the number of boot splash you want....

Sunday, April 27, 2014

Make Colorful Folder Icon in Nautilus

Folder Color is a Nautilus extension that allows you to easily change the folder icon color to some predefined colors such as blue, pink, black, yellow, violet, orange, green, grey or red. With a small tweak, the extension also works with Nemo file manager.



Saturday, April 26, 2014

Install and Configure Apache Tomcat in Netbeans Ubuntu

  • If Tomcat is not installed yet, install it first
sudo apt-get install tomcat7
  •  And then configure like this
cd /usr/share/tomcat7
sudo mkdir common
cd common
sudo ln -s ../lib lib
cd ..
sudo mkdir conf
cd conf
sudo ln -s /etc/tomcat7/server.xml server.xml
sudo chmod o+rx /usr/share/tomcat7/conf
  • Open service tab on upper left beside project tab
  • Right click servers, add server
  • Choose Apache Tomcat
  • Browse server location in /usr/share/tomcat7
  • Enter username and password you want, for example I add "admin" for the username and password
  • Open terminal and execute
sudo nano /etc/tomcat7/tomcat-users.xml
  •  Add this on the top of </tomcat-users> 
<role rolename="admin-gui"/>
<user username="admin" password="admin" roles="admin-gui"/>
  • Press Ctrl + O and the enter
  • Type this in terminal 
sudo service tomcat7 restart
  •  Access your apache tomcat from browser in http://localhost:8080 
  • The root web directory located in /usr/share/tomcat7-root/default_root

Install Adobe Reader Ubuntu

  • Get installer here
  • Open the deb with gdebi or software center or dpkg

Friday, April 25, 2014

Source For Adding File System into Linux

10 Super Powerful Linux Commands

We always say that the most powerful Linux tools are its Command lines. This is because you can do about everything right from your command line. You can easily explain your computer exactly what you require and it comes back to you with appropriate results. Infact there are some commands that make this tool even more powerful! Here we bring to you a list of 10 such commands that work like energy drinks for you Linux machines!

Thursday, April 24, 2014

Solving "perl: warning: Setting locale failed" in Ubuntu

It is happen because locale setting needs to be reconfigured. To do that, just type this in terminal
sudo dpkg-reconfigure locales
If it doesn't successfull, try to set locale first
sudo locale-gen en_US en_US.UTF-8
and then type dpkg again.

source

Sunday, April 20, 2014

Install Squid Proxy Ubuntu Server

  • Install Squid
sudo apt-get install squid
  • Set squid to run after startup
update-rc.d squid3 defaults
  • Open squid configuration file
sudo nano /etc/squid/squid.config
  • Add this to the first line of squid.conf to use ipv4 only
dns_v4_first on
  • Press Ctrl+w to search "http_access deny all"
  • clear "#"
  • Search "acl localnet" with Ctrl+w
  • add line "acl localnet src your-ip-public"
  • Press Ctrl+w to search "http_access allow"
  • add line "http_access allow localnet"
  • Press Ctrl+o and then press enter to save edited file
  • restart squid service
sudo service squid3 restart
NB:
  • You can change localnet to whatever you want
  • To change proxy port, search "http_port 3128" and change 3128 with port you want
Source

Friday, April 11, 2014

How Priority Queue in Java is Working

Source Code

  1. import java.util.*;  
  2. class PQ{  
  3.     static class PQsort implements Comparator<Integer>{   // inverse sort  
  4.         public int compare(Integer one, Integer two){  
  5.             return two - one;           // unboxing  
  6.         }  
  7.     }  
  8.     public static void main(String[] args){  
  9.         int[] ia = {1,5,3,7,6,9,8};         // unordered data  
  10.         PriorityQueue<Integer> pq1 =   
  11.             new PriorityQueue<Integer>();     // use natural order  
  12.           
  13.         for (int x : ia)                // load queue  
  14.             pq1.offer(x);  
  15.               
  16.         for (int x : ia)                // review queue  
  17.             System.out.print(pq1.poll() + " ");  
  18.         System.out.println("");  
  19.               
  20.         PQsort pqs = new PQsort();          // get a Comparator  
  21.         PriorityQueue<Integer> pq2 =   
  22.             new PriorityQueue<Integer>(10,pqs);   // use Comparator  
  23.               
  24.         for (int x : ia)                // load queue  
  25.             pq2.offer(x);  
  26.           
  27.           
  28.         for (int x : ia)                // review queue  
  29.             System.out.print(pq2.poll() + " ");  
  30.           
  31.         System.out.println(" ");  
  32.     }  

Saturday, April 5, 2014

Backup and Restore Database MySQL

For backup all databases
  mysqldump -u username -ppassword --all-databases > /tmp/alldatabases.sql
For backup spesific database
 mysqldump -u username -ppassword --databases databasename > /tmp/filename.sql
For restore
mysql -u username -ppassword databasename < /tmp/filename.sql

Friday, April 4, 2014

Instaling Kubuntu Desktop without KDE Application

Just type this in terminal
sudo apt-get install --no-install-recommends kubuntu-desktop

Setting Proxy for apt-get in Ubuntu

  1. Open terminal
  2. Type this
    sudo nano /etc/apt/apt.conf
  3. Add this line if there in no authentication in your proxy
    Acquire::http::proxy "http://proxyserver:port/";
  4. Add this if there is authentication in your proxy
    Acquire::http::proxy "http://username:password@proxyserver:port/";
  5. Press Ctrl+x and then press y

Wednesday, March 12, 2014

Check Status and Wear Level Battery in Ubuntu

Just try this in terminal

upower -i /org/freedesktop/UPower/devices/battery_BAT0

And you will get this


In there you can get your battery status. You can also look how many real capacity your battery have. My battery have 38.006 Wh for its designed capacity but just 34.942 Wh left because battery will lose its capacity over time. Thats all :D

Wednesday, February 5, 2014

Install qt Latest Ubuntu

Qt adalah sebuah GUI frameworks yang cross platform dan juga mendukung untuk berbagai bahasa pemrograman. Cara penginstalan di Ubuntu:
sudo apt-add-repository ppa:ubuntu-sdk-team/ppa
sudo apt-get update
sudo apt-get install qt-sdk

Di windows, download installer di sini
http://qt-project.org/downloads