So, I heard that OpenSolaris will be dead a.k.a discontinued.
Me my self, currently has no reason to use OpenSolaris. Why ? Simple question, what cant a Solaris box do compared to OpenSolaris ? currently Solaris also stil free, gcc stil runs on it, (sunfreeware.com ?). Need to install Oracle ? Oracle onlys supports Solaris distribution - not OpenSolaris. Need SUN's good old JDK ? use Solaris :) Not to mention that OpenSolaris distro's loves x86 too much instead Sparc ( well, almost all of my machines in my test lab were sparc :D ). Nexenta for example, the one that I -was- believe to be the ice breaker in Solaris world with their apt-get style, seems love x86 too much. Not too mention the stupidness of OpenSolaris AI installer for Sparc, which need an x86 OpenSolaris to be installed first, plus its additional macro thingy to be configured during wanboot. Why would I need that in Solaris ? Why cant I just plug the disc and do boot - install to my sparc machine ?
So now, there are only 2 options for my sparc machines, use Solaris, or Linux :D. Debian can run on Sparc platform. Just install sparc-utils, and we'll get the similar administration CLI just as we did on Sparc Solaris.
But too bad, Debian's apt package for solaris mostly compiled for 32 bit platform. If we need to boost the performace for our apps, we should re-compile it. No big deal, gcc is available :)
Showing posts with label Linux stuff. Show all posts
Showing posts with label Linux stuff. Show all posts
Saturday, August 14, 2010
Tuesday, August 10, 2010
Solaris Jumpstart on Linux
Intro :
- Linux, Debian based (mine: Lenny), hostname : pegasus, act as the Solaris jumpstart server.
- Solaris, Solaris 10, hostname: solclient, will be the machine to be installed.
- IP addresses range 192.168.10.x (class C), make sure you use standard network class IP, this is where the standard broadcast address (192.168.10.255) comes into play during arp broadcast.
- solclient will broadcast arp request, replied by pegasus's rarpd, and then and IP address will be assigned. solclient will then download the minimum kernel using tftp. The kernel file name will be the ip address of the solclient. For example, if the assigned IP is 192.168.10.5, and then the kernel name will be C0A80A05. Another way is to use this command:
elinpra@pegasus > printf "%02X%02X%02X%02X\n" 192 168 10 5
C0A80A05
This file should be stored inside the root directory of tftp. Check the tftp setting on /etc/inetd.conf. Here is mine:
elinpra@pegasus > cat /etc/inetd.conf
tftp dgram udp4 wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp/
Then, the file C0A80A05 should be put in /srv/tftp.
Steps :
1. Install bootparamd, rarpd, tftpd and nfs-kernel-server in Linux server (pegasus)
root@pegasus > apt-get install bootparamd rarpd tftpd nfs-kernel-server
2. Run iptables -F, make sure no firewall in Linux server
root@pegasus > iptables -F
3. Check the mac address of the solaris client.
Try boot from {ok}, see the mac address during booting (if the system is currently up, go to init 0 mode) :
ok boot net
Resetting ...
LOM event: +56d+21h39m43s host reset
รพ
Sun Fire V120 (UltraSPARC-IIe 648MHz), No Keyboard
OpenBoot 4.0, 1024 MB memory installed, Serial #61911409.
Ethernet address 0:3:ba:b0:b1:71, Host ID: 83b0b171.
Back to lom> or sc> using 'break' command.
4. Set /etc/ethers and /etc/hosts in Linux server with the mac address and hostname of the solaris client.
elinpra@pegasus > echo "0:3:ba:b0:b1:71 solclient" >> /etc/ethers
elinpra@pegasus > echo "192.168.10.5 solclient" >> /etc/hosts
5. Start the rarpd if has not started yet.( I’m using debian based linux here )
root@pegasus > /etc/init.d/rarpd start
6. If you're installing using Solaris iso file, mount the iso file to a directory using the following command, otherwise if using Solaris CD/DVD, directly go to step 8:
root@pegasus > mkdir -p /mnt/sol10
root@pegasus > mount -o loop solaris_iso_file.iso /mnt/sol10
root@pegasus > cd /mnt/sol10
7. If you have the Solaris 10 CD, insert it on pegasus, do the following steps :
root@pegasus > cd /mnt/cdrom/ (to your solaris cdrom directory)
8. Find the suitable kernel for your machine type. Mine is SunFire v120, so it will be sun4u type. If your hardware is T5220, T2000 etc then you need sun4v kernel.
Locate the kernel on directory Solaris_10/Tools/Boot/platform/sun4u/inetboot for sun4u, or Solaris_10/Tools/Boot/platform/sun4v/inetboot for sun4v.
Copy it to /srv/tftp and make symbolic link to that file into C0A80A05.
root@pegasus > cp inetboot /srv/tftp
root@pegasus > ln -s /srv/tftp/inetboot /srv/tftp/C0A80A05
9. Start tftpd daemon in pegasus :
root@pegasus > /etc/init.d/openbsd-inetd restart
10. start nfs service in pegasus :
root@pegasus > /etc/init.d/nfs-kernel-server start
11. Prepare nfs mount so that solclient later on can download the entire installation package using nfs mount. Set the mount root into where the cdrom or iso files are mounted. Make sure that the nfs mount root from solclient is /sol10.
root@pegasus > exportfs \*:/mnt/cdrom -o fsid=0,ro,no_root_squash,crossmnt,no_subtree_check,sync <<- for CD/DVD or root@pegasus > exportfs \*:/mnt -o fsid=0,ro,no_root_squash,crossmnt,no_subtree_check,sync <<>Check if the nfs shares can be mounted correctly.
- Linux, Debian based (mine: Lenny), hostname : pegasus, act as the Solaris jumpstart server.
- Solaris, Solaris 10, hostname: solclient, will be the machine to be installed.
- IP addresses range 192.168.10.x (class C), make sure you use standard network class IP, this is where the standard broadcast address (192.168.10.255) comes into play during arp broadcast.
- solclient will broadcast arp request, replied by pegasus's rarpd, and then and IP address will be assigned. solclient will then download the minimum kernel using tftp. The kernel file name will be the ip address of the solclient. For example, if the assigned IP is 192.168.10.5, and then the kernel name will be C0A80A05. Another way is to use this command:
elinpra@pegasus > printf "%02X%02X%02X%02X\n" 192 168 10 5
C0A80A05
This file should be stored inside the root directory of tftp. Check the tftp setting on /etc/inetd.conf. Here is mine:
elinpra@pegasus > cat /etc/inetd.conf
tftp dgram udp4 wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp/
Then, the file C0A80A05 should be put in /srv/tftp.
Steps :
1. Install bootparamd, rarpd, tftpd and nfs-kernel-server in Linux server (pegasus)
root@pegasus > apt-get install bootparamd rarpd tftpd nfs-kernel-server
2. Run iptables -F, make sure no firewall in Linux server
root@pegasus > iptables -F
3. Check the mac address of the solaris client.
Try boot from {ok}, see the mac address during booting (if the system is currently up, go to init 0 mode) :
ok boot net
Resetting ...
LOM event: +56d+21h39m43s host reset
รพ
Sun Fire V120 (UltraSPARC-IIe 648MHz), No Keyboard
OpenBoot 4.0, 1024 MB memory installed, Serial #61911409.
Ethernet address 0:3:ba:b0:b1:71, Host ID: 83b0b171.
Back to lom> or sc> using 'break' command.
4. Set /etc/ethers and /etc/hosts in Linux server with the mac address and hostname of the solaris client.
elinpra@pegasus > echo "0:3:ba:b0:b1:71 solclient" >> /etc/ethers
elinpra@pegasus > echo "192.168.10.5 solclient" >> /etc/hosts
5. Start the rarpd if has not started yet.( I’m using debian based linux here )
root@pegasus > /etc/init.d/rarpd start
6. If you're installing using Solaris iso file, mount the iso file to a directory using the following command, otherwise if using Solaris CD/DVD, directly go to step 8:
root@pegasus > mkdir -p /mnt/sol10
root@pegasus > mount -o loop solaris_iso_file.iso /mnt/sol10
root@pegasus > cd /mnt/sol10
7. If you have the Solaris 10 CD, insert it on pegasus, do the following steps :
root@pegasus > cd /mnt/cdrom/ (to your solaris cdrom directory)
8. Find the suitable kernel for your machine type. Mine is SunFire v120, so it will be sun4u type. If your hardware is T5220, T2000 etc then you need sun4v kernel.
Locate the kernel on directory Solaris_10/Tools/Boot/platform/sun4u/inetboot for sun4u, or Solaris_10/Tools/Boot/platform/sun4v/inetboot for sun4v.
Copy it to /srv/tftp and make symbolic link to that file into C0A80A05.
root@pegasus > cp inetboot /srv/tftp
root@pegasus > ln -s /srv/tftp/inetboot /srv/tftp/C0A80A05
9. Start tftpd daemon in pegasus :
root@pegasus > /etc/init.d/openbsd-inetd restart
10. start nfs service in pegasus :
root@pegasus > /etc/init.d/nfs-kernel-server start
11. Prepare nfs mount so that solclient later on can download the entire installation package using nfs mount. Set the mount root into where the cdrom or iso files are mounted. Make sure that the nfs mount root from solclient is /sol10.
root@pegasus > exportfs \*:/mnt/cdrom -o fsid=0,ro,no_root_squash,crossmnt,no_subtree_check,sync <<- for CD/DVD or root@pegasus > exportfs \*:/mnt -o fsid=0,ro,no_root_squash,crossmnt,no_subtree_check,sync <<>Check if the nfs shares can be mounted correctly.
root@pegasus > mount -t nfs4 pegasus:/sol10 /tmp/somewhere
Verify in your mount list :
root@pegasus > df -kh
Go to /tmp/somewhere, and make sure there’s a directory called sol10/, if not, then the nfs root stil wrong.
13. Configure bootparams in /etc/bootparams, fill in this entry:
solclient root=pegasus:/sol10/Solaris_10/Tools/Boot install=pegasus:/sol10/ boottype=:in
14. You might want to see what's happen in your pegasus using tcpdump:
root@pegasus > tcpdump -i eth0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
10:35:16.385289 arp who-has osol1 (Broadcast) tell osol1
10:35:16.786701 IP pegasus > OSPF-ALL.MCAST.NET: OSPFv2, Hello, length: 44
10:35:17.904404 IP solclient.syslog > 255.255.255.255.sunrpc: [|syslog]
10:35:18.666258 IP osol2.58847 > resolver.ao.ericsson.se.domain: 57879+ TXT? _nfsv4idmapdomain. (35)
10:35:18.692884 IP resolver.ao.ericsson.se.domain > osol2.58847: 57879 ServFail 0/0/0 (35)
10:35:18.693883 IP osol2.58848 > resolver.sw.ericsson.se.domain: 57879+ TXT? _nfsv4idmapdomain. (35)
10:35:18.944002 IP resolver.sw.ericsson.se.domain > osol2.58848: 57879 ServFail 0/0/0 (35)
10:35:18.945066 IP osol2.58849 > resolver.am.ericsson.se.domain: 57879+ TXT? _nfsv4idmapdomain. (35)
10:35:19.349904 IP resolver.am.ericsson.se.domain > osol2.58849: 57879 ServFail 0/0/0 (35)
10:35:19.350799 IP osol2.58850 > resolver.ao.ericsson.se.domain: 57879+ TXT? _nfsv4idmapdomain. (35)
10:35:19.391665 IP resolver.ao.ericsson.se.domain > osol2.58850: 57879 ServFail 0/0/0 (35)
10:35:19.426161 IP osol2.58851 > resolver.sw.ericsson.se.domain: 57879+ TXT? _nfsv4idmapdomain. (35)
10:35:19.713817 IP resolver.sw.ericsson.se.domain > osol2.58851: 57879 ServFail 0/0/0 (35)
10:35:19.714855 IP osol2.58852 > resolver.am.ericsson.se.domain: 57879+ TXT? _nfsv4idmapdomain. (35)
10:35:20.057720 IP solclient.syslog > 255.255.255.255.sunrpc: [|syslog]
10:35:20.125082 IP resolver.am.ericsson.se.domain > osol2.58852: 57879 ServFail 0/0/0 (35)
10:35:21.870552 IP solclient.syslog > 255.255.255.255.sunrpc: [|syslog]
...
10:45:43.677010 IP solclient.afpovertcp > pegasus.nfs: . ack 39685605 win 47784
10:45:43.677183 IP solclient.afpovertcp > pegasus.nfs: . ack 39688501 win 44888
10:45:43.677350 IP solclient.afpovertcp > pegasus.nfs: . ack 39691397 win 41992
...
15. Boot your solclient from ok prompt:
ok boot net -v - install
Boot device: /pci@1f,0/pci@1,1/network@c,1 File and args: -v - install
3a000 Using RARP/BOOTPARAMS...
Internet address is: 192.168.10.5
Bootparam response received
hostname: solclient
domainname: (none)
Found 192.168.10.1 @ 8:0:20:eb:52:e0
root server: jumpstart (192.168.10.1)
root directory: /sol10/Solaris_10/Tools/Boot
module /platform/sun4u/kernel/sparcv9/unix: text at [0x1000000, 0x10a096d] data
module /platform/sun4u/kernel/sparcv9/genunix: text at [0x10a0970, 0x12615bf] da
module /platform/SUNW,UltraAX-i2/kernel/misc/sparcv9/platmod: text at [0x12615c0
module /platform/sun4u/kernel/cpu/sparcv9/SUNW,UltraSPARC-IIe: text at [0x126184
SunOS Release 5.10 Version Generic_139555-08 64-bit
Copyright 1983-2009 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Ethernet address = 0:3:ba:b0:b1:71
Using default device instance data
mem = 1048576K (0x40000000)
avail mem = 845930496
root nexus = Sun Fire V120 (UltraSPARC-IIe 648MHz)
pseudo0 at root
pseudo0 is /pseudo
scsi_vhci0 at root
scsi_vhci0 is /scsi_vhci
ramdisk0 at root
ramdisk0 is /ramdisk-root
root on /ramdisk-root:a fstype ufs
pcipsy0 at root: UPA 0x1f 0x0
pcipsy0 is /pci@1f,0
PCI-device: pci@1,1, simba0
simba0 is /pci@1f,0/pci@1,1
PCI-device: isa@7, ebus1
ebus1 is /pci@1f,0/pci@1,1/isa@7
pseudo-device: dld0
dld0 is /pseudo/dld@0
SUNW,eri0 : Local Ethernet address = 0:3:ba:b0:b1:71PCI-device: network@c,1, eri
eri0 is /pci@1f,0/pci@1,1/network@c,1
SUNW,eri1 : Local Ethernet address = 0:3:ba:b0:b1:72SUNW,eri1 : Using local MAC
eri1 is /pci@1f,0/pci@1,1/network@5,1
su0 at ebus1: offset 0,3f8
su0 is /pci@1f,0/pci@1,1/isa@7/serial@0,3f8
PCI-device: usb@c,3, ohci0
ohci0 is /pci@1f,0/pci@1,1/usb@c,3
PCI-device: usb@5,3, ohci1
ohci1 is /pci@1f,0/pci@1,1/usb@5,3
cpu0: UltraSPARC-IIe (portid 0 impl 0x13 ver 0x33 clock 648 MHz)
iscsi0 at root
iscsi0 is /iscsi
SUNW,eri0 : 100 Mbps full duplex link up
pseudo-device: zfs0
zfs0 is /pseudo/zfs@0
Configuring devices.
pseudo-device: devinfo0
devinfo0 is /pseudo/devinfo@0
PCI-device: pci@1, simba1
simba1 is /pci@1f,0/pci@1
pseudo-device: pseudo1
pseudo1 is /pseudo/zconsnex@1
PCI-device: ebus@c, ebus0
ebus0 is /pci@1f,0/pci@1,1/ebus@c
PCI-device: pmu@3, pmubus0
/pci@1f,0/pci@1/scsi@8 (glm0):
glm0 supports power management.
/pci@1f,0/pci@1/scsi@8 (glm0):
Rev. 7 Symbios 53c896 found.
PCI-device: scsi@8, glm0
glm0 is /pci@1f,0/pci@1/scsi@8
/pci@1f,0/pci@1/scsi@8,1 (glm1):
glm1 supports power management.
/pci@1f,0/pci@1/scsi@8,1 (glm1):
Rev. 7 Symbios 53c896 found.
PCI-device: scsi@8,1, glm1
glm1 is /pci@1f,0/pci@1/scsi@8,1
power0 at ebus1: offset 0,800
power0 is /pci@1f,0/pci@1,1/isa@7/power@0,800
su1 at ebus1: offset 0,2e8
su1 is /pci@1f,0/pci@1,1/isa@7/serial@0,2e8
pseudo-device: fssnap0
fssnap0 is /pseudo/fssnap@0
pseudo-device: ramdisk1024
ramdisk1024 is /pseudo/ramdisk@1024
pseudo-device: winlock0
winlock0 is /pseudo/winlock@0
pseudo-device: llc10
llc10 is /pseudo/llc1@0
pseudo-device: lofi0
lofi0 is /pseudo/lofi@0
sd3 at glm0: target 0 lun 0
sd3 is /pci@1f,0/pci@1/scsi@8/sd@0,0
pseudo-device: fcp0
fcp0 is /pseudo/fcp@0
pseudo-device: fcsm0
fcsm0 is /pseudo/fcsm@0
pseudo-device: trapstat0
trapstat0 is /pseudo/trapstat@0
pseudo-device: pool0
pool0 is /pseudo/pool@0
pseudo-device: mem_cache0
mem_cache0 is /pseudo/mem_cache@0
pseudo-device: fcode0
fcode0 is /pseudo/fcode@0
sd0 at glm0: target 1 lun 0
sd0 is /pci@1f,0/pci@1/scsi@8/sd@1,0
Using RPC Bootparams for network configuration information.
Attempting to configure interface eri1...
Skipped interface eri1
Attempting to configure interface eri0...
Configured interface eri0
Reading ZFS config: done.
Setting up Java. Please wait...
Serial console, reverting to text install
Beginning system identification...
Searching for configuration file(s)...
Search complete.
Discovering additional network configuration...
Select a Language
0. English
1. French
2. German
3. Italian
4. Japanese
5. Korean
6. Simplified Chinese
7. Spanish
8. Swedish
9. Traditional Chinese
Please make a choice (0 - 9), or press h or ? for help:
Verify in your mount list :
root@pegasus > df -kh
Go to /tmp/somewhere, and make sure there’s a directory called sol10/, if not, then the nfs root stil wrong.
13. Configure bootparams in /etc/bootparams, fill in this entry:
solclient root=pegasus:/sol10/Solaris_10/Tools/Boot install=pegasus:/sol10/ boottype=:in
14. You might want to see what's happen in your pegasus using tcpdump:
root@pegasus > tcpdump -i eth0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
10:35:16.385289 arp who-has osol1 (Broadcast) tell osol1
10:35:16.786701 IP pegasus > OSPF-ALL.MCAST.NET: OSPFv2, Hello, length: 44
10:35:17.904404 IP solclient.syslog > 255.255.255.255.sunrpc: [|syslog]
10:35:18.666258 IP osol2.58847 > resolver.ao.ericsson.se.domain: 57879+ TXT? _nfsv4idmapdomain. (35)
10:35:18.692884 IP resolver.ao.ericsson.se.domain > osol2.58847: 57879 ServFail 0/0/0 (35)
10:35:18.693883 IP osol2.58848 > resolver.sw.ericsson.se.domain: 57879+ TXT? _nfsv4idmapdomain. (35)
10:35:18.944002 IP resolver.sw.ericsson.se.domain > osol2.58848: 57879 ServFail 0/0/0 (35)
10:35:18.945066 IP osol2.58849 > resolver.am.ericsson.se.domain: 57879+ TXT? _nfsv4idmapdomain. (35)
10:35:19.349904 IP resolver.am.ericsson.se.domain > osol2.58849: 57879 ServFail 0/0/0 (35)
10:35:19.350799 IP osol2.58850 > resolver.ao.ericsson.se.domain: 57879+ TXT? _nfsv4idmapdomain. (35)
10:35:19.391665 IP resolver.ao.ericsson.se.domain > osol2.58850: 57879 ServFail 0/0/0 (35)
10:35:19.426161 IP osol2.58851 > resolver.sw.ericsson.se.domain: 57879+ TXT? _nfsv4idmapdomain. (35)
10:35:19.713817 IP resolver.sw.ericsson.se.domain > osol2.58851: 57879 ServFail 0/0/0 (35)
10:35:19.714855 IP osol2.58852 > resolver.am.ericsson.se.domain: 57879+ TXT? _nfsv4idmapdomain. (35)
10:35:20.057720 IP solclient.syslog > 255.255.255.255.sunrpc: [|syslog]
10:35:20.125082 IP resolver.am.ericsson.se.domain > osol2.58852: 57879 ServFail 0/0/0 (35)
10:35:21.870552 IP solclient.syslog > 255.255.255.255.sunrpc: [|syslog]
...
10:45:43.677010 IP solclient.afpovertcp > pegasus.nfs: . ack 39685605 win 47784
10:45:43.677183 IP solclient.afpovertcp > pegasus.nfs: . ack 39688501 win 44888
10:45:43.677350 IP solclient.afpovertcp > pegasus.nfs: . ack 39691397 win 41992
...
15. Boot your solclient from ok prompt:
ok boot net -v - install
Boot device: /pci@1f,0/pci@1,1/network@c,1 File and args: -v - install
3a000 Using RARP/BOOTPARAMS...
Internet address is: 192.168.10.5
Bootparam response received
hostname: solclient
domainname: (none)
Found 192.168.10.1 @ 8:0:20:eb:52:e0
root server: jumpstart (192.168.10.1)
root directory: /sol10/Solaris_10/Tools/Boot
module /platform/sun4u/kernel/sparcv9/unix: text at [0x1000000, 0x10a096d] data
module /platform/sun4u/kernel/sparcv9/genunix: text at [0x10a0970, 0x12615bf] da
module /platform/SUNW,UltraAX-i2/kernel/misc/sparcv9/platmod: text at [0x12615c0
module /platform/sun4u/kernel/cpu/sparcv9/SUNW,UltraSPARC-IIe: text at [0x126184
SunOS Release 5.10 Version Generic_139555-08 64-bit
Copyright 1983-2009 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Ethernet address = 0:3:ba:b0:b1:71
Using default device instance data
mem = 1048576K (0x40000000)
avail mem = 845930496
root nexus = Sun Fire V120 (UltraSPARC-IIe 648MHz)
pseudo0 at root
pseudo0 is /pseudo
scsi_vhci0 at root
scsi_vhci0 is /scsi_vhci
ramdisk0 at root
ramdisk0 is /ramdisk-root
root on /ramdisk-root:a fstype ufs
pcipsy0 at root: UPA 0x1f 0x0
pcipsy0 is /pci@1f,0
PCI-device: pci@1,1, simba0
simba0 is /pci@1f,0/pci@1,1
PCI-device: isa@7, ebus1
ebus1 is /pci@1f,0/pci@1,1/isa@7
pseudo-device: dld0
dld0 is /pseudo/dld@0
SUNW,eri0 : Local Ethernet address = 0:3:ba:b0:b1:71PCI-device: network@c,1, eri
eri0 is /pci@1f,0/pci@1,1/network@c,1
SUNW,eri1 : Local Ethernet address = 0:3:ba:b0:b1:72SUNW,eri1 : Using local MAC
eri1 is /pci@1f,0/pci@1,1/network@5,1
su0 at ebus1: offset 0,3f8
su0 is /pci@1f,0/pci@1,1/isa@7/serial@0,3f8
PCI-device: usb@c,3, ohci0
ohci0 is /pci@1f,0/pci@1,1/usb@c,3
PCI-device: usb@5,3, ohci1
ohci1 is /pci@1f,0/pci@1,1/usb@5,3
cpu0: UltraSPARC-IIe (portid 0 impl 0x13 ver 0x33 clock 648 MHz)
iscsi0 at root
iscsi0 is /iscsi
SUNW,eri0 : 100 Mbps full duplex link up
pseudo-device: zfs0
zfs0 is /pseudo/zfs@0
Configuring devices.
pseudo-device: devinfo0
devinfo0 is /pseudo/devinfo@0
PCI-device: pci@1, simba1
simba1 is /pci@1f,0/pci@1
pseudo-device: pseudo1
pseudo1 is /pseudo/zconsnex@1
PCI-device: ebus@c, ebus0
ebus0 is /pci@1f,0/pci@1,1/ebus@c
PCI-device: pmu@3, pmubus0
/pci@1f,0/pci@1/scsi@8 (glm0):
glm0 supports power management.
/pci@1f,0/pci@1/scsi@8 (glm0):
Rev. 7 Symbios 53c896 found.
PCI-device: scsi@8, glm0
glm0 is /pci@1f,0/pci@1/scsi@8
/pci@1f,0/pci@1/scsi@8,1 (glm1):
glm1 supports power management.
/pci@1f,0/pci@1/scsi@8,1 (glm1):
Rev. 7 Symbios 53c896 found.
PCI-device: scsi@8,1, glm1
glm1 is /pci@1f,0/pci@1/scsi@8,1
power0 at ebus1: offset 0,800
power0 is /pci@1f,0/pci@1,1/isa@7/power@0,800
su1 at ebus1: offset 0,2e8
su1 is /pci@1f,0/pci@1,1/isa@7/serial@0,2e8
pseudo-device: fssnap0
fssnap0 is /pseudo/fssnap@0
pseudo-device: ramdisk1024
ramdisk1024 is /pseudo/ramdisk@1024
pseudo-device: winlock0
winlock0 is /pseudo/winlock@0
pseudo-device: llc10
llc10 is /pseudo/llc1@0
pseudo-device: lofi0
lofi0 is /pseudo/lofi@0
sd3 at glm0: target 0 lun 0
sd3 is /pci@1f,0/pci@1/scsi@8/sd@0,0
pseudo-device: fcp0
fcp0 is /pseudo/fcp@0
pseudo-device: fcsm0
fcsm0 is /pseudo/fcsm@0
pseudo-device: trapstat0
trapstat0 is /pseudo/trapstat@0
pseudo-device: pool0
pool0 is /pseudo/pool@0
pseudo-device: mem_cache0
mem_cache0 is /pseudo/mem_cache@0
pseudo-device: fcode0
fcode0 is /pseudo/fcode@0
sd0 at glm0: target 1 lun 0
sd0 is /pci@1f,0/pci@1/scsi@8/sd@1,0
Using RPC Bootparams for network configuration information.
Attempting to configure interface eri1...
Skipped interface eri1
Attempting to configure interface eri0...
Configured interface eri0
Reading ZFS config: done.
Setting up Java. Please wait...
Serial console, reverting to text install
Beginning system identification...
Searching for configuration file(s)...
Search complete.
Discovering additional network configuration...
Select a Language
0. English
1. French
2. German
3. Italian
4. Japanese
5. Korean
6. Simplified Chinese
7. Spanish
8. Swedish
9. Traditional Chinese
Please make a choice (0 - 9), or press h or ? for help:
Monday, April 5, 2010
Playing around with low end VPS box
Last week I just bought a VPS account for playing around with. It feels so great having our own shell account with root login so that we can do anything inside. I bought it from here. First of all, I bought the minimalist one, with 64mb memory, with no burstable ram :D, using Centos. I simply cant do anything, their Centos installation itself took around 20-30mb ram. I also not well enough playing with Yum. This is not great, so I upgraded the account to 128mb ram. At the same time I noticed that besides Centos, the hosting provider also provide Debian Lenny as the OS....why dont you said that from the beginning ??? :D Now, I'm running Lenny with 128mb ram. The VM specs itself it's not that bad, considering it's powered with 2 cpu @3Ghz, 128mb ram with no swap ( this guy here shares a great script to create a fake swap, but I dont need it any longer ;) read the rest of the entry to know why... ), and with 10Gb disk, more than enough storage for minimalist like me :)
So, first thing first, chop all the unnecessary program, replace it with the program with smaller 'cost'. Just do ps -ef and there I found apache2 and Sendmail sitting around and eating my memory. Just do :
# apt-get remove --purge sendmail apache2And dont forget to kill them, and remove them from startup script.
# kill -9 pid
# update-rc.d -f remove apache2
# update-rc.d -f remove sendmail
Ok, that left me around 5 mb used memory. Not bad :)
Next thing is to replace the default shell, since bash shell become greedy enough to eat my memory. I replaced it with pdksh since after googling around, this pdksh shell saves ~1mb for every shell session...good enough. So I install it :
# apt-get install pdksh
Dont remove the bash shell yet, since it has a lot of dependencies. Leave it there, but dont use it :) How do we do that ? Just edit your own default shell to become pdksh in /etc/passwd :
# vi /etc/passwd
Change the line using /bin/bash, into /bin/pdksh, and voillaa, next login session will be using pdksh.
Not enought with just # prompt ? It's time to decorate your shell with some fancy prompts, just edit the .profile located inside the user's home directory ( just do ls -la to see it, since it's a hidden file ). Add the following line :
HOSTNAME=`hostname`PS1=`print "\027\033[1;32m$USER@$HOSTNAME $PWD > \027\033[0m"`
And then do logout and login again, now you have a green fancy prompt sitting around in your shell prompts.
Next thing we can chop with, is the rsyslogd daemon and the sshd daemon. I got a great reference here. We will replace the rsyslogd daemon with syslog-ng, and replace the open-ssh server with dropbear.
# apt-get install syslog-ng && dpkg --purge rsyslog
And then the dropbear.
# touch /etc/ssh/sshd_not_to_be_run
# apt-get install dropbear
And edit the /etc/default/dropbear to set
NO_START=0. To make sure of what we have change, just reboot the server.
And after fresh reboot, here's what I have in my VPS :
root@ath.cx /root > ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Apr05 ? 00:00:00 init [2]
root 340 1 0 Apr05 ? 00:00:00 /usr/sbin/syslog-ng -p /var/run/
root 348 1 0 Apr05 ? 00:00:00 /usr/sbin/dropbear -d /etc/dropb
root 367 1 0 Apr05 ? 00:00:00 /usr/sbin/xinetd -pidfile /var/r
root 382 1 0 Apr05 ? 00:00:00 /usr/sbin/cron
root 8864 348 0 02:24 ? 00:00:00 /usr/sbin/dropbear -d /etc/dropb
onty 8865 8864 0 02:24 pts/1 00:00:00 -pdksh
root 9192 8865 0 02:51 pts/1 00:00:00 -pdksh
root 9226 1 0 03:01 ? 00:00:00 nginx: master process /usr/sbin/
www-data 9227 9226 0 03:01 ? 00:00:00 nginx: worker process
root 9229 9192 0 03:01 pts/1 00:00:00 ps -ef
root@ath.cx /root > free -m
total used free shared buffers cached
Mem: 128 6 121 0 0 0
-/+ buffers/cache: 6 121
Swap: 0 0 0
Yep, I end up with just 6 mb ram for OS, dropbear, and nginx, and 121 ram free for my other apps.
Monday, May 18, 2009
Quick guide on UNIX task scheduling with at and batch command
While task scheduling in UNIX commonly uses Crontab facilities, UNIX based system (actually, Windows provide it too, at.exe) also provide at command. Both related to the same area, task scheduling. While Crontab aims to schedule a recurring command (every minutes, every month, every week, etc), at command aims to schedule a task that run once, with specific time arguments. Here’s one example of how we can schedule a task with at command:
$ at now + 1 hour <>&1 > outfile | mailx mygroup
!
commands will be executed using /bin/tcsh
job 1242637613.s at Mon May 18 16:06:53 2009
As we can see from the example above, we want to schedule a task to be executed 1 hour from now, and the task to be executed is diff file1 file2 2>&1 > outfile | mailx mygroup. The at command then returns the job id, which we will able to list all the queueing at command using atq or at –l below:
$ atq
Rank Execution Date Owner Job Queue Job Name
1st May 18, 2009 17:06 minsat 1242637774.a a stdin
$ at -l
1242637774.a Mon May 18 16:18:45 2009
From above we can see that there are only 1 jobs queuing at queue named ‘a’ (this is special queue name for at, and it is used to distinguish between the job executed by at and batch command). We can also see that the execution time will be May 18, 2009 17:06.
And to cancel the scheduled at command, we use atrm or at –r command as follows:
$ atrm 1242637774.a
1242637774.a: removed
$ at -r 1242637774.a
1242637774.a: removed
There are lots of other parameter we can use for describing the time parameter and how to execute the at command which is I found it quite ‘human readable’. Here’s some list of other possible parameter we can use:
1. Direct time
$ at 01.30
$ at 0815am Jan 24
$ at 5 pm FRIday
2. Now keyword
$ at now + 1 minutes
$ at now + 1 hours
$ at now "+ 1day"
3. Tomorrow keyword
$ at 0830 tomorrow
4. Noon keyword
$ at noon tomorrow
5. Midnight keyword
$ at midnight tomorrow
6. Week keyword
$ at 2pm next week
7. Piped with other command
$ echo "mail -s 'REMINDER: Task Scheduler samples' lintang.jp@gmail.com" | at '5/18/2009 10:00AM'
8. Putting the job inside a file
$ at –f runScript.sh now + 1 hour
9. Sending an email after the job is completed
$ at –m –f runScript.sh now + 1 hour
10. Using another shell instead of the user’s default shell for execution
$ at –c –f runScript.sh now + 1 week // C Shell
$ at –k –f runScript.sh now + 1 week // Korn Shell
$ at –s –f runScript.sh now + 1 week // Bourne Shell
Several behaviors and conditions that must be known when running at command as follows:
1. All environment variables, current working directory, file creation mask, and system resource limits during at utility execution will be retained and used when the at job is executed. So it’s different with Crontab where we have to set our environment variables manually to be called inside our script execution.
2. The default shell environment to be used during execution is the user’s default shell, listed in /etc/passwd.
3. Any users that is allowed or forbidden to use at command are listed in the following file :
2. The default shell environment to be used during execution is the user’s default shell, listed in /etc/passwd.
3. Any users that is allowed or forbidden to use at command are listed in the following file :
1. /usr/lib/cron/at.deny // denied user
2. /usr/lib/cron/at.allow // allowed user
If the file does not exist, for example: at.allow file does not exist, means that all users are allowed to use at command.
While batch command is similar with at -q b -m now commands. Meaning that the batch command will use different queue with at (special queue named ‘b’), and by default it will send a report via email. It will also execute right away. If the queue is full, then the command will have to wait to be executed one by one.
While batch command is similar with at -q b -m now commands. Meaning that the batch command will use different queue with at (special queue named ‘b’), and by default it will send a report via email. It will also execute right away. If the queue is full, then the command will have to wait to be executed one by one.
Resource : 1. Unix at man pages, with some slang modifications :p
Fiuh, alhamdulillah, that was hard to wrote :D
Monday, December 22, 2008
Bye bye apache, welcome Nginx
Bagi saya, php tetap memiliki kenangan yang indah dalam mengisi hari-hari pemrograman saya terdahulu. Programming language yang fleksibel, dan nggak pake ribet. Justru kesulitan ditemui ketika deploy di server. Kebanyakan server yang tersedia sudah diinstall default dengan bundle apache, beserta modul-modul yang sudah di tentukan sebelumnya. Kalau pake keluarga Redhat, iya kalau kebetulan dapet rpm yang pas versinya, kalo nggak ? Cara paling enak memang tetap dengan compile dari source, karena kita bisa bongkar pasang modul yang kita inginkan, tambahkan semaunya, kurangi sesukanya. Jaman dulu(nggak dulu banget sih, 2004), saya hanya kenal Apache dan IIS buat jadi webserver untuk skrip php saya. Belakangan ini, muncul sebuah webserver yang tidak terlalu terkenal, tapi sepertinya ampuh. Kenapa ampuh ? Coba anda pergi ke netcraft.com, dan coba anda scan situs wordpress.com dan detik.com, apa webserver mereka ? Mereka pakai Nginx (baca:engine X). Ini dua situs besar loh, dan saya sangat yakin, tiap hari banyak diantara kita yang berinteraksi dengan kedua situs ini, ya tho ? Nggak mungkin dong mereka pake webserver yang kurang 'terkenal' kalo nggak karena mereka merasakan keampuhan dibaliknya, tul ndak ? Coba buka aja deh langsung di situsnya.
Ok, karena saya bukan pembuat Nginx, sejarahnya tidak akan saya beberkan disini. Berikut sebagai pengingat saja buat saya (syukur kalau berguna buat anda juga) untuk ngebangun server PHP siap pakai dengan Nginx dan lighttpd.
Berikut Linux saya, ubuntu 7.10 :
lintang@cygnus:~$ uname -a
Linux cygnus 2.6.22-14-generic #1 SMP Sun Oct 14 23:05:12 GMT 2007 i686 GNU/Linux
Disini kebetulan waktu nginstall, saya pake apt-get saja untuk nginx nya, baru php dan lighttpdnya yang compile dari source. Selain nginx, kita juga harus install dependenciesnya, terutama pcre dan zlib, serta openssl kalau anda ingin.
root@cygnus:~# apt-get install libpcre3 libpcre3-dev zlib1g zlib1g-dev nginx
Tunggu sejenak, bikin kopi dulu juga boleh. Atau kalau anda ingin waktu anda efisien, mari kita donlot dulu PHP dan Lighttpd nya :D
Saya ambil PHP versi 5.2.6, dan Lighttpd versi 1.4.19. Dari mana ? please deh, silakan googling, mudah didapat kok kedua-duanya.
Ok, kita mulai dengan PHP dulu, silakan ekstrak, compile, dan install. Berikut opsi yang saya gunakan untuk PHP saya.
lintang@cygnus:~$ ./configure --prefix=/usr/local/php-5.2.6 --with-mysql --enable-fastcgi --with-sockets --with-zlib
Ini berarti, kita akan instal PHP kita nanti di direktori /usr/local/php-5.2.6, mengikut-sertakan library koneksi php untuk mysql, membuat PHP yang berfungsi sebagai interpreter CGI ( nantinya skrip PHP bisa dijalankan dari shell, mirip /bin/bash atau /usr/bin/perl), lalu PHP tersebut dapat memiliki/membuka socket tersendiri (nantinya PHP akan berjalan sebagai process yang terpisah dari webserver, tidak seperti model Apache dimana PHP berjalan sebagai modul di dalamnya), lalu yang terakhir, mengikut sertakan library php untuk support kompresi dengan tipe Gzip.
Tunggu sejenak, setelah sukses, silakan lakukan langkah dibawah seperti biasa :
lintang@cygnus:~$ make
lintang@cygnus:~$ sudo make install
Nah, coba cek di direktori /usr/local/php-5.2.6/bin, seharusnya ada file executable bernama php-cgi. File inilah yang akan berjalan sebagai interpreter PHP anda dari shell.
Menurut beberapa sumber dari internet, sebenarnya php-cgi ini saja cukup untuk dipanggil dari Nginx nantinya untuk menjalankan PHP, namun akan lebih baik apabila kita mengambil spawner dari project Lighttpd. Spawner ini akan mengeksekusi php-cgi kita. Berikut langkah-langkahnya, seperti biasa, silakan ekstrak Lig
lintang@cygnus:~$ ./configure --prefix=/opt/lighttpd-1.4.19 --enable-static --disable-shared
Kira-kira maksudnya, kita akan menconfigure Lighttpd sebagai library static yang dependenciesnya mutlak terhadap file-file .so tertentu. Opsi static ini membuat program yang kita compile akan jauh lebih cepat, karena versi dependencies di dalamnya seperti di hardcode. Berkebalikan dengan ketika kita compile dengan modus dinamis, hasilnya program akan lebih lambat, namun dependencies terhadap versi library tertentu bisa dihindari. Kalau kita ingin membuat server yang cepat, siapa peduli dengan dinamisasi, bukan begitu ? :p
Lalu seperti biasa, kita jalankan make, tapi kali ini tanpa make install.
lintang@cygnus:~$ make
Seharusnya nanti, di direktori src/ akan ada file bernama spawn-fcgi. Kopikan file tersebut ke directory /usr/bin sebagai berikut :
lintang@cygnus:~$ sudo cp spawn-fcgi /usr/bin/
Lalu anda buat skrip .sh sederhana sebagai berikut :
lintang@cygnus:/usr/local/php-5.2.6$ cat > /usr/bin/php-fastcgi << EOF
#!/bin/sh
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 8999 -f /usr/local/php-5.2.6/bin/php-cgi
EOF
Ini adalah skrip untuk menjalankan PHP sebagai proses CGI yang terpisah dari webserver anda nantinya. PHP akan membuka socket di port 8999, dan akan binding di interface lo(127.0.0.1) anda, sehingga hanya bisa diakses dari mesin anda sendiri.
Ok, langkah terakhir tinggal setup nginx.conf anda, punya saya ada di sini /etc/nginx/nginx.conf.
Berikut isi file konfigurasi Nginx saya :
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
include /etc/nginx/sites-enabled/*;
}
Perhatikan baris yang di bold, bahwa Nginx saya berjalan atas nama user www-data, sehingga user ini mutlak harus ada sebelumnya, sepertinya kalau di Ubuntu, user ini dibuatkan otomatis ketika kita install Nginx yah, saya lupa sih :D.
Baris selanjutnya, worker_processes, saya isi 4. User yang mengakses webserver saya disini kurang dari 100 orang, dan selama ini, 4 worker sudah cukup sih.
Lalu selanjutnya, gzip on, ini modul gzip compress yang kita aktifkan setelah sebelumnya kita install zlib. Dan yang terakhir, kita akan meng-include kan semua file konfigurasi di direktori /etc/nginx/sites-enabled. Berikut contoh file konfigurasi saya di direktori tersebut :
Filename : atutor.conf
server {
listen 80;
server_name atutor;
access_log /var/log/nginx/atutor.access.log;
location / {
root /var/www/nginx-default;
index index.html index.htm index.php;
}
#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 /var/www/nginx-default/ATutor;
}
# 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:8999;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
Konfigurasi ini mengatakan bahwa, saya memiliki sebuah aplikasi (kebetulan aTutor), yang saya letakkan di /var/www/nginx-default, dan untuk semua URL yang berakhiran .php, maka saya akan lemparkan requestnya ke CGI interpreter PHP yang berjalan di port 8999 seperti konfigurasi PHP diatas.
And that's it, kita bisa mengetes konfigurasi nginx kita dengan perintah :
lintang@cygnus:~$ sudo nginx -t
Lalu untuk menjalankan nginx bisa dengan perintah sbb :
lintang@cygnus:~$ sudo nginx
Kalau kita ada perubahan konfigurasi nginx, setelah selesai mengedit file konfigurasi, untuk merestart nginx bisa dengan perintah sbb :
lintang@cygnus:~$ sudo killall -HUP nginx
Udah deh, silakan arahkan browser anda di port 80, aplikasi anda siap melayani user :)
Ok, karena saya bukan pembuat Nginx, sejarahnya tidak akan saya beberkan disini. Berikut sebagai pengingat saja buat saya (syukur kalau berguna buat anda juga) untuk ngebangun server PHP siap pakai dengan Nginx dan lighttpd.
Berikut Linux saya, ubuntu 7.10 :
lintang@cygnus:~$ uname -a
Linux cygnus 2.6.22-14-generic #1 SMP Sun Oct 14 23:05:12 GMT 2007 i686 GNU/Linux
Disini kebetulan waktu nginstall, saya pake apt-get saja untuk nginx nya, baru php dan lighttpdnya yang compile dari source. Selain nginx, kita juga harus install dependenciesnya, terutama pcre dan zlib, serta openssl kalau anda ingin.
root@cygnus:~# apt-get install libpcre3 libpcre3-dev zlib1g zlib1g-dev nginx
Tunggu sejenak, bikin kopi dulu juga boleh. Atau kalau anda ingin waktu anda efisien, mari kita donlot dulu PHP dan Lighttpd nya :D
Saya ambil PHP versi 5.2.6, dan Lighttpd versi 1.4.19. Dari mana ? please deh, silakan googling, mudah didapat kok kedua-duanya.
Ok, kita mulai dengan PHP dulu, silakan ekstrak, compile, dan install. Berikut opsi yang saya gunakan untuk PHP saya.
lintang@cygnus:~$ ./configure --prefix=/usr/local/php-5.2.6 --with-mysql --enable-fastcgi --with-sockets --with-zlib
Ini berarti, kita akan instal PHP kita nanti di direktori /usr/local/php-5.2.6, mengikut-sertakan library koneksi php untuk mysql, membuat PHP yang berfungsi sebagai interpreter CGI ( nantinya skrip PHP bisa dijalankan dari shell, mirip /bin/bash atau /usr/bin/perl), lalu PHP tersebut dapat memiliki/membuka socket tersendiri (nantinya PHP akan berjalan sebagai process yang terpisah dari webserver, tidak seperti model Apache dimana PHP berjalan sebagai modul di dalamnya), lalu yang terakhir, mengikut sertakan library php untuk support kompresi dengan tipe Gzip.
Tunggu sejenak, setelah sukses, silakan lakukan langkah dibawah seperti biasa :
lintang@cygnus:~$ make
lintang@cygnus:~$ sudo make install
Nah, coba cek di direktori /usr/local/php-5.2.6/bin, seharusnya ada file executable bernama php-cgi. File inilah yang akan berjalan sebagai interpreter PHP anda dari shell.
Menurut beberapa sumber dari internet, sebenarnya php-cgi ini saja cukup untuk dipanggil dari Nginx nantinya untuk menjalankan PHP, namun akan lebih baik apabila kita mengambil spawner dari project Lighttpd. Spawner ini akan mengeksekusi php-cgi kita. Berikut langkah-langkahnya, seperti biasa, silakan ekstrak Lig
lintang@cygnus:~$ ./configure --prefix=/opt/lighttpd-1.4.19 --enable-static --disable-shared
Kira-kira maksudnya, kita akan menconfigure Lighttpd sebagai library static yang dependenciesnya mutlak terhadap file-file .so tertentu. Opsi static ini membuat program yang kita compile akan jauh lebih cepat, karena versi dependencies di dalamnya seperti di hardcode. Berkebalikan dengan ketika kita compile dengan modus dinamis, hasilnya program akan lebih lambat, namun dependencies terhadap versi library tertentu bisa dihindari. Kalau kita ingin membuat server yang cepat, siapa peduli dengan dinamisasi, bukan begitu ? :p
Lalu seperti biasa, kita jalankan make, tapi kali ini tanpa make install.
lintang@cygnus:~$ make
Seharusnya nanti, di direktori src/ akan ada file bernama spawn-fcgi. Kopikan file tersebut ke directory /usr/bin sebagai berikut :
lintang@cygnus:~$ sudo cp spawn-fcgi /usr/bin/
Lalu anda buat skrip .sh sederhana sebagai berikut :
lintang@cygnus:/usr/local/php-5.2.6$ cat > /usr/bin/php-fastcgi << EOF
#!/bin/sh
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 8999 -f /usr/local/php-5.2.6/bin/php-cgi
EOF
Ini adalah skrip untuk menjalankan PHP sebagai proses CGI yang terpisah dari webserver anda nantinya. PHP akan membuka socket di port 8999, dan akan binding di interface lo(127.0.0.1) anda, sehingga hanya bisa diakses dari mesin anda sendiri.
Ok, langkah terakhir tinggal setup nginx.conf anda, punya saya ada di sini /etc/nginx/nginx.conf.
Berikut isi file konfigurasi Nginx saya :
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
include /etc/nginx/sites-enabled/*;
}
Perhatikan baris yang di bold, bahwa Nginx saya berjalan atas nama user www-data, sehingga user ini mutlak harus ada sebelumnya, sepertinya kalau di Ubuntu, user ini dibuatkan otomatis ketika kita install Nginx yah, saya lupa sih :D.
Baris selanjutnya, worker_processes, saya isi 4. User yang mengakses webserver saya disini kurang dari 100 orang, dan selama ini, 4 worker sudah cukup sih.
Lalu selanjutnya, gzip on, ini modul gzip compress yang kita aktifkan setelah sebelumnya kita install zlib. Dan yang terakhir, kita akan meng-include kan semua file konfigurasi di direktori /etc/nginx/sites-enabled. Berikut contoh file konfigurasi saya di direktori tersebut :
Filename : atutor.conf
server {
listen 80;
server_name atutor;
access_log /var/log/nginx/atutor.access.log;
location / {
root /var/www/nginx-default;
index index.html index.htm index.php;
}
#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 /var/www/nginx-default/ATutor;
}
# 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:8999;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
Konfigurasi ini mengatakan bahwa, saya memiliki sebuah aplikasi (kebetulan aTutor), yang saya letakkan di /var/www/nginx-default, dan untuk semua URL yang berakhiran .php, maka saya akan lemparkan requestnya ke CGI interpreter PHP yang berjalan di port 8999 seperti konfigurasi PHP diatas.
And that's it, kita bisa mengetes konfigurasi nginx kita dengan perintah :
lintang@cygnus:~$ sudo nginx -t
Lalu untuk menjalankan nginx bisa dengan perintah sbb :
lintang@cygnus:~$ sudo nginx
Kalau kita ada perubahan konfigurasi nginx, setelah selesai mengedit file konfigurasi, untuk merestart nginx bisa dengan perintah sbb :
lintang@cygnus:~$ sudo killall -HUP nginx
Udah deh, silakan arahkan browser anda di port 80, aplikasi anda siap melayani user :)
Labels:
aTutor,
Internet,
Linux stuff,
Nginx,
Unix,
Web Server
Tuesday, November 13, 2007
Ruby Install on DSL Linux
Went home earlier than before today, after a day full of meeting with client. I missed my linux. Got a bling about ruby. This stuff sounds cool. Lot's of java programmer migrating to this language, let's give it a shot. I started my adventure by googling with some 'beginner standars' keyword regarding ruby : "howto install ruby", and I got these links :
- http://www.ruby-lang.org/id
- http://hivelogic.com/narrative/articles/ruby_rails_lighttpd_mysql_tiger?status=301
Great, I boot up my DSL linux under qemu, and start downloading the necessary package. I tried to install using DSL's extension facilities (MyDSL-ruby.dsl) but, I don't know if it's work. So I decided to download the source, and compile it, just like the good old days :)
First, I downloaded ruby here. And then as usual, run 3 commands :
dsl@1[ruby-1.8.6]$ ./configure --prefix=/opt/ruby-1.8.6
dsl@1[ruby-1.8.6]$ make
dsl@1[ruby-1.8.6]$ sudo make install
And, I got my ruby installed in /opt/ruby-1.8.6. Dont forget to add the path reference to ruby's bin/ directory installation as follows (mine at /opt/ruby-1.8.6/bin) :
export PATH=/opt/ruby-1.8.6/bin:$PATH
To make my life easier, I put that line in /etc/profile, and run : source /etc/profile. Check whether it points to the right path, type : irb, it should shows you some prompt like this :
dsl@0[Installer]$ irb
irb(main):001:0>
Ok, I continued my journey by getting a tools called RubyGems. This RubyGems is a handy command-line tool for managing the installation of Ruby packages, like Rails ('quoted from here ').
I downloaded it from here.
After that, I unpack it, and went inside the exploded directory and type : ruby setup.rb
This will start the installation process of RubyGems.
OK, next I installed Rails, what is it ?.
Quoted from http://rubyonrails.org/, ruby itself is a programming language, and Rails is the framework, just like Struts in Java. Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern.
After RubyGems installed, it's all easy to install Rails, I just have to type :
sudo gem install rails --include-dependencies
And RubyGems will download all the needs.
While RubyGems downloading my Rails installation, I went to next step and install PCRE and Lighttpd. PCRE is a Ruby regex extensions stands for Perl Compatible Regular Expression. I downloaded it from here. While Lighttpd is a webserver that became the default one when we choose Rails. I downloaded Lighttpd from here.
First, PCRE. I run : ./configure, make, and make install. I done the same command with Lighttpd, only that I gave different prefix on each ./configure like this :
PCRE : ./configure --prefix=/opt/pcre-7.4
Lighttpd : ./configure --prefix=/opt/Lighttpd-1.4.18
And the rest make and make install commands were same.
Ok, I should be ready for rock and roll with ruby on rails.
I'll write my next experiments later. Now, it's time to get rest, we'll have a great patch deployment tomorrow :)
- http://www.ruby-lang.org/id
- http://hivelogic.com/narrative/articles/ruby_rails_lighttpd_mysql_tiger?status=301
Great, I boot up my DSL linux under qemu, and start downloading the necessary package. I tried to install using DSL's extension facilities (MyDSL-ruby.dsl) but, I don't know if it's work. So I decided to download the source, and compile it, just like the good old days :)
First, I downloaded ruby here. And then as usual, run 3 commands :
dsl@1[ruby-1.8.6]$ ./configure --prefix=/opt/ruby-1.8.6
dsl@1[ruby-1.8.6]$ make
dsl@1[ruby-1.8.6]$ sudo make install
And, I got my ruby installed in /opt/ruby-1.8.6. Dont forget to add the path reference to ruby's bin/ directory installation as follows (mine at /opt/ruby-1.8.6/bin) :
export PATH=/opt/ruby-1.8.6/bin:$PATH
To make my life easier, I put that line in /etc/profile, and run : source /etc/profile. Check whether it points to the right path, type : irb, it should shows you some prompt like this :
dsl@0[Installer]$ irb
irb(main):001:0>
Ok, I continued my journey by getting a tools called RubyGems. This RubyGems is a handy command-line tool for managing the installation of Ruby packages, like Rails ('quoted from here ').
I downloaded it from here.
After that, I unpack it, and went inside the exploded directory and type : ruby setup.rb
This will start the installation process of RubyGems.
OK, next I installed Rails, what is it ?.
Quoted from http://rubyonrails.org/, ruby itself is a programming language, and Rails is the framework, just like Struts in Java. Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern.
After RubyGems installed, it's all easy to install Rails, I just have to type :
sudo gem install rails --include-dependencies
And RubyGems will download all the needs.
While RubyGems downloading my Rails installation, I went to next step and install PCRE and Lighttpd. PCRE is a Ruby regex extensions stands for Perl Compatible Regular Expression. I downloaded it from here. While Lighttpd is a webserver that became the default one when we choose Rails. I downloaded Lighttpd from here.
First, PCRE. I run : ./configure, make, and make install. I done the same command with Lighttpd, only that I gave different prefix on each ./configure like this :
PCRE : ./configure --prefix=/opt/pcre-7.4
Lighttpd : ./configure --prefix=/opt/Lighttpd-1.4.18
And the rest make and make install commands were same.
Ok, I should be ready for rock and roll with ruby on rails.
I'll write my next experiments later. Now, it's time to get rest, we'll have a great patch deployment tomorrow :)
Friday, June 1, 2007
Tora(Toolkit for Oracle) Installation
Yesterday I managed to install my laptop with Tora. I'm using Kubuntu Feisty Fawn.For you who doesnt have any idea what kind of animal Tora is, let me give you some hint. If you used to use Toad in M$-Windows to do your oracle database-related jobs, well, you can say that Tora has similar usage.It can runs on Linux, make your life simpler, and easier, he he. Hey, it's your laptop that should work for you, not you're the one that has to work for your laptop, right ?
Ok, here's the step I saved from my installation adventure :
1. get Oracle instant client
You can get it here :
http://download.oracle.com/otn/linux/instantclient/instantclient-basic-linux32-10.2.0.3-20061115.zip
http://download.oracle.com/otn/linux/instantclient/instantclient-sdk-linux32-10.2.0.3-20061115.zip
2. Unzip it at some directory, e.g : /opt/instantclient_10_2
3. Add the directory to /etc/ld.so.conf, dont forget run /sbin/ldconfig.
Here's the sample from my laptop :
------------------
onty@phoenix:~$ cat /etc/ld.so.conf
/lib
/usr/lib
/usr/lib/firefox/plugins
/opt/instantclient_10_2
------------------
4. Install libqscintilla.
Thank God, I'm using Kubuntu,and having great internet connection in my office. So just simply run apt-get.
root@phoenix:/opt# apt-get install libqscintilla6 libqscintilla-dev
5. Download and Unzip tora
You can get it here. I'm using version 1.3.21.
6. compile start
oracle@phoenix:/opt/tora-1.3.21$ ./configure --with-qt-dir=/usr/lib/qt3 --with-oracle-libraries=/opt/instantclient_10_2 --with-oracle-includes=/opt/instantclient_10_2/sdk/include --with-oci-version=10G --with-instant-client
oracle@phoenix:/opt/tora-1.3.21$ make
oracle@phoenix:/opt/tora-1.3.21$ make install
7. In the midde of make, I'm getting error says that toThreadStartWrapper has not been declared. I googled around to find the solution, and found out that I have to edit a file named tothread.cpp around line 157 like below.
#define THREAD_ASSERT(x) if((x)!=0) { \
throw (qApp->translate("toThread","Thread function \"%1\" failed.").arg(QString::fromLatin1( #x ))); }
/* new added start */
void *toThreadStartWrapper(void *t);
/* new added end */
void toThread::initAttr()
After that, I continued with make, and make install.
And finally, run ./tora and you can see ORACLE option in your connection. That connection refers to wherever you put our TNSNAMES.ORA in your ORACLE_HOME.
OK, that's for today's tip.
Ok, here's the step I saved from my installation adventure :
1. get Oracle instant client
You can get it here :
http://download.oracle.com/otn/linux/instantclient/instantclient-basic-linux32-10.2.0.3-20061115.zip
http://download.oracle.com/otn/linux/instantclient/instantclient-sdk-linux32-10.2.0.3-20061115.zip
2. Unzip it at some directory, e.g : /opt/instantclient_10_2
3. Add the directory to /etc/ld.so.conf, dont forget run /sbin/ldconfig.
Here's the sample from my laptop :
------------------
onty@phoenix:~$ cat /etc/ld.so.conf
/lib
/usr/lib
/usr/lib/firefox/plugins
/opt/instantclient_10_2
------------------
4. Install libqscintilla.
Thank God, I'm using Kubuntu,and having great internet connection in my office. So just simply run apt-get.
root@phoenix:/opt# apt-get install libqscintilla6 libqscintilla-dev
5. Download and Unzip tora
You can get it here. I'm using version 1.3.21.
6. compile start
oracle@phoenix:/opt/tora-1.3.21$ ./configure --with-qt-dir=/usr/lib/qt3 --with-oracle-libraries=/opt/instantclient_10_2 --with-oracle-includes=/opt/instantclient_10_2/sdk/include --with-oci-version=10G --with-instant-client
oracle@phoenix:/opt/tora-1.3.21$ make
oracle@phoenix:/opt/tora-1.3.21$ make install
7. In the midde of make, I'm getting error says that toThreadStartWrapper has not been declared. I googled around to find the solution, and found out that I have to edit a file named tothread.cpp around line 157 like below.
#define THREAD_ASSERT(x) if((x)!=0) { \
throw (qApp->translate("toThread","Thread function \"%1\" failed.").arg(QString::fromLatin1( #x ))); }
/* new added start */
void *toThreadStartWrapper(void *t);
/* new added end */
void toThread::initAttr()
After that, I continued with make, and make install.
And finally, run ./tora and you can see ORACLE option in your connection. That connection refers to wherever you put our TNSNAMES.ORA in your ORACLE_HOME.
OK, that's for today's tip.
Subscribe to:
Comments (Atom)