Pemecahan kasus LC_ALL = (unset) di Ubuntu

Bila menemui pesan kesalahan seperti ini atau yang mirip:

perl: warning: Setting locale failed.   
perl: warning: Please check that your locale settings:
....
perl: warning: Falling back to the standard locale ("C").   
locale: Cannot set LC_CTYPE to default locale: No such file or directory   
locale: Cannot set LC_MESSAGES to default locale: No such file or directory   
locale: Cannot set LC_ALL to default locale: No such file or directory

Silahkan dicoba pemecahannya dengan cara berikut:

$ sudo locale-gen "en_US.UTF-8"

lalu 

$ sudo dpkg-reconfigure locales

Semoga berhasil !

Mouse di Ubuntu 14.04 tidak terkendali ?

Saya beberapa kali mengalami kejadian berupa kursor mouse yang tiba-tiba berpindah ke sisi lain dari screen tanpa kita gerakkan, bahkan melakukan klik di tempat yang tidak diduga. Hal ini sangat mengganggu. Ternyata hal ini kemungkinan  disebabkan oleh kerusakan atau gangguan pada TrackPad atau Touchpad laptop. Bisa jadi karena kotor atau penyebab lainnya. Cara yang paling praktis adalah dengan mematikan fungsi track/touch pad tersebut lalu menggunakan mouse untuk sementara waktu atau permanen. Jika Keyboard Anda tidak memiliki fungsi (fn) untuk mematikan/menghidupkan touch pad, maka cara dibawah ini masih bisa Anda lakukan melalui terminal.

Untuk mematikan track/touch pad tersebut Anda perlu terlebih dahulu mencari ‘id’ dari device tersebut, caranya :

xinput list

Contoh hasilnya adalah sebagai berikut :

xlist_input

Disitu terlihat bahwa TouchPad pada laptop saya ( SynPS/2 Synaptics TouchPad )  memiliki ‘id’ = 21. Untuk menonaktifkan touchpad tersebut lakukanlah perintah seperti berikut ini :

xinput –disable 21

Untuk mengaktifkan kembali caranya :

xinput –enable 21

Demikianlah, semoga bermanfaat 🙂 Salam opensource !

 

Mencopot MySQL sepenuhnya

Uninstall MySQL dengan apt-get remove terkadang tidak lah cukup, karena tidak menghapus jejak-jejak sepenuhnya.

Berikut perintah-perintah yang lebih ‘gahar’, tapi mohon hati-hati ya, jangan sampai data Anda hilang kalau belum di backup :

sudo -i
service mysql stop
killall -KILL mysql mysqld_safe mysqld
apt-get --yes purge mysql-server mysql-client
apt-get --yes autoremove --purge
apt-get autoclean
deluser --remove-home mysql
delgroup mysql
rm -rf /etc/apparmor.d/abstractions/mysql /etc/apparmor.d/cache/usr.sbin.mysqld /etc/mysql /var/lib/mysql /var/log/mysql* /var/log/upstart/mysql.log* /var/run/mysqld
updatedb
exit

 

Memperbaiki masalah “locale”

Masalah yang selalu munculnya teks seperti di bawah ini:

perl: warning: Setting locale failed.   
perl: warning: Please check that your locale settings:   
        LANGUAGE = "en_US:en",   
        LC_ALL = (unset),   
        LC_MESSAGES = "en_US.UTF-8",   
        LANG = "en_US.UTF-8"   
    are supported and installed on your system.   
perl: warning: Falling back to the standard locale ("C").   
locale: Cannot set LC_CTYPE to default locale: No such file or directory   
locale: Cannot set LC_MESSAGES to default locale: No such file or directory   
locale: Cannot set LC_ALL to default locale: No such file or directory   
(Reading database ... 21173 files and directories currently installed.)  
Removing bind9 ...  
 * Stopping domain name service... bind9                                        [ OK ]
Processing triggers for man-db ...   
locale: Cannot set LC_CTYPE to default locale: No such file or directory   
locale: Cannot set LC_MESSAGES to default locale: No such file or directory   
locale: Cannot set LC_ALL to default locale: No such file or directory

Berikut salah satu cara untuk menanggulanginya, kalau tidak berhasil silahkan cari cari lainnya ya 🙂

  1. Jalankan perintah locale untuk melihat locales apa yang sedang terpasang
    $ locale
    LANG=C
    LANGUAGE=
    LC_CTYPE=fi_FI.UTF-8
    LC_NUMERIC="C"
    LC_TIME="C"
    LC_COLLATE=fi_FI.UTF-8
    LC_MONETARY="C"
    LC_MESSAGES=fi_FI.UTF-8
    LC_PAPER="C"
    LC_NAME="C"
    LC_ADDRESS="C"
    LC_TELEPHONE="C"
    LC_MEASUREMENT="C"
    LC_IDENTIFICATION="C"
    LC_ALL=
  2. Kemudian kita bangun locale yang belum terpasang dan direconfigure

    $ sudo locale-gen "en_US.UTF-8"
    Generating locales...
      en_US.UTF-8... done
    Generation complete.
    
    $ sudo dpkg-reconfigure locales
    Generating locales...
      en_US.UTF-8... up-to-date
    Generation complete.

Semoga berhasil ! 🙂

Beberapa perintah untuk mendapatkan informasi hardware di linux

 

1. lscpu
lspcu akan memberikan laporan tentang cpu dan unit prosesingnya secara sederhana.

2. lshw

Perintah ini akan memberikan informasi lebih terinci tentang berbagai hardaware yang ada seperti cpu, memory, disk, usb controllers, network adapters, dsb. lshw ini mengambil informasi dari berbagai berkas/file di direktori /proc

3. hwinfo

Perintah hwinfo ini belih rinci di bandingkan dengan lshw.

 

  • References :
    http://www.binarytides.com/linux-commands-hardware-info/

Configuring DNS in an openVPN based routing VPN setup

Hi all

I have an openVPN server which is configured for routing based VPN. Multiple clients connect to this VPN server.

The network address range for the VPN is 10.111.10.0/24
The server’s VPN IP address is 10.111.10.1
The server is also connected directly on the internet with a static IP address on eth0 – some p.q.r.s

Right now I end up addressing all the clients and the server using IP addresses. But I intend to set up different services on the server like a mailhost, git, apache, etc. and I plan to use different hostnames for all of these services but all running on the same server. I’m planning to use a private domain example.site for all the hosts in the VPN.

Could someone guide me through the setup for this ?

I’ve already installed the bind package and went through pages about BIND and named.conf, the zones and such. But it is still kind of confusing how do I put all these together.
Also, what DNS options should I be pushing to the openVPN clients so that their resolv.conf can use the DNS server on the VPN for querying only the hostnames for the example.site domain. All other queries should go through the client’s default nameserver already in the resolv.conf.

Thanks.

UPDATE:

I was able to set up the name server for my VPN and it seems to be working. I’m also able to push the DOMAIN and DNS server options from my openvpn server.conf. And all the clients are able to resolve the hostname using either just hostnames or hostname.example.site. Now I’d like to enable dynamic DNS updates for enabling the clients to register themselves with the name server server on the VPN so that multiple clients can also address each other using hostnames. Could some one help me with that ?

These are my config files.

/etc/named.conf

Code:
options {
    directory "/var/lib/named";
    managed-keys-directory "/var/lib/named/dyn/";
    dump-file "/var/log/named_dump.db";
    statistics-file "/var/log/named.stats";
    listen-on-v6 { none; };
    notify no;
    disable-empty-zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA";
    include "/etc/named.d/forwarders.conf";
     allow-query { 127.0.0.1; 10.111.10/24; };
     listen-on port 53 { 127.0.0.1; 10.111.10.1; };
};

zone "." in {
    type hint;
    file "root.hint";
};

zone "localhost" in {
    type master;
    file "localhost.zone";
};

zone "0.0.127.in-addr.arpa" in {
    type master;
    file "127.0.0.zone";
};

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" in {
    type master;
    file "127.0.0.zone";
};

include "/etc/named.conf.include";
logging {
    category default { log_syslog; };
    channel log_syslog { syslog; };
};
 zone "example.site" in {
     file "master/example.site";
    type master;
    allow-transfer { any; };
};
 zone "10.111.10.in-addr.arpa" in {
     file "master/10.111.10.in-addr.arpa";
    type master;
     allow-transfer { any; };
  };

/var/lib/named/master/example.site

Code:
$TTL 2d
 @        IN SOA        ns1.example.site.    root.example.site. (
                2012052901    ; serial
                3h        ; refresh
                1h        ; retry
                1w        ; expiry
                1d )        ; minimum

 example.site.    IN MX        0 mothership.example.site.
 example.site.    IN NS        mothership.example.site.
 mothership    IN A        10.111.10.1
ns1        IN CNAME    mothership
mail        IN CNAME    mothership

/var/lib/named/master/10.111.10.in-addr.arpa

Code:
$TTL 2d
 @        IN SOA        ns1.example.site.    root.example.site. (
                2012053000    ; serial
                3h        ; refresh
                1h        ; retry
                1w        ; expiry
                1d )        ; minimum

 10.111.10.in-addr.arpa.    IN NS        ns1.example.site.
 1.10.111.10.in-addr.arpa.    IN PTR        mothership.example.site.

Set static client’s VPN IP

Kali ini kita akan memberikan static VPN IP untuk setiap client openVPN :

buatlah sebuah direktori ccd di bawah /etc/openvpn/:

mkdir /etc/openvpn/ccd

Tambahkan satu baris di  OpenVPN server.conf  yang berada di bawah  /etc/openvpn/,:

client-config-dir ccd

simpan.

Sekarang di dalam /etc/openvpn/ccd kita buat sebuah file untuk setiap user agar memiliki ip address yang tetap. Anda harus memberi nama file persama dengan username dari VPN, jika Anda menambahkan user melalui perintah useradd di mesin lokal, atau menggunakan user yang dibuat dalam FreeRADIUS, maka nama file tersebut harus sama dengan nama username.

Contoh : saya memiliki username : smk1jkt dan dalam file OpenVPN server.conf kita gunakan subnet 10.8.0.0/24, jika kita ingin memberikan smk1jkt IP 10.8.0.100 kita lakukan di bawah ini :

cd /etc/openvpn/ccd/
touch safesrv

Dan kemudian tambahkan satu baris ke dalam file yang bernama smk1jkt :

ifconfig-push 10.8.0.100 10.8.0.101

Restart OpenVPN:

service openvpn restart

User smk1jkt akan mendapat  IP 10.8.0.100 =)

MySQL Create Database with utf8mb4 Character Set Syntax

Create database

I frequently create database with utf8mb4 character set:

CREATE DATABASE 'mydb' CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; GRANT ALL ON 'mydb'.* TO 'username'@localhost IDENTIFIED BY 'password'; FLUSH PRIVILEGES;

or

CREATE SCHEMA 'mydb' CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; GRANT ALL ON 'mydb'.* TO 'username'@localhost IDENTIFIED BY 'password'; FLUSH PRIVILEGES;

Create user

Create user and give privilege to it

create user 'username'@localhost identified by 'password'; grant all privileges on *.* to username@localhost; 
or 
GRANT [type of permission] ON [database name].[table name] TO ‘[username]’@'localhost’;

Change user’s password

Replace the password with the password that you want to use.

MySQL 5.7.6 and later:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';

MySQL 5.7.5 and earlier:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');

Here is a short list of other common possible permissions that users can enjoy.

  • ALL PRIVILEGES- as we saw previously, this would allow a MySQL user all access to a designated database (or if no database is selected, across the system)
  • CREATE- allows them to create new tables or databases
  • DROP- allows them to them to delete tables or databases
  • DELETE- allows them to delete rows from tables
  • INSERT- allows them to insert rows into tables
  • SELECT- allows them to use the Select command to read through databases
  • UPDATE- allow them to update table rows
  • GRANT OPTION- allows them to grant or remove other users’ privileges

Reference from :

  • http://www.euperia.com/development/mysql/mysql-create-database-with-utf8-character-set-syntax/1064
  • https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql

Deteksi port menggunakan nmap

Apakah itu Port?
Ada beberapa lapisan (layer) dalam model jaringan OSI. Lapisan Transport adalah lapisan yang berkaitan dengan masalah komunikasi diantara layanan dan aplikasi yang berbeda. Dilapisan inilah yang namanya Port memiliki keterkaitan.

Jika Anda belum memasang nmap, silahkan install dengan cara :

Debian/Ubuntu : #sudo apt-get install nmap
Centos/RedHat : #sudo yum install nmap

Misalkan untuk mendeteksi apakah server yang dituju membuka service port berapa saja antara 1 s/d 10000:

#nmap -P1-10000 <IP atau domain name yang dituju>

Contoh :

toosa@toosa-T580:~$ nmap -p1-10000 localhost

Starting Nmap 6.40 ( http://nmap.org ) at 2014-07-23 11:37 WIB
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00031s latency).
Not shown: 9988 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
22/tcp   open  ssh
25/tcp   open  smtp
80/tcp   open  http
139/tcp  open  netbios-ssn
443/tcp  open  https
445/tcp  open  microsoft-ds
631/tcp  open  ipp
3306/tcp open  mysql
5432/tcp open  postgresql
5433/tcp open  pyrrho
5434/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 0.23 seconds
1 3 4 5 6 7 12