Archive for the ‘HowTo’ Category

XRDP on CentOS 5

$ yum install gcc pam-devel openssl-devel
$ tar -zxvf xrdp-0.4.1.tar.gz
$ cd xrdp-0.4.1
$ make
$ sudo make install
$ ln /usr/local/xrdp/xrdp_control.sh /etc/init.d/xrdesktop
$ gconftool-2 –type list –list-type=string –set /desktop/gnome/peripherals/keyboard/kbd/layouts [damnlayouts] # map keyboard layout
$ sudo nano /etc/xrdp/sesman.ini
change 127.0.0.1 to 0.0.0.0
$ /sbin/chkconfig –add xrdesktop
$ /sbin/service xrdesktop start

$ yum install gcc pam-devel openssl-devel

$ wget http://ncu.dl.sourceforge.net/sourceforge/xrdp/xrdp-0.4.1.tar.gz

$ tar -zxvf xrdp-0.4.1.tar.gz

$ cd xrdp-0.4.1

$ make

$ sudo make install

$ ln /usr/local/xrdp/xrdp_control.sh /etc/init.d/xrdesktop

$ gconftool-2 –type list –list-type=string –set /desktop/gnome/peripherals/keyboard/kbd/layouts [damnlayouts] # map keyboard layout

$ sudo nano /etc/xrdp/sesman.ini

change 127.0.0.1 to 0.0.0.0

$ /sbin/chkconfig –add xrdesktop

$ /sbin/service xrdesktop start

[optional]
$ cp startwm.sh startwm.sh.bak
$ nano /usr/local/xrdp/startwm.sh // change login env
export LANG=zh_TW.UTF-8

Install proftpd on CentOS5

$ nano /etc/yum.repos.d/dag.repo  // create dag.repo
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
$ rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt // import non-official GPG
$ yum install proftpd
$ nano /etc/proftpd.conf
Change ServerName
change DefaultRoot ~
$ nano /etc/xinetd.d/xproftpd
Change “DURATION USERID” to “HOST PID”
Change “USERID” to “HOST”
Change “disable = yes” to  ”disable = no”
$ /sbin/chkconfig xproftpd on
$ /sbin/chkconfig –list xproftpd
$ /etc/rc.d/init.d/xinetd restart

Source:

$ nano /etc/yum.repos.d/dag.repo // create dag.repo

[dag]

name=Dag RPM Repository for Red Hat Enterprise Linux

baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag

gpgcheck=1

enabled=1

$ rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt // import non-official GPG

$ yum install proftpd

$ nano /etc/proftpd.conf

Change ServerName

Change ServerType to inetd

change DefaultRoot ~

$ nano /etc/xinetd.d/xproftpd

Change “DURATION USERID” to “HOST PID”

Change “USERID” to “HOST”

Change “disable = yes” to  ”disable = no”

$ /sbin/chkconfig xproftpd on

$ /sbin/chkconfig –list xproftpd

$ /etc/rc.d/init.d/xinetd restart

Install oracle 11g x64 on CentOS5.3

1. Check packages
$ rpm -q grep binutils-2.*    \
elfutils-libelf-0.*        \
glibc-2.*                  \
glibc-common-2.*           \
libaio-0.*                 \
libgcc-4.*                 \
libstdc++-4.*              \
make-3.*                   \
compat-libstdc++-33        \
elfutils-libelf-devel-0.*  \
glibc-devel-2.*            \
gcc-4.*                    \
gcc-c++-4.*                \
libaio-devel-0.*           \
libstdc++-devel-4.*        \
unixODBC-2.*               \
unixODBC-devel-2.*         \
sysstat-7.*
2. Create Oracle account
$ /usr/sbin/groupadd oinstall
$ /usr/sbin/groupadd dba
$ /usr/sbin/useradd -m -g oinstall -G dba oracle
$ id oracle
(uid=501(Oracle) gid=501(oinstall) groups=501(oinstall),502(dba))
$ passwd oracle
3. Modified the sysctl.conf
$ cat >> /etc/sysctl.conf << EOF
kernel.sem=1055 32000 100 128
kernel.shmmax=2147483648
kernel.shmall = 2097152
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0
net.ipv4.conf.default.rp_filter = 0
net.core.optmem_max = 65535
net.core.rmem_default = 4194304
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 262144
fs.file-max = 6553600
net.ipv4.ip_local_port_range = 1024 65000
EOF
3.a Check parameters
$ /sbin/sysctl -p
4. Modified the limits.conf (Shell limits for oracle user)
$ cat >> /etc/security/limits.conf << EOF
*     soft      nproc          2047
*     hard      nproc         16384
*     soft      nofile         1024
*     hard      nofile        65536
EOF
5. Modified the login
# cat >> /etc/pam.d/login << EOF
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so
EOF
6. Modified the config
$ nano /etc/selinux/config
(Leave the following two lines only)
SELINUX=disabled
SELINUXTYPE=disabled
7. Create Directories
mkdir -p /u01
mkdir -p /opt/oracle
mkdir –p /opt/oracle/product
chown -R oracle:oinstall /u01
chown -R oracle:oinstall /opt/oracle
chmod -R 775 /u01
chmod -R 775 /opt/oracle
chmod -R 775 /opt/oracle/product
8. For network configuration requirements (important!)
modified /etc/hosts to actual ip address
9. Change ownership to oracle
$ chown oracle:oinstall linux.x64_11gR1_database_1013.zip
10. Log in as oracle (GUI)
$ cd /opt/oracle
$ unzip linux.x64_11gR1_database_1013.zip
$ cd database
$ ./runInstaller
=====In the first screen========
a. /opt/oracle/ (ORACLE BASE LOCATIONS)
b. /opt/oracle/product/11.1.0/db_1 (ORACLE HOME LOCATIONS)
c. Change the UNIX DBA group from dba to oinstall
d. Create Starter Database
====In the second screen====
a. /opt/oracle/product/oraInventory (INVETORY LOCATIONS)
b. leave the group name oinstall
===In the complete screen===
Do not forget to execute two scripts
Note: connect from osx
./sqlplus sys/password@oracle as SYSDBA
Maintenance
To shut down everything Oracle:
$ . oraenv
<enter your SID>
$ sqlplus “/ as sysdba”
SQL> shutdown immediate
SQL> exit
$ lsnrctl
LSNRCTL> stop
LSNRCTL> exit
$ cd $ORACLE_HOME/bin
./emctl stop dbconsole
To start up everything Oracle:
$ . oraenv
<enter your SID>
$ sqlplus “/ as sysdba”
SQL> startup
SQL> exit
$ lsnrctl
LSNRCTL> start
LSNRCTL> exit
$ cd $ORACLE_HOME/bin
1. Check packages
$ rpm -q grep binutils-2.*    \
elfutils-libelf-0.*        \
glibc-2.*                  \
glibc-common-2.*           \
libaio-0.*                 \
libgcc-4.*                 \
libstdc++-4.*              \
make-3.*                   \
compat-libstdc++-33        \
elfutils-libelf-devel-0.*  \
glibc-devel-2.*            \
gcc-4.*                    \
gcc-c++-4.*                \
libaio-devel-0.*           \
libstdc++-devel-4.*        \
unixODBC-2.*               \
unixODBC-devel-2.*         \
sysstat-7.*
2. Create Oracle account
$ /usr/sbin/groupadd oinstall
$ /usr/sbin/groupadd dba
$ /usr/sbin/useradd -m -g oinstall -G dba oracle
$ id oracle
(uid=501(Oracle) gid=501(oinstall) groups=501(oinstall),502(dba))
$ passwd oracle
3. Modified the sysctl.conf
$ cat >> /etc/sysctl.conf << EOF
kernel.sem=1055 32000 100 128
kernel.shmmax=2147483648
kernel.shmall = 2097152
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0
net.ipv4.conf.default.rp_filter = 0
net.core.optmem_max = 65535
net.core.rmem_default = 4194304
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 262144
fs.file-max = 6553600
net.ipv4.ip_local_port_range = 1024 65000
EOF
3.a Check parameters
$ /sbin/sysctl -p
4. Modified the limits.conf (Shell limits for oracle user)
$ cat >> /etc/security/limits.conf << EOF
*     soft      nproc          2047
*     hard      nproc         16384
*     soft      nofile         1024
*     hard      nofile        65536
EOF
5. Modified the login
# cat >> /etc/pam.d/login << EOF
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so
EOF
6. Modified the config
$ nano /etc/selinux/config
(Leave the following two lines only)
SELINUX=disabled
SELINUXTYPE=disabled
7. Create Directories
mkdir -p /u01
mkdir -p /opt/oracle
mkdir –p /opt/oracle/product
chown -R oracle:oinstall /u01
chown -R oracle:oinstall /opt/oracle
chmod -R 775 /u01
chmod -R 775 /opt/oracle
chmod -R 775 /opt/oracle/product
8. For network configuration requirements (important!)
modified /etc/hosts to actual ip address
9. Change ownership to oracle
$ chown oracle:oinstall linux.x64_11gR1_database_1013.zip
10. Log in as oracle (GUI)
$ cd /opt/oracle
$ unzip linux.x64_11gR1_database_1013.zip
$ cd database
$ ./runInstaller
=====In the first screen========
a. /opt/oracle/ (ORACLE BASE LOCATIONS)
b. /opt/oracle/product/11.1.0/db_1 (ORACLE HOME LOCATIONS)
c. Change the UNIX DBA group from dba to oinstall
d. Create Starter Database
====In the second screen====
a. /opt/oracle/product/oraInventory (INVETORY LOCATIONS)
b. leave the group name oinstall
===In the complete screen===
Do not forget to execute two scripts
Note: connect from osx
./sqlplus sys/password@oracle as SYSDBA
Maintenance
To shut down everything Oracle:
$ . oraenv
<enter your SID>
$ sqlplus “/ as sysdba”
SQL> shutdown immediate
SQL> exit
$ lsnrctl
LSNRCTL> stop
LSNRCTL> exit
$ cd $ORACLE_HOME/bin
./emctl stop dbconsole
To start up everything Oracle:
$ . oraenv
<enter your SID>
$ sqlplus “/ as sysdba”
SQL> startup
SQL> exit
$ lsnrctl
LSNRCTL> start
LSNRCTL> exit
$ cd $ORACLE_HOME/bin
1. Check packages
$ rpm -q grep binutils-2.*    \
elfutils-libelf-0.*        \
glibc-2.*                  \
glibc-common-2.*           \
libaio-0.*                 \
libgcc-4.*                 \
libstdc++-4.*              \
make-3.*                   \
compat-libstdc++-33        \
elfutils-libelf-devel-0.*  \
glibc-devel-2.*            \
gcc-4.*                    \
gcc-c++-4.*                \
libaio-devel-0.*           \
libstdc++-devel-4.*        \
unixODBC-2.*               \
unixODBC-devel-2.*         \
sysstat-7.*
2. Create Oracle account
$ /usr/sbin/groupadd oinstall
$ /usr/sbin/groupadd dba
$ /usr/sbin/useradd -m -g oinstall -G dba oracle
$ id oracle
(uid=501(Oracle) gid=501(oinstall) groups=501(oinstall),502(dba))
$ passwd oracle
3. Modified the sysctl.conf
$ cat >> /etc/sysctl.conf << EOF
kernel.sem=1055 32000 100 128
kernel.shmmax=2147483648
kernel.shmall = 2097152
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0
net.ipv4.conf.default.rp_filter = 0
net.core.optmem_max = 65535
net.core.rmem_default = 4194304
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 262144
fs.file-max = 6553600
net.ipv4.ip_local_port_range = 1024 65000
EOF
3.a Check parameters
$ /sbin/sysctl -p
4. Modified the limits.conf (Shell limits for oracle user)
$ cat >> /etc/security/limits.conf << EOF
*     soft      nproc          2047
*     hard      nproc         16384
*     soft      nofile         1024
*     hard      nofile        65536
EOF
5. Modified the login
# cat >> /etc/pam.d/login << EOF
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so
EOF
6. Modified the config
$ nano /etc/selinux/config
(Leave the following two lines only)
SELINUX=disabled
SELINUXTYPE=disabled
7. Create Directories
mkdir -p /u01
mkdir -p /opt/oracle
mkdir –p /opt/oracle/product
chown -R oracle:oinstall /u01
chown -R oracle:oinstall /opt/oracle
chmod -R 775 /u01
chmod -R 775 /opt/oracle
chmod -R 775 /opt/oracle/product
8. For network configuration requirements (important!)
modified /etc/hosts to actual ip address
9. Change ownership to oracle
$ chown oracle:oinstall linux.x64_11gR1_database_1013.zip
10. Log in as oracle (GUI)
$ cd /opt/oracle
$ unzip linux.x64_11gR1_database_1013.zip
$ cd database
$ ./runInstaller
=====In the first screen========
a. /opt/oracle/ (ORACLE BASE LOCATIONS)
b. /opt/oracle/product/11.1.0/db_1 (ORACLE HOME LOCATIONS)
c. Change the UNIX DBA group from dba to oinstall
d. Create Starter Database
====In the second screen====
a. /opt/oracle/product/oraInventory (INVETORY LOCATIONS)
b. leave the group name oinstall
===In the complete screen===
Do not forget to execute two scripts
Note: connect from osx
./sqlplus sys/password@oracle as SYSDBA
Maintenance
To shut down everything Oracle:
$ . oraenv
<enter your SID>
$ sqlplus “/ as sysdba”
SQL> shutdown immediate
SQL> exit
$ lsnrctl
LSNRCTL> stop
LSNRCTL> exit
$ cd $ORACLE_HOME/bin
./emctl stop dbconsole
To start up everything Oracle:
$ . oraenv
<enter your SID>
$ sqlplus “/ as sysdba”
SQL> startup
SQL> exit
$ lsnrctl
LSNRCTL> start
LSNRCTL> exit
$ cd $ORACLE_HOME/bin
./emctl start dbconsole

1. Check packages

$ rpm -q grep binutils-2.*    \
elfutils-libelf-0.*        \
glibc-2.*                  \
glibc-common-2.*           \
libaio-0.*                 \
libgcc-4.*                 \
libstdc++-4.*              \
make-3.*                   \
compat-libstdc++-33        \
elfutils-libelf-devel-0.*  \
glibc-devel-2.*            \
gcc-4.*                    \
gcc-c++-4.*                \
libaio-devel-0.*           \
libstdc++-devel-4.*        \
unixODBC-2.*               \
unixODBC-devel-2.*         \
sysstat-7.*

2. Create Oracle account

$ /usr/sbin/groupadd oinstall
$ /usr/sbin/groupadd dba
$ /usr/sbin/useradd -m -g oinstall -G dba oracle
$ id oracle
(uid=501(Oracle) gid=501(oinstall) groups=501(oinstall),502(dba))
$ passwd oracle

3. Modified the sysctl.conf

$ cat >> /etc/sysctl.conf << EOF
kernel.sem=1055 32000 100 128
kernel.shmmax=2147483648
kernel.shmall = 2097152
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0
net.ipv4.conf.default.rp_filter = 0
net.core.optmem_max = 65535
net.core.rmem_default = 4194304
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 262144
fs.file-max = 6553600
net.ipv4.ip_local_port_range = 1024 65000
EOF

3.a Check parameters

$ /sbin/sysctl -p

4. Modified the limits.conf (Shell limits for oracle user)

$ cat >> /etc/security/limits.conf << EOF
*     soft      nproc          2047
*     hard      nproc         16384
*     soft      nofile         1024
*     hard      nofile        65536
EOF

5. Modified the login

# cat >> /etc/pam.d/login << EOF
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so
EOF
6. Modified the config
$ nano /etc/selinux/config
(Leave the following two lines only)
SELINUX=disabled
SELINUXTYPE=disabled

7. Create Directories

$ mkdir -p /u01
$ mkdir -p /opt/oracle
$ mkdir –p /opt/oracle/product
$ chown -R oracle:oinstall /u01
$ chown -R oracle:oinstall /opt/oracle
$ chmod -R 775 /u01
$ chmod -R 775 /opt/oracle
$ chmod -R 775 /opt/oracle/product

8. For network configuration requirements (important!)

modified /etc/hosts to actual ip address

9. Change ownership to oracle

$ chown oracle:oinstall linux.x64_11gR1_database_1013.zip

10. Log in as oracle (GUI)

$ cd /opt/oracle
$ unzip linux.x64_11gR1_database_1013.zip
$ cd database
$ ./runInstaller
=====In the first screen========
a. /opt/oracle/ (ORACLE BASE LOCATIONS)
b. /opt/oracle/product/11.1.0/db_1 (ORACLE HOME LOCATIONS)
c. Change the UNIX DBA group from dba to oinstall
d. Create Starter Database
====In the second screen====
a. /opt/oracle/product/oraInventory (INVETORY LOCATIONS)
b. leave the group name oinstall
===In the complete screen===
Do not forget to execute two scripts

Note: connect from osx (download client software)

./sqlplus sys/password@oracle as SYSDBA

Maintenance

To shut down everything Oracle:

$ . oraenv
<enter your SID>
$ sqlplus “/ as sysdba”
SQL> shutdown immediate
SQL> exit
$ lsnrctl
LSNRCTL> stop
LSNRCTL> exit
$ cd $ORACLE_HOME/bin (optional)
./emctl stop dbconsole

To start up everything Oracle:

$ . oraenv
<enter your SID>
$ sqlplus “/ as sysdba”
SQL> startup
SQL> exit
$ lsnrctl
LSNRCTL> start
LSNRCTL> exit
$ cd $ORACLE_HOME/bin (optional)
./emctl start dbconsole

XRDP on ubuntu

$ sudo apt-get install libpam0g-dev
$ sudo apt-get install libcurl4-openssl-dev

$ tar -zxvf xrdp-0.4.1.tar.gz
$ cd xrdp-0.4.1
$ make
$ sudo make install

$ sudo apt-get install tightvncserver # don’t use vino
$ gconftool-2 –type list –list-type=string –set /desktop/gnome/peripherals/keyboard/kbd/layouts [damnlayouts] # map keyboard layout
OR disable the keyboard plugin of the gnome-settings-daemon using gconf-editor:
/apps/gnome_settings_daemon/plugins/keyboard set active to False.
$ sudo nano /etc/xrdp/sesman.ini
change 127.0.0.1 to 0.0.0.0
$ sudo /usr/local/xrdp/xrdp_control.sh start # after reboot

Now, you can remote control your ubuntu via RDC from windows

python interface for libsvm on Leopard with default python

/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python <==origin python

modified Makefile
============================
CXX? = g++
SWIG ?= swig
#Windows: see ../README ../Makefile.win
PYTHON_INCLUDEDIR ?= /System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/
CFLAGS = -O3 -I$(PYTHON_INCLUDEDIR) -I..
#LDFLAGS = -shared
# Mac OS
LDFLAGS = -framework Python -bundle
all: svmc.so
svmc.so: svmc_wrap.o svm.o
$(CXX) $(LDFLAGS) -o svmc.so svmc_wrap.o svm.o
svmc_wrap.o: svmc_wrap.c ../svm.h
$(CXX) $(CFLAGS) -fPIC -c svmc_wrap.c
svmc_wrap.c: svmc.i
$(SWIG) -python -noproxy svmc.i
svm.o: ../svm.cpp ../svm.h
$(CXX) $(CFLAGS) -fPIC -c ../svm.cpp
clean:
rm -f *~ *.o *.so *.pyc *.pyo svm.o
moreclean: clean
rm -f svmc_wrap.c

PyQT Installation on OSX

$ sudo port install python25

$ sudo port install python_select
$ sudo python_select python25
$ sudo port install py25-macholib-devel
$ sudo port install py25-sip
$ sudo port install py25-pyqt4
$ sudo port install py25-py2app-devel
$ sudo port install py25-pyqt


# install eric4 u need QScintilla2
$ cd QScintilla 
$ cd Qt4 
$ qmake-mac qscintilla.pro -spec macx-g++ 
make 
sudo make install 
#Python wrapper for QScintilla. 
$ cd QScintilla* 
$ cd Python 
$ python configure.py 
$ make 
$ sudo make install 



Command Alias

$ sudo cp .bashrc .bashrc.bak # backup
$ sudo nano .bashrc # ubuntu
$ sudo nano .bash_profile # mac
add the following:
alias imac=’$ ssh user@ip -p 1234′
alias py3=’/opt/local/Library/Frameworks/Python.framework/Versions/3.0/bin/python3.0′

crontab scheduling

User level
$ crontab -e
# m h  dom mon dow   command
  * 3 * * * /home/user/public_html/xxx
min/hour/day/month/week command
$ /etc/init.d/cron restart
Root level(after restart system)
$ sudo nano /ect/crontab
the same, but add root
$ /etc/init.d/cron restart

Install Python/Numpy from source

command reference only, plz install from port
$ tar zxvf Python-2.6.2.tgz
$ sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libbz2-dev libc6-dev libsqlite3-dev tk-dev
$ cd python-2.6.2
$ ./configure
$ make
$ make install

$ sudo apt-get install python-setuptools

$ cd numpy
$ sudo python setup.py install

$ tar zxvf scipy-0.7.0.tar.gz
$ sudo python setup.py install

$ sudo apt-get build-dep matplotlib

$ cd matplotlib
$ sudo python setup.py install

Remove macports completely

% sudo rm -rf  the following folders
/opt/local 
/Applications/MacPorts 
/Library/Tcl/macports1.0 
/Library/LaunchDaemons/org.macports.* 
/Library/StartupItems/DarwinPortsStartup