Thursday, November 20, 2008
湿热下注针灸治疗
症状:小腹坠沉,... ...
针灸穴位:
三阴交,
足少阴神经:太溪,复溜,
足厥阴肝经:行间,太冲,
足少阳胆经:侠溪,
足太阴脾经:阴陵泉,血海,
足阳明胃经:足三里,
任脉:关元,
手少阳三焦经:支沟
足三里,侠溪,复溜不必须
Wednesday, November 12, 2008
Ubuntu 8.10
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
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
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 Prectical How To
Contents
- Linux Command
- Firewall
- environment variable
- customise firewall while install RedHat Linux
- Install Web Application on RedHat Linux
- 1. Install Apache Web Server
- 2. install JAVA 2
- 3. install tomcat
- 4.install MySQL
- About security of redhat linux
- turn on ftp server (for ever)
- linux command
- create WAR file for bustops
- Network Config
- Add a user
linux command
- setup the computer: prompt>setup
- config network interface: prompt>network config
- ?? chkconfig ipchains off ??
- service ipchains status
- service ipchains start
- service ipchains stop
- service ipchains restart
- about net work configure
- lsmod
- cd /etc/sysconfig/network-scripts
- ls
- pico ifcfg-eth0
- service network restart
- ifconfig
- lokkit
- 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)
- prompt>chkconfig wu-ftpd on
- 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
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
Install MySQL 5.0 on Redhat Linux 8.0
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
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