總網頁檢視次數

顯示包含「Linux」標籤的文章。顯示所有文章
顯示包含「Linux」標籤的文章。顯示所有文章

星期四, 10月 14, 2010

Linux tar usage

tar [options]

Operations:
[-]A --catenate --concatenate
[-]c --create
[-]d --diff --compare
[-]r --append
[-]t --list
[-]u --update
[-]x --extract --get
--delete

Common Options:
-C, --directory DIR
-f, --file F
-j, --bzip2
-p, --preserve-permissions
-v, --verbose
-z, --gzip

--recursion
recurse into directories


Example

To tar and zip the whole directory

tar -xcv filename.tar.gz /target/directory

To extract the tar file

tar -zxv filename.tar.gz -C /target/directory

Linux Netstat usage

功能说明:Netstat用于显示与IP、TCP、UDP和ICMP协议相关的统计数据,一般用于检验本机各端口的网络连接情况。
语  法:netstat [-acCeFghilMnNoprstuvVwx][-A<网络类型>][--ip]
补充说明:利用netstat指令可让你得知整个Linux系统的网络情况。
参  数:
-a或–all 显示所有连线中的Socket。
-A<网络类型>或–<网络类型> 列出该网络类型连线中的相关地址。
-c或–continuous 持续列出网络状态。
-C或–cache 显示路由器配置的快取信息。
-e或–extend 显示网络其他相关信息。
-F或–fib 显示FIB。
-g或–groups 显示多重广播功能群组组员名单。
-h或–help 在线帮助。
-i或–interfaces 显示网络界面信息表单。
-l或–listening 显示监控中的服务器的Socket。
-M或–masquerade 显示伪装的网络连线。
-n或–numeric 直接使用IP地址,而不通过域名服务器。
-N或–netlink或–symbolic 显示网络硬件外围设备的符号连接名称。
-o或–timers 显示计时器。
-p或–programs 显示正在使用Socket的程序识别码和程序名称。
-r或–route 显示Routing Table。
-s或–statistice 显示网络工作信息统计表。
-t或–tcp 显示TCP传输协议的连线状况。
-u或–udp 显示UDP传输协议的连线状况。
-v或–verbose 显示指令执行过程。
-V或–version 显示版本信息。
-w或–raw 显示RAW传输协议的连线状况。
-x或–unix 此参数的效果和指定”-A unix”参数相同。
–ip或–inet 此参数的效果和指定”-A inet”参数相同

星期一, 8月 16, 2010

Rsync - From Window to Linux

1. Download cwrsync server from http://www.itefix.no/i2/node/10650.
2. Install it as service
3. edit the configuration file and manually start-up it

Here is the sample

uid = 0
gid = 0
use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log

[test]
path = /cygdrive/d/backup
read only = false
transfer logging = yes

4. in linux , yum install rsync if you don't have it.
5. run the command

rsync -av --delete --progress Window_IP::test /local_path/

To set the file permission with rsync
rsync -av --delete --chmod=a+rw,g+r,o+r remote_IP::remote_directory /local_directory/

星期一, 8月 02, 2010

CentOS - non-English support

yum groupinstall "Chinese Support"

星期三, 7月 14, 2010

Setup Linux VNC server

1. yum install vncserver.i386 ( x86_64 )
2. yum groupinstall "Desktop Environment "
3. cd
4. cd .vnc
5. vi xtartup

Here is the sample configuration
#!/bin/sh

xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session & (==> for GNOME)
startkde & (==> for KDE)

6. service vncserver start
7. You can vnc from your pc to it by 5901 port

星期四, 3月 22, 2007

CentOS 3.8 Server Setup

1. mkdir /backup
2. wget all source files, mysql+apache+php (php5 is not ok for CentOS 3.8)
3. rpm -ivh *.rpm // for mysql setup files
4. yum install perl-DBI // fullfill mysql deps
5. yum install gcc // fulfill apache install deps
6. in apache tar directory

$./configure --prefix=/usr/local/apache2

or (when you have any error related to apr...)

$./configure --enable-so --enable-mods-shared=expires,ssl,headers,http,info,rewrite --with-apr=/backup/httpd-2.2.4/srclib/apr/ --with-apr-util=/backup/httpd-2.2.4/srclib/apr-util/


$ make
$ make install
$ /usr/local/spache2/bin/apachectl start

Refer to http://httpd.apache.org/docs/2.2/install.html for more details
7. extract php source
8. yum install flex // fulfill php compile deps
9. yum install bison // fulfill php comple deps
10. yum install libxml libxml-devel libxml2-devel // fulfill php comple deps
11. ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
12. make
13. make install
14. refer to /php-4.4.6/INSTALL for the rest of configuration

After that, I have Mysql5.0 + Apache 2 + PHP 4 in my server

PHP compile options

// add graphical support
yum install libjpeg-devel
yum install libpng-devel
yum install zlib-devel
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-gd --with-zlib-dir=usr/share/doc/zlib-1.1.4



yum install libpng-devel

星期三, 3月 21, 2007

Useful Linux (CentOS) commands

yum remove package-name // remove package
yum list // show availiable package from server
yum install package-name // install package
yum localinstall package-name.rpm // try to install the rpm with deps


chkconfig --list // check list of running environment process

CentOS 3.8 PHP 4.3.2 config file location

Default YUM installed PHP configure file location

/etc/php.ini
/etc/php.d

CentOS 3.8 PHP MbString problem

when you first install phpmyadmin and it shows the following error

Warning: mb_internal_encoding(): Unknown encoding "big5" in /var/www/html/phpmyadmin/libraries/string.lib.php on line 41Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/phpmyadmin/libraries/string.lib.php:41) in /var/www/html/phpmyadmin/libraries/common.lib.php on line 2404Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/phpmyadmin/libraries/string.lib.php:41) in /var/www/html/phpmyadmin/libraries/common.lib.php on line 2404Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/phpmyadmin/libraries/string.lib.php:41) in /var/www/html/phpmyadmin/libraries/common.lib.php on line 2354Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/phpmyadmin/libraries/string.lib.php:41) in /var/www/html/phpmyadmin/index.php on line 101

You can edit the /var/www/html/phpmyadmin/libraries/string.lib.php line 41 to comment out that line by

change it from

mb_internal_encoding($GLOBALS['charset']);

to

// mb_internal_encoding($GLOBALS['charset']);

and then you can reload your page again and you can see that .. and then you have to setup your language to any one rather than "Chinese Traditional Big5". I choose UTF8 and then you can del the comment for line 41 and everything will works fine .. remember dont' choose Big5 after you del the comment. If not, you have to do so again.