thefu*k, aplikasi anti typo command di Ubuntu

Typo, satu hal yang sering kita alami kalau sedang bermain di console/terminal. Saya sendiri termasuk yang sering lupa mengetik sudo sebelum apt-get, atau bahkan malah mengetik aptget daripada apt-get. Konyol memang.

Nah, bagi yang kerap kena penyakit typo, kalian bisa coba aplikasi kecil yang berjalan di Ubuntu (dan tentunya distro Linux lain), namanya thefuck. Ya, jorok memang. Kita akan ganti nanti setelah terinstall

Instalasi

untuk instalasi thefuck di Ubuntu (atau turunannya) silakan ikuti perintah berikut:

sudo apt update
sudo apt install python3-dev python3-pip
sudo -H pip3 install thefuck

untuk instalasi thefuck di Linux lain, bisa memanfaatkan Python Installer (pip):

sudo -H pip install thefuck

OK, jika dirasa nulis “fuck” terlalu jorok di kantor, kalian bisa bikin alias di console/terminal dengan contoh misalnya, tulis di file .bash_profile, .bashrc, .zshrc:

eval "$(thefuck --alias dhus)"

Simak video tutorialnya berikut:

Referensi: https://github.com/nvbn/thefuck

Cara Membuat LiveUSB Windows dengan WinUSB di Ubuntu 16.04

Pengguna Linux yang masih dual-boot dengan Windows pasti pernah mengalami kejadian dimana tiba-tiba Windows dipartisi sebelah rusak dan harus diinstall ulang. Tapi, bagaimana jika LiveUSB Installer Windows belum dibuat dan tidak ada laptop/PC cadangan untuk membuatnya?

Untunglah, ada satu software di Ubuntu yang bisa kita pakai untuk membuat LiveUSB Installer di Linux, namanya WinUSB. Meskipun belum sempurna betul, tapi setidaknya WinUSB bisa menolong kita pada kejadian seperti diatas. Continue reading Cara Membuat LiveUSB Windows dengan WinUSB di Ubuntu 16.04

Mengenal Armitage, GUI Management Attack untuk Metasploit

Armitage adalah software berbasis GUI yang menjadi panel manajemen cyber attack yang menggunakan Metasploit Project, dimana fitur utamanya adalah membuat visualisasi target dan rekomendasi exploit yang mungkin bisa dipakai.

Screen Shot 2016-06-18 at 9.11.06 PM

Armitage sendiri dilepas secara gratis dan dikembangkan sebagai project open-source oleh om Raphael Mudge. Tool ini bahkan disebut-sebut sebagai tool wajib untuk skenario red team collaboration karena bisa melakukan sharing session, sharing data dan jalur komunikasi lewat Metasploit.

Skenario manajemen cyber attack dengan Armitage

Tool ini sebenarnya bisa berjalan secara cross-platform karena ditulis dengan bahasa JAVA, namun secara resmi mereka hanya mendukung Linux dan Mac OS. Untuk pengguna Windows, hanya client dari Armitage yang bisa digunakan.

Requirement

Untuk bisa menggunakan Armitage, setidaknya requirement yang dibutuhkan adalah ada Metasploit Framework dan dependensinya seperti PostgreSQL dan Nmap, kemudian ada JAVA setidaknya versi 1.7 ke atas.

Jika tidak mau kesulitan menyiapkan kebutuhan diatas, bisa pakai cara sederhana seperti langsung menggunakan distro pen-test seperti Kali Linux atau Pentoo. Cara kedua bisa menggunakan script Installer MSF yang dibuat oleh DarkOperator, atau menggunakan official installer dari Armitage itu sendiri.

Mencoba Armitage di Kali Linux

Karena Kali Linux sudah menghadirkan Metasploit Framework dan dependensinya secara default, itu artinya kita bisa memasang dan menggunakan Armitage dengan mudah.

Langkah setup nya seperti ini:

  • Buka terminal/console
  • Start postgresql dengan perintah service postgresql start
  • Inisialisasi database metasploit dengan service metasploit start
  • Stop daemon metasploit dengan service metasploit stop
  • kemudian install Armitage dengan perintah: apt-get update; apt-get install armitage
  • Update environment Java ke Java 1.7, dengan perintah update-java-alternatives –jre -s java-1.7.0-openjdk-i386 atau update-java-alternatives –jre -s java-1.7.0-openjdk-amd64

kemudian untuk memulainya bisa dengan membuka terminal, kemudian start PostgreSQL dengan perintah service postgresql start dan run Armitage.

Untuk penggunaannya sendiri, silakan cermati video berikut:

Referensi:

How to Record Terminal Session on Linux with TTYRec

Recording a terminal session could be important to create some learning material or references to someone, or just a sharing information in much understandable way. Unlike using Desktop Capture  software like RecordMyDesktop or Kazaam. You can use TTYRec as simple app to record your terminal sessions. Its small and compact, and can produce a gif output!

To record terminal session, you need TTYRec to be installed. In Ubuntu/Debian, you can install it with: Continue reading How to Record Terminal Session on Linux with TTYRec

Tutorial Backup MySQL/MariaDB dengan Script Bash

Mempunyai server VPS dan butuh script backup database tiap aplikasi? Ini salah satu contoh skrip backup dengan BASH yang bisa kamu gunakan.

Untuk menggunakan script ini, pastikan mysqldump sudah terpasang, alias ada paket MySQL (entah itu MySQL atau MariaDB).

Contoh script:

#!/bin/bash

# Database credentials
 user=""
 password=""
 host=""
 db_name=""
 
# Other options
 backup_path="/home/namauser/backup/"
# format tanggal backup 2016-03-29
 date=$(date +"%Y-%m-%d")
# Set default file permissions
 umask 177
# Dump database into SQL file
 mysqldump --user=$user --password=$password --host=$host $db_name > $backup_path/$date-$db_name.sql

untuk mengompres file SQL menjadi file GZIP (biar lebih hemat kuota server) silakan edit script diatas pada bagian mysqldump:

mysqldump --user=$user --password=$password --host=$host $db_name | gzip > $backup_path/$date-$db_name.sql.gz

Setelah itu jadikan file script tersebut menjadi executable dengan chmod +x namafilescript.sh.

Kombinasi dengan kekuatan Crontab, misalnya di eksekusi tiap jam 1 malam tiap hari.

Cara Install Virtualbox Guest Addition di Debian Wheezy/Jessie

Mungkin panduan singkat ini sangat berguna bagi kamu yang ingin memasang Virtualbox Guest Addition di Debian Wheezy ataupun Jessie. Cara yang sama berlaku untuk seluruh turunan Debian Linux.

Yang pertama, silakan gunakan terminal dan masuk sebagai root, dengan perintah sudo su atau su.

Pastikan seluruh software dan repositori software sudah paling baru, dengan perintah apt-get update; apt-get upgrade; Continue reading Cara Install Virtualbox Guest Addition di Debian Wheezy/Jessie

Finding All MP4 files and Move to New Folder In Linux

So, basically (probablye we have the same problem) I have a (nearly) thousands MP4 files, spreaded accross my Drive. In Windows partition, in Linux Partition etc.

So,this is the time to make a move. I will move all MP4 files that spreaded accross partition to be located in just one folder, /media/data/video or D:/video. And I will do it with Linux. Continue reading Finding All MP4 files and Move to New Folder In Linux

How to List Disk in Linux

In Windows, all you have to type is “List Disk” using DisPart in a command prompt and it’ll list all physical storage devices available, their size, format, etc. How you can do this in Linux?

In linux there are many tools for that, for example lsblk, fdisk -l or parted -l.

this is lsblk output example

$ lsblk
NAME           MAJ:MIN  RM  SIZE    RO  TYPE  MOUNTPOINT
sda            8:0      0   238.5G  0   disk
├─sda1         8:1      0   200M    0   part  /boot/efi
├─sda2         8:2      0   500M    0   part  /boot
└─sda3         8:3      0   237.8G  0   part
├─fedora-root  253:0    0   50G     0   lvm   /
├─fedora-swap  253:1    0   2G      0   lvm   [SWAP]
└─fedora-home  253:2    0   185.9G  0   lvm

How to Copy Files Recursively in Linux with ‘cp’

You can type this command to copy files recursively in linux, from one folders to another with:

cp -R /path/to/sources/* /path/destination/

but, when one or more files is already exists on the destination, you have to type ‘yes’ answer all the time. So, you can use this simple and yet silly trick: Continue reading How to Copy Files Recursively in Linux with ‘cp’

How to View tar.gz content without Extracting

You have a tar.gz files (lets says it is a server backup files) and want to view the content without extracting it?

You can use 3 commands bellow, tarvim or less.

tar -tf filename.tar.gz

or

vim filename.tar.gz

or

less -l filename.tar.gz

Cara Menghapus File .DS_Store dan ._* Bekas Mac

Jujur, salah satu yang membuat saya sebel dengan filesystem di Mac OS X adalah langkahnya membuat file .DS_Store ditiap folder yang jadi target. Saya yang sering gonta-ganti laptop, antara Macbook dan HP Compaq dengan Linux ini merasakan pahitnya junk file .DS_Store ini.

Pada repo-repo git software yang saya kembangkan, dapat dipastikan file .DS_Store dan .* saya ignore dalam file gitignore. Namun, terkadang aksi itu juga tidak cukup. Nah, inilah cara menghapus file .DS_Store dan file .* secara rekursif (untuk semua subfolder yang ada).

find /var/www/html \( -name '.DS_Store' -or -name '._*' \) -delete

NB. Hati-hati!

How to Install Kernel 4.0.3 on RHEL 7 and CentOS 7

Kernel 4.0.3 is already released by Greg Kroah-Hartman recently. This version include small updates for drivers, architecture, file system enhancement and more. This version also bring Life Patching feature as kernel 4.0 does.

This is a simple how to install kernel 4.0.3 on Red Hat Enterprise Linux 7 and CentOS 7 (or other distribution that based on them).

Continue reading How to Install Kernel 4.0.3 on RHEL 7 and CentOS 7

How to Install Docker in Univention Corporate Server 4.0-2

Docker is an open-source project that automates the deployment of applications inside software containers. And Univention Corporate Server 4.0-2 is officially supporting docker integration.

This is mini how-to install Docker in UCS 4.0-2

type and run this command in terminal:

univention-install docker.io

Just for checking after you install it, type in the terminal:

~# docker -v
Docker version 1.3.2, build 39fa2fa

Congratulations!

Menghemat Memori Dengan Disable BIND di Server CentOS 7

Sesuai judul diatas, pada tutorial singkat ini kita akan mengemat memori server kita dengan mendisable service BIND/named di CentOS 7.

BIND/named termasuk daemon yang boros memori. Memori yang bisa kita hemat dengan cara ini termasuk lumayan, sekitar 10 MB per daemon.

Catatan: Jika server yang anda tuju adalah server DNS, jangan ikuti tutorial ini dul… Continue reading Menghemat Memori Dengan Disable BIND di Server CentOS 7

How to Install & Configure LEMP (Linux, Nginx, MariaDB, PHP-FPM) on CentOS 7

LEMP is an archetypal model of web service solution stacks, named as an acronym of the names of its original four components: the Linux operating system, the Nginx HTTP Server, the MySQL/MariaDB relational database management system (RDBMS), and the PHP programming language.

This is how to install and configure LEMP (Linux, Nginx, MariaDB and PHP-FPM) on CentOS 7. Please follow this tutorial with your own risk!

UPDATE YOUR CENTOS

yum update

INSTALL VIM AND ENABLE EPEL
Install the vim editor if it’s not already installed on the system and enable the EPEL repository by running:

if ! type -path "vim" > /dev/null 2>&1; then yum install vim -y; fi
yum install epel-release

INSTALL MARIADB DATABASE SERVER
MariaDB is an enhanced, drop-in replacement for MySQL. It is the default database server in CentOS 7 / RedHat and can be installed on the virtual server using yum.

yum install mariadb mariadb-server

once MariaDB is installed, restart it using systemctl

systemctl restart mariadb
systemctl status mariadb

next, it is recommended to run MySQL/MariaDB post installation script mysql_secure_installation as in:

mysql_secure_installation

Enter current password for root (enter for none):
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

finally, edit /etc/my.cnf.d/server.cnf and add bind-address = 127.0.0.1 within the [mysqld] block:

vim +/^[mysqld /etc/my.cnf.d/server.cnf
[mysqld]
bind-address = 127.0.0.1
restart the database server using systemctl for the changes to take effect:

systemctl restart mariadb
systemctl status mariadb

verify MariaDB is listening on localhost only:

ss -tnlp | grep 3306
LISTEN 0 0 127.0.0.1:3306 *:* users:(("mysqld",1159,14))

INSTALL NGINX HTTP SERVER
Nginx is an open source reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols, as well as a load balancer, HTTP cache, and a web server (origin server). It is event-based driven and asynchronous which means it uses less resources and can handle much more load and concurrent requests.

Anyway, it can be installed on the virtual server using yum:

yum install nginx

change to /etc/nginx directory and backup your original Nginx configuration file

cd /etc/nginx
cp nginx.conf{,.bak}

Now edit /etc/nginx.conf and make sure it looks like the following:

vim nginx.conf
user nginx;
worker_processes 2;

error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;

pid /run/nginx.pid;

events {
worker_connections 1024;
use epoll;
}

# set open fd limit to 30000
worker_rlimit_nofile 30000;

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

#access_log /var/log/nginx/access.log main;

sendfile on;

keepalive_timeout 30;
server_tokens off;

connection_pool_size 256;
client_header_buffer_size 1k;
large_client_header_buffers 4 2k;
request_pool_size 4k;

output_buffers 1 32k;
postpone_output 1460;

types_hash_max_size 2048;
server_names_hash_bucket_size 64;

gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_http_version 1.1;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;

add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";

# include vhosts from sites-enabled/
include /etc/nginx/sites-enabled/*.conf;

# include configs from conf.d/*.conf
include /etc/nginx/conf.d/*.conf;
}

You can edit the configuration to suit your needs, but in general, you would only have to tune the worker_processes option which is determined by the number of the CPUs your virtual server has.

The following command will display the number of CPUs on your CentOS VPS:

grep -c 'model name' /proc/cpuinfo

Since we’re including configuration files from /etc/nginx/sites-enabled and /etc/nginx/conf.d, we will need to create some additional directories which will held the virtual server block configurations:

mkdir /etc/nginx/{sites-available,sites-enabled}

DEFAULT NGINX VHOST

Set-up the default Nginx vhost in /etc/nginx/sites-available/default.conf. This means that any domains which are pointed/resolving to your virtual server IP address and are not yet configured, will hit this server block (vhost)

vim /etc/nginx/sites-available/default.conf

server {
listen 80 default_server;
server_name _;
root /var/www/html/default;
location / {
index index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /var/www/html/default;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html/default;
}
}

create the document root directory for the default Nginx vhost and set-up some html files:

mkdir -p /var/www/html/default
cat << EOF > /var/www/html/default/index.html
 
<div style="color: #fff; width: 100%;">
<h1 align="center">Contoh dari emka.web.id</h1>
</div>
EOF
cat &lt;&lt; EOF &gt; /var/www/html/default/404.html
&nbsp;
<div style="color: #fff; width: 100%;">
<h1 align="center">HTTP 404 Not Found</h1>
<h2 align="center">Contoh dari emka.web.id</h2>
</div>
EOF
cat &lt;&lt; EOF &gt; /var/www/html/default/50x.html
&nbsp;
<div style="color: #fff; width: 100%;">
<h1 align="center">Server Error</h1>
<h2 align="center">Contoh dari emka.web.id</h2>
</div>
EOF

INSTALL PHP-FPM
Install PHP support on the CentOS 7 VPS using yum

yum install php-fpm php-mysql php-mcrypt

also, install any other PHP module that your application requires. The list is shown below and you can always use yum search php- in the command line to get the list of available PHP modules on your CentOS 7 VPS:

php-bcmath – A module for PHP applications for using the bcmath library
php-cli – Command-line interface for PHP
php-common – Common files for PHP
php-dba – A database abstraction layer module for PHP applications
php-devel – Files needed for building PHP extensions
php-embedded – PHP library for embedding in applications
php-enchant – Enchant spelling extension for PHP applications
php-fpm – PHP FastCGI Process Manager
php-gd – A module for PHP applications for using the gd graphics library
php-imap – A module for PHP applications that use IMAP
php-intl – Internationalization extension for PHP applications
php-ldap – A module for PHP applications that use LDAP
php-mbstring – A module for PHP applications which need multi-byte string handling
php-mcrypt – Standard PHP module provides mcrypt library support
php-mysql – A module for PHP applications that use MySQL databases
php-mysqlnd – A module for PHP applications that use MySQL databases
php-odbc – A module for PHP applications that use ODBC databases
php-pdo – A database access abstraction module for PHP applications
php-pear.noarch – PHP Extension and Application Repository framework
php-pecl-memcache – Extension to work with the Memcached caching daemon
php-pgsql – A PostgreSQL database module for PHP
php-process – Modules for PHP script using system process interfaces
php-pspell – A module for PHP applications for using pspell interfaces
php-recode – A module for PHP applications for using the recode library
php-snmp – A module for PHP applications that query SNMP-managed devices
php-soap – A module for PHP applications that use the SOAP protocol
php-xml – A module for PHP applications which use XML
php-xmlrpc – A module for PHP applications which use the XML-RPC protocol

CONFIGURE PHP

Edit /etc/php.ini and change/set the following parameters:

cgi.fix_pathinfo=0
date.timezone = Europe/Amsterdam
expose_php = Off

CONFIGURE PHP-FPM

Edit /etc/php-fpm.conf and change/set the following parameters:

emergency_restart_threshold = 10
emergency_restart_interval = 1m
process_control_timeout = 10

CONFIGURE PHP-FPM POOLS

cd /etc/php-fpm.d/
mv www.conf{,.orig}
vim www.conf

[MAIN]
;listen = 127.0.0.1:9000
listen = /var/run/main-php.socket
listen.mode = 0666
user = nginx
group = nginx
request_slowlog_timeout = 5s
slowlog = /var/log/php-fpm/php.log
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 7
pm.start_servers = 3
pm.min_spare_servers = 3
pm.max_spare_servers = 7
pm.max_requests = 400
listen.backlog = -1
pm.status_path = /status
request_terminate_timeout = 120s
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output = yes
php_value[session.save_handler] = files
;php_value[session.save_path] = /var/lib/php/session
php_admin_value[error_log] = /var/log/php-fpm/php-error.log
php_admin_flag[log_errors] = on

ENABLE AND RESTART SERVICES

nginx -t
systemctl restart nginx
systemctl status nginx
systemctl restart mariadb
systemctl status mariadb
systemctl restart php-fpm
systemctl status php-fpm
systemctl enable nginx mariadb php-fpm

If you’re one of our Linux VPS Hosting customers we can help you install and configure the LEMP stack on your virtual server for you free of charge. Just contact us and some of our experts will complete your request immediately.

How to Add New Search Engines on Chrome

This is the day where search engines come to save our day. Now, creating an organizing a list of results based on various criteria is easy peasy. Some are specialized to retrieve data only from particular locations, narrowing specific down results.

This is how to adding a new custom search engine:

Step 1: Download, install, and run Google Chrome.

Step 2-a: Right-click the URL field and choose to Edit search engines.

OR: Continue reading How to Add New Search Engines on Chrome

Cara Mempercantik Ubuntu 15.04 dengan Icon Nitrux dan Tema Numix

Kalau anda tidak terlalu suka dengan icon-icon di Ubuntu, atau butuh penyegaran, silakan coba tutorial ini. Kita akan mempercantik Ubuntu dengan themes baru dan icon baru.

Adalah icon Nitrux dan themes Numix yang akan kita pakai. Dua project opensource ini menjadi salah satu icon dan themes yang menjadi sorotan karena kualits desainnya yang tinggi. Mereka bahkan mendapat dukungan yang luar biasa ketika mereka menjual themes dan icon mereka untuk pembiayaan.

Untuk menginstall Nitrux Icon dan Numix icon, kita bisa pakai PPA yang mereka sediakan: Continue reading Cara Mempercantik Ubuntu 15.04 dengan Icon Nitrux dan Tema Numix