Monday, December 12, 2011

Var in Freebsd is full

when you #df -h
if show var is 108%... but when you check at folder /var it seem only have file 40-50M only..

What should i do?
1. already try to restart apache22 but cannot resolve
2. restart deamon.. cannot work
3. finally.. i restart the server.. hehehe.. done ;) but actually need to search what is the problem.

---- janji selesai ;)---- nnti study smula

Thursday, December 8, 2011

Reference Blog Open Source

Basic MySQL

"Shell" is the most important thing when you work with open source environment, below you can learn  a lot of command inside Linux / Unix
 Tips


Make Link at Freebsd

ln -- make links
ln [-fs] source_file [target_file]
-f    Unlink any already existing file, permitting the link to occur.  
-s    Create a symbolic link.
So, kalu kita upgrade port moodle tuh.. dia akan direct ke /data/training (kat mana kita simpan data)...
eg: #ln -s /data/training moodle

Wednesday, December 7, 2011

MYSQL Server

Install mySQL server

1. Check the most stable mysql server (usually high number)
2. Install mysql**-server
eg: install mysql55-server
#cd /usr/ports/database/mysql55-server
#make install

3. Start mysql-server
#/usr/local/etc/rc.d/mysql-server start
#echo "mysql_enable"="YES">>/etc/rc.conf
kalau >> means akan tambah lines kat rc.conf tuh
kalau > means akan replace line itu jerk -> so be careful

4. Check mysql status
#ps ax
atau
#sockstat -4 -> check port mysql 3306

5. Login mysql
#mysql -uroot -p

6. Admin password
mysqladmin -uroot password "*********"

7. Create dB
create database coursework;

Tuesday, December 6, 2011

Install New Server Freebsd

1. boot the OS and install
  • select non-boot -> 1 OS
2. Start to install port
  • install apache, php ngan application ( eg: moodle)
3. Install dulu apache..
  • #cd /usr/ports/www/apache22 -> path apache22
  • #make config -> nih utk option dalam package
  • #ee /usr/ports/www/apache22/Make file -> nih utk tgk version
  • #make install clean ->nih untuk install
4. Install php
  • #cd /usr/ports/lang/php5
  • #make config ->jangan lupa select (X) apache (by default tak tick)
  • #make install clean
  • lepas install ;
-> akan kasitau "make sure index.php is a part of your Directory Index
AddType application/x-httpd-php.php
AddType application/x-httpd-php-source.php

1-> so, kena pi kat # ee /usr/local/etc/apache22/https.conf
^y (search = DirectoryIndex)
DirectoryIndex index.html index.php
2-> ^y (search = AddType)
pastekan AddType application/x-httpd-php.php
AddType application/x-httpd-php-source.php

---dsb (php.extension, moodle, ...etc)---

5. tukar few setting yek
1-> setting host
#ee /etc/hosts
ip servername@domain.edu.my servername
2-> setting virtual host
#cd /usr/local/etc/apache22/extra/httpd-vhost.conf
ServerAdmin username@domain.edu.my
DocumentRoot "/data/foldername"
ServerName servername.mediu.edu.my
ErrorLog "/var/log/httpd-error-form.log"
CustomLog "/var/log/httpd-access-form.log" common


6. Start Apache
# /usr/local/etc/rc.d/apache22 start -> utk start apache
restart -> utk restart
graceful -> utk update, so apache tak mati.

7. Few error troubleshoot
-> error forbidden
* tukar directory root (# ee /usr/local/etc/apache22/httpd.conf)
# This should be changed to whatever you set DocumentRoot to.
#
# "/usr/local/www/apache22/data">
-> tukar kat path yang kita letak shariha.php

->if there is anychange need to setup such as
Add the following to your Apache configuration, and restart the server:
### Add the AcceptPathInfo directive only for Apache 2.0.30 or later.
Alias /moodle /usr/local/www/moodle/
AcceptPathInfo On
AllowOverride None
Order Allow,Deny
Allow from all
AllowOverride None
Order Allow,Deny
Deny from all
this is need to be added either at httpd.conf or /usr/local/etc/apache22/extra/httpd-vhost.conf



8. Shared object libpcre.so.0 not found required by httpd
1. check httpd path 
# whereis httpd
2. check link shortcut already listed
#ldd /usr/local/sbin/httpd

eg :  libpcre.so.0 => not found

have to change this -> libpcre.so -> libpcre.so.3 to libpcre.so.0 -> libpcre.so.3

# ln -s libpcre.so.3 libpcre.so.0

Then ok.. :) 


Monday, December 5, 2011

Patching FreeBSD server

1. cvsup : is a software package for updating collections of files across a
network.
Firstly, we have to update all the files;
# cvsup -h cvsup.freebsd.org -g -L2 /usr/share/examples/cvsup/ports-supfile - NO LONGER (Deprecated)

portsnap : is a fast and user-friendly tool for retrieving the Ports Collection, the preferred choice for most users.
1. Download a compressed snapshot of the Ports Collection

# portsnap fetch
2.When running Portsnap for the first time, extract the snapshot
# portsnap extract
3. #cd
-> since it will reset your node point.

2. portaudit: provides a system to check if installed ports are listed in a
database of published security vulnerabilities.
# portaudit -Fda
Secondly, we can check which ports and packages that need to upgrade;

3. To find out version that currently be used;
# pkg_info

4. To find out updated version that currently available;
# ee {path of the ports}
eg: ee /usr/ports/www/apache22/Makefile ; easy editor (ee) ->utility is a simple screen oriented text editor

5. To find out where is the path of package or port.
# whereis {package name}
eg: # whereis perl
p/s: sometimes it cannot search... so you have to check it by yourself.

6. portupgrade: is a tool set for working with ports and packages.
It enhances abilities of system tools and adds many new ones.
# portupgrade {path of the package}
eg: # portupgrade /var/db/pkg/sudo ;eg for upgrade sudo

7. If cannot upgrade: read the error occur;
eg:
A. need to reinstall;
pwd at the package;
i. # make config
to find out the custom option of configuration.
ii. # make install or # make reinstall
to install the package

B. need to delete the package before reinstall;
pwd at the package;
i. # make deinstall
to deinstall the pakage.

C. cannot fetch the new package;
pwd at the package;
i. # fetch {http://...}

8. php error at date.time zone
A. # cd usr/local/etc/
# ee php.ini
--> search date.time format
setting : http://www.php.net/manual/en/timezones.asia.php
then change add "eg: date.timezone = "Asia/Kuala_Lumpur""

9. Find folder
eg: if you want to search php folder
# ls -d php*