3 Membuat Kalkulator Online

Buat file index.html dengan isi sbb:
<title>Kalkulator Online</title> 
 
 
<form name="form1" method="post" action="hitung.php"> 
<p>Operator matematika </p> 
<p> 
<input name="angka" id="angka" type="text"> 
<select name="operator" id="operator"> 
<option>+</option> 
<option>-</option> 
<option>*</option> 
<option>/</option> 
</select> 
<input name="angka2" id="angka2" type="text">  
<input name="Submit" value="Hitung" type="submit"> 
</p> 
</form> 
<form name="form2" method="post" action="hitung2.php"> 
<p>Konstanta matematika </p>
<p> 
<input name="angka" id="angka" type="text"> 
<select name="operator" id="operator"> 
<option>abs</option> 
<option>floor</option> 
      <option>round</option> 
      <option>decbin</option> 
      <option>bindec</option> 
      <option>decoct</option> 
      <option>octdec</option> 
      <option>dechex</option> 
      <option>hexdec</option> 
      <option>sin</option> 
      <option>cos</option> 
      <option>tan</option> 
      <option>log</option> 
      <option>sqrt</option> 
    </select> 
    <input name="Submit" value="Hitung" type="submit"> 
</p> 
  <p>Keterangan :</p> 
  <table width="100%" border="0"> 
    <tbody><tr> 
      <td>+</td> 
      <td>=</td> 
      <td>Tambah.</td> 
    </tr> 
    <tr> 
      <td>-</td> 
      <td>=</td> 
      <td>Kurang.</td> 
    </tr> 
    <tr> 
      <td>*</td> 
      <td>=</td> 
      <td>Kali.</td> 
    </tr> 
    <tr> 
      <td>/</td> 
      <td>=</td> 
      <td>Bagi.</td> 
    </tr> 
    <tr>
 <td width="4%">abs</td> 
      <td width="2%">=</td> 
      <td width="94%">Mencari nilai absolut .</td> 
</tr><tr> 
   <td>floor</td> 
   <td>=</td> 
   <td>Pembulatan nilai. </td> 
 </tr> 
<tr> 
      <td>round</td> 
      <td>=</td> 
      <td>Membulatkan angka di belakang koma. </td> 
    </tr> 
    <tr> 
      <td>decbin</td> 
      <td>=</td> 
      <td>Mengkonversi menjadi bilangan biner. </td> 
    </tr> 
    <tr> 
      <td>bindec</td> 
      <td>=</td> 
      <td>Mengkonversi menjadi bilangan desimal. (kebalikan dari decbin) </td> 
    </tr> 
    <tr> 
      <td>decoct</td> 
      <td>=</td> 
      <td>Mengkonversi menjadi bilangan oktal. </td> 
    </tr> 
    <tr> 
      <td>octdec</td> 
      <td>=</td> 
      <td>Mengkonversi menjadi bilangan desimal (kebalikan dari decoct) </td> 
    </tr> 
    <tr> 
      <td>dechex</td> 
      <td>=</td> 
      <td>Mengkonversi menjadi bilangan Hexadesimal. </td> 
    </tr> 
    <tr> 
      <td>hexdec</td> 
      <td>=</td> 
      <td>Mengkonversi menjadi bilangan desimal (kebalikan dari dechex). </td> 
</tr>
<tr> 
      <td>sin</td> 
      <td>=</td> 
      <td>sine</td> 
    </tr> 
    <tr> 
      <td>cos</td> 
      <td>=</td> 
      <td>cosine</td> 
    </tr> 
    <tr> 
      <td>tan</td> 
      <td>=</td> 
      <td>tangent</td> 
    </tr> 
    <tr> 
      <td>log</td> 
      <td>=</td> 
      <td>log</td> 
    </tr> 
<tr> 
      <td>sqrt</td> 
      <td>=</td> 
      <td>akar</td> 
    </tr> 
  </tbody></table> 
</form>


Selanjutnya file hitung.php
<?php  
$angka = $_POST['angka']; 
$angka2 = $_POST['angka2']; 
$operator = $_POST['operator']; 
if ($operator == '+'){ 
$hasil = $angka+$angka2;} 
if ($operator == '-'){ 
$hasil = $angka-$angka2;}
if ($operator == '*'){ 
$hasil = $angka*$angka2;} 
if ($operator == '/'){ 
$hasil = $angka/$angka2;} 
echo "$hasil"; 
echo "
<input type='button' value='kembali' onclick='history.back()'>";
?>


Dan yang terakhir file hitung2.php
<?php 
$angka = $_POST['angka']; 
$operator = $_POST['operator']; 
if ($operator == 'abs'){ 
$hasil = abs($angka);} 
if ($operator == 'floor'){ 
$hasil = floor($angka);} 
if ($operator == 'round'){ 
$hasil = round($angka);} 
if ($operator == 'decbin'){ 
$hasil = decbin($angka);} 
if ($operator == 'bindec'){ 
$hasil = bindec($angka);} 
if ($operator == 'decoct'){ 
$hasil = octdec($angka);} 
if ($operator == 'octdec'){ 
$hasil = octdec($angka);} 
if ($operator == 'dechex'){
$hasil = dechex($angka);} 
if ($operator == 'hexdec'){ 
$hasil = hexdec($angka);} 
if ($operator == 'sin'){ 
$hasil = sin($angka);} 
if ($operator == 'cos'){ 
$hasil = cos($angka);} 
if ($operator == 'tan'){ 
$hasil = tan($angka);} 
if ($operator == 'log'){ 
$hasil = log($angka);} 
if ($operator == 'sqrt'){ 
$hasil = sqrt($angka);} 
echo "$hasil"; 
echo "<br><input type='button' value='kembali' onclick='history.back()'>";
?>

0 Cisco Command Sumarry

18 Instalasi ViMP di Ubuntu 11.04

Kebutuhan Hardware
  1. Processor Dual-Core atau yang lebih baik paling tidak 2.5GHz.
  2. RAM 4+ GB
  3. Harddisk 250+ GB (SATA-II atau SAS), 500 GB lebih baik.
Kebutuhan Software
  1. Apache2: Version 2.2 recommended, mod_rewrite enabled
  2. PHP: Version 5.2.6 atau yang lebih tinggi, GD, mysql, XSL & cURL extension di instal, PHP CLI (Command Line Interface) di instal
  3. MySQL: Version 5.0 atau yang lebih baik, InnoDB storage engine
  4. Transcoding: MEncoder / MPlayer 1.0RC2 atau yang lebih baru, FFmpeg, Paket codec tambahan
Instalasi Instalasi paket yang dibutuhkan
apt-get install apache2 libapache2-mod-php5 php5-cli php5-mysql php5-gd php5-xsl php5-curl mysql-server mplayer mencoder ffmpeg flvtool2 gstreamer0.10-ffmpeg gstreamer0.10-fluendo-mp3 gstreamer0.10-plugins-bad gstreamer0.10-plugins-ugly
Enable beberapa fitur
a2enmod rewrite
Konfigurasi Apache
mkdir -p /var/www/showvid/data
mkdir -p /var/www/showvid/logs
chown -R www-data:www-data /var/www/showvid
vi /etc/apache2/sites-available/showvid
<VirtualHost *:80>
  DocumentRoot "/var/www/showvid/data/web"
  ServerName example.com
  ServerAlias www.example.com
  ServerAlias 127.0.0.1
  ServerAlias localhost
  <Directory "/var/www/showvid/data/web">
    AllowOverride All
    RewriteEngine On
    Options -Indexes FollowSymLinks
  </Directory>
  ErrorLog /var/www/showvid/logs/error.log
  CustomLog /var/www/showvid/logs/access.log combined
  LogLevel error
</VirtualHost>
Konfigurasi PHP Edit
vi /etc/php5/apache2/php.ini
pastikan
upload_max_filesize: 1024M
post_max_size: 1024M
memory_limit: 512M
Edit
vi /etc/php5/cli/php.ini
pastikan
upload_max_filesize: 1024M
post_max_size: 1024M
memory_limit: 512M
Konfigurasi Database Jika diasumsikan password mysql adalah "jaringan" dapat menggunakan perintah
mysqladmin -pjaringan create showvid
mysql -u root -pjaringan
CREATE USER showvid@localhost IDENTIFIED BY 'showvid';
GRANT ALL PRIVILEGES ON showvid.* TO showvid;
FLUSH PRIVILEGES;
exit
Instalasi Source Guardian
mkdir /tmp/loader
cp /var/www/showvid/data/data/loader.tar.gz /tmp/loader/
cd /tmp/loader
tar xfz loader.tar.gz
cp Linux_x86-32/ixed.5.3.lin /usr/lib/php5/20090626+lfs/
Edit sourceguardian.ini
vi /etc/php5/conf.d/sourceguardian.ini
isi dengan
[sourceguardian]
zend_extension=/usr/lib/php5/20090626+lfs/ixed.5.3.lin
Instalasi ViMP Download terlebih dahulu paket vimp.framework-2.2.1-r19622-community.tar.gz
cp vimp.framework-2.2.1-r19622-community.tar.gz /var/www/showvid/data
cd /var/www/showvid/data
tar xvzf vimp.framework-2.2.1-r19622-community.tar.gz
rm vimp.framework-2.2.1-r19622-community.tar.gz
chmod +x symfony
a2dissite default
a2ensite showvid
/etc/init.d/apache2 restart
Jalankan symfony
./symfony framework:init mysql://showvid:showvid@localhost/showvid
Edit crontab
crontab -e
isi dengan
*/1 * * * * /var/www/showvid/data/scripts/sync_new_uploads.sh > /dev/null 2>&1
Akses Web
http://localhost/
Untuk akses sebagai admin, login menggunakan
username: admin
password: admin

Screenshot:


Black Skin:

0 Meningkatkan Traffic Blog dengan Plipeo


Apa itu Plipeo?

Sebuah cara mudah bagi pemilik blog untuk memperbanyak pengunjung ( Visitor ). Anda mengirimkan pengunjung, dan sebagai gantinya plipeo akan mengirimkan kembali sekitar dua kali lipat bahkan mengkalikan lalu lintas traffic tersebut ke blog Anda 150% hingga 300%.

Bagaimana cara bergabung?

Setelah Anda mendaftar,

  • Silahkan anda memasang WIDGET plipeo pada Blog anda, Dan untuk mendapatkan Widget silakan buka halaman Widget Anda.
  • Setelah memasang Widget pada blog, Silahkan anda membuat sebuah postingan mengenai layanan plipeo baik cara mendaftar, manfaat atau review tetang Plipeo.com lalu di tambahkan ke halaman tambah posting dengan memilih kategori Support US. 
  • Setelah itu anda bisa menambahkan beberapa posting konten Blog Anda pada halaman Tambah Posting. 



Ketentuan:

Semua pemilik blog atau blogger di perbolehkan bergabung dengan layanan pertukarang traffic ini, tentunya plipeo mengharapkan blog yang terdaftar tersebut memiliki Konten Asli atau Original bukan hasil dari CopyPaste ( Mengkopi ) dari situs lain.

Plipeo tidak menerima atau melarang situs yang berpotensi spam, memiliki konten ilegal, atau mengandung pornografi.

Jika pemilik blog sudah terdaftar dan posting sudah tersebar melalui jaringan plipeo namun pemilik blog melepas Widget plipeo maka secara otomatis website akan dibanned plipeo dan anda tidak akan lagi mendapatkan lalu lintas traffic ke blog anda.

0 Install phpmyadmin di Nginx web server


Diasumsikan webserver nginx dengan dukungan php dan mysql telah terpasang, lihat disini, dan virtualhost untuk phpmyadmin sebagai contoh menggunakan myadmin.example.com

Login sebagai super user

sudo su

Install paket php-apc untuk caching dan optimizing php

apt-get install php-apc

restart service php5-fpm

/etc/init.d/php5-fpm restart

Install paket phpmyadmin

apt-get install phpmyadmin

Web server to reconfigure automatically: -- Jangan pilih apapun
Configure database for phpmyadmin with dbconfig-common? -- Yes

Setting virtualhost untuk phpmyadmin, edit file /etc/nginx/sites-available/default

Tambahkan script berikut di baris paling bawah

server {
 server_name myadmin.example.com;
 root /usr/share/phpmyadmin;

 location / {
  index index.html index.php index.htm;
 }

 location ~ \.php$ {
 fastcgi_pass 127.0.0.1:9000;
 fastcgi_index index.php;
 include fastcgi_params;
 }

 location = /favicon.ico {
 log_not_found off;
 access_log off;
 }

 location = /robots.txt {
 allow all;
 log_not_found off;
 access_log off;
 }

 location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
 deny all;
 }

 location ~ /\. {
 deny all;
 access_log off;
 log_not_found off;
 }

 location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
 expires max;
 log_not_found off;
 }
}


Reload konfigurasi nginx

/etc/init.d/nginx restart

Untuk pengujian, Arahkan browser ke myadmin.example.com



4 Nginx webserver dengan dukungan PHP dan MySQL


Login sebagai super user

sudo su

Install paket-paket pendukung

apt-get install mysql-server mysql-client nginx php5-fpm

/etc/init.d/nginx start

Sampai tahap ini, nginx sudah terpasang.
Arahkan browser ke http://localhost maka akan muncuk default html nginx







Konfigurasi nginx

edit file /etc/nginx/sites-available/default kurang lebih seperti berikut

server {
        listen   80; ## listen for ipv4; this line is default and implied
        listen   [::]:80 default ipv6only=on; ## listen for ipv6

        root /usr/share/nginx/www;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name example.com;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to index.html
                try_files $uri $uri/ /index.html;
        }

        location /doc {
                root /usr/share;
                autoindex on;
                allow 127.0.0.1;
                deny all;
        }

        location /images {
                root /usr/share;
                autoindex off;
        }

        #error_page 404 /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/www;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #       proxy_pass http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
                deny all;
        }
}

*kofigurasi data disesuaikan

save konfigurasi dan restart nginx

/etc/init.d/nginx restart

Untuk menguji php sudah berjalan, buat sebuah contoh file yaitu /usr/share/nginx/www/info.php yang berisi



<?php
phpinfo();
?>


Simpan konfigurasi, lalu arahkan browser ke http://localhost/info.php
Jika halaman seperti dibawah muncul, maka php telah berfungsi






















Install dukungan mysql pada php

apt-get install php5-mysql

restart php-fpm

/etc/init.d/php5-fpm restart

Arahkan browser ke http://localhost/info.php lalu scroll ke bagian modules. Jika terdapat halaman seperti dibawah, maka dukungan mysql pada php telah terpasang.


8 Ultimate Frets on Fire

Frets on Fire adalah sebuah game dalam bidang musik yang mengandalkan kecepatan jari-jari tangan. Tujuan game ini adalah untuk bermain guitar dengan keyboard secara teliti. Mungkin sebagian orang pernah bermain game seperti ini yaitu Guitar Hero, ya, game ini mirip seperti guitar hero tetapi yang paling utama adalah game ini bisa didapatkan secara gratis dan dapat dimainkan di PC dengan spesifikasi yang pas pas-an :-) .

Ultimate Frets on Fire merupakan hasil modifikasi game Frets on Fire (RF-mod-4.15) yang sudah ditambahkan fitur-fitur tertentu, seperti neck selection, skins selection dan masih banyak lagi.

Gameplay Ultimate Frets on Fire ini memang mirip dengan Guitar Hero tetapi ada perbedaan utama dalam memainkannya, biasanya dalam game Guitar Hero untuk mendapatkan nada cukup dengan menekan R1, R2, L1, L2 (PlayStation), tetapi dalam Ultimate FOF untuk mendapatkan nada tersebut ditambahkan dengan menekan tombol pick (tombol pick bisa disesuaikan di settingan key).

Karena game ini dirancang untuk dimainkan dengan keyboard, jadi ketika bermain seperti halnya memainkan guitar :-) dengan jari-jari kiri menekan tombol-tombol yang ada di keyboard (biasanya F1-F5), dan jari kanan menekan pick (biasanya right Crtl atau Enter). Tetapi tidak menutup kemungkinan game ini dimainkan dengan menggunakan joystick.

 

Kebutuhan Minimum (Minimum Requirement):

  • 128 MB of RAM
  • a fairly fast OpenGL graphics card (shader support not necessary, antialiasing support recommended)
  • Direct X compatible sound card

Langsung aja nih screenshot-nya (klik untuk melihat ukuran sebenarnya):


















 


















Silahkan download di
http://adf.ly/9Zw99

password di http://adf.ly/9ZwGj

Untuk lagu-lagunya bisa di cari di
http://adf.ly/9ZwZr/
http://www.fretsonfire.net/forums/

3 Install Cherokee dengan Dukungan PHP5 dan MySQL di Ubuntu 11.04

Login sebagai root

sudo su

Install MySQL 5

apt-get install mysql-server mysql-client

Install cherokee

apt-get install cherokee

Sampai tahap ini, cherokee sudah terpasang. Arahkan browser ke http://localhost/ maka akan ada tampilan default cherokee






















 



Install PHP5

apt-get install php5-cgi

Konfigurasi PHP5

Edit file /etc/php5/cgi/php.ini dan uncomment baris cgi.fix_pathinfo=1
seperti berikut










 

Lalu restart cherokee

/etc/init.d/cherokee restart


Mengaktifkan PHP5 di Cherokee

Secara default php tidak diaktifkan di Cherokee, untuk mengaktifkannya kita harus menjalankan Cherokee's web-base control panel

cherokee-admin -b

Maka akan muncul kurang lebih seperti berikut









 


Arahkan browser ke http://localhost:9090/ lalu login sesuai dengan username dan password yang diberikan sebelumnya

















 

Pilih vServers, dan klik pada default, pilih tab Behavior, klik Rule Management


















 


Di kolom sebelah kiri akan ada rule-rule yang sedang digunakan, klik New untuk menambahkan















 

Lalu akan muncul pops up, klik Languages dari kolom sebelah kiri dan pilih PHP lalu klik button Add

















 

Berikutnya klik button Create












Sekarang akan terlihat rule baru untuk PHP di kolom sebelah kiri















Untuk mengaktifkan rule tersebut, klik NON FINAL




sehingga berubah menjadi FINAL





Klik tombol save di pojok kanan atas, dan pilih Graceful restart

















Sekarang Extension php sudah terpasang

















Tekan CTRL+C pada command line untuk menghentikan Cherokee's web-base control panel

Testing PHP5

Default dokumen root cherokee ada di /var/www. Sekarang buat sebuah contoh file untuk testing php

nano /var/www/info.php

isinya:

<?php phpinfo(); ?>

Arahkan browser ke http://localhost/info.php
Maka akan muncul informasi tentang php dan php pun telah berjalan dengan baik



















 

Install PHP5 dengan dukungan MySQL

install php5-mysql

apt-get install php5-mysql

restart cherokee

killall php-cgi
/etc/init.d/cherokee restart

Reload http://localhost/info.php di browser, lalu scroll ke bagian module.
Sekarang modul mysql telah terpasang di php.


















 

Untuk memasang modul-modul php lainnya, silahkan cari menggunakan perintah

apt-cache search php5

0 Manage VirtualBox via Web

Download phpvirtualbox di http://code.google.com/p/phpvirtualbox/downloads/list lalu pilih versi yang sesuai dengan penggunaan untuk versi virtualbox-nya.

Dalam contoh kali ini saya menggunakan virtualbox versi 4.0.4 jadi saya download yang phpvirtualbox-4.0-7.zip

Extract hasil download, lalu pindahkan ke folder /var/www/
# mv phpvirtualbox-4.0-7 /var/www
# mv /var/www/phpvirtualbox-4.0-7 /var/www/virtualbox
# chown www-data.www-data /var/www/virtualbox
# chmod -R 777 /var/www/virtualbox

Edit file konfigurasi phpvirtualbox
# mv /var/www/virtualbox/config.php-example /var/www/virtualbox/config.php
# nano /var/www/config.php
edit bagian
var $username = 'vbox';
var $password = 'pass';

edit username dan passwordnya sesuai dengan user yang digunakan

Download virtualbox extension pack
# wget http://download.virtualbox.org/virtualbox/4.0.4/Oracle_VM_VirtualBox_Extension_Pack-4.0.4-70112.vbox-extpack

Buka VirtualBox, pilih File --> Preferences --> Extensions --> Add packages
pilih extension pack yang sudah di didownload tersebut

Jalankan sevice web virtrualbox
# vboxwebsrv

Buka Browser lalu arahkan ke http://ip_address/virtualbox atau http://domain/virtualbox

Login dengan user admin dan password admin

Sebagai contoh, buat satu virtual machine
Untuk mengaktifkan fitur console, klik kanan pada virtual machine yang telah dibuat, pilih --> Settings --> Display --> Remote Display
Checklist bagian Enable Server


Sekarang Anda bisa mengatur penggunaan virtualbox melalui interface berbasis web

Jalankan contoh virtualmachine yang telah dibuat, lalu klik tab console, masukkan username dan password lalu klik connect.


0 Quick Linux Server Installation

Before proceeding to install, update the necessary packages with debian with this command.

apt-get update

#### Installing Apache + PHP ####

Apache is one of the most famous web server which runs on most linux based servers by webhosting companies . With just few commands you can configure apache to run with PHP 5.

apt-get install apache2 php5 libapache2-mod-php5

Apache configuration file is located at: /etc/apache2/apache2.conf and your web folder is /var/www

To check whether php is installed and running properly, just create a test.php in your /var/www folder with phpinfo() function exactly as shown below.

nano /var/www/test.php

# test.php

<?php phpinfo(); ?>

Point your browser to http://ip.address/test.php or http://domain/test.php and this should show all your php configuration and default settings.

You can edit necessary values or setup virtual domains using apache configuration file.

Enabling GD Library with PHP

If you want to use CAPTCHA or for dynamic image generation with php scripts for image verification to stop SPAM or automated robots, then it is absolutely necessary to get php gd library installed with php. Here is the command

apt-get install php5-gd

Thats it!! Point your browser to http://domain/test.php and the php configuration settings will show GD library will be enabled for PNG, GIF, JPG etc.

Enabling Mod Rewrite with .htaccess

Do you use mod-rewrite from apache to rewrite friendly URLs ?? This must be absolutely necessary for the rewrite module to get enabled in your apache, especially if your blog, forum script uses rewriting engine to generate friendly URLs in your site.
Note that default apache2 installation does not come with mod-rewrite. Here is how you enable it. Issue the following command

# a2enmod rewrite

Once you run this command, apache will tell you that this rewrite module is enabled. You can find mod_rewrite enabled and show up in your test.php file.

I often experienced page not found 404 error with debian/ubuntu versions eventhough your apache runs with mod-rewrite. To fix this, you will need to edit the following file to make some changes.

nano /etc/apache2/sites-enabled/000-default

Find the following and change AllowOverride from None to All

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>

Upload the .htaccess file to your server and restart apache. /etc/init.d/apache2 restart

Make sure your .htaccess file has 644 permission as otherwise you get permission denied error.

#### Installing MySQL Database Server ####

Installing mysql database server is always necessary if you are running a database driven ecommerce site. Remember running mysql server to a fair extend requires atleast 256mb of RAM in your server. So unless you are running database driven sites you dont absolutely need mysql. The following commands will install mysql 5 server and mysql 5 client.

apt-get install mysql-server mysql-client php5-mysql

The configuration file of mysql is located at: /etc/mysql/my.cnf

Creating users to use MySQL and Changing Root Password

By default mysql creates user as root and runs with no passport. You might need to change the root password.

To change Root Password

mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';
mysql> FLUSH PRIVILEGES;


To Create User

You must never use root password, so you might need to create a user to connect to mysql database for a PHP script. Alternatively you can add users to mysql database by using a control panel like webmin or phpMyAdmin to easily create or assign database permission to users. We will install Webmin and phpmyadmin during later once we complete basic mail LAMP installation.

PhpMyAdmin Installation

PhpMyAdmin is a nice web based database management and administration software and easy to install and configure under apache. Managing databases with tables couldnt be much simpler by using phpmyadmin.

All you need to do is:

apt-get install phpmyadmin

The phpmyadmin configuration file is located at: /etc/phpmyadmin folder.

To setup under apache all you need to do is include the following line in /etc/apache2/apache2.conf

Include /etc/phpmyadmin/apache.conf

Now restart apache: /etc/init.d/apache2 restart

Point your browser to: http://domain/phpmyadmin

Thats it!! MySQL and phpMyAdmin is Ready !!! Login with your mysql root password and create users to connect to database from your php script.

#### Mail Server Installation ####

  1. Postfix (Mail Transfer Agent MTA)
  2. Dovecot (IMAP/POP3 Server)
  3. SASL Authentication with TLS (Authenticate before sending mail outside network in Outlook)
  4. Squirrel Mail (Popular Web based Email)

As a beginner to linux it took about almost a month for me for proper installation of mail server and fixing necessary problems. I had real nightmares to configure this and so i decided that my hardwork would be helpful to linux community.

Note: If you install Postfix/Dovecot mail server you will ONLY be able to send mail within your network. You can only send mail externally if you install SASL authentication with TLS. As otherwise you get nasty "Relay Access Denied" error.

Install Postfix MTA (Mail Transfer Agent)

First install postfix package along with sasl with apt-get

apt-get install postfix postfix-tls libsasl2 sasl2-bin libsasl2-modules popa3d

During installation, postfix will ask for few questions like name of server and answer those questions by entering your domain name and select Internet site for postfix.

Postfix configuration file is located at:/etc/postfix/main.cf. You can edit this file using popular text editor nano /etc/postfix/main.cf

Start or Restart Postfix Server:

/etc/init.d/postfix restart
/etc/init.d/postfix stop
/etc/init.d/postfix start

Install Dovecot

Dovecot is one of the popular POP3/IMAP server which needs MTA like Postfix to work properly.

apt-get install dovecot

In some linux versions, the above might not work so you can install by specifying individual package names.

apt-get install dovecot-imapd dovecot-pop3d dovecot-common

Dovecot configuration file is located at: /etc/dovecot/dovecot.conf

Before we proceed we need to make some changes with dovecot configuration file. Double check the following entries in the file if the values are entered properly.

nano /etc/dovecot/dovecot.conf

# specify protocols = imap imaps pop3 pop3s protocols = pop3 imap
# uncomment this and change to no.

disable_plaintext_auth = no

pop3_uidl_format = %08Xu%08Xv


I have noticed that in some ubuntu versions, most of the above parameters are not specified. You will need to insert the values if not specified or left empty. If you dont uncomment and change disable_plaintext_auth to no, you will get "plain text authentication error" from outlook or mail clients.

Now, create a user to test our pop3 mail with outlook:

adduser <user_name>

Caution: Always create a separate user to test your mail or ftp. DO NOT LOGIN WITH ROOT ACCESS.

Restart Dovecot:

/etc/init.d/dovecot restart

Now, you can use your outlook express to test whether your new mail server is working or not. Just enter username: <user_name> with password in outlook.

Remember you will NOT be able to send email outside your network, you will be only be able to send within your domain or local network. If you attempt to send email you get nasty "relay access denied" error from outlook express. However, you should have no problems in receiving your email from outlook. Inorder to send email external email you will need to configure SASL authentication as described below.

Configure SASL Authentication with TLS

SASL Configuration + TLS (Simple authentication security layer with transport layer security) used mainly to authenticate users before sending email to external server, thus restricting relay access. If your relay server is kept open, then spammers could use your mail server to send spam. It is very essential to protect your mail server from misuse.

Let us set up SMTP authentication for our users with postfix and dovecot.

Edit the postfix configuration file /etc/postfix/main.cf and enter the few lines to enable authentication of our users

smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = yourdomain.com smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination smtpd_sasl_security_options = noanonymous

On the Dovecot side you also need to specify the dovecot authentication daemon socket. In this case we specify an absolute pathname. Refer to this postfix manual from http://www.postfix.org/SASL_README.html

Edit /etc/dovecot/dovecot.conf

Look for the line that starts with auth default, before that insert the lines below.

auth default {
mechanisms = plain login
passdb pam {

}
userdb passwd {
}
socket listen {
client {
path = /var/spool/postfix/private/auth

mode = 0660

user = postfix

group = postfix

}

}

}


Now, rename previous auth default to auth default2. If you dont rename this then dovecot server will give you error like multiple instances of auth default.

Now restart all the components of mail server.

/etc/init.d/saslauthd restart
/etc/init.d/postfix restart
/etc/init.d/dovecot restart


Test whether your mail server works or not with your outlook express. Configure a user with a user name <user_name> (without @domain) and make sure that you select my server requires authentication. Under settings select same as incoming mail server





NOTE:

  1. If you dont enable My server requires authentication in outlook you cannot send emails to external recipients and you get relay access deniederror.
  2. Do not use root login to login to your mail server.
  3. Dont forget to create a new user before you authenticate using outlook.
Forwarding Mails

Ever wondered how to forward your mails especially if you are a webmaster managing number of sites. You might need to forward any email sent to your primary email address. Its that easy. Just create a .forward file on your home directory. Insert list of emails addresses separated by commas, where you want to get forwarded.

Login as user and type

echo 'destination_email_address' > .forward

or you can use nano to create .forward file. Just Delete .forward file if you dont want any forwarding.

Installing Squirrel Web Mail

Squirrel mail is one of the most popular web based email with very friendly interface. Squirrel mail works without mysql database very easy to install and configure under apache2..

Note: It is recommended to have apache and php installed before you install squirrelmail.

apt-get install squirrelmail

Squirrelmail configuration file is located in: /etc/squirrelmail/ folder. By default all settings are preloaded.

# Run squirrelmail configuration utility as ROOT
/usr/sbin/squirrelmail-configure

Now we want to setup to run under apache. Edit apache configuration file /etc/apache2/apache2.conf and insert the following line:

Include /etc/squirrelmail/apache.conf

Thats it. Your webmail is ready !!!.
Point your browser to: http://yourdomain/squirrelmail

Create a separate local user and login as a new user.

DO NOT LOGIN AS ROOT AND YOU WILL GET "ERROR: CONNECTION DROPPED"

Mail Server Problems in Logs

Always refer to logs located in /var/log/mail.log so that you can identify what the problem is before you can troubleshoot.

#### Webmin - Server Control Panel ####

Webmin is a nice server control panel available free of charge. It is similar like cpanel or plesk to manage your server. Download the latest version of webmin from the main site (www.webmin.com)

wget http://downloadpath/webmin-x.x.xx.tar.gz
tar xzf webmin-x.x.x.tar.gz
cd /webmin-x.x.x
./setup.sh

The installation program will ask series of questions and most values will be automatically set by default.

Once done, point your browser to:
http://ip.address:10000 or http://www.domainname:10000

Login into your webmin and you can do almost anything with your server.

#### Webalizer Installation ####

Webalizer is a visitor statistics software shows you nice graphic based on visitors, hits and pageviews of your site. It is indeed very easy to configure and run webalizer under apache. Webalizer runs as a daily cron job to monitor your server stats.

apt-get install webalizer

Now edit the webalizer configuration file located at: /etc/webalizer.conf and locate a line with LogFile /var/log/apache/access.log.1 and change to the correct name access.log as shown below.

LogFile /var/log/apache2/access.log

and the bin of webalizer is located at /usr/bin/webalizer which is automatically scheduled to run daily as cron job.

To run webalizer manually.

/usr/bin/webalizer

Point your browser to http://domain/webalizer and you must see some pretty nice visitor statistics of your site.

#### Installing FTP Server (VSFTP) ####

You will need a simple ftp server to upload and download your web files. i specially like vsftp server because not only it is very easy to configure but also runs faster than other ftp peers with good connection speed.

apt-get install vsftpd

Configuration file is located at: /etc/vsftpd.conf

Change the following settings in /etc/vsftpd.conf so that you allow local users and allow write using ftp.

# Uncomment this to allow local users to log in.
local_enable=YES
# Uncomment this to enable any form of FTP write command.
write_enable=YES

Before you connect using ftp client, you will need to create local users and group. Do not upload files using root.

# CD to /home/<user> and create a symbolic link to /var/www as this is the public html folder.
ln -s /var/www www

#change ownership /var/www to user
chown -R <user> /var/www

#Change to 755 permissions
chmod -R 755 /var/www

Now you can connect to ftp and upload files. Once you upload all necesarry files in the public html folder, make sure all the files have 755 permission as otherwise you will get permission denied/forbidden error from apache.

Enabling VSFTP to Show Dotted Files

By default, vsftp does not show dotted files in the server, especially .htaccess, eventhough you have successfully uploaded the files. This could be frustrating especially if you are using .htaccess for authentication or rewriting friendly URLs. To fix this just add force_dot_files=YES in your vsftp configuration file/etc/vsftpd.conf

# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
force_dot_files=YES

Restart the vsftp server /etc/init.d/vsftpd restart.

Webmin Package: VSFTP also available as webmin package. You can easily change settings from webmin for vsftp.

#### ClamAV - Antivirus Software ####

Linux based systems are often vulnerable to trojans, worms and viruses. It is often to be on the safer side to scan your server using freely available ClamAV antivirus available for linux

apt-get install clamav

To scan necessary files

clamscan -R /folders

-R is recursive and is optional

To update virus database:

freshclam

Running as Cron Daily Job

To run antivirus as a cron job (automatically scan daily) just run crontab -e from your command line. Then add the following line and save the file.

02 1 * * * root clamscan -R /var/www

This will run the cron job daily @ 1.02 AM by scanning the public html. You can change the folder to whatever you want for mail etc.

#### Quick IP Tables Firewall ####

Without firewall there is no absolute security for your server. Atleast i would recommend a simple firewall that would employ packet filtering and block off unnecessary ports in your server using IP tables.

apt-get install iptables

I found Quick n Dirty Firewall
(http://wiki.vpslink.com/index.php?title=HOWTO) pretty interesting. You can copy and run the shell script to set up your quick firewall.

Remember not to block important ports like
21 (ftp)
22 (SSH)
23 (Telnet)
25 110 (email)
443 (SSL http or https)
993 (imap ssl)
995 (pop3 ssl)
10000 (webmin)
80 (http)

0 Bandwith Limit pada Mikrotik Menggunakan Winbox

MikroTik RouterOS™ adalah sistem operasi dan yang dapat digunakan untuk menjadikan komputer manjadi router network yang handal, mencakup berbagai fitur lengkap untuk network dan wireless, salah satunya adalah bandwidth manajemen.

Jalankan winbox, login ke ip mikrotik sebagai user dan password yang disesuaikan

Klik menu ip --> firewall --> mangle
Buat rule (klik tanda + merah) dengan parameter sbb:
Pada tab General:
Chain=forward,
Src.address=192.168.1.2 (atau ip yg ingin di limit)
Pada tab Action :
Action = mark connection,
New connection mark=erwin-con (atau nama dari mark conection yg kita buat)
Klik Apply dan OK











Buat rule lagi dengan parameter sbb:
Pada tab General:
Chain=forward,
Connection mark=erwin-con (pilih dari dropdown menu)
Pada tab Action:
Action=mark packet,
New packet Mark=erwin (atau nama packet mark yg kita buat)
Klik Apply dan OK
























Klik menu Queues --> Queue Tree
Buat rule (klik tanda + merah) dengan parameter sbb:
Pada tab General:
Name=erwin-download (misal),
Parent=ether2 (adalah interface yg arah keluar),
Paket Mark=erwin (pilih dari dropdown, sama yg kita buat pada mangle),
Queue Type=default,
Priority=8,
Max limit=2048 (misal, digunakan untuk seting bandwith brustable)
Klik aplly dan Ok
























Icon hijau menandakan bandwidth kurang dari batasan, Icon berubah kuning berarti bandwidth mendekali full dan merah berarti full.











Pengujian dilakukan dengan melakukan proses download dari client ke web server lokal melalui interface yang terhubung ke Router Mikrotik

















Indikator icon berubah menjadi merah menandakan pemakaian bandwidth yang full. Kecepatan download berkurang karena bandwidth telah di limit oleh Router Mikrotik