Entries Tagged 'Linux' ↓
May 7th, 2012 — Linux
Mari kita mencoba lakukan setting ip address pada linux Ubuntu dalam graphic mode, kita tinggalkan sejenak bermain dengan modus text. Disini yang dicoba adalah menggunakan Ubuntu 9.10.
1. Perhatikan Gambar 1berikut, letaknya adalah disudut kanan atas pada tampilan Desktop

- Pada lingkaran merah adalah posisi dimana Network dalam posisi Connected
- Bentuk icon berbeda-beda, ada yang berbentuk dua buah monitor dan ada juga berbentuk seperti sinyal pada HP
2. Klik Kanan pada icon , sehingga seperti pada Gambar 2 dibawah ini dan kemudian klik Edit Connections…


3. Pada tab Wired itu terdapat Auto eth0, klik Auto eth0 kemudian klik Edit pada sebelah kanan

Pada Gambar 4, klik tab IPV4 Settings
Ket:
1. Tab IPV4 Settings
2. Metode pemilihan jenis yaitu MANUAL
3. IP Address yang akan dimasukkan
4. DNS (192.168.9.12)
Setelah semua selesai klik Apply, bila meminta password berikan password user atau password root jika password user tidak bisa
April 28th, 2012 — Linux
Judulnya bahasa Inggris Find and Delete File Under Linux, tadinya ingin menggunakan bahasa Indonesia untuk judul, tapi kayaknya ga pas kata-katanya. 
Ada sebuah pertanyaan lagi, Bagaimana mencari dan menghapus file di Linux? tapi melalui command line. 
Berikut perintah untuk mencari suatu file dan menghapusnya
find . -name “namafile” -exec rm -rf {} \;
atau
find . -type f -name “namafile” -exec rm -f {} \;
misalnya, Anda akan mencari file tetapi Anda hanya mengingat beberapa kata saja “Document Laporan Keuangan.doc” dan yang Anda ingat hanya kata “Keuangan”
find . -name “*keuangan*”
berikut contoh pencarian file mp3 dan kemudian dilakukan penghapusan, contoh ini akan mencari semua data yang ada di system Linux
find / -type f -name “*.mp3″ -exec rm -f {} \;
dan contoh semua file video dan music akan dihapus
find / -type f -name “*.flv” -exec rm -f {} \;
find / -type f -name “*.mpg” -exec rm -f {} \;
find / -type f -name “*.avi” -exec rm -f {} \;
find / -type f -name “*.AVI” -exec rm -f {} \;
find / -type f -name “*.mpeg” -exec rm -f {} \;
find / -type f -name “*.MPEG” -exec rm -f {} \;
find / -type f -name “*.3gp” -exec rm -f {} \;
find / -type f -name “*.3GP” -exec rm -f {} \;
find / -type f -name “*.mp4″ -exec rm -f {} \;
find / -type f -name “*.wmv” -exec rm -f {} \;
find / -type f -name “*.vob” -exec rm -f {} \;
find / -type f -name “*.jpg” -exec rm -f {} \;
find / -type f -name “*.JPG” -exec rm -f {} \;
find / -type f -name “*.dat” -exec rm -f {} \;
find / -type f -name “*.MPG” -exec rm -f {} \;
find / -type f -name “*.asf” -exec rm -f {} \;
find / -type f -name “*.ASF” -exec rm -f {} \;
find / -type f -name “*.MPEG” -exec rm -f {} \;
find / -type f -name “*.ASX” -exec rm -f {} \;
find / -type f -name “*.mp3″ -exec rm -f {} \;
NOTE: hati-hati menggunakan perintah ini
April 26th, 2012 — Linux
Beberapa pertanyaan, Bagaimana mengetahui ukuran/size database atau tabel dalam MySQL?? dari pertanyaan ini saya coba membantu beberapa script MySQL yang digunakan untuk mengetahui ukuran databases dan ukuran masing-masing tabel.

Pertama adalah login di MySQL server sebagai root, dalam artian mempunya privilage tertinggi dalam server MySQL
Berikut script MySQL
check semua database pada server MySQL
SELECT table_schema “Database Name”, SUM( data_length + index_length) / 1024 / 1024 “Data Base Size in MB” FROM information_schema.TABLES GROUP BY table_schema ;
check databases tertentu (misalnya database db_paidjo_blog)
SELECT TABLE_SCHEMA AS ‘Database’, TABLE_NAME AS ‘Table’,
CONCAT(ROUND(((DATA_LENGTH + INDEX_LENGTH – DATA_FREE) / 1024 / 1024),2),” MB”
AS Size FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA LIKE ‘%db_paidjo_blog%’;
check size table
SELECT TABLE_NAME, table_rows, data_length, index_length,
ROUND(((data_length + index_length) / 1024 / 1024),2) “Size in MB”
FROM information_schema.TABLES WHERE table_schema = “db_paidjo_blog”;
Mohon koreksi jika ada kesalahan pengetikan, semua script sudah saya coba. Dan bila ada tambahan silahkan comment.
Sumber: http://pdjo.us/h6mq
March 28th, 2012 — Linux
Anda ingin memblokir akses keluar atau memblokir berdasarkan ip tertentu dengan port tertentu. Berikut tutorial singkat Blok Akses Keluar dengan Iptables (Blocking Outgoing Access with IPTABLES)
iptables -A OUTPUT -d 202.152.12.15 -j DROP
perintah diatas akan melakukan blokir semua akses ke ip 202.152.12.15
Block Outgoing/blok akses keluar berdasarkan port
iptables -A OUTPUT -p tcp –dport 8080 -j DROP
Blok port 8080 pada ip 171.16.100.1
iptables -A OUTPUT -p tcp -d 171.16.100.1 –dport 8080 -j DROP
March 21st, 2012 — Linux
Proftpd merupakan aplikasi ftp sebagai transfer file baik download maupun upload pada server Linux. Bagaimana Install Proftpd di Centos 5? disini saya akan memberikan cara instan install proftpd, dan pastikan server centos 5 Anda sudah terhubung dengan Internet untuk melakukan proses Install Proftpd. Bagaimana memberikan hak akses users proftpd, proftpd AuthUserFile with htpasswd, secure proftpd, .ftpaccess AuthUserFile, semua akan saya berikan disini.

1. Install proftpd
yum install proftpd
2. Rename dulu file config yang asli, menjaga bila ada kesalahan
mv /etc/proftpd.conf /etc/proftpd.conf-ori
3. Buat file baru proftpd.conf
nano -w proftpd.conf
4. Berikut konfigurasi
ServerName “Private FTP Server”
ServerType standalone
ServerIdent on “Private FTP (c)2012 [paidjo]”
DefaultServer on
DeferWelcome on
UseReverseDNS off
IdentLookups off
RequireValidShell no
Port 21
Umask 002
MaxInstances 100
User pftp
Group pftp
#PersistentPasswd off
RootLogin on
SystemLog /var/log/proftpd/proftpd.log
TransferLog /var/log/proftpd/xferlog
DefaultRoot ~ !pftp
AuthUserFile /var/pftp/auth
AuthGroupFile /var/pftp/group
AuthOrder mod_auth_file.c mod_auth_unix.c
#SQLAuthTypes Empty
#SQLAuthenticate off
AllowOverwrite on
AllowRetrieveRestart on
DeleteAbortedStores on
PathDenyFilter “(\\.ftpaccess)|(\\.htaccess)$”
TimesGMT off
DirFakeUser on ~
DirFakeGroup on ~
5. Buat user sesuai dengan konfigurasi
useradd pftp -s /dev/null
6. Perhatikan pada konfigurasi
AuthUserFile /var/pftp/auth
AuthGroupFile /var/pftp/group
authentication user tidak perlu create user pada mesin linux, hanya perlu digunakan htpasswd untuk create user dan passwordnya
misalnya kita akan create user FTP untuk akses sebagai client dengan nama paidjo dengan password passpaidjo
htpasswd -nb paidjo passpaidjo
akan dihasilkan
paidjo:UOl0364v46mU6
7. Buat file /var/pftp/auth
nano -w /var/pftp/auth
chown pftp.pftp /var/pftp/auth
chmod go-r /var/ptfp/auth
Paste hasil htpasswd tadi kedalam file auth
paidjo:UOl0364v4usYd:1020:1011: Paidjo FTP:/var/www/html/paidjo:/bin/bash
semprul:iLidR64v4usYd:1020:1011: Paidjo FTP:/var/www/html/paidjo:/bin/bash
KET:
paidjo:UOl0364v46mU6 merupakan user dan password
1020:1011 ini adalah UID yaitu 1020 dan GID 1011 (gunakan nilai diatas 1000)
Paidjo FTP ini identitas untuk usernya (bebas juga)
/var/www/html/paidjo ini adalah target folder untuk akses yang diberikan user
/bin/bash hanya didalam ini perintah diberikan oleh user
8. Buat file untuk group /var/pftp/group
nano -w /varpftp/group
chown pftp.pftp /var/pftp/group
chmod go-r /var/ptfp/group
isinya adalah seperti berikut
usersgrp:*:1011:semprul
admingrp:*:1011: paidjo
KET:
silahkan Anda masukkan user FTP sesuai kriteria yang dibuat, misalnya paidjo adalah admin maka dimasukkan dalam admingrp dan semprul sebagai user dan dimasukkan dalam usersgrp, maka penulisannya ada seperti diatas, ini nanti akan menentukan hak akses yang akan diberikan dalam suatu folder.
9. Memberi hak akses folder pada user dan admin, buat file .ftpaccess pada folder /var/www/html/paidjo
cd /var/www/html/paidjo
nano -w .ftpaccess
isikan data seperti berikut
<Limit LIST READ RETR CWD CDUP PWD>
AllowUser semprul
</Limit>
<Limit ALL>
AllowGroup admingrp
DenyGroup usersgrp
</Limit>
KET:
pada LIMIT ALL atau semua akses diberikan oleh admingrp yaitu paidjo kecuali usersgrp yang ditolak akses LIMIT ALL,
sedangkan semprul diberikan akses hanya melihat list (sesuaikan dengan kebutuhan users), untuk perintah lengkapnya silahkan ke List of raw FTP command
10. Ubah kepemilikan folder sesuai dengan nilai UID dan GID
chown 1020.1011 /var/www/html/paidjo
11. Jalankan atau Running Proftpd
/etc/init.d/proftpd start
atau
/usr/sbin/proftpd -c /etc/proftpd.conf
Troubleshooting:
linux.paidjo.web.id proftpd[1235]: warning: unable to determine IP address of ‘linux.paidjo.web.id’
linux.paidjo.web.id proftpd[1235]: error: no valid servers configured
linux.paidjo.web.id proftpd[1235]: Fatal: error processing configuration file ‘/etc/proftpd.conf’
pernyelesaiannya adalah
mesin linux.paidjo.web.id harus didefinisikan oleh ip, silahkan coba edit /etc/hosts
nano -w /etc/hosts
tambahkan seperti berikut
192.168.1.1 linux.paidjo.web.id linux
192.168.1.1 adalah ip server ftp dimesin linux Anda sendiri
Mohon koreksinya bila ada yang salah… karena ini murni eksperimen sendiri sehingga mungkin ada penulisan yang kurang

March 20th, 2012 — Linux
Berikut perintah yang ada dalam FTP
Common commands
- ABOR – abort a file transfer
- CWD – change working directory
- DELE – delete a remote file
- LIST – list remote files
- MDTM – return the modification time of a file
- MKD – make a remote directory
- NLST – name list of remote directory
- PASS – send password
- PASV – enter passive mode
- PORT – open a data port
- PWD – print working directory
- QUIT – terminate the connection
- RETR – retrieve a remote file
- RMD – remove a remote directory
- RNFR – rename from
- RNTO – rename to
- SITE – site-specific commands
- SIZE – return the size of a file
- STOR – store a file on the remote host
- TYPE – set transfer type
- USER – send username
Less common commands
- ACCT* – send account information
- APPE – append to a remote file
- CDUP – CWD to the parent of the current directory
- HELP – return help on using the server
- MODE – set transfer mode
- NOOP – do nothing
- REIN* – reinitialize the connection
- STAT – return server status
- STOU – store a file uniquely
- STRU – set file transfer structure
- SYST – return system type
ABOR
Syntax:
ABORAborts a file transfer currently in progress.
ACCT*
Syntax:
ACCT account-infoThis command is used to send account information on systems that require it. Typically sent after a PASS command.
ALLO
Syntax:
ALLO size [R max-record-size]Allocates sufficient storage space to receive a file. If the maximum size of a record also needs to be known, that is sent as a second numeric parameter following a space, the capital letter “R”, and another space.
APPE
Syntax:
APPE remote-filenameAppend data to the end of a file on the remote host. If the file does not already exist, it is created. This command must be preceded by a PORT or PASV command so that the server knows where to receive data from.
CDUP
Syntax:
CDUPMakes the parent of the current directory be the current directory.
CWD
Syntax:
CWD remote-directoryMakes the given directory be the current directory on the remote host.
DELE
Syntax:
DELE remote-filenameDeletes the given file on the remote host.
HELP
Syntax:
HELP [command]If a command is given, returns help on that command; otherwise, returns general help for the FTP server (usually a list of supported commands).
LIST
Syntax:
LIST [remote-filespec]If remote-filespec refers to a file, sends information about that file. If remote-filespec refers to a directory, sends information about each file in that directory. remote-filespec defaults to the current directory. This command must be preceded by a PORT or PASV command.
MDTM
Syntax:
MDTM remote-filenameReturns the last-modified time of the given file on the remote host in the format ”
YYYYMMDDhhmmss“:
YYYYis the four-digit year,
MMis the month from 01 to 12,
DDis the day of the month from 01 to 31,
hhis the hour from 00 to 23,
mmis the minute from 00 to 59, and
ssis the second from 00 to 59.
MKD
Syntax:
MKD remote-directoryCreates the named directory on the remote host.
MODE
Syntax:
MODE mode-characterSets the transfer mode to one of:
- S – Stream
- B – Block
- C – Compressed
The default mode is Stream.
NLST
Syntax:
NLST [remote-directory]Returns a list of filenames in the given directory (defaulting to the current directory), with no other information. Must be preceded by a PORT or PASV command.
NOOP
Syntax:
NOOPDoes nothing except return a response.
PASS
Syntax:
PASS passwordAfter sending the USER command, send this command to complete the login process. (Note, however, that an ACCT command may have to be used on some systems.)
PASV
Syntax:
PASVTells the server to enter “passive mode”. In passive mode, the server will wait for the client to establish a connection with it rather than attempting to connect to a client-specified port. The server will respond with the address of the port it is listening on, with a message like:
227 Entering Passive Mode (a1,a2,a3,a4,p1,p2)where a1.a2.a3.a4 is the IP address and p1*256+p2 is the port number.
PORT
Syntax:
PORT a1,a2,a3,a4,p1,p2Specifies the host and port to which the server should connect for the next file transfer. This is interpreted as IP address a1.a2.a3.a4, port p1*256+p2.
PWD
Syntax:
PWDReturns the name of the current directory on the remote host.
QUIT
Syntax:
QUITTerminates the command connection.
REIN*
Syntax:
REINReinitializes the command connection – cancels the current user/password/account information. Should be followed by a USER command for another login.
REST
Syntax:
REST positionSets the point at which a file transfer should start; useful for resuming interrupted transfers. For nonstructured files, this is simply a decimal number. This command must immediately precede a data transfer command (RETR or STOR only); i.e. it must come after any PORT or PASV command.
RETR
Syntax:
RETR remote-filenameBegins transmission of a file from the remote host. Must be preceded by either a PORT command or a PASV command to indicate where the server should send data.
RMD
Syntax:
RMD remote-directoryDeletes the named directory on the remote host.
RNFR
Syntax:
RNFR from-filenameUsed when renaming a file. Use this command to specify the file to be renamed; follow it with an RNTO command to specify the new name for the file.
RNTO
Syntax:
RNTO to-filenameUsed when renaming a file. After sending an RNFR command to specify the file to rename, send this command to specify the new name for the file.
SITE*
Syntax:
SITE site-specific-commandExecutes a site-specific command.
SIZE
Syntax:
SIZE remote-filenameReturns the size of the remote file as a decimal number.
STAT
Syntax:
STAT [remote-filespec]If invoked without parameters, returns general status information about the FTP server process. If a parameter is given, acts like the LIST command, except that data is sent over the control connection (no PORT or PASV command is required).
STOR
Syntax:
STOR remote-filenameBegins transmission of a file to the remote site. Must be preceded by either a PORT command or a PASV command so the server knows where to accept data from.
STOU
Syntax:
STOUBegins transmission of a file to the remote site; the remote filename will be unique in the current directory. The response from the server will include the filename.
STRU
Syntax:
STRU structure-characterSets the file structure for transfer to one of:
- F – File (no structure)
- R – Record structure
- P – Page structure
The default structure is File.
SYST
Syntax:
SYSTReturns a word identifying the system, the word “Type:”, and the default transfer type (as would be set by the TYPEcommand). For example:
UNIX Type: L8
TYPE
Syntax:
TYPE type-character [second-type-character]Sets the type of file to be transferred. type-character can be any of:
- A – ASCII text
- E – EBCDIC text
- I – image (binary data)
- L – local format
For A and E, the second-type-characterspecifies how the text should be interpreted. It can be:
- N – Non-print (not destined for printing). This is the default if second-type-character is omitted.
- T – Telnet format control (
<CR>,
<FF>, etc.)
- C – ASA Carriage Control
For L, the second-type-characterspecifies the number of bits per byte on the local system, and may not be omitted.
USER
Syntax:
USER usernameSend this command to begin the login process. username should be a valid username on the system, or “anonymous” to initiate an anonymous login.
Sumber: http://pdjo.us/16p3t2
March 16th, 2012 — Linux
Membuat konfigurasi SquidGuard berdasarkan jam kerja, sehingga dapat memudahkan administator. Jam kerja yang digunakan adalah hari Senin, Selasa, Rabu, Kamis, dan Jum’at dalam squidguard (m=mon, t =tue, w=wed, h=thu, f=fri) selebihnya adalah akses bebas.
Untuk konfigurasi tentukan jam kerja kantor
dbhome /etc/squidGuard/db
logdir /var/log/squidGuard
time workhours {
weekly mtwhf 08:00 – 18:00
}
Jam kerja adalah jam 08:00 sampai 18:00
Buat list untuk masing-masing user
scr admin {
ip 192.168.1.2 192.168.1.3
}
scr users {
ip 192.168.1.10 192.168.1.11 192.168.1.12
}
Buat ACL
acl {
admin within workhours {
pass !movies any
redirect http://www.pdjo.us
} else {
pass any
redirect http://www.kerd.us
}
users within workhours {
pass !adv !drugs !tracker !aggressive !music !movies !podcasts !ringtones !webtv !webradio !porn !sex !models !spyware any
redirect http://www.paidjo.web.id
} else {
pass !movies any
redirect http://www.pdjo.us
}
default {
pass none
redirect 302:http://www.paidjo.web.id
}
}
Ket:
untuk Admin pada jam kerja akan melakukan block pada konten semua yang berhubungan dengan Movies misalnya youtube.com dan lain-lain, setelah jam kerja maka akan dibuka semua aksesnya tanpa terkecuali
untuk Users pada jam kerja akan melakukan block internet pada conten yang telah dituliskan diatas, sedangkan diluar jam kerja akan dibuka semua akses kecuali conten movies
Mohon maaf tidak memberikan tutorial secara lengkap, untuk panduan install squidguard silahkan untuk googling untuk mendapatkan tutorialnya
March 10th, 2012 — Linux
Kebetulan mempunyai Webserver yang diakses public yang mungkin rentan akan masalah sekuritas atau keamanannya. Walaupun banyak jalan untuk meningkatkan keamanan pada server, disini akan saya coba untuk melakukan Disable Services pada Server Centos yang tidak digunakan. Selain sekuritas atau keamanan disable services dapat menghemat memory yang dibutuhkan oleh server itu sendiri.

RPC services, autofs atau NFS tidak saya gunakan
$ /sbin/chkconfig portmap off
$ /sbin/chkconfig nfslock off
$ /sbin/chkconfig netfs off
$ /sbin/chkconfig rpcgssd off
$ /sbin/chkconfig rpcidmapd off
$ /sbin/chkconfig autofs off
Email services juga tidak digunakan dalam server ini
$ /sbin/chkconfig sendmail off
$ /sbin/chkconfig mailman off
Tidak digunakan untuk printing
$ /sbin/chkconfig cups off
Dan beberapa service lain yang tidak digunakan dalam webserver ini
$ /sbin/chkconfig xfs off
$ /sbin/chkconfig isdn off
$ /sbin/chkconfig gpm off
$ /sbin/chkconfig pcmcia off
NOTE: Webserver ini digunakan sebagai server Apache, MySQL, dan PHP dengan multi virtual host domain. Silahkan menyesuaikan sesuai dengan kebutuhan masing-masing server.
March 9th, 2012 — Linux
Judul Backup Logs Server Linux tidak akan jauh dari sebuah pekerjaan yang dilakukan oleh seorang admin IT. Contoh sederhana adalah saya akan mencoba melakukan backup logs ircd server (Internet Relay Chat Daemon) sebuah server chating yang terdapat banyak log dalam setiap user melakukan aktifitas. Berikut saya berikan gambaran alur script yang saya lakukan dalam melakukan backup sehari (file ini dijalankan oleh crontab setiap harinya):

1. Menentukan Folder Logs yang akan di backup
2. Melakukan Compress file logs dengan nama sesuai tanggal backup, jadi hanya berbeda penanggalannya
3. Meng-copy file logs backup yang sudah dicompres kedalam folder yang sudah ditentukan
4. Mengirim data dari folder backup akhir ke server lain
NOTE: untuk point 4 nanti akan saya berikan terpisah bagaimana mengirim file ke server lain
Berikut script lengkapnya
#!/bin/sh
#set -x
#——————————————–
# ID: backuplog-xchat.sh – BACKUP items to folder
# USAGE: ./backuplog-xchat.sh
#——————————————–
# PATH
PATH=/opt/bin:/usr/bin:/bin; export PATH
# CONFIG
# — Silahkan masukan folder log yang akan dibackup
FOLDERS=”/var/logs/ircd”
# — Letak file backup
BACKUPFOLDER=”/var/xchat-log”
# — Hapus isi dalam BACKUPFOLDER
rm $BACKUPFOLDER/*
# — ARCHIVE COMMAND
COMPRESSCMD=”tar czfv ”
# Periksa folder backup
[ ! -d $BACKUPFOLDER ]
chown root:root $BACKUPFOLDER
chmod 755 $BACKUPFOLDER
# clean the screen
clear
echo lets start
## loop thru folders
for itm in $FOLDERS; do
FARCHIVE=$BACKUPFOLDER/`basename $itm`_`date +%d-%m-%Y`.tgz
$COMPRESSCMD $FARCHIVE $itm
done
# — SEND FILE to NAS
/home/paidjo/script/cp_log_xchat.sh
echo .. done
NOTE: pada SEND FILE to NAS ini berupa script terpisah, sehingga akan dikirimkan lagi pada server lain
Jika Anda akan meletakkan file backup pada hardisk yang berbeda mohon dihapus script
rm $BACKUPFOLDER/*
kemudian tentukan BACKUPFOLDER nya sesuai dengan hardisk yang sudah di mount sebelumnya
BACKUPFOLDER=”/mnt/hdb1/xchat-log”
Saya rasa scriptnya mudah dibaca dan dipahami, mohon kritiknya jika ada kesalahan melalui koment dibawah
March 9th, 2012 — Linux
Judul Install OpenVPN di VPS Centos5.x ini sebenarnya sudah lama masuk daftar draft web paidjo.web.id yaitu ditahun 2009/2010 (lupa) waktu jamannya banyak oparator seluler dengan akses internet gratis melalui OpenVPN, sehingga memicu saya untuk membuat OpenVPN hanya sebagai konsumsi pribadi, sekarang coba akan saya publish artikel ini supaya saya bisa saling berbagi.

Sebelum melakukan installasi openVPN di vps anda pastikan akses tun/tap anda enable. untuk mengecek akses tun/tap masukan perintah ini pada console/ssh
# ls -al /dev/net/tun
Apabila tun/tap enable akan ada balasan seperti ini
-bash-3.2# ls -al /dev/net/tun
crw------- 1 root root 10, 200 2009-08-01 01:45 /dev/net/tun
pastikan gcc sudah terinstall di vps anda
# yum install gcc
download paket yang di perlukan
# wget http://openvpn.net/release/openvpn-2.0.9.tar.gz
# wget http://openvpn.net/release/lzo-1.08-4.rf.src.rpm
install dan build paket yang di butuhkan
# yum install nano
# yum install rpm-build
# yum install autoconf.noarch
# yum install zlib-devel
# yum install pam-devel
# yum install openssl-devel
# yum install make
# rpmbuild --rebuild lzo-1.08-4.rf.src.rpm
# rpm -Uvh /usr/src/redhat/RPMS/i386/lzo-*.rpm
# rpmbuild -tb openvpn-2.0.9.tar.gz
# rpm -Uvh /usr/src/redhat/RPMS/i386/openvpn-2.0.9-1.i386.rpm
Salin file konfigurasi ke /etc/openvpn
# cp -r /usr/share/doc/openvpn-2.0.9/easy-rsa/ /etc/openvpn
membuat sertifikat pada server
# cd /etc/openvpn/easy-rsa/2.0
# source ./vars
# ./vars
# ./clean-all
# ./build-ca
membuat key pada server
# ./build-key-server server
Build Diffie Hellman
# ./build-dh
salin dan simpan sertifikat itu ke /etc/openvpn/keys
# cp /etc/openvpn/easy-rsa/2.0/keys /etc/openvpn/keys -R
membuat file configurasi server vpn
simpan dan beri nama server.conf dan di letakan pada /etc/openvpn
# cd /etc/openvpn
# nano server.conf
kemudian isi dengan “dev tun” tanpa tanda petik, simpan CTRL+O dan exit CTRL+X
membuat file configurasi untuk port 53
# nano 53.conf
lalu isi dengan kode seperti di bawah ini
port 53
proto udp
dev tun
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key
dh /etc/openvpn/keys/dh1024.pem
plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so /etc/pam.d/login
client-cert-not-required
username-as-common-name
server 192.168.1.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1"
push "dhcp-option DNS 4.2.2.1"
push "dhcp-option DNS 4.2.2.2"
keepalive 1 10
comp-lzo
persist-key
persist-tun
status server-tcp.log
verb 3
lalu simpan.
jalankan server vpn anda dengan perintah
# service openvpn start
atau
# service openvpn restart
Enabling packet forwarding dengan command:
# echo 1 > /proc/sys/net/ipv4/ip_forward
Edit NAT table untuk MASQUERADING
Command berikut khusus untuk server Dedicated saja:
# iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE
Sedangkan untuk VPS, command nya adalah sbb:
# iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o venet0 -j SNAT --to xx.xx.x.x
xx.xx.x.x disesuaikan dengan IP venet0 di VPS anda.
Download openVPN berbasis GUI
Download sertifikat yang di buat tadi ke komputer anda, file yang di butuhkan adalah ca.crt lalu simpan di folder config di instalasi openvpn pada komputer.
buatlah file konfigurasi client dan beri nama misalkan user1.ovpn dengan isi
client
dev tun
proto udp
remote xx.xx.xx.x 53
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
auth-user-pass
comp-lzo
verb 3
mute 20
keepalive 10 100
tun-mtu 5000
redirect-gateway def1
route-method exe
route-delay 2
kemudian simpan di dalam folder c://Program File/openVPN/config/user1.ovpn
membuat user vpn
# useradd namauser -M -s /bin/false
# passwd namauser
Jalankan dan connect ke vpn anda
VPS (Virtual Private Server) adalah teknologi server yang bersifat virtual dimana hal ini bekerja secara software dan terdapat didalam sebuah physical server dibagi-bagi sehingga setiap VPS terlihat dan bekerja seperti sebuah server mandiri yang sebenarnya. Setiap VPS memiliki Full Root Access, Sistem Operasi, dan pengaturan sendiri untuk init script, users, pemrosesan, filesystem dan sebagainya termasuk resources server seperti CPU dan RAM yang berdiri sendiri. Berbeda dengan shared hosting yang menggunakan resource server bersama-sama dan saling mempengaruhi, proses yang berjalan pada suatu VPS tidak akan mempengaruhi VPS yang lain dalam satu server. (sumber: http://pdjo.us/9tcjum)