Monday, November 10, 2008

Linux Command

Linux Command

Linux Prectical How To



  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


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:


To check a single environment variable:


customise firewall while install RedHat Linux


2.lokkit [enter]---customise




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



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 -d 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 access MySQL on linux server as MySQL client

prompt> ipchains -I input -j ACCEPT -p tcp -s -d 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
  • stop network interface: ifconfig eth0 down
  • start network interface: ifconfig eth0 up
  • add default gateway: route add default gw

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

No comments: