Archive for the 'FreeBsd' Category

Dec 14 2011

Install Mail Server dengan Postfix with Mysql di FreeBsd 7.3

Published by under FreeBsd

Install Webserver Di FREEBSD 7.3 dengan port

Pertama sebelum masuk ke Webserver kalo saya mending install wget dulu

angga#cd /usr/ports/ftp/wget make install clean

ketika muncul config bebas mana yang di centang
Setelah selesai baru dibawah ini

Install Database MySQL

angga# cd /usr/ports/databases/mysql51-server
angga# make
angga# make install
angga# make clean

Sebelum menjalankan MySQL untuk yang pertama kali, kita jalankan dulu :

angga#/usr/local/bin/mysql_install_db

angga#chown -R mysql:mysql /var/db/mysql

Jalankan MySQL dengan perintah:

angga# /usr/local/bin/mysqld_safe &

Jika sudah selesai silahkan edit /etc/make.conf :

angga# ee /etc/make.conf

Tambahkan dua baris berikut:

WITH_BDB_VER=51
WITH_MYSQL_VER=51

“PASTIKAN DUA BARIS TERSEBUT SESUAI DENGAN VERSI MYSQL YANG SAHABAT GUNAKAN”

Tekan enter untuk keluar dari editor dan pastikan pilih save changes.

Install Apache13 + ModSSL

angga# cd /usr/ports/www/apache13-modssl
angga# make
angga# make certificate

Pada langkah ini sahabat akan diminta untuk mengisi atau menjawab hal-hal yang dibutuhkan, silahkan pilih [R]SA server key untuk performa yang bagus, ubah data yang desesuaikan dengan data sahabat, ketika ditanya want to encrypt this key ? pilih saja [N]o, kemudian ikuti langkah berikut:

angga# make install
angga# make clean

Install PHP

angga# cd /usr/ports/lang/php5

angga# make
angga# make install
angga# make clean

Install PHP Extensions

angga# cd /usr/ports/lang/php5-extensions

angga# make

Pada tahap ini kita diminta untuk memilih extensi PHP yang sekiranya kita butuhkan silahkan di pilih/centang, proses compile akan memakan waktu cukup lama, tergantung extensi yang kita pilih tadi dan tergantung keceptan internet yang kita gunakan. Setelah beres prosesnya:

angga# make install
angga# make clean

Untuk memastikan web server yang baru saja kita install bisa menangani PHP:

Tambahkan baris berikut:

#————————————————–

AddType application/x-httpd-php .php

#————————————————–

Supaya Apache dan MySQL jalan otomatis ketika mesin FreeBSD dinyalakan, edit /etc/rc.conf:

angga# ee /etc/rc.conf

tambahkan baris berikut:

mysql_enable=”YES”
apache_enable=”YES”

tekan Esc untuk keluar dari editor dan pilih save changes, setelah itu restart FreeBSD kita;

angga# reboot

Jangan lupa untuk menambahkan password untuk root MySQL:

angga# mysqladmin -u root password password-sahabat-disini

Ini adalah tulisan saya bulan Maret 2009,  Semoga bisa membantu bagi yang belum tahu, bagi sang ahli apabila ada yang salah tolong dikoreksi.

We assume you already have Freebsd 7 OS with MYSQL PHP and Apache installed on it.

1. Create Postfix DB

Login into your server and su with root access.

#mysql -u root -p
#create database postfix;
#GRANT ALL PRIVILEGES ON postfix.* TO ‘postfix’@’localhost’ IDENTIFIED BY ‘yourpostfixpassword’ WITH GRANT OPTION;
#flush privileges;
#exit

From mysql command above, we have created postfix db, with postfix user and yourpostfixpassword as db password.

2. Install Cyrus-SASL

Login into your server and su with root access.

#/usr/ports/security/cyrus-sasl2
#make config

Please kindly to take a look a capture screen below :
You need to make sure MYSQL, LOGIN and PLAIN is ticked/checked.

#make install clean

This will automatically install any dependency like MYSQL, OpenSSL.. etc.. leave it untouch and wait until the installation finished.

3. Install Postfix

#/usr/ports/mail/postfix
#make config

Please kindly to take a look a capture screen below :
You need to make sure PCRE, MYSQL,SASL2,TLS

#make install clean

This will automatically install any dependency like PCRE, MYSQL, Cyrus-SASL2, OpenSSL.. etc.. leave it untouch and wait until the installation finished.

3.1 Generate SSL for postfix

#cd /etc/ssl
#openssl req -new -x509 -nodes -out smtpd.pem -keyout smtpd.pem -days 3650

This will create smtpd.pem in /etc/ssl

3.2 Modify postix main.cf

## Add few lines below in the end of main.cf
virtual_alias_maps = proxy:mysql:/usr/local/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:125
virtual_mailbox_base = /var/vmail/
virtual_mailbox_domains = proxy:mysql:/usr/local/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 112400000
virtual_mailbox_maps = proxy:mysql:/usr/local/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 125
virtual_transport = virtual
virtual_uid_maps = static:125
alias_maps = mysql:/usr/local/etc/postfix/mysql_virtual_alias_maps.cf

#====================SASL========================
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
permit_mynetworks,  
permit_sasl_authenticated,
reject_invalid_hostname,
reject_non_fqdn_hostname,
reject_unknown_sender_domain,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
reject_unauth_pipelining,
reject_unauth_destination,
permit

smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_sasl_application_name = smtpd
smtpd_banner=$myhostname ESMTP “rainforest.neorack.com”

smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /etc/ssl/smtpd.pem
smtpd_tls_cert_file = /etc/ssl/smtpd.pem
smtpd_tls_CAfile = /etc/ssl/smtpd.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom

3.3 Create All *.cf files in /usr/local/etc/postfix

#cd /usr/local/etc/postfix
#pico mysql_virtual_alias_maps.cf

user = postfix
password = yourpostfixpassword
hosts = localhost
dbname = postfix
query = SELECT goto FROM alias WHERE address=’%s’ AND active = ‘1’

#pico mysql_virtual_domains_maps.cf

user = postfix
password = yourpostfixpassword
hosts = localhost
dbname = postfix
query = SELECT domain FROM domain WHERE domain=’%s’ AND active = ‘1’

#pico mysql_virtual_mailbox_maps.cf

user = postfix
password = yourpostfixpassword
hosts = localhost
dbname = postfix
query = SELECT maildir FROM mailbox WHERE username=’%s’ AND active = ‘1’

3.4 Create VMAIL directory

#cd /var
#mkdir vmail
#chown -R postfix:postfix vmail

4 Install Courier-Authlib and SMTP AUTH

#cd /usr/ports/security/courier-authlib

Please kindly to take a look a capture screen below
You need to make sure Ticked AUTH_MYSQL

#make install clean

This will automatically install any dependency like MYSQL.. leave it untouched until finished.

4.1 Edit authdaemonrc

#cd /usr/local/etc/authlib
#mv authdaemonrc authdaemonrc-ori
#pico authdaemonrc
## uncomment this line below and edit this line to :
authmodulelist=”authmysql”

4.2 Edit authmysqlrc

#cd /usr/local/etc/authlib
#mv authmysqlrc authmysqlrc-ori

Before you edit authmysqlrc, please check your postfix UID and GID.

#id postfix
uid=125(postfix) gid=125(postfix) groups=125(postfix),6(mail)

We will need postfix UID and GID in authmysqlrc config file below

#pico authmysqlrc

## Edit and change the sql user,db and password as needed
MYSQL_SERVER            localhost
MYSQL_USERNAME          postfix
MYSQL_PASSWORD          yourpostfixpassword
MYSQL_SOCKET            /tmp/mysql.sock
MYSQL_PORT              0
MYSQL_OPT               0
MYSQL_DATABASE          postfix
MYSQL_USER_TABLE        mailbox
MYSQL_CRYPT_PWFIELD     password
MYSQL_CLEAR_PWFIELD     password
MYSQL_UID_FIELD         ‘125’
MYSQL_GID_FIELD         ‘125’
MYSQL_LOGIN_FIELD       username
MYSQL_HOME_FIELD        ‘/var/vmail’
MYSQL_NAME_FIELD        name
MYSQL_MAILDIR_FIELD     maildir

4.3 Setting SMTP AUTH

#cd /usr/local/lib/sasl2
#pico smtpd.conf

pwcheck_method: authdaemond
log_level: 3
mech_list: PLAIN LOGIN
authdaemond_path:/var/run/authdaemond/socket

4.4 Change authdaemond_path permission

#chown -R postfix:postfix /var/run/authdaemond/

5. Install Courier-Imap

#cd /usr/ports/mail/courier-imap
#make config

Please kindly to take a look a capture screen below,
Make sure you have ticked a AUTH_MYSQL

#make install clean

It will automatically install any dependency like MYSQL.. leave it untouched until installation finished.

5.1 Edit imapd, imapd-ssl, pop3d and pop3d-ssl

#cd /usr/local/etc/courier-imap
#cp pop3d.dist pop3d
#pico pop3d

## edit these line below to :
POP3AUTH=”PLAIN LOGIN”
POP3AUTH_TLS=”PLAIN LOGIN”
POP3DSTART=YES
## leave other options untouched

#cp imapd.dist imapd
#pico imapd

## change this line below to :
IMAPDSTART=YES
## leave other options untouched

#cp pop3d-ssl.dist pop3d-ssl
#pico pop3d-ssl

## change these line below to :
POP3DSSLSTART=YES
POP3_STARTTLS=NO
TLS_CERTFILE=/etc/ssl/smtpd.pem
## leave other options untouched

#cp imapd-ssl.dist imapd-ssl
#pico imapd-ssl

## change these line below to :
IMAPDSSLSTART=YES
IMAPDSTARTTLS=NO
TLS_CERTFILE=/etc/ssl/smtpd.pem
## leave other options untouched

6. Install Postfixadmin

#cd /usr/ports/mail/postfixadmin
#make config

Please kindly to take a look a capture screen below:
Please make sure you ticked a MYSQL

#make install clean

It will automatically install any dependency such as MYSQL etc.. please leave it untouched until finished.

6.1 Edit postfix admin config file

#cp -R /usr/local/www/postfixadmin /var/www/html/postfixadmin
#cd /var/www/html/postfixadmin

Find file config.inc.php.dist or config.inc.php-dist rename it to config.inc.php
#pico config.inc.php

## edit few lines below to :
$CONF[‘configured’] = true;
$CONF[‘postfix_admin_url’] = ‘http://10.10.10.10/postfixadmin’; ## change it to your ip address/website
$CONF[‘database_type’] = ‘mysql’;
$CONF[‘database_host’] = ‘localhost’;
$CONF[‘database_user’] = ‘postfix’;
$CONF[‘database_password’] = ‘yourpostfixpassword’;
$CONF[‘database_name’] = ‘postfix’;
$CONF[‘database_prefix’] = ”;[/code]

You can access postfixadmin from browser. Example :http://10.10.10.10/postfixadmin/setup.php
After you have access the url above. you will generate a admin password for postfix. example your admin password is : testing123

you will receive a line like below, this is a HASH password for testing123:

$CONF[‘setup_password’] = ‘e457ce0976f66096b69267f5103b62e0:712a40a9bd487e5fde6e1c6014f25’

Next, you need to edit config.inc.php again>
#pico config.inc.php

### fine $CONF[‘setup_password’] ###
Change it like below :

$CONF[‘setup_password’] = ‘e457ce0976f66096b69267f5103b62e0:712a40a9bd487e5fde6e1c6014f25’
### save this file ###

So you can start create a postmaster account to manage all your virtual domains and virtual mailbox
From this url http://10.10.10.10/postfixadmin/setup.php
Input your setup admin password example : testing123
Input your master email or master admin email example : postmaster@testing.com
Inpur your master email or master admin email password example ; test123

After you have finished created a postmaster account / master admin email account.
you can login via this url http://10.10.10.10/postfixadmin/ to create a domain and virtual email account.

7. Install Squirrelmail Webmail

#cd /usr/ports/mail/squirrelmail
#make install clean

7.1 Configure Squirrelmail

#cp -R /usr/local/www/squirrelmail /var/www/html/webmail
#cd /var/www/html/webmail/config
#./conf.pl

type option 2
type option A
type option 6 for auth type “login”
type option 8 and type courier

type option B
type option 7 for smtp auth “login”
type S to save
type Q to quit

You can access your webmail from http://10.10.10.10/webmail, Change it into your website url/ your server ip address.

7.2 Install Courierpassd

#cd /usr/ports/security/courierpassd
#make install clean

7.3 Install Courierpassd in Inetd.conf

#pico /etc/inetd.conf

## add this line in the end of the config file
courierpassd stream tcp nowait root /usr/local/sbin/courierpassd courierpassd -s imap

#pico /etc/services

## add this line in the end of the config file
courierpassd 106/tcp #for courierpassd

8. Configure all Services in rc.conf and rc.local

#pico /etc/rc.conf
postfix_enable=”YES”
courier_authdaemond_enable=”YES”
courier_imap_imapd_enable=”YES”
courier_imap_pop3d_enable=”YES”
courier_imap_imapd_ssl_enable=”YES”
courier_imap_pop3d_ssl_enable=”YES”
inetd_enable=”YES”

#pico /etc/rc.local
/usr/local/bin/mysqld_safe –user=mysql &

8.1 Starting all Services and daemon

#/usr/local/sbin/postfix start
postfix/postfix-script: starting the Postfix mail system
#/usr/src/etc/rc.d/inetd restart
Starting inetd.
#/usr/local/etc/rc.d/courier-authdaemond start
Starting courier_authdaemond.
#/usr/local/etc/rc.d/courier-imap-imapd start
Starting courier-imap-imapd.
#/usr/local/etc/rc.d/courier-imap-imapd-ssl start
Starting courier-imap-imapd-ssl.
#/usr/local/etc/rc.d/courier-imap-pop3d start
Starting courier-imap-pop3d.
#/usr/local/etc/rc.d/courier-imap-pop3d-ssl start
Starting courier-imap-pop3d-ssl. 

Dapet dari

http://faruqafif.student.fkip.uns.ac.id/2009/07/29/install-apache-php-mysql-di-freebsd-71/

http://www.wowtutorial.org/tutorial/168.html

Comments Off on Install Mail Server dengan Postfix with Mysql di FreeBsd 7.3

Dec 05 2011

Memindah Directory Default Mysql di Freebsd

Published by under FreeBsd

Secara default, jika kita install mysql server via port maka data-data dari database yang ada dalam mysql server akan tersimpan pada dir /var/db/mysql
Akan merepotkan kalau ternyata partisi /var kita terlalu kecil, sehingga data nambah sedikit aja partisi /var udah penuh.
Ada 2 cara untuk mensiasati hal tsb,
pertama ada merubah letak data directory pada file konfigurasi mysql kita my.cnf.
Hal ini memerlukan perubahan pada file konfigurasi my.cnf
# ee /var/db/mysql/my.cnf
[mysqld]
datadir=/data/mysqlbaru
Create directory tempat data baru disimpan
# mkdir /data/mysqlbaru
merubah owner directory tsb menjadi milik mysql
#chown -R mysql:mysql /data/mysqlbaru
kemudian start mysql
# /usr/local/etc/rc.d/mysql-server start

Cara kedua adalah dengan memindah dan melakukan linking directory mysql.
Detailnya sbb :

matikan server :
# /usr/local/etc/rc.d/mysql-server stop
# cd /var/db
pindahkan directory data mysql ke directory baru yang kapasitasnya lebih lega :
# mv mysql /data
lakukan linking directory
# ln -s /data/mysql /var/db/mysql
start server :

# /usr/local/etc/rc.d/mysql-server start

Disadur dari http://www.indofreebsd.or.id/tips-and-trick/merubah-data-directory-pada-mysql-server-freebsd-server.html

Comments Off on Memindah Directory Default Mysql di Freebsd

Feb 22 2011

Mengetahui Port webmin Kalo Lupa heehee

Published by under FreeBsd,LinuX

Hehehe….buat webmin kok lupa portnya….yaudah googling aja…akhirnya ketamu…baik di freebsd atau linuk danlain sebagainya cari aja file ini

miniserv.conf

nah liat aja file itu nanti keliatan deh portnya berapa….itu dulu ….heheheeee

Comments Off on Mengetahui Port webmin Kalo Lupa heehee

Oct 06 2010

Installasi dan Konfigurasi Smokeping di FreeBSD 7

Published by under FreeBsd

Pendahuluan

Tulisan ini dibuat karena udah beberapa kali harus install smokeping tapi selalu ada kelewat satu step. NGOX!!

Smokeping apaan tuch?? Kata deskripsinya: SmokePing is a latency logging and graphing system. It consists of a daemon process which organizes the latency measurements and a CGI which presents the graphs.

Kelebihan yang kerasa:

  1. Ga perlu adanya snmp2-an kaya cacti ato mrtg.
  2. Basednya pake ping jadi ngitungnya berdasarkan time bukan penggunaan bandwidth (orang awam bakalan lebih paham).
  3. Bisa dipake senjata ke ISP yg suka nyangkal kalo koneksi kita pernah putus.

Mari kita lanjutkan ke step selanjutnya:

Installasi

1. Install apache20

# /usr/ports/www/apache20/
# make install clean

2. Install smokepingnya

# /usr/ports/net-mgmt/smokeping
# make install clean

Jangan lupa centang fping ama echoping pada option, proses ini akan menginstall otomatis:

  • rrdtool
  • SpeedyCGI
  • fping
  • echoping

3. Asusmsi kalo di mesin sudah terinstall perl5.8

# cpan
cpan> install socket6
cpan> install Net::DNS
cpan> quit

Konfigurasi

1. Edit httpd.conf nya

# ee /usr/local/etc/apache2/httpd.conf

  • check apakah module speedycgi udah keload

LoadModule speedycgi_module   libexec/apache2/mod_speedycgi.so

kalo udah berarti dah aman.

  • aktifkan & Tambahin  .cgi pada AddHandler

AddHandler cgi-script .cgi

  • Tambahin smokeping.cgi pada DirectoryIndex

DirectoryIndex index.html index.php smokeping.cgi

2. Bikin file smokeping.conf di folder /usr/local/etc/apache2/Include

# ee /usr/local/etc/apache2/Include/smokeping.conf

isi filenya:

Alias /smokeping “/usr/local/smokeping/htdocs”

<Directory “/usr/local/smokeping/htdocs”>
Options ExecCGI
Allow from all
</Directory>

Alias /smokeimg/ /usr/local/smokeping/htdocs/img/
Alias /cropper/ /usr/local/smokeping/htdocs/cropper/

3. Edit smoekping config.

# ee /usr/local/etc/smokeping/config
owner    = Kabayan
contact  =
<!–
var prefix = ‘ma’ + ‘il’ + ‘to’;
var path = ‘hr’ + ‘ef’ + ‘=’;
var addy74877 = ‘kabayan’ + ‘@’;
addy74877 = addy74877 + ‘indofreebsd’ + ‘.’ + ‘or’ + ‘.’ + ‘id’;
document.write( ‘<a ‘ + path + ”’ + prefix + ‘:’ + addy74877 + ”>’ );
document.write( addy74877 );
document.write( ‘</a>’ );
//–>n kabayan@indofreebsd.or.id
<!–
document.write( ‘<span style=’display: none;’>’ );
//–>
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
<!–
document.write( ‘</’ );
document.write( ‘span>’ );
//–>

mailhost = localhost
sendmail = /usr/sbin/sendmail
# NOTE: do not put the Image Cache below cgi-bin
# since all files under cgi-bin will be executed … this is not
# good for images.
imgcache = /usr/local/smokeping/htdocs/img
imgurl   = /smokeimg
datadir  = /var/smokeping
piddir  = /var/smokeping
cgiurl   = http://server-smokeping.com/smokeping/smokeping.cgi
smokemail = /usr/local/etc/smokeping/smokemail
tmail = /usr/local/etc/smokeping/tmail

*** Alerts ***
to =
<!–
var prefix = ‘ma’ + ‘il’ + ‘to’;
var path = ‘hr’ + ‘ef’ + ‘=’;
var addy7040 = ‘kabayan’ + ‘@’;
addy7040 = addy7040 + ‘indofreebsd’ + ‘.’ + ‘or’ + ‘.’ + ‘id’;
document.write( ‘<a ‘ + path + ”’ + prefix + ‘:’ + addy7040 + ”>’ );
document.write( addy7040 );
document.write( ‘</a>’ );
//–>n kabayan@indofreebsd.or.id
<!–
document.write( ‘<span style=’display: none;’>’ );
//–>
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
<!–
document.write( ‘</’ );
document.write( ‘span>’ );
//–>

from =
<!–
var prefix = ‘ma’ + ‘il’ + ‘to’;
var path = ‘hr’ + ‘ef’ + ‘=’;
var addy284 = ‘smokeping’ + ‘@’;
addy284 = addy284 + ‘server-smokeping’ + ‘.’ + ‘com’;
document.write( ‘<a ‘ + path + ”’ + prefix + ‘:’ + addy284 + ”>’ );
document.write( addy284 );
document.write( ‘</a>’ );
//–>n smokeping@server-smokeping.com
<!–
document.write( ‘<span style=’display: none;’>’ );
//–>
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
<!–
document.write( ‘</’ );
document.write( ‘span>’ );
//–>

+ Indofreebsd
menu = Targets
++ indofreebsd
menu = indofreebsd
title = indofreebsd
host = www.indofreebsd.or.id

4. Jalankan apache ama smokepingnya

# /usr/local/etc/rc.d/apache2 forcestart
# /usr/local/etc/rc.d/smokeping forcestart

5. Pasang di rc.conf biar autorun

# ee /etc/rc.conf

apache2_enable=”YES”
smokeping_enable=”YES”

6. BERES

Disadur dari Indo Freebsd Thanks Bro

Comments Off on Installasi dan Konfigurasi Smokeping di FreeBSD 7

Aug 11 2010

Menambah Hardisk Di Freebsd 7

Published by under FreeBsd

  1. Secara fisik hard disk [IDE termasuk SATA] yang akan ditambahkan sudah terpasang dengan benar di komputer FreeBSD yang diinginkan yang sebelumnya hanya menggunakan satu hard disk IDE [ad0].
  2. # edit /var/run/dmesg.boot Langkah ini untuk melihat apakah hard disk baru yang ditambahkan bisa dikenali oleh sistem FreeBSD kita. Pada langkah-langkah selanjutnya, di sini diasumsikan bahwa hard disk baru dikenali sebagai ad1
  3. # dd if=/dev/zero of=/dev/rad1 bs=1k count=1 Langkah ini men-clear-kan hard disk baru
  4. # fdisk  -BI ad1 Langkah ini untuk menginisialisasi hard disk baru yang ditambahkan
  5. # bsdlabel -B -w -r ad1s1 auto lalu # bsdlabel -e ad1s1 Langkah ini untuk melabeli
  6. # mkdir -p /hd2 Langkah ini membuat direktori /hd2 untuk menampung mounting dari  partisi hard disk baru nantinya
  7. # newfs /dev/ad1s1e Langkah ini memformat partisi baru
  8. # mount -t ufs /dev/ad1s1e /hd2 Langkah ini untuk melakukan mounting partisi /dev/ad1s1e yang telah dibuat pada point 7 ke direktori /hd2 yang dibuat pada point 6
  9. # edit /etc/fstab Tambahkan baris berikut : /dev/ad1s1e    /hd2   ufs     rw     1    1

    agar pada booting berikutnya FreeBSD Anda bisa mengenali penambahan hard disk baru ini dan kita tinggal menggunakannya di /hd2

  10. Untuk hard disk tipe SCSI ganti ad dengan da

FreeBSD…masihkah perlu diragukan ?

Comments Off on Menambah Hardisk Di Freebsd 7

« Prev - Next »