[Centos] Change your default rpm query format on multi-lib archs (like x86_64)

http://grokbase.com/t/centos.org/centos/2005/01/centos-change-your-default-rpm-query-format-on-multi-lib-archs-like-x86-64/1277ni5dyifjolxwsmqjhio6j7m4

All,

I am now building rpms on, and using a multi-lib arch (x86_64) for the
first time … when using the standard command:

rpm -qa | grep pkg_name

The results might be pkg_name.i386 or pkg_name.x86_64 … or both. But,
the way it is shown by the default query format, looks the same … like
this:

pkg_name
pkg_name
—————————-
example:

[root@x86-64 ~]# rpm -qa | grep popt

popt-1.9.1-21
popt-1.9.1-21
—————————-

To fix this problem on multi-lib machines (and change the default query
format), you can change your .rpmmacros (or create a .rpmmacros) in your
user home directory and add this line:

%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}

—————————
Now the result of the above example is:

[root@x86-64 ~]# rpm -qa | grep popt

popt-1.9.1-21.x86_64
popt-1.9.1-21.i386
—————————

So now you can easily tell which arch of a program is installed on
multi-lib machines.

Thanks,
Johnny Hughes

Posted in Linux | Leave a comment

how to backup esxi vm images

http://communities.vmware.com/docs/DOC-8760

Posted in Linux | Leave a comment

Rar under linux

Create a rar package with 50M size.

rar a -m5 -v50000k -R bigphoto.rar bigphoto/

Posted in Linux | Leave a comment

windows server 2008 terminal server license

zz: http://forums.mydigitallife.info/threads/4077-Windows-Server-2008-Terminal-Server-Licensing

Note it .;P

Posted in Linux | Leave a comment

vmrun control vmware server

vmrun -T server -h https://192.168.0.2:8333/sdk -u root -p password start “[standard] vhost-11-win2k3_1/vhost-11-win2k3.vmx”

find more help try

vmrun -h


vmrun version 2.0.2 build-203138

Usage: vmrun [AUTHENTICATION-FLAGS] COMMAND [PARAMETERS]

AUTHENTICATION-FLAGS
--------------------
These must appear before the command and any command parameters.

-h (not needed for Workstation)
-P (not needed for Workstation)
-T (ws|server|server1)
for example, use '-T server' for Server 2.0
use '-T server1' for Server 1.0
-u (not needed for Workstation)
-p (not needed for Workstation)
-gu
-gp

POWER COMMANDS PARAMETERS DESCRIPTION
-------------- ---------- -----------
start Path to vmx file Start a VM
[gui|nogui]

stop Path to vmx file Stop a VM
[hard|soft]

reset Path to vmx file Reset a VM
[hard|soft]

suspend Path to vmx file Suspend a VM
[hard|soft]

pause Path to vmx file Pause a VM

unpause Path to vmx file Unpause a VM

SNAPSHOT COMMANDS PARAMETERS DESCRIPTION
----------------- ---------- -----------
snapshot Path to vmx file Create a snapshot of a VM
Snapshot name

deleteSnapshot Path to vmx file Remove a snapshot from a VM
Snapshot name

revertToSnapshot Path to vmx file Set VM state to a snapshot
Snapshot name

RECORD/REPLAY COMMANDS PARAMETERS DESCRIPTION
---------------------- ---------- -----------
beginRecording Path to vmx file Begin recording a VM
Snapshot name

endRecording Path to vmx file End recording a VM

beginReplay Path to vmx file Begin replaying a VM
Snapshot name

endReplay Path to vmx file End replaying a VM

GUEST OS COMMANDS PARAMETERS DESCRIPTION
----------------- ---------- -----------
runProgramInGuest Path to vmx file Run a program in Guest OS
[-noWait]
[-activeWindow]
[-interactive]
Complete-Path-To-Program
[Program arguments]

fileExistsInGuest Path to vmx file Check if a file exists in Guest OS
Path to file in guest

setSharedFolderState Path to vmx file Modify a Host-Guest shared folder
Share name
Host path
writable | readonly

addSharedFolder Path to vmx file Add a Host-Guest shared folder
Share name
New host path

removeSharedFolder Path to vmx file Remove a Host-Guest shared folder
Share name

listProcessesInGuest Path to vmx file List running processes in Guest OS

killProcessInGuest Path to vmx file Kill a process in Guest OS
process id

runScriptInGuest Path to vmx file Run a script in Guest OS
Interpreter path
script_text

deleteFileInGuest Path to vmx file Delete a file in Guest OS
Path in guest

createDirectoryInGuest Path to vmx file Create a directory in Guest OS
Directory path in guest

deleteDirectoryInGuest Path to vmx file Delete a directory in Guest OS
Directory path in guest

listDirectoryInGuest Path to vmx file List a directory in Guest OS
Directory path in guest

copyFileFromHostToGuest Path to vmx file Copy a file from host OS to guest OS
Path on host
Path in guest

copyFileFromGuestToHost Path to vmx file Copy a file from guest OS to host OS
Path in guest
Path on host

renameFileInGuest Path to vmx file Rename a file in Guest OS
Original name
New name

captureScreen Path to vmx file Capture the screen of the VM to a local file
Path on host

writeVariable Path to vmx file Write a variable in the VM state
[runtimeConfig|guestEnv]
variable name
variable value

readVariable Path to vmx file Read a variable in the VM state
[runtimeConfig|guestEnv]
variable name

VPROBE COMMANDS PARAMETERS DESCRIPTION
--------------- ---------- -----------
vprobeVersion Path to vmx file List VP version

vprobeLoad Path to vmx file Load VP script
'VP script text'

vprobeReset Path to vmx file Disable all vprobes

vprobeListProbes Path to vmx file List probes

vprobeListGlobals Path to vmx file List global variables

GENERAL COMMANDS PARAMETERS DESCRIPTION
---------------- ---------- -----------
list List all running VMs

upgradevm Path to vmx file Upgrade VM file format, virtual hw

installtools Path to vmx file Install Tools in Guest

register Path to vmx file Register a VM

unregister Path to vmx file Unregister a VM

listRegisteredVM List registered VMs

clone Path to vmx file Create a copy of the VM
Path to destination vmx file
full|linked
[Snapshot name]

Examples:

Starting a virtual machine with Workstation on a Windows host
vmrun -T ws start "c:\my VMs\myVM.vmx"

Stopping a virtual machine with Server on a linux host
vmrun -T server -h https://myHost.com/sdk -u hostUser -p hostPassword stop "[storage1] vm/myVM.vmx"

Running a program in a virtual machine with Workstation on a Windows host with Windows guest
vmrun -T ws -gu guestUser -gp guestPassword runProgramInGuest "c:\my VMs\myVM.vmx" "c:\Program Files\myProgram.exe"

Running a program in a virtual machine with Server on a linux host with linux guest
vmrun -T server -h https://myHost.com/sdk -u hostUser -p hostPassword -gu guestUser -gp guestPassword runProgramInGuest "[storage1] vm/myVM.vmx" /usr/bin/X11/xclock -display :0

Creating a snapshot of a virtual machine with Workstation on a Windows host
vmrun -T ws snapshot "c:\my VMs\myVM.vmx" mySnapshot

Reverting to a snapshot with Workstation on a Windows host
vmrun -T ws revertToSnapshot "c:\my VMs\myVM.vmx" mySnapshot

Deleting a snapshot with Workstation on a Windows host
vmrun -T ws deleteSnapshot "c:\my VMs\myVM.vmx" mySnapshot

Posted in Linux | Tagged , | Leave a comment

Install php-fpm 5.2.17 via apt +nginx

1. add apt key

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 19803648C18789EA

2. add the source into /etc/apt/source.list. the source is only avaiable for hardy and lucid version.

deb http://ppa.launchpad.net/skettler/php/ubuntu lucid main
deb-src http://ppa.launchpad.net/skettler/php/ubuntu lucid main


root@ubuntu:~# apt-get update

root@ubuntu:~# apt-cache search php52
php52-pear – PEAR – PHP Extension and Application Repository
libapache2-mod-php52 – server-side, HTML-embedded scripting language (Apache 2 module)
php52 – server-side, HTML-embedded scripting language
php52-dev – Files for PHP5 module development
php52-fpm – server-side, HTML-embedded scripting language (FastCGI Manager)
php52-apc – Alternative PHP Cache
php52-common – server-side, HTML-embedded scripting language
php52-xdebug – Function traces and profiling for PHP
php52-cairowrapper – Cairo Wrapper Extension
php52-ioncube – ionCube Loader for PHP

3. install the fpm package

apt-get update

apt-get install php52-common php52-dev php52-fpm php52

4. vi /etc/init.d/php52-fpm

change the line

php_fpm_CONF=/etc/php53/php-fpm.conf

to

php_fpm_CONF=/etc/php52/php-fpm.conf

change the line

php_fpm_PID=/var/run/php52-fpm.pid

to

php_fpm_PID=/var/run/php-fpm.pid

4. edit the php fpm configure file : /etc/php52/php-fpm.conf

<?xml version=”1.0″ ?>
<configuration>
<section name=”global_options”>
<value name=”pid_file”>/var/run/php-fpm.pid</value>
<value name=”error_log”>/var/log/php-fpm.log</value>
<value name=”log_level”>notice</value>
<value name=”emergency_restart_threshold”>10</value>
<value name=”emergency_restart_interval”>1m</value>
<value name=”process_control_timeout”>5s</value>
<value name=”daemonize”>yes</value>
</section>
<workers>
<section name=”pool”>
<value name=”name”>default</value>
<value name=”listen_address”>/tmp/php-fcgi.sock</value>
<value name=”listen_options”>
<value name=”backlog”>-1</value>
<value name=”owner”></value>
<value name=”group”></value>
<value name=”mode”>0666</value>
</value>
<value name=”php_defines”>
<value name=”sendmail_path”>/usr/sbin/sendmail -t -i</value>
<value name=”display_errors”>0</value>
</value>
<value name=”user”>www-data</value>
<value name=”group”>www-data</value>
<value name=”pm”>
<value name=”style”>apache-like</value>
<value name=”max_children”>15</value>
<value name=”apache_like”>
<value name=”StartServers”>5</value>
<value name=”MinSpareServers”>5</value>
<value name=”MaxSpareServers”>15</value>
</value>
</value>
<value name=”request_terminate_timeout”>0s</value>
<value name=”request_slowlog_timeout”>0s</value>
<value name=”slowlog”>logs/slow.log</value>
<value name=”rlimit_files”>65535</value>
<value name=”rlimit_core”>0</value>
<value name=”chroot”></value>
<value name=”chdir”></value>
<value name=”catch_workers_output”>yes</value>
<value name=”max_requests”>1024</value>
<value name=”allowed_clients”>127.0.0.1</value>
<value name=”environment”>
<value name=”HOSTNAME”>$HOSTNAME</value>
<value name=”PATH”>/usr/local/bin:/usr/bin:/bin</value>
<value name=”TMP”>/tmp</value>
<value name=”TMPDIR”>/tmp</value>
<value name=”TEMP”>/tmp</value>
<value name=”OSTYPE”>$OSTYPE</value>
<value name=”MACHTYPE”>$MACHTYPE</value>
<value name=”MALLOC_CHECK_”>2</value>
</value>
</section>
</workers>
</configuration>

5.Install Zend Optimizer

wget http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz

tar zxf ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz

cp ZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/ZendOptimizer.so /usr/lib/php52/20060613/

add the following line to /etc/php52/fpm/php.ini

zend_extension=/usr/lib/php52/20060613/ZendOptimizer.so

6. start the php-fpm start

/etc/init.d/php52-fpm restart

Posted in Linux, PHP | Leave a comment

Install php-fpm via yum

http://jk.scanmon.com/en/wp/2010/02/installing-nginx-php-fpm-using-centos-alt-ru-epel-repo-in-centos.html

I have create post about installing nginx + php-fpm from source before in here http://adityo.blog.binusian.org/?p=428. In this tutorial i will create a more simple way installing nginx + php-fpm using yum with centos.alt.ru & EPEL repo.

Here it’s goes:

- Create repo
# cd /etc/yum.repos.d
# vim rusia-repo.repo

- and paste this

[rusia-repo]
name=CentOS-$releasever – rusia packages for $basearch
#baseurl=file:///raid/RH/CentOS/$releasever/local/$basearch
baseurl=http://centos.alt.ru/pub/repository/centos/5/i386/
enabled=1
gpgcheck=0
protect=1

- Enable EPEL repo
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/$(uname -m)/epel-release-5-3.noarch.rpm

- Install nginx and php-fpm

# yum install nginx php-fpm

- you will see this package
================================================================================
Package         Arch        Version                      Repository       Size
================================================================================
Installing:
nginx               x86_64      0.6.39-2.el5                 epel            319 k
nginx               i386        0.8.32-1.el5                 rusia-repo      393 k
php-fpm         i386        5.3.1-2.el5                  rusia-repo      1.2 M
Installing for dependencies:
bzip2-libs      i386        1.0.3-4.el5_2                base             37 k
db4                  i386        4.3.29-10.el5                base            909 k
gdbm              i386        1.8.0-26.2.1                 base             27 k
gmp                 i386        4.1.4-10.el5                 base            664 k
libedit            i386        2.11-2.20080712cvs.el5       epel             79 k
libevent        i386        1.4.12-1.el5                 rusia-repo      128 k
libxml2         i386        2.6.26-2.1.2.8               base            795 k
pcre                i386        6.6-2.el5_1.7                base            112 k
perl                 i386        4:5.8.8-27.el5               extras           12 M
php-common      i386        5.3.1-2.el5                  rusia-repo      553 k

Transaction Summary
================================================================================
Install     13 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 17 M)
Remove       0 Package(s)

Total download size: 7.4 M

- go to nginx configuration file: “/usr/local/nginx/conf/nginx.conf” , and add  the php configuration

location ~ \.php$ {
root /usr/share/nginx/html; # itmena the root of the coument are located on

/usr/share/nginx/html
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}

- Go to /usr/share/nginx/html and create php files
# vi index.php
<?php phpinfo(); ?>

- Start the nginx and php-fpm
# service php-fpm start
# service nginx start

You can go to your server domain / ip address to see the phpinfo files

Posted in PHP | Leave a comment

install php-fpm 5.3 from apt source

edit /etc/apt/sources.lst

deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all
deb http://php53.dotdeb.org stable all
deb-src http://php53.dotdeb.org stable all


apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E9C74FEEA2098A6E


wget http://us.archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu38_3.8-6ubuntu0.2_amd64.deb
wget  http://us.archive.ubuntu.com/ubuntu/pool/main/k/krb5/libkrb53_1.6.dfsg.4~beta1-5ubuntu2_amd64.deb
dpkg -i *.deb

Install the latest php 5.3 from apt source

apt-get install php5-cli php5-common php5-suhosin php5-fpm php5-cgi php5-mysql php5-gd

install the latest version nginx
edit /etc/apt/sources.lst

deb http://ppa.launchpad.net/jdub/ppa/ubuntu lucid main


apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E9EEF4A1
apt-get install nginx

Posted in PHP | Tagged | Leave a comment

grub single boot and kernel panic reboot

ZZ from :http://www.linux-noob.com/forums/index.php?/topic/2928-grub-single-boot-and-kernel-panic-reboot/

 

1.) Booting once-only – (same as lilo -R)

In reference to http://www.gnu.org/s…g-once_002donly

in grub.conf, add the following line to the beginning.

default saved

If for example your grub.conf looks like the one i have below. This boots into the 2.6.20-1.2944 by default.

default=0 
timeout=5 
splashimage=(hd0,0)/grub/splash.xpm.gz 
hiddenmenu 
title Fedora Core (2.6.20-1.2944.fc6) 
        root (hd0,0) 
        kernel /vmlinuz-2.6.20-1.2944.fc6 ro root=LABEL=/ acpi=off  
        initrd /initrd-2.6.20-1.2944.fc6.img 
title Fedora Core (2.6.20-FluKex.com) 
        root (hd0,0) 
        kernel /vmlinuz-2.6.20-FluKex.com ro root=LABEL=/ acpi=off  
        initrd /initrd-2.6.20-FluKex.com.img

If you want to have it so that 2.6.20-FluKex.com boots on next boot, run the following command from the console before rebooting.
echo “savedefault –default=1 –once” | grub –batch
then
reboot

Now, if you have a kernel that panics and need it to reboot if it panics. change your config and add the panic=# (# being seconds before auto reboot) to the kernel line. Example file below

default=0 
timeout=5 
splashimage=(hd0,0)/grub/splash.xpm.gz 
hiddenmenu 
title Fedora Core (2.6.20-1.2944.fc6) 
        root (hd0,0) 
        kernel /vmlinuz-2.6.20-1.2944.fc6 ro root=LABEL=/ acpi=off panic=5 
        initrd /initrd-2.6.20-1.2944.fc6.img 
title Fedora Core (2.6.20-FluKex.com) 
        root (hd0,0) 
        kernel /vmlinuz-2.6.20-FluKex.com ro root=LABEL=/ acpi=off panic=5 
        initrd /initrd-2.6.20-FluKex.com.img

so the order of operations on this are as follows.

1.) Add new kernel to grub.conf
2.) set default=# in grub.conf to the failsafe kernel (the one you want it to try if the other fails)
3.) run the following:
echo “savedefault –default=1 –once” | grub –batch
4.) reboot

Posted in Linux | Tagged | Leave a comment

nginx configure for ubuntu

./configure –prefix=/usr –conf-path=/etc/nginx/nginx.conf \
–error-log-path=/var/log/nginx/error.log –pid-path=/var/run/nginx.pid \
–lock-path=/var/lock/nginx.lock   –http-log-path=/var/log/nginx/access.log \
–http-client-body-temp-path=/var/lib/nginx/body –http-proxy-temp-path=/var/lib/nginx/proxy \
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi –with-http_stub_status_module –with-pcre \
–with-http_flv_module –with-http_ssl_module –with-http_gzip_static_module \
–with-http_secure_link_module –with-http_dav_module \
–with-http_realip_module

Posted in Linux | Tagged | Leave a comment