Install Webserver on Ubuntu
Tutorial install webserver di server ubuntu
- Persiapan
Assumsi server ubuntu sudah tersinstall :
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.1 LTS
Release: 12.04
Codename: precise
Set konfigurasi jaringan :
# vi /etc/network/interfaces
The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 203.x.x.x
network 203.x.x.255
netmask 255.255.255.0
brodcast 203.x.x.255
gateway 203.x.x.1
# vi /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
nameserver 2203.x.x.x
nameserver 2203.x.x.x
# /etc/init.d/networking restart
# ifconfig
# ping >www.google.com
PING google.com (74.125.236.66) 56(84) bytes of data.
64 bytes from maa03s05-in-f2.1e100.net (74.125.236.66): icmp_req=1 ttl=55 time=58.8 ms
64 bytes from maa03s05-in-f2.1e100.net (74.125.236.66): icmp_req=2 ttl=55 time=58.9 ms
# vi /etc/network/options
ip_forward=no
spoofprotect=yes
syncookies=no
Set koneksi ssh supaya bisa remote :
#apt-get install openssh-server openssh-client
- Sekarang saatnya install webserver : mysql5+apache2+php5+phpmyadmin
#apt-get update
(untuk update paket2x di ubuntu – klo di freebsd pakai cvsup-without-gui)
#apt-get install mysql-server
#apt-get install apache2
#apt-get install php5
#apt-get install phpmyadmin
- Post Installation…..
cek service apache :
#/etc/init.d/apache2 stop
#/etc/init.d/apache2 start
#ps ax | grep apache2
5538 ? Ss 0:00 /usr/sbin/apache2 -k start 5543 ? S 0:00 /usr/sbin/apache2 -k start 5544 ? S 0:00 /usr/sbin/apache2 -k start 5545 ? S 0:00 /usr/sbin/apache2 -k start 5546 ? S 0:00 /usr/sbin/apache2 -k start 5547 ? S 0:00 /usr/sbin/apache2 -k start
#netstat -pln | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 5538/apache2
konfigurasi apache :
#/etc/apache2/apache2.conf
File2x konfigurasi ada di folder -> /etc/apache2/
Default httpddocs -> /var/www/
– Menambah server Alias :
#a2enmod alias
#vi /etc/apache2/sites-available/default
– Mengaktifkan mod rewrite :
#locate mod_rewrite.so
#nano /etc/apache2/mods-enabled/rewrite.load
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
#service apache2 restart
cek php dengan membuat file info.php berisi fungsi phpinfo()
# cd /var/www/
# vi info.php
<?
phpinfo ()
?>
untul lokasi php.ini di -> /etc/php5/apache2/php.ini
cek koneksi ke mysql dengan membuat file dbtest.php
# cd /var/www/ # vi dbtest.php
<?php
$con = mysql_connect(“localhost”,”root”,”password_root_mysql”);
if (!$con)
{
die(‘Tidak bisa koneksi: ‘ . mysql_error());
}
else
{
echo “Selamat, Koneksi ke database berhasil !”;
}
mysql_close($con);
?>
lokasi my.cnf di -> /etc/mysql/my.cnf
Untuk meremote database menggunakan navicat atau tool lain hidupkan fasilitas networking dengan meng-comment : #bind-address=127.0.0.1
restart mysql
#/etc/init.d/mysql restart
lokasi database mysql di : /var/lib/mysql
set konfigurasi phpmyadmin di apache2 :
edit file /etc/apache2/apache2.conf kemudian tambahkan baris berikut “Include /etc/phpmyadmin/apache.conf”
# vi /etc/apache2/apache2.conf
#include phpmyadmin configurations:
Include /etc/phpmyadmin/apache.conf
restart apache
#service apache2 restart
akses phpmyadmin dari : http://alamat.anda/phpmyadmin