Showing posts with label freebsd. Show all posts
Showing posts with label freebsd. Show all posts

Monday, October 22, 2012

FreeBSD: How to Jails on FreeBsd(Filter access)

Thanks Kokteels, the guide refered from you:
http://shab4b.blogspot.com/2012/03/how-to-jails-on-freebsd-82.html

1. Need to csup for port & stable supfile. Skip this step if you already compile before. 

2. Next step 

# setenv D /jail/www
# mkdir -p $D 
# cd /usr/src
# make buildworld
# make installworld DESTDIR=$D
# cd etc/
# make distribution DESTDIR=$D 
# mount -t devfs devfs $D/dev 

3. Edit following patch  #ee /etc/rc.conf
sshd_enable="YES"
ifconfig_em0="DHCP"
ifconfig_bge0_alias1="inet 10.0.0.100 netmask 255.255.255.0"
jail_set_hostname_allow="NO"
jail_enable="YES"
jail_list="www"
jail_interface="bge0"
jail_devfs_enable="YES"
jail_procfs_enable="YES"
jail_mount_enable="NO"
jail_www_rootdir="/jail/www"
jail_www_hostname="www.ozel.net"
jail_www_ip="10.0.0.100"
jail_www_devfs_ruleset="devfsrules_jail"
*can be any available IP at you LAN.

4. Start Jail
#/etc/rc.d/jail start

5. Testing Jail.
#jls -v
# jls


***Minimum 6Gb need to deploy jails. Csup will take lot of file.

Wednesday, May 9, 2012

FreeBSD: Enter full pathname of shell or RETURN for /bin/sh

I got this error after scp a big file yesterday.. I thought my server was crash.
But it actually run in single user shell.

Solution:
Enter full pathname of shell or RETURN for /bin/sh:  > Enter
# Exit or ctrl-D to leave the single-user shell.


Then login like usual to your server.


**********Standard way of dealing with single user mode:
Code:
fsck -y
mount -u /
mount -a -t ufs
swapon -a

Sunday, May 6, 2012

FreeBSD: Upgrade from 8.2 to 9.0


If you use this command to upgrade to latest release FreeBSD 9.0:

$ freebsd-update -r 9.0-RELEASE upgrade
You might see following error:
The update metadata is correctly signed, but failed an integrity check. Cowardly refusing to proceed any further.
This error indicate that it cannot accept % and @ characters which appear in FreeBSD 9 . To overcome this, run following command:
$ sed -i '' -e 's/=_/=%@_/' /usr/sbin/freebsd-update
Now start the upgrade process:
$ freebsd-update -r 9.0-RELEASE upgrade
Accept all prompted values and follow the wizard. This process downloads all files and patches required for upgrade so it takes time. You might need to press ‘Enter’ once to check /etc/hosts file. Once complete, run following command to start installing the updates:
$ freebsd-update install
After a while, you should see the system will prompt something as below:
Installing updates...rmdir: ///boot/kernel: Directory not empty   Kernel updates have been installed. Please reboot and run "/usr/sbin/freebsd-update install" again to finish installing updates.
Reboot the server:
$ init 6
Once up, it will boot to FreeBSD 9. Run again the installation command:
$ freebsd-update install
After the process completed, the system will ask you to build back all your application which installed using ports. Once done, you need to rerun again the above command to complete the upgrade process and you should something like below:
$ freebsd-update install Installing updates... Done
Your update should be completed now. To check the new version, run following command:
$ uname -r 9.0-RELEASE

Credit to : http://blog.secaserver.com/2012/02/freebsd-upgrade-8-2-9-0/

Monday, April 2, 2012

Date Timezone Problem in Unix(BSD) Server

Case: System cannot login OR Timezone Error in application.

Solution:

  1. # cd usr/local/etc/
  2. ee php.ini
  3. Search keyword: date.timezone
  4. Read reference setting:  http://www.php.net/manual/en/timezones.asia.php
  5. Change / add timezone
     date.timezone = "Asia/Kuala_Lumpur"
  6. Checking date in server
    #date

  7. if not same you have to setting up using this command
    #ntpdate asia.pool.ntp.org
  8. Restart APACHE service
    #/usr/local/etc/rc.d/apache22 restart




Sunday, February 26, 2012

SSH Connection Failed: AWS Cloud Access failed after switch IP

My Case:

Server OS: FreeBSD 8.x
After switching IPs between 2 application, the new server can be ssh, but the previous one failed.
New : x.x.x.143
Old : x.x.x.250

SSH Access command to new server ok, but the old one failed.
I ask my bos, and luckily it not because of wrong configured, but the access cache that stored in host..

  1. Run this command:
    % ee .ssh/known_hosts

    This file keep cache of previous access ssh command
  2. Delete all the content
  3. Save
  4. Try run the ssh command again:
    %ssh -i cloudcert.pem os@x.x.x.250
  5. Connection success!.

MySQL Server: Can’t connect to local MySQL server through socket /tmp/mysql.sock

Server OS: FreeBSD 8.x

This mysql server cannot start mysql server service after shutting down.
Try to start manually using this command, but still got error.#/usr/local/etc/rc.d/mysql-server start

Step taken:

1) Check Error Log for mysql(in mysqldata/mysql/)
    # ee ----------------mysql.err
  
    ERROR start from this line:
    
120224 19:42:32 [ERROR] /usr/local/libexec/mysqld: unknown option '--skip-locking'

2) Try to find where the rules  '--skip-locking' stated

3) This rule stated in my.cnf located in mysql path
    # ee my.cnf

4) Comment the line like this
:    
port            = 3306
socket          = /tmp/mysql.sock
#skip-locking
key_buffer = 256M
:
:

5) Start the Mysql-Server command
    #/usr/local/etc/rc.d/mysql-server start

6) Check from some related command
    #ps ax     or
    #sockstat -4
    #top

7) Check in mysql path (mysqldata/mysql), pid file will auto created.
    -rw-rw----  1 mysql  mysql         6 Feb 27 10:36 thedomain.mysql-name-server.pid


FreeBSD Server: Change date

How to change server date in FreeBSD?

1) Check current server date
#date

2)Update correct date refering asia
#ntpdate asia.pool.ntp.org

3)Check again current date after update
#date

.

Sunday, May 3, 2009




Selama aku involve buat website ni, aku pernah try beberapa cms punya free framework yang senang nak install dan configure. Tapi banyak2 yang aku test, aku suka mambo dengan joomla. Sekarang ni aku guna joomla, sebab banyak sangat template, plug-in, module, component yang programmer satu dunia ni contribute untuk joomla. Nak install senang, nak patch pun senang, nak maintain pun senang... free lagi... source code pun free untuk digodek kalau pandai dan minat.

Cara mudah Install Joomla dalam FreeBSD!
  • Download dulu Joomla 1.5 Installer kat sini
  • Sebelum tu kenalah dah setup webserver yang dah ada root folder.
    Aku anggapkan, satu server php dah setup dengan apache webserver. Aku biasa guna server FreeBSD .
  • Pastikan jugak Mysql juga dah diinstall dulu dan up.
  • Buatkan satu folder khas untuk joomla dekat folder root. Dalam freeBSD normal pathnya /usr/local/www/apache22/data/root/
  • Copy installation file Jommla 1.5 tadi ke dalam folder tu.
    cth: /usr/local/www/apache22/data/root/joomla/
  • Create database mysql untuk website joomla & grant user.
    - Gunakan putty atau phpmyadmin site untuk buat database baru.
    # mysql -uroot -p
    # create database web;
    # grant all privileges on web.* to adminroot@localhost identified by "passw@rd";
    # flush privileges;
    ** Pastikan catit dulu nama database, username dan password database untuk kegunaan masa pre-installation.

  • Unzipkan installation file Joomla tadi dalam root folder(joomla).
  • Tukar permission mode untuk folder joomla tu kepada 775 untuk memudahkan proses pre-installation nanti.
    # chmod -R 775 joomla
  • Tukar juga owner file joomla kepada www
    # chown -R www:www joomla
  • Setup dns untuk website joomla tadi di dns server. Satu url akan dibuat di sini. cth: http://webjoomla.domain.com.my
    (Bolehlah minta bantuan network admin(NA) kalau tak tau)
  • Bukak url tadi dekat browser IE atau Firefox. Ikut jer apa yang diarahkan dalam pre-installation joomla punya wizard. Senang jer. Pastikan ingat katalaluan admin yang dibuat semasa proses pre-installation ni untuk login administrator page nanti.
  • Selesai jer pre-installation,kena buang dulu forlder installation dalam folder joomla tadi. Buat melalui putty atau winscp.
  • Kemudian barulah website joomla yang kita setup tu boleh keluar melalui url tadi http://webjoomla.domain.com.my
  • Untuk customize template, component, module, plug-in semua boleh dibuat melalui administrator page. Cuma taipkan url tadi dan tambahkan administrator di hujungnya. http://webjoomla.domain.com.my/administrator
    **Gunakan login dan katalaluan admin tadi untuk masuk.
  • Rujuk di laman web joomla untuk download macam2 extension yang sedia untuk digunakan. Mudah diinstall dan yang penting percuma!