Up and Running with Linux For PHP Developer

persiapan

– download ubuntu server
– download virtualbox -> install

config

– buat folder yang akan kita buat jadi shared folder

mkdir ~/websites

Virtualbox

buat sebuah virtual machine baru

  • ram 1024
  • hardisk 8GB
  • dinamical storage

configure virtual machine

Storage->CD->iso ubuntu
Network -> port forwading

Name    Protocol     Host Port    Guest Port
HTTP     TCP            8080           80
MySQL  TCP            9306            3306
SSH        TCP            2222            22

port-forwading

Shared Folder
Folder Path: ~/websites
Folder Name: sandbox
* Auto mount

shared-folder

Install ubuntu Server

– dont encrypt home directory
– use all hardisk
– use ext4 format hardisk
– Software to Install

  1. * OpenSSH server
  2. * LAMP server

software-selection

– user youruser
– pass yourpass

Configure Server

– login with ssh

ssh youruser@localhost -p2222

windows: host localhost port 2222
– update system

$ sudo apt-get update

– upgrade

$ sudo apt-get upgrade

– instal paket pendukung
* build-essential -> compile software
* module-assistant -> assistant module packages
* linux-headers ->linux kernel header
* dkms -> dynamic kernel module
* zip
* unzip

$ sudo apt-get -q -y install build-essential module-assistant linux-headers-$(uname -r) dkms zip unzip

Install virtualBox Guest Additons

– mount cdrom

$ sudo  mount /dev/cdrom /media/cdrom

– run VboxLinux Additons tanpa Xwindows

$ sudo sh /media/cdrom/VBoxLinuxAdditions.run --nox11

Configure Apache

# tambahkan user yg dipakai ke group vboxsf (group baca tulis di share folder virtualbox)
$ sudo usermod -a -G vboxsf youruser
# tambahkan user apache ke group vboxsf
$ sudo usermod -a -G vboxsf www-data
# aktipkan module rewrite pada apache
$ sudo a2enmod rewrite
$ sudo service apache2 restart
# ubah path dokumen root
$ cd /etc/apache2
$ sudo mkdir backup
$ sudo mv sites-available/default backup/
$ sudo nano /etc/apache2/sites-available/default

– masukan kode berikut

 <VirtualHost *:80>
 ServerAdmin webmaster@localhost

DocumentRoot /media/sf_sandbox/
 <Directory />
 Options FollowSymLinks
 AllowOverride All
Require all granted
 </Directory>
 <Directory /media/sf_sandbox/>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride All
 #Order allow,deny
 allow from all
Require all granted
 </Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
 <Directory '/usr/lib/cgi-bin'>
 AllowOverride None
 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
 Order allow,deny
 Allow from all
 </Directory>

LogLevel info
 ErrorLog /media/sf_sandbox/logs/error_ub
 CustomLog /media/sf_sandbox/logs/custom_ub combined

RewriteEngine On
 RewriteLog /media/sf_sandbox/logs/rewrite_ub
 RewriteLogLevel 0

Alias /doc/ '/usr/share/doc/'
 <Directory '/usr/share/doc/'>
 Options Indexes MultiViews FollowSymLinks
 AllowOverride None
 Order deny,allow
 Deny from all
 Allow from 127.0.0.0/255.0.0.0 ::1/128
 </Directory>

</VirtualHost>

– server name (debug)

$ sudo nano /etc/apache2/httpd.conf

isi kode berikut

ServerName development

Configure php.ini

$ sudo nano -w /etc/php5/apache2/php.ini

– ganti nilai2 ini
error_reporting = E_ALL & ~E_DEPRECATED
to
error_reporting = E_ALL & ~E_STRICT

display_errors = Off
to
display_errors = On

log_errors = On

log_errors_max_len = 1024
to
log_errors_max_len = 0

error_log = /media/sf_sandbox/php_errors.log

Configure Database

$ sudo nano -w /etc/mysql/my.cnf

– untuk koneksi dari berbagai ip
bind-address    = 127.0.0.1
to
bind-address    = 0.0.0.0

lamp-virtualbox

if error 403 (forbidden)

edit /etc/apache2/apache2.conf

and update the path /var/www to your path


#<Directory /var/www/>
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted
#</Directory>

<Directory /media/sf_sandbox/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

Published by

G3n1k

just to remember what i had known :)

2 thoughts on “Up and Running with Linux For PHP Developer”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s