Selasa, 01 November 2016

Create Table Mysql

Membuat table mysql :

SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS `tampung`;
CREATE TABLE `tampung` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `msisdn` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL,
  `message` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL,
  `senderid` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL,
  `providerid` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MYISAM DEFAULT CHARSET=utf8;

Sekian Terima kasih.

Kamis, 06 Agustus 2015

Setting up Sendmail

Q : Apakah server Linux atau UNIX bisa mengirim email ?

A : Bisa, saya menggunakan opensource software "sendmail" yang dapat running di port 25 (smtp). Sendmail bekerja secara Incoming Mail (reciver) dan Outgoing Mail (sender)

Berjalan di Centos/RHEL 6.3

1. Install Dependence Package

# yum install m4 telnet mailx

2. Install Sendmail dengan "yum"
 
# yum install sendmail sendmail-cf
 
3. Configuration Sendmail

Ketika sebelum configurasi sendmail, langsung dijalankan akan muncul sebagai berikut

# ps -ef | grep -v grep | grep -i sendmail
   root      3595     1  0 00:20 ?        00:00:00 sendmail: accepting connections
   smmsp     3604     1  0 00:20 ?        00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue

# netstat -an | grep :25 | grep tcp
   tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN

Sendmail masih menggunakan local interface host 127.0.0.1 dengan port 25.

Sehingga agar Sendmail bisa running maka harus kita config menjadi ip 0.0.0.0 dengan port 25 , ini karena smtp harus bisa terconnection seluruh network Linux. Confignya sebagai berikut

# vi /etc/mail/sendmail.mc

     Ubah dari :
     DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

     Menjadi :
     dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
 
Kemudian built file configurasi menggunakan "m4", sebagai berikut

# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

Restart sendmail untuk menjalankan service dan buat berjalan di bawah kernel dengan "chkonfig"

# service sendmail restart
# chkconfig sendmail on

Check service sendmail

# netstat -an | grep :25 | grep tcp
   tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN
 
4. Validation dan Testing

Create dua buah user di Linux
 
# useradd test1
# useradd test2

Login sebagai user "test1" dan coba kirim email ke user "test2" melalui command line

$ mail -s "Test mail from testuser1" testuser2
   Hello this is the test mail
   .
   EOT

Sekarang checking maillog di "/var/log/maillog" untuk melihat aktifitas dan melihat issue yang muncul.
 
# tail /var/log/maillog
   Aug 19 01:07:58 server001 sendmail[4019]: r7IJalr6004019: from=test1@xxx.com, size=37, class=0, nrcpts=1, msgid=, proto=SMTP, daemon=MTA,   relay=localhost [127.0.0.1]
   Aug 19 01:07:58 server001 sendmail[4022]: r7IJalr6004019: to=test2@xxx.com, ctladdr=test1@xxx.com (502/503), delay=00:00:39, xdelay=00:00:00, mailer=local, pri=30438, dsn=2.0.0, stat=Sent

Jika sendmail berhasil sukses berjalan maka akan muncul seperti berikut
 
$ mail
   N  1 test1@xxx.com       Mon Aug 19 01:07  13/503   "Sendmail Test"

5. Firewall Rule (optional)

Sebenarnya ini step optional yang bisa dijalankan dan juga bisa tidak di jalankan.

Berikut untuk open port 25 agar bisa interconnetion network dengan jaringan luar menggunkan "iptables", confignya sebagai berikut :

# iptables -A INPUT -p tcp -m tcp –dport 25 -j ACCEPT

Save dan Restart iptables

service iptables save
service iptables restart

Catatan :
Congratulation you have successfully setup MTA service using Sendmail, now is the time to configure Dovecot service to fetch mail using your favourite MUA (Mail User Agent) like MS Outlook, Thunderbird etc.


source : https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-email-mta-sendmail.html



Minggu, 08 Maret 2015

Compress and Uncompress a Whole Linux or UNIX Directory?

Q : Bagaimana compress seluruh direktori Linux atau UNIX menggunakan shell console / terminal ?

A : Saya menggunakan command Linux / UNIX

$ tar -zcvf archive-name.tar.gz directory-name ( Compress .tar.gz )

$ tar -cjf archive-name.tar.bz2 directory-name ( Compress .tar.bz2 )

Dimana,
  • -z : Compress archive using gzip program
  • -c : Create archive
  • -v : Verbose i.e display progress while creating archive
  • -f : Archive File name
  • -j : Decompress the contents of the compressed archive created by bzip2 program [tar.bz2]

Dan untuk Uncompress dengan command berikut :

$ tar -zxvf archive-name.tar.gz ( uncompress .tar.gz )

$ tar -xvf archive-name.tar.bz2 ( uncompress .tar.bz2 )

Dimana,
  • -x: Extract files

Catatan :
Dibeberapa command tar compress yang paling kecil dalam menghasilkan compressing adalah (.tar.bz2)

 source : http://www.tecmint.com/18-tar-command-examples-in-linux/



Rabu, 08 Oktober 2014

wget queue list

Bagaimana download multifile dan time tertentu ?

command :
wget -i

Buat file untuk list data download

~$ vi list-download.txt
~$ cat list-download.txt
data-download1.pdf
data-download2.pdf
data-download3.pdf

~$ crontab -e

set time untuk waktu mulai download file, misalkan kita ingin jalankan ketika tengah malam jam 3.00 am

00 03 * * * * wget -i /directory/path/list-download.txt > download.log
kemudian save crontab.

Proccess :

--2014-10-08 03:00:00--  https://domain.com/data-download1.pdf
Connecting to domain.com (domain.com)|54.231.244.0|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5821575 (5,6M) [pdf]
Saving to: ‘data-download1.pdf’

100%[=====================================================================================================>] 5.821.575   77,4KB/s   in 72s  

2014-10-08 03:15:00 (78,7 KB/s) - ‘data-download1.pdf’ saved [5821575/5821575]

--2014-10-08 03:15:01--  https://domain.com/data-download2.pdf
Reusing existing connection to domain.com.
HTTP request sent, awaiting response... 200 OK
Length: 6531095 (6,2M) [pdf]
Saving to: ‘data-download2.pdf’

100%[=====================================================================================================>] 6.531.095    101KB/s   in 78s  

2014-10-08 03:25:00 (81,3 KB/s) - ‘data-download2.pdf’ saved [6531095/6531095]

FINISHED --2014-10-08 03:25:01--
Total wall clock time: 1h 26m 15s
Downloaded: 34 files, 384M in 1h 25m 25s (76,7 KB/s)

Source :
http://askubuntu.com/questions/103623/download-files-from-a-list
http://www.thegeekstuff.com/2009/06/15-practical-crontab-examples/

Minggu, 05 Oktober 2014

Mulai persiapan Certificate Redhat SysAdmin

Saat ini saya interest terhadap system redhat, sehingga saya search tentang certificate rhcsa ( redhat certificate  ). Saya punya planning untuk tahun depan ingin mengambil certificate ini, amin. Ini beberapa preparation study point yang dapat di pelajari untuk mengambil certitificate rhcsa.

Understand and use essential tools
  • Access a shell prompt and issue commands with correct syntax
  • Use input-output redirection (>, >>, |, 2>, etc.)
  • Use grep and regular expressions to analyze text
  • Access remote systems using ssh
  • Log in and switch users in multiuser targets
  • Archive, compress, unpack, and uncompress files using tar, star, gzip, and bzip2

Sabtu, 13 September 2014

Deployment System


Apa itu Deployment System?


Salah satu yang pernah saya kerjakan sebagi sysadmin disebuah startup, yaitu membuat deploy system untuk component data application agar dapat berjalan pada mesin - mesin enviroment. Sebenarnya apa itu Deployment System (Release System) ? Deploy system adalah salah satu component yang masuk dalam Software Architecture, sebuah system computer yang terdiri dari perangkat lunak dan component - component software yang telah terinstall menjadi sebuah enviroment yang di butuhkan application agar dapat berjalan sesuai business process. Tujuannya adalah untuk mempermudah proses automatisasi release software dengan cara yang konsisten.

Kamis, 28 Agustus 2014

Example syntax for Secure Copy (scp)

What is Secure Copy?

scp allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.

Examples

Copy the file "foobar.txt" from a remote host to the local host

    $ scp your_username@remotehost.edu:foobar.txt /some/local/directory

Copy the file "foobar.txt" from the local host to a remote host