Thursday, December 25, 2008

Watch Youtube Video on Centos 5

Download:

flash-plugin-10.0.15.3-release.i386.rpm

from adobe website.

Install:

rpm -Uvh flash-plugin-10.0.15.3-release.i386.rpm

Close all firefox windows.

Restart firefox, you should be able to watch the video on youtube website.

Wednesday, December 24, 2008

Static IP configuration on Ubuntu 8.10ic

1. Edit interfaces file

sudo gedit /etc/network/interfaces

add lines:

auto eth0
iface eth0 inet static
address 192.168.0.108
netmask 255.255.255.0
gateway 192.168.0.1

If there is a line like:

iface eth0 inet dhcp

need to add # before the line to comment it.

2. Edit file /etc/resolv.conf

sudo gedit /etc/resolv.conf

Add lines:

search 64.59.144.93
nameserver 64.59.144.92

These are DNS, that might be different for different ISP

If you do only step 1, not step 2, you can only visite web site by using number IP not domain name.

3. Restart network

sudo /etc/init.d/networking restart

You should see the static IP you setup.

Note: the graphic thing (for net work configure) on the top bar is not working even I set up everything there.

Install Eclipse 3.4 (jee) in Ubuntu 8.10

Download packages

Java - Application--Add/Remove -- Programming to get the latest version, as the time this is written, the version is 1.6
There are many articles about the java installation.

Eclipse - Eclipse website -eclipse-jee-ganymede-SR1-linux-gtk.tar.gz
I download this one is because no plugin is required to run with Apache-tomcat

Tomcat -- apache website - the version i got is apache-tomcat-6.0.18.tar.gz

Install packages

Sun's Java JDK: Many ways to do this. there are many different way on the website. I will put one here later.

Tomcat:

tar xzf apache-tomcat-6.0.18.tar.gz
sudo mv apache-tomcat-6.0.18 /usr/local
cd /usr/local
sudo chown -R root:root apache-tomcat-6.0.18
sudo chmod -R +r apache-tomcat-6.0.18
sudo chmod +x `sudo find apache-tomcat-6.0.18 -type d`
sudo ln -s apache-tomcat-6.0.18 tomcat

Edit tomcat users:
sudo gedit /usr/local/tomcat/conf/tomcat-users.xml

And add an admin and your username and password:


user name="admin" password="admin" roles="manager,admin"
user name="yourname" password="blah" roles="manager,admin"
Eclipse:
Extract the eclipse download and move to opt.

tar zxvf eclipse-jee-ganymede-SR1-linux-gtk.tar.gz
sudo mv eclipse /opt/eclipse
cd /opt
sudo chown -R root:root eclipse
sudo chmod -R +r eclipse
sudo chmod +x `sudo find eclipse -type d`

Then create an eclipse executable in your path

sudo touch /usr/bin/eclipse
sudo chmod 755 /usr/bin/eclipse
sudo gedit /usr/bin/eclipse

With this contents

#!/bin/sh
#export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
export ECLIPSE_HOME="/opt/eclipse"

$ECLIPSE_HOME/eclipse $*

Then create a gnome menu item

sudoedit /usr/share/applications/eclipse.desktop

With this contents

[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true

Configure

You now have a working eclipse.
But run this command first to initialise the set up.

/opt/eclipse/eclipse -clean

Then from here on you can run from the menu item
applications/programming/eclipse

Eclipse 3.4 (Ganymede) on Ubuntu

Eclipse Ganymede (the successor to Europa) has nice features that we are missing out on (Mylyn, inline renames, etc.).

JDK
Make sure that it is at least Java 5.

sudo apt-get install openjdk-6-jdk

Then update your ~./bashrc file, appending the JAVA_HOME (adjust this if you use a different JDK).

export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/

Get Ganymede

wget http://ftp.osuosl.org/pub/eclipse/technology/epp/downloads/release/ganymede/R/eclipse-java-ganymede-linux-gtk.tar.gz
tar xzvf eclipse-java-ganymede-linux-gtk.tar.gz
mv eclipse eclipse3.4

We should be ready to go:

eclipse3.4/eclipse

And your nice new Eclipse is up and running.

Suggested Plugins
Eclipse is great because it has so many plugins. I even use it as my default Python editor. If you go to Help > Software Updates, you will see a vastly improved update dialog (the previous one was painful).


Update: As Scott points out in the comments, there is an open request on launchpad to include a more recent version of Eclipse in the Ubuntu repositories: https://bugs.edge.launchpad.net/ubuntu/+source/eclipse/+bug/123064

Tuesday, December 23, 2008

Install MySQL 5.0.67 on Ubuntu 8.10

Ubuntu 8.10下安装MySQL数据库是非常简单的。

下面是在Ubuntu 8.10下完成安装的MySQL,MySQL 服务器应该自动启动。您可以在终端提示符后运行以下命令来检查 MySQL 服务器是否正在运行:(见图1)

sudo netstat -tap | grep mysql

当您运行该命令时,您可以看到类似下面的行:

linuxidc@linuxidc-laptop:~$ sudo netstat -tap | grep mysql

[sudo] password for linuxidc:
tcp 0 0 localhost:mysql *:* LISTEN 7283/mysqld
linuxidc@linuxidc-laptop:~$

要在Ubuntu 8.10下安装 MySQL,我们可以在终端命令行下输入下列命令:(如图2)


sudo apt-get install mysql-server mysql-client



附过程:

linuxidc@linuxidc-laptop:~$ sudo apt-get install mysql-server mysql-client
[sudo] password for linuxidc:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会安装下列额外的软件包:
libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl
mysql-client-5.0 mysql-server-5.0
建议安装的软件包:
dbishell mysql-doc-5.0 tinyca
下列【新】软件包将被安装:
libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl mysql-client
mysql-client-5.0 mysql-server mysql-server-5.0
共升级了 0 个软件包,新安装了 8 个软件包,要卸载 0 个软件包,有 0 个软件未被升级。
需要下载 35.8MB 的软件包。
解压缩后会消耗掉 109MB 的额外空间。
您希望继续执行吗?[Y/n]

当然选择Y了,在安装过程中会有软件包设置,输入root密码及再次确认。然后确定(见图3)。


如果服务器不能正常运行,您可以通过下列命令启动它:

sudo /etc/init.d/mysql restart

* Stopping MySQL database server mysqld [ OK ]
* Starting MySQL database server mysqld [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.

配置 MySQL 的管理员密码

sudo mysqladmin -u root password newpassword

配置MySQL

注意,MySQL缺省是只允许本地访问的,如果你要其他机器也能够访问的话,那么需要改变/etc/mysql/my.cnf配置文件了!

默认的MySQL安装之后根用户是没有密码的,所以首先用根用户进入:

$mysql -u root

在这里之所以用-u root是因为我现在是一般用户(firehare),如果不加-u root的话,mysql会以为是firehare在登录。注意,我在这里没有进入根用户模式,因为没必要。一般来说,对mysql中的数据库进行操作, 根本没必要进入根用户模式,只有在设置时才有这种可能。

如果你是用的root用户进入时则可以不要切换用户,直接进入第三步

进入mysql之后,最要紧的就是要设置Mysql中的root用户密码了,否则,Mysql服务无安全可言了。

mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "123456";

注意,我这儿用的是123456做为root用户的密码

用root用户建立你所需要的数据库。我这里就以xoops为例:

mysql>CREATE DATABASE xoops;mysql>GRANT ALL PRIVILEGES ON xoops.* TO xoops_root@localhost IDENTIFIED BY "654321";

这样就建立了一个xoops_roots的用户,它对数据库xoops有着全部权限。以后就用xoops_root来对xoops数据库进行管理,而无需要再用root用户了,而该用户的权限也只被限定在xoops数据库中。

如果你想进行远程访问或控制,那么你要做两件事:

其一:

mysql>GRANT ALL PRIVILEGES ON xoops.* TO xoops_root@"%" IDENTIFIED BY "654321";

允许xoops_root用户可以从任意机器上登入MySQL。

测试通过了,可是不知道为什么在访问的速度上很慢,可能是UBUTN的内存只有100M的原因,哈哈!!!!



$sudo gedit /etc/mysql/my.cnf

老的版本中

>skip-networking => # skip-networking

新的版本中

>bind-address=127.0.0.1 => bind-address= 你机器的IP

这样就可以允许其他机器访问MySQL了。

DESTOP版下安装MYSQLCC

apt-get install mysqlcc

gedit /usr/share/applications/MySQLCC.desktop

Insert the following lines into the new file

将下列语句插入新文件

[Desktop Entry]

Name=MySQLCC

Comment=MySQLCC

Exec=mysqlcc

Icon=/usr/share/pixmaps/mysqlcc.xpm

Terminal=false

Type=Application

Categories=Application;System;

这样就可以使用MYSQLCC来操作数据库了。



Install MySQL 5.0.51b on Ubuntu 8.10

Problem

While install MySQL 5.0.51b for Linux on Ubuntu 8.10
when I execte configure:

sudo ./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --sysconfdir=/etc

got error message:

checking for tgetent in -ltermcap... no
checking for termcap functions library... configure: error: No curses/termcap library found

Solution

need to install ncurses-5.2.tar.gz,after install, set the path in the configure parameter

or maybe the ncurses is already installed, so just add path.


add

--with-named-curses-libs=/usr/lib/libncursesw.so.5

the it looks like this:

sudo ./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --sysconfdir=/etc --with-named-curses-libs=/usr/lib/libncursesw.so.5

Install Apach Tomcat 6 on Ubuntu 8.10

Before we install Tomcat we need to find out if we already have installed Java. Let’s assume that we are trying to install Tomcat we’ve already installed java, but if we aren’t sure we can check with the dpkg command like this:

dpkg –get-selections | grep sun-java

This should give us this output if we already installed java:

sun-java6-bin                                   install
sun-java6-jdk install
sun-java6-jre install

If that command has no results, we’ll want to install the latest version with this command:

sudo apt-get install sun-java6-jdk

Installation

Now we’ll download and extract Tomcat from the apache site. We should check to make sure there’s not another version and adjust accordingly.

wget http://apache.hoxt.com/tomcat/tomcat-6/v6.0.14/bin/apache-tomcat-6.0.14.tar.gz

tar xvzf apache-tomcat-6.0.14.tar.gz

The best thing to do is move the tomcat folder to a permanent location. I chose /usr/local/tomcat.

sudo mv apache-tomcat-6.0.14 /usr/local/tomcat

Tomcat requires setting the JAVA_HOME variable. The best way to do this is to set it in the .bashrc file.

The better method is editing the .bashrc file and adding the bolded line there. We’ll have to logout of the shell for the change to take effect.

vi ~/.bashrc

Add the following line:

export JAVA_HOME=/usr/lib/jvm/java-6-sun

At this point we can start tomcat by just executing the startup.sh script in the tomcat/bin folder.

Automatic Starting

To make tomcat automatically start when we boot up the computer, we can add a script to make it auto-start and shutdown.

sudo vi /etc/init.d/tomcat

Now paste in the following:

# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid

export JAVA_HOME=/usr/lib/jvm/java-6-sun

case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0

We’ll need to make the script executable by running the chmod command:

sudo chmod 755 /etc/init.d/tomcat

The last step is actually linking this script to the startup folders with a symbolic link. Execute these two commands and we should be on our way.

sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat

Tomcat should now be fully installed and operational. Cheers!

Install Java 6 on Ubuntu 8.10

There are several ways of installing Java on the Ubuntu operating system. One of the easiest ways is to make use of apt-get command in Ubuntu.

Setup Repository

The apt-get command makes use of a source configuration file, which contains a list of the repositories the package manager should query to retrieve the correct package. The source configuration file is known as sources.list and is situated in the /etc/apt/sources.list location. The following command can be used to edit the source file to ensure the multiverse repository is included.

Code:


sudo gedit /etc/apt/sources.list

Ensure that the following two sources are added to the configuration file:


deb http://za.archive.ubuntu.com/ubuntu/ intrepid main restricted

deb http://za.archive.ubuntu.com/ubuntu/ intrepid multiverse


After the configuration file is updated, the package repository needs to updated with the following command:

Code:


sudo apt-get update


Install Java Package

After the package repository was successfully updated, the Sun Java packages can be installed on the Ubuntu system. The Sun Java packages consist of Java 5 and Java 6 packages. Depending on the version that is required, the list of packages specified below can be installed.

Java 5
The Java 5 packages available is listed as follows:

  • sun-java5-bin
  • sun-java5-fonts
  • sun-java5-plugin
  • sun-java5-demo
  • sun-java5-jdk
  • sun-java5-source
  • sun-java5-doc
  • sun-java5-jre
  • sun-java5-src

Java 6
The Java 6 packages available is listed as follows:

  • sun-java6-bin
  • sun-java6-javadb
  • sun-java6-plugin
  • sun-java6-demo
  • sun-java6-jdk
  • sun-java6-source
  • sun-java6-doc
  • sun-java6-jre
  • sun-java6-src
  • sun-java6-fonts
  • sun-java6-jre-headless

To install Java version 6, the following command needs to be executed:

Code:


sudo apt-get install sun-java6-jre sun-java6-jdk sun-java6-plugin


Verify Java Installation

To verify that the correct version of java is installed the following command can be used:

Code:


java -version

This command will print the current version of java that is active. Should there be more than one version of Java be installed on the operating system, the following command can be used to list the available java versions:

Code:


update-java-alternatives -l

This command list all the available Java runtime environments on the Ubuntu system. To change from one version to another, the following command can be used:

Code:

sudo update-java-alternatices -s



Testing Java Runtime Environment

You’ll want to confirm that your system is configured properly for Sun’s JRE. This is a two-step process.

First, check that the JRE is properly installed by running the following command from a terminal.

java -version

You should get similar output

java version “1.6.0″
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
Testing Java Plugin for Firefox

open Firefox and typing about:plugins in the address bar and check for java plugin

Saturday, December 20, 2008

Install Flas Player For Ubuntu Linux

Type the following command to install flash player:

$ sudo apt-get install flashplugin-nonfree

Now flash player should be working. Visit youtube or any other site to view flash content.

Troubleshooting tip

Update: This issue only relevant to older Ubuntu Linux version such as 6.04.

Some people may find voice is not working with newly installed flash player. Type following commands to solve this problem (thanks to macewan.org):
$ sudo apt-get install alsa-oss
$ gksudo gedit /etc/firefox/firefoxrc

Find line that read as FIREFOX_DSP and set to:
FIREFOX_DSP="aoss"

Save and close the file.

Close Firefox and restart it again.

Install VMware Server 2.0 on Ubuntu 8.10

1. Download VMware Server 2.0

Registe on VMware web site to get an account. When you download you would see a serial nomber.

What I download was TARimage (not for 64 bit version). you should get what you need according your machine.

VMware-server-2.0.0-122956.i386.tar.gz

2. Install nessesary dependence:

sudo apt-get install linux-headers-`uname -r` build-essential xinetd
sudo apt-get install xinetd

3. Unzip tar ball

tar zxvf VMware-server-2.0.0-122956.i386.tar.gz

you will get a folder:

vmware-server-distrib

4.

cd vmware-server-distrib

sudo ./vmware-install.pl


之后

cd vmware-server-distrib
sudo ./vmware-install.pl

下面一路回车就可以了。只是要注意一点:

The current administrative user for VMware Server is ”. Would you like to
specify a different administrator? [no]

如果你选择默认的no,在登录vmware终端的时候要用root。这不是个大问题,但是如果你想用你自己的用户登录(登录Ubuntu的用户),你必须输入yes然后回车,然后就会让你i输入你自己的用户。

4.如果你上步选择了默认的no,就会以root登录,你要为root设个密码:

sudo passwd root

5. 打开Firefox(我试过Opera也可以),在地址栏输入 http://localhost:8222会弹出登录框。

6.输入你的用户名和密码,如果第三步选择no,在这里就要用root登录。

OK,现在可以建立你自己的虚拟机了。

Friday, December 19, 2008

AAA

Windows A8425-FPWAR-V9684-4KJAH

Linux A0081-FMW2D-UE1F0-4UQHH

Xcopy- Powerful and versatile way to copy or back up files

Copy- Powerful and versatile way to copy or back up files

For copying large numbers of files or backing up a large folder, the command line is often the fastest and easiest way to go. The command “xcopy” is a very useful and powerful command for this purpose. (The old DOS also had an “xcopy” command but it sometimes had trouble with long file names. The XP version has no such problems.) “xcopy” comes with an alphabet soup of assorted switches that give it great versatility for use as a file backup utility. Enter “xcopy /?” in a command prompt to see them all. For example with the switch “/d:[mm-dd-yyy]” only files changed after a given date are copied. A command that will copy all files from the folder myfolder that have changed since June 1, 2003 to the folder mybackup is given byxcopy myfolder mybackup /d:06-01-2003 If no date is specified the switch “/d” will copy all files that have changed at any time.As is true in general, if there are spaces in a name, the path and file name have to be enclosed in quotes. Adding the switch "/s" provides that subfolders and their contents will also be copied. Other switches provide for read-only and hidden files. Altogether, there are something like 27 command line options for xcopy. More information is on this page.

如何在Ubuntu上安装RealPlayer(How to install RealPlayer on Ubuntu)

ZT

本来在Ubuntu上安装RealPlayer应该是很容易的,就是直接在终端中键入
sudo apt-get install realplayer
就可以了的,但是我如此操作只能得到

正在读取软件包列表... 完成
正在分析软件包的依赖关系树
Reading state information... 完成
现在没有可用的软件包 realplayer,但是它被其它的软件包引用了。
这可能意味着这个缺失的软件包可能已被废弃,
或者只能在其他发布源中找到
E: 软件包 realplayer 还没有可供安装的候选者
我已经用了官方的源和LupaWorld的源都是如此。于是准备自己手动安装RealPlayer。
先到RealPlayer官方网站上下载:
http://www.real.com/linux/?src=020923home_cn_cn
将文件RealPlayer10GOLD.bin保存到主文件夹中,即/home/[yourusername]文件夹下。
然后打开终端,进行如下操作:
$chmod +x RealPlayer10GOLD.bin
$sudo ./RealPlayer10GOLD.bin
当终端显示
Welcome to the RealPlayer (10.0.8.805) Setup for UNIX
Setup will help you get RealPlayer running on your computer.
Press [Enter] to continue...
时按下回车键,进入下一步:
Enter the complete path to the directory where you want
RealPlayer to be installed. You must specify the full
pathname of the directory and have write privileges to
the chosen directory.
Directory: [/home/shixinyu/RealPlayer]:
这里默认安装到用户的主文件夹下的RealPlayer目录下,如果你想要安装到别处,就在此处输入路径,否则直接回车即可。
You have selected the following RealPlayer configuration:

Destination: /home/shixinyu/RealPlayer

Enter [F]inish to begin copying files, or [P]revious to go
back to the previous prompts: [F]: F
安装程序会提示最后确定信息,如果都确定了,按下F键后回车。
当提示
Copying RealPlayer files...configure system-wide symbolic links? [Y/n]:
时按下Y键回车即可,后面基本上就没有需要用户操作的地方了,通常到这里基本上就安装好了,你可以到“应用程序,影音”下找到RealPlayer10来运行了,首次运行会有一段安装协议需要同意。

注:如果在跟着上述步骤完成安装操作之后到应用程序菜单下的“影音”中单击RealPlayer无反应,并且你的Ubuntu安装的是SCIM输入法,那么很可能是SCIM与RealPlayer的冲突,你还需要进行下面操作:
$sudo gedit /home/[yourid]/RealPlayer/realplay \\[yourid]指你的主文件夹名
在打开的文本编辑器的首行添加下面一行
export GTK_IM_MODULE=xim

之后保存文本编辑器,然后再次执行RealPlayer应该就正常了。


*** ???
添加源
deb http://archive.canonical.com/ubuntu dapper-commercial main
即可直接升级。

Thursday, December 18, 2008

Install Mplayer on Centos 5

1.
yum install yum-fastestmirror

2.
yum install yum-priorities

3.

Download (corresponding to your computer)
i386 http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
x86_64 http://apt.sw.be/redhat/el5/en/x%20...%201.el5.rf.x86_64.rpm

4.
Install DAG's GPG key

rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

5.

Check

rpm -K rpmforge-release-0.3.6-1.el5.rf.*.rpm (you don't have to do this step)

Install:

rpm -ivh rpmforge-release-0.3.6-1.el5.rf.*.rpm

6.
Check for update:

yum check-update

This step might take a longer time, system will create a file named "primary.xml.gz"

7.
yum install mplayer*

8.
[root@centos installed]# yum check-update

9.

application ---> Sound and Video --->mplayer

Complete!!

Install Chinese pinyin input method on Ubuntu

Go to the following URL:
http://code.google.com/p/scim-python/downloads/list

download file:
scim-python-0.1.12.tar.gz

Execute commands:

$ sudo apt-get install scim-dev
$ sudo apt-get install Python-dev
$ sudo apt-get install python-enchant
$ sudo apt-get install python-gtk2-dev
$ sudo apt-get install libgtk2.0-dev
$ tar zxvf scim-python-${version}.tar.bz2
$ cd scim-python-${version}
$ ./configure –prefix=/usr
$ make
$ sudo make install

The Chinese input method will effect after you log out and then log in,

Thursday, November 20, 2008

湿热下注针灸治疗

湿热下注针灸治疗

症状:小腹坠沉,... ...

针灸穴位:

三阴交,
足少阴神经:太溪,复溜,
足厥阴肝经:行间,太冲,
足少阳胆经:侠溪,
足太阴脾经:阴陵泉,血海,
足阳明胃经:足三里,
任脉:关元,
手少阳三焦经:支沟

足三里,侠溪,复溜不必须

Wednesday, November 12, 2008

Ubuntu 8.10

Today I installed Ubuntu 8.10 on my broken Dell 4150. I installed Windows XP pro and Redhat Linux on it and Windows XP failed working recently.
I never thought it would be do easy to install Ubuntu! Even much easy then windows. Afer the installation finished, everthing is working.
When I start it I heard the start sound, I knew that I don't need worry to find the driver for the sound card. Then I saw a firefox icon there, I double clicked it the web page just come out, I realized that I even don't need to do anything to setup the network card and Internet connection! Wow!!
I like that!
I used Unix, Linux and Windows for so many years, I don't worry about to get the drivers for different hardware, I could do it, But everything takes time.
What I am lack is just the time.
Now I find Ubuntu. it can save mo lots of time. I still have two computers stay there and doing nothing because I could not get time to install it.
Now I am going to install Ubuntu on both of them .

Tuesday, November 11, 2008

Frequently Used MySQL Commands For Reference

CONCAT(str1,str2,...)

Returns the string that results from concatenating the arguments. May have one or more arguments. If all arguments are non-binary strings, the result is a non-binary string. If the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent binary string form; if you want to avoid that, you can use an explicit type cast, as in this example:

SELECT CONCAT(CAST(int_col AS CHAR), char_col);

CONCAT() returns NULL if any argument is NULL.

mysql> SELECT CONCAT('My', 'S', 'QL');
-> 'MySQL'
mysql> SELECT CONCAT('My', NULL, 'QL');
-> NULL
mysql> SELECT CONCAT(14.3);
-> '14.3'

Monday, November 10, 2008

Install Tomcat on Linux

Install Tomcat (5.0.28) on Redhat Linux 8.0
November 10, 2008

Install java

Go to http://java.sun.com/
Download and install jdk. Newest version 1.3.1_01 (during the time it is first installed).
The file name is: j2sdk-1_3_1_01-linux-i386-rpm.bin (or something like that.)

feed it into a shell:

# chmod 700 j2sdk-1_3_1_01-linux-i386-rpm.bin
# j2sdk-1_3_1_01-linux-i386-rpm.bin

scroll through the license agreement, answer yes at the bottom, and it will unpack into jdk-1.3.1_01.i386.rpm

Install the rpm file:

# rpm -ivh jdk-1.3.1_01.i386.rpm

This will install the JDK in: /usr/java/jdk1.3.1_01

You need to modify the /etc/profile to include /usr/java/jdk.x.x/bin in the path, so that the executable will run.

Usually, to make a symble link called /usr/java/jdk:
# ln –s /usr/java/jsk.x.x /usr/java/jdk
This way we don’t need to update the path in the /etc/profile every time a new version of JDK is installed.
JAVA_HOME should alos be set up in the /etc/profile
Add line:
JAVA_HOME=/usr/java/jdk; export JAVA_HOME
Into /etc/profile


Install tomcat

Download the latest stable release of tomcat, I have got: jakarta-tomcat-5.0.28.tar.gz
And then extract it into /usr/local

# cd /usr/local
# tar zxvf jakarta-tomcat-5.0.28.tar.gz
For convenience,
# ln –s Jakarta-tomcat-5.0.28 tomcat

# cd tomcat
# cd bin
# rm *.bat

To enable the Tomcat manager, you need to modify /usr/local/jakarta-tomcat-5.0.28/conf/tomcat-users.xml add a user “admin” with the role “manager”. The result should look like this:










Now the tomcat should be able to be started:

# /usr/local/tomcat/bin/startup.sh

We should be able to connect to : http://localhost:8080/index.jsp

To stop tomcat:

# /usr/local/tomcat/bin/shutdown.sh

The default permissions in the binary directory for tomcat are wrong for some silly reason.

# cd $TOMCAT_HOME/bin
# chmod 744 *.sh

Set up environment variables

In the /etc/profile, add lines:

JAVA_HOME=/usr/java/jdk; export JAVA_HOME
CLASSPATH=/usr/java/jdk/lib:usr/java/jre/lib:/usr/java/jdk/src.zip; export CLASSPATH
CATALINA_HOME=/usr/local/tomcat; export CATALINA_HOME
CATALINA_BASE=/usr/local/tomcat; export CATALINA_BASE
PATH=$PATH:$JAVA_HOME/bin

Auto-Start tomcat

To start tomcat automatically when the Linux starts:

1.
Add lines:
JAVA_HOME=/usr/java/jdk
CATALINA_HOME=/usr/local/tomcat
In the Catalina.sh file, before the line: PRGDIR=’dirname “$PRG” ‘

2.
# cd /etc/rc.d/init.d
# cp /usr/local/tomcat/bin/Catalina.sh ./
# ln –s /etc/rc.d/init.d/catalina.sh /etc/rc.d/rc5.d/S81tomcat

Linux Command

Linux Command



Linux Prectical How To


PY

Contents





  1. Linux Command
  2. Firewall
  3. environment variable
  4. customise firewall while install RedHat Linux
  5. Install Web Application on RedHat Linux
  6. 1. Install Apache Web Server
  7. 2. install JAVA 2
  8. 3. install tomcat
  9. 4.install MySQL
  10. About security of redhat linux
  11. turn on ftp server (for ever)
  12. linux command
  13. create WAR file for bustops
  14. Network Config
  15. Add a user



linux command




  1. setup the computer: prompt>setup
  2. config network interface: prompt>network config
  3. ?? chkconfig ipchains off ??
  4. service ipchains status
  5. service ipchains start
  6. service ipchains stop
  7. service ipchains restart
  8. about net work configure
  9. lsmod
  10. cd /etc/sysconfig/network-scripts
  11. ls
  12. pico ifcfg-eth0
  13. service network restart
  14. ifconfig
  15. lokkit
  16. service ipchains restart




Firewall


check firewall: service ipchains status


turn off firewall: service ipchains stops


turn off firewall from computer boot: chkconfig ipchains off




environment variable


The local environment variable is the "local" variable, it's available only for the particular instance of the shell.


The global environment variable is the shell variable which stays available ("inherited") for any program started from the current shell, including an another shell.


To set the local environment variable:


set variable_name=value (C shell)



variable_name=value (Korn or Bourne shell)



To unset the local environment variable:


unset variable_name (all shells)



To set the global environment variable:


setenv VARIABLE_NAME value (C shell)


VARIABLE_NAME=value; export VARIABLE_NAME (Korn or Bourne shell)



To unset the global environment variable:


unsetenv VARIABLE_NAME value (C shell)


unset VARIABLE_NAME (Korn or Bourne shell)



To list all environmnet variables:


env


To check a single environment variable:


echo $VARIABLE_NAME










customise firewall while install RedHat Linux



1.install


2.lokkit [enter]---customise


3.netconfig[enter]?


4.rhn_rgister[enter]


5.up2date










Install Web Application on RedHat Linux





1. Install Apache Web Server




cd /usr/local

cp /mnt/cdrom/apache_1.3.24.tar.gz ./

tar -zxf apache_1.3.24.tar.gz

mkdir apache

cd apache

cp -rf /usr/local/apache_1.3.24/* ./

cd ..

rm -rf apache_1.3.24

cd apache

./config

make

make install

/usr/local/apache/bin/apachectl start



stop apache


/usr/local/apache/bin/apachectl stop


restart apache


/usr/local/apache/bin/apachectl restart






2. install JAVA 2




RedHat Application CD

cd IBM

rpm -ivh IBMJava2-SDK-1.3-9.0.i386.rpm


cd /root

vi .bash_profile


add follow two lines:


JAVA_HOME=/opt/IBMJava2-13; export JAVA_HOME

PATH=$PATH:/opt/IBMJava2-13; export PATH


set PATH and JAVA_HOME for tomcat





3. install tomcat



tomcat 3.3.2



cd /usr/local

cp -rf /mnt/cdrom/jakarta-tomcat-3.3.2-dev.tar.gz ./

tar -zxf jakarta-tomcat-3.3.2-dev.tar.gz

mkdir tomcat

cd tomcat

cp -rf /usr/local/jakarta-3.3.2-dev/* ./

cd ..

rm -rf /usr/local/jakarta-tomcat-3.3.2-dev

cd tomca

cd bin

chmod 755 startup

chmod 755 tomcat

chmod 755 shutdown


./startup to start tomcat

./shutdown to stop tomcat



to open port 8080


prompt> ipchains -I input -j ACCEPT -p tcp -s 64.119.96.78 -d 64.119.96.77 8080

this command will not work

you must do:


prompt> setup


select firewall or prompt> lokkit[enter]

go to customize, on the line of "Other ports" put "webcache:tcp"

then type:

prompt> service ipchains restart




4.install MySQL



rpm -ivf /mnt/cdrom/MySQL-3.22.32-1.i386.rpm

rpm -ivf /mnt/cdrom/MySQL-client-3.22.32-1.i386.rpm


add password to root user:


/usr/bin/mysqladmin -u root password 'susan';



let 64.119.96.78 access MySQL on linux server as MySQL client


prompt> ipchains -I input -j ACCEPT -p tcp -s 64.119.96.78 -d 64.119.96.77 3306



3306 mysql's default tcp port number




About security of redhat linux





1. install



2. lokkit

3. netconfig[enter]?

4. rhn_register

5. up2date




?????????????????????????
after change the security rules:

ipchain restart
?????????????????????????



turn on ftp server (for ever)


  1. prompt>chkconfig wu-ftpd on
  2. check : prompt>ftp localhost


create WAR file for bustops




JAR -cvf ../deploy/emstops0.war *.*


Network Config

  • list all exist network interface: ifconfig
  • change IP: ifconfig eth0 664.119.96.78
  • assign nstmask: ifconfig eth0 netmask 255.255.255.248
  • stop network interface: ifconfig eth0 down
  • start network interface: ifconfig eth0 up
  • add default gateway: route add default gw 64.119.96.73





Add a User



  • add user on Linux Server: take nina as a example
  • add nina to www group password: ninatang
  • useradd -g www nina
  • vi ninapas
  • nina:ninatang
  • chpasswd < ninapas
  • change group the user belong to: usermod -g newgroup nina





latest update : July 22, 2002

Linux Command

I kept writing frequently used Linux command in files, and save them somewhere.
Then I found it dificult to find out them later.

Now I am starting to find them and put them here.


Linux Command
written by: YLast updated: Monday Oct. 27, 2008

find Linux kernel version
uname -mrsn

Uninstall MySQL 4.0.12
1.rpm -qagrep -i mysql
display:
MySQL-server-4.0.12-0MySQl-client-4.0.12-0
2.rpm -e MySQL-server-4.0.12-0
3.
rpm -e MySQL-client-4.0.12-0

usermod: enables the user to modify the information contained in the system account files
Example: To change user Ajita's home directory to /home/chemdept. enter
shell>usermod -d /home/chemdept ajita

Find the number of files in a Listing(directory)
$ls wc -l
49
$

Make a symbolic link to a file

# ln -s /etc/rc.d/init.d/catalina.sh /etc/rc.d/rc5.d/S81tomcat

delete the symbolic link

# unlink /etc/rc.d/rc5.d/S81tomcat

Find out run level
# runlevel

Saturday, November 8, 2008

Fall in Burnaby







So beautiful!

Install MySQL 5.0 on Redhat Linux 8.0

Install MySQL 5.0.x on Redhat Linux
Saturday November 8, 2008


Install RPM package

Uninstall exist RPM package
#rpm -qagrep -i mysql // find out all former installed mysql
Display:
MySQL-server-4.0.12-0
MySQl-client-4.0.12-0
#rpm -e MySQL-server-4.0.12-0
#rpm -e MySQL-client-4.0.12-0

Install new version of MySQL RPM file
#rpm –install MySQL-server-5.0.67-0.i386.rpm
or:
#rpm –ivh MySQL-server-5.0.67-0.i386.rpm


Source (.tar.gz) installation

#groupadd mysql
#useradd –g mysql mysql
(#useradd -M -o -r -d /var/lib/mysql -s /bin/bash -c "MySQL Server" -u 27 mysql )
#cd /usr/local
Download mysql-5.0.51b.tar.gz
#tar -zxvf mysql-5.0.51b
# cd mysql-5.0.51b
# ./configure –prefix=/usr/local/mysql --localstatedir=/var/lib/mysql

***./configure --prefix=/usr/local/mysql
--sysconfdir=/etc // path for file my.ini
--localstatedir=/var/lib/mysql //path to the data folder

--without-debug \not debug mode
--with-extra-charsets=gb2312 \ add gb2312 Chinese characters support
--enable-assembler \ use character function's assmbler
--without-isam \ no support for isam table, isam tables are plateform dependent table
--without-innodb \no support for innodb table, innodb tables are the tables support transaction, usually for enterprise use
--with-pthread \ force to use pthread library(posix pthread library)
--enable-thread-safe-client \Compile terminal by using thread mode
--with-client-ldflags=-all-static \ --with-mysqld-ldflags=-all-static \ Compile Server and Client site by using static mode

# make
# make install

# cd /usr/local/mysql
# cp share/mysql/my-medium.cnf /etc/my.cnf
Or
# cp support-files/my-medium.cnf /etc/my.cnf \copy configure file,there are large,medium,small three enviornments. select based on the performence, when load is havey,change the variable in the configure file to change the memory size used by MySQL

# bin/mysql_install_db --user=mysql (# scripts/mysql_install_db \Create mysql user Database and table files )
# chown -R root:mysql /usr/local/mysql
(# chmod 750 mysql -R )
# chgrp -R mysql . (# chgrp -R mysql /usr/local/mysql)

# chown –R mysql:mysql /var/lib/mysql
# chmod 777 /var/lib/mysql

Start MySQL
# bin/mysqld_safe --user=mysql & (It is important to start MySQl by user mysql.)
# bin/mysql -uroot -p (type password, the default password is empty,so just type enter.)

# Can't connect to local MySQL server through socket '/tmp/mysql.sock'

If the above message displayed, mysql server does not start. mysql will be able create mysql.sock file if mysql server start normally.


# killall mysql !!!!! will kill all mysqk process

Restart
# /bin/mysqld_safe --user=mysql &
# bin/mysql -uroot -p

- start mysql
# /bin/mysqld_safe --user=mysql &
or
# /usr/local/mysql/share/mysql/mysqld start

-stop mysql
/usr/local/bin/mysqladmin shutdown

Add password for root:
# mysqladmin –u root password "youpassword" // set the password for the root account
# mysql -uroot -p
enter your password, get into mysql
mysql>use mysql;
mysql>delete from user where password=""; //delete the account with out password, which is used for local anonymous to connect to mysql DB
mysql>flush privileges;
mysql>quit


To start mysql automatically when Linux starts up

# cp shared/mysql/mysql.server /etc/rc.d/init.d/mysqld
(# cp support-files/mysql.server /etc/init.d/mysqld \copy mysqld
# chmod 700 /etc/init.d/mysqld)
(chmod a+x /usr/local/mysql/share/mysql/mysqld)

# chkconfig –add mysqld
# chkconfig --level 345 mysqld on
# service mysqld start
?(# netstat -atln )
??? use “ntsysv” to set up mysql start when every time the Linux starts

MySQL installation completed.

To start mysql service
/etc/rc.d/init.d/mysqld start


Troubleshooting

1. Dealing with problems compileing MySQL

If configure is run after it has previously been run, it may use information that was gathered during its previous invocation. This information is stored in config.cache. When configure starts up, it looks for that file and reads its contents if it exists, on the assumption that the information is still correct. That assumption is invalid when you reconfigure.
Each time you run configure, you must run make again to recompile. However, you may want to remove old object files from previous builds first because they were compiled using different configuration options.
To prevent old configuration information or object files from being used, run these commands before re-running configure:
shell> rm config.cache
shell> make clean


2. Check config.log file can see the information loged while config.

If you get the error message:
ERROR 2002: Can't connect to local MySQL server through socket /var/lib/mysql/mysql.sock' (2)
Check error log: /var/lib/mysql/*.err
You will find why mysql can’t start,the reason is the permission of the folder /var/lib/mysql does not allow user mysql to access.
Mysql is started by the user mysql by default. Now we know the reason (mysql can’t start),
What we need to do is:
# chown -R mysql:mysql /var/lib/mysql
Or you can set up the permission by using the following commands:

#chown -R root /usr/local/mysql
#chgrp -R mysql /usr/local/mysql
#chown -R root /usr/local/mysql/bin
#chgrp -R mysql /usr/local/mysql/bin
#chgrp -R mysql /var/lib/mysql
#chmod 777 /var/lib/mysql
#chown -R root /var/lib/mysql/mysql
#chgrp -R mysql /var/lib/mysql/mysql
#chmod 777 /var/lib/mysql/mysql
#chown -R root /var/lib/mysql/mysql/*
#chgrp -R mysql /var/lib/mysql/mysql/*
#chmod 777 /var/lib/mysql/mysql/*
#chmod 777 /usr/local/mysql/lib/mysql/libmysqlclient.a

3. If you get the following error message:
Can't start server: Bind on TCP/IP port: Invalid argument071207 22:50:57 [ERROR] Do you already have another mysqld server running on port: 3306 ?071207 22:50:57 [ERROR] Aborting071207 22:50:57 [Note] mysqld-max-nt: Shutdown complete

Try this command to shutdown mysql
#mysqladmin --host=abc --password shutdown


MySQL command used frequently

??mysqld -----start log support --log --log-update --log-long-formart

Created a new user and grant all the privileges to operate the database
mysql> grant all on database.* to user identified by "password"

revoke all on database from user

revoke all privileges on the database

Run the sql command in the file.sql in the databasename
mysql -uroot -p --one-database databasename < file.sql

Let mysqld to open a new log file, to clean the old log file
mysqladmin mysqladmin flush-logs

To link mysql’s lib and include path to default path (you don’t have to), use the lines:
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql

Thursday, November 6, 2008

Redhat Linux Runlevel

There are altogether eight runlevels in Redhat Linux, starting from runlevel 0 to runlevel 7 and runlevel S or s. Runlevels 7 to 9 are also valid, but not really documented, as the traditional UNIX variants don't use them.This article served as reference for the others Linux variants too, as most of them are same.When Redhat Linux boots up, the init process refers to /etc/inittab file for default runlevel booting. Normally, default Redhat Linux installation set to boot into runlevel 3 or runlevel 5 (if X windows is installed).After decide which runlevel to boot, Redhat Linux init process will executing runlevel specific initialization scripts files, located at /etc/rcN.d directory, where N refers to runlevel.To change the default runlevel during boot up, edit the /etc/inittab file and search for line begin with id: keyword. For example,id:2:initdefault: - default runlevel 2id:5:initdefault: - default runlevel 5Description of each different Redhat Linux runlevel
Runlevel 0
The halt system runlevel, indicates that the Redhat Linux is shutting down. Obviously, this runlevel should not becomes the default runlevel in /etc/inittab file.
Runlevel 1
Single user mode runlevel, indicates that only one user, and must be locally login in front of physical console. There are only very minimal set of functions loaded by the kernel at this runlevel, for example no networking function!Booting Redhat Linux into single user mode is ideal to perform system maintenance or repairing works.
Runlevel 2
Redhat does not use this runlevel, and it is user-definable runlevel. Having say that, it could be customized by user for this runlevel.In Debian, however, this is the default runlevel. Debian runlevel 2 to 5 are full multi-user mode.
Runlevel 3
Similar to Debian runlevel 2. Redhat Linux runlevel 3 is full multi-user mode without X windows
Runlevel 4
This is also an user-definable runlevel.
Runlevel 5
This is Redhat Linux full multi-user mode runlevel, with X windows system loaded.
Runlevel 6
This is Redhat Linux system reboot runlevel. Obviously, this runlevel should not be default runlevel as well.Related information:
Using the telinit command to change the system current runlevel without rebooting. For example, while at current system runlevel 5, executing telinit 3 will change to system runlevel 3 without rebooting the system.
Executing the runlevel command without argument to find out a line with two columns, where first column indicates previous system runlevel and second column indicates current system runlevel. If the previous runlevel are unknown, the character N printed.
How to add extra hard disk to Redhat Linux, and boot up into single user mode using LILO or GRUB
Search more related info with Google Search engine built-in

Tuesday, July 1, 2008

我爱令狐冲

看过金庸的笑傲江湖,看过电视剧。没有细想,却给令狐冲在心中留下了位置。今天在网上输入令狐冲搜索,才发现那麽多人喜爱着令狐冲,而且总结的头头是道。
想想,自己喜欢上令狐冲却完全不是一种理性的分析,而是一种感觉,只觉得他不受拘束,不求功名,又心存正义的个性暗合我的性格,或说是我认为我该有的理想性格。

Happy blogger

Today I showed my son the Google blogger, in fact I was originally trying to show him about how to set up a web site by using Google's pages creator.
My son started writing his first blog and then he was totally attracted by the amazing features.
He put his favorite game web sites and youtube videos links to his blog.
He called his friend to look at his blog.
He even can't stop thinking to add contents on his blog.

He is a happy blogger now.

Things Around Us

Even I started using Gmail for a long time, I found google's blog today. So see, how many thins around us but we have never noticed in our busy life.
Slow down, slow down, enjoy life!
Otherwise, we will just be a hurry guest of our life, come and go, feel nothing.

The Monk theme song

The Monk theme song is called "It's a Jungle Out There".

Here are the lyrics:

It's a jungle out there
Disorder and confusion everywhere
No one seems to care
Well I do
Hey, who's in charge here?
It's a jungle out there
Poison in the very air we breathe
Do you know what's in the water that you drink?
Well I do, and it's amazing
People think I'm crazy, 'cause I worry all the time
If you paid attention, you'd be worried too
You better pay attention
Or this world we love so much might just kill you
I could be wrong now, but I don't think so
It's a jungle out there