Professional Documents
Culture Documents
Netkiller CentOS Linux 手札
Netkiller CentOS Linux 手札
2009-10-31
版权声明
转载请与作者联系,转载时请务必标明文章原始出处和作者信息及本声明。
系列文档
下面是我多年积累下来的经验整理文档供大家参考:
目录
About author
作者简介
联系作者
1. System
useful commands
Package Manager
yum - Yellowdog Updater Modified
rpm - RPM Package Manager
Time Zone
日期、时间
sudo, sudoedit - execute a command as another user
Logging
Fonts 字体
Services
chkconfig
xinetd.d
2. Network
IP Address
Gateway
hosts
Route
Iptables
3. Samba
4. Apache httpd
5. INND
6. snmpd - daemon to respond to SNMP request packets.
cacti
nagios
7. LAMP Server
Install
Configure
Apache
MySQL
Starting
apachetop
FAQ
compile php
8. Nginx
spawn-fcgi script
nginx.conf
9. MySQL
Installation
10. Teamwork
Subversion
classic Unix-like xinetd daemon
WebDav
项目目录结构
Trac
standalone
Using Authentication
Permissions
Resync
I. Virtualization
11. Xen
install
Manager
12. KVM
下一页
About author
About author
上一页 下一页
About author
目录
作者简介
联系作者
作者简介
主页地址:http://netkiller.sourceforge.net, http://netkiller.hikz.com, http://netkiller.8800.org
2001年来深圳进城打工,成为一名外来务工者.
2002年我发现不能埋头苦干,埋头搞技术是不对的,还要学会"做人".
2003年这年最惨,公司拖欠工资16000元,打过两次官司2005才付清.
2004年开始加入分布式计算团队,目前成绩
2004-10月开始玩户外和摄影
2005-6月成为中国无线电运动协会会员
2006年单身生活了这么多年,终于找到归宿.
2007物价上涨,买不起房,买不起车,辛辛苦苦几十年,一下回到解放前
2010对电子打击乐产生兴趣,计划学习爵士鼓
上一页 下一页
Netkiller CentOS Linux 手札 起始页 联系作者
联系作者
上一页 About author 下一页
联系作者
Mobile: +86 13113668890
注:请不要问我安装问题!
E-Mail: openunix@163.com
IRC irc.freenode.net #ubuntu / #ubuntu-cn
Yahoo: bg7nyt
ICQ: 101888222
AIM: bg7nyt
TM/QQ: 问我
MSN: 问我
G Talk: 问我
网易泡泡:openunix
写给火腿:
也同样欢迎无线电爱好者和我QSO,我的QTH在深圳龙华苹果园10F,设备YAESU FT-50R,FT-60R,
FT-7800 144-430双段机,拉杆天线/GP天线 Nagoya MAG-79EL-3W/Yagi
第 1 章 System
上一页 下一页
第 1 章 System
目录
useful commands
Package Manager
yum - Yellowdog Updater Modified
rpm - RPM Package Manager
Time Zone
日期、时间
sudo, sudoedit - execute a command as another user
Logging
Fonts 字体
Services
chkconfig
xinetd.d
useful commands
配置工具
authconfig-tui
ntsysv
setup
ntsysv
lokkit
timeconfig
system-config-cluster
system-config-network-tui
system-config-securitylevel-tui
system-config-httpd
system-config-nfs
system-config-services
system-config-network
system-config-samba
system-config-network-cmd
system-config-securitylevel
上一页 下一页
联系作者 起始页 Package Manager
Package Manager
上一页 第 1 章 System 下一页
Package Manager
install
reinstall
list
yum list
select mirror
update
Redhat resource
i386
x86_64
install/upgrade/remove
1.安装一个包
# rpm -ivh
2.升级一个包
# rpm -Uvh
3.删除一个包
# rpm -e
不检查依赖性关系
query
查询一个包是否被安装
安装的包的信息
Install Date: Mon 28 Dec 2009 02:36:36 PM HKT Build Host: x86-6.fedora.phx.
redhat.com
Group : System Environment/Daemons Source RPM: nginx-0.6.39-2.el5.src.rpm
Size : 772477 License: BSD
Signature : DSA/SHA1, Mon 07 Dec 2009 07:06:40 AM HKT, Key ID 119cc036217521f6
Packager : Fedora Project
URL : http://nginx.net/
Summary : Robust, small and high performance http and reverse proxy server
Description :
Nginx [engine x] is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3
proxy server written by Igor Sysoev.
列出该包中有哪些文件
列出一个文件属于哪一个RPM包
列出所有被安装的RPM包
Time Zone
上一页 第 1 章 System 下一页
Time Zone
timeconfig
http://netkiller.sourceforge.net/centos/ch01s03.html[21/5/2010 22:18:59]
日期、时间
日期、时间
上一页 第 1 章 System 下一页
日期、时间
# date -s "2008-7-19"
# date -s 18:10
# rdate time-a.nist.gov 查看
# rdate -s time-a.nist.gov 设置
http://netkiller.sourceforge.net/centos/ch01s04.html[21/5/2010 22:19:01]
sudo, sudoedit - execute a command as another user
http://netkiller.sourceforge.net/centos/ch01s05.html[21/5/2010 22:19:03]
Logging
Logging
上一页 第 1 章 System 下一页
Logging
http://netkiller.sourceforge.net/centos/ch01s06.html[21/5/2010 22:19:07]
Fonts 字体
Fonts 字体
上一页 第 1 章 System 下一页
Fonts 字体
http://netkiller.sourceforge.net/centos/ch01s07.html[21/5/2010 22:19:08]
Services
Services
上一页 第 1 章 System 下一页
Services
[ ] NetworkManager
[ ] acpid
[ ] anacron
[ ] atd
[ ] auditd
[ ] autofs
[ ] avahi-daemon
[ ] avahi-dnsconfd
[ ] bluetooth
[ ] conman
[ ] cpuspeed
[*] crond
[ ] cups
[ ] dnsmasq
[ ] dund
[ ] firstboot
[ ] gpm
[ ] haldaemon
[ ] hidd
[ ] httpd
[ ] ip6tables
[*] iptables
[ ] irda
[ ] irqbalance
[*] kudzu
[ ] lvm2-monitor
[ ] mcstrans
[ ] mdmonitor
[ ] mdmpd
[*] messagebus
[ ] microcode_ctl
[ ] multipathd
[ ] netconsole
[ ] netfs
[ ] netplugd
[*] network
[ ] nfs
[ ] nfslock
[ ] nscd
[ ] ntpd
[ ] oddjobd
[ ] pand
[ ] pcscd
[ ] portmap
[ ] psacct
[ ] rdisc
[ ] readahead_early
[ ] readahead_later
[ ] restorecond
[ ] rpcgssd
[ ] rpcidmapd
[ ] rpcsvcgssd
[ ] saslauthd
[*] sendmail
[ ] smartd
[*] sshd
[*] syslog
[ ] vncserver
[ ] wdaemon
[ ] winbind
[ ] wpa_supplicant
[ ] xfs
[ ] ypbind
[ ] yum-updatesd
chkconfig
xinetd.d
第 2 章 Network
上一页 下一页
第 2 章 Network
目录
IP Address
Gateway
hosts
Route
Iptables
IP Address
ifcfg-eth0,ifcfg-eth1,ifcfg-eth2 ... ifcfg-eth(n)
eth0:1
reload network
上一页 下一页
Services 起始页 Gateway
Gateway
上一页 第 2 章 Network 下一页
Gateway
http://netkiller.sourceforge.net/centos/ch02s02.html[21/5/2010 22:19:17]
hosts
hosts
上一页 第 2 章 Network 下一页
hosts
# cat -n /etc/hosts
1 # Do not remove the following line, or various programs
2 # that require network functionality will fail.
3 127.0.0.1 development.domain.org development localhost.
localdomain localhost
4 ::1 localhost6.localdomain6 localhost6
http://netkiller.sourceforge.net/centos/ch02s03.html[21/5/2010 22:19:19]
Route
Route
上一页 第 2 章 Network 下一页
Route
route table
restart network
http://netkiller.sourceforge.net/centos/ch02s04.html[21/5/2010 22:19:21]
Iptables
Iptables
上一页 第 2 章 Network 下一页
Iptables
Activating the IPTables Service
Firewall Policies
http://netkiller.sourceforge.net/centos/ch02s05.html[21/5/2010 22:19:23]
第 3 章 Samba
第 3 章 Samba
上一页 下一页
第 3 章 Samba
smbpasswd
smb.conf
[homes]
comment = Home Directories
browseable = no
writable = yes
valid users = %S
[developer]
comment = Developer Stuff
path = /var/www/html
public = yes
writable = yes
printable = no
write list = +apache
上一页 下一页
Iptables 起始页 第 4 章 Apache httpd
http://netkiller.sourceforge.net/centos/ch03.html[21/5/2010 22:19:25]
第 4 章 Apache httpd
第 4 章 Apache httpd
上一页 下一页
第 4 章 Apache httpd
./configure --prefix=/usr/local/httpd-2.2.14 \
--with-mpm=worker \
--enable-so \
--enable-mods-shared=all \
--enable-static-support \
--enable-static-htpasswd \
--enable-static-htdigest \
--enable-static-ab \
--disable-include \
--disable-actions \
--disable-alias \
--disable-asis \
--disable-autoindex \
--disable-auth_basic \
--disable-authn_file \
--disable-authn_default \
--disable-authz_groupfile \
--disable-authz_user \
--disable-authz_default \
--disable-cgi \
--disable-cgid \
--disable-env \
--disable-negotiation \
--disable-status \
--disable-userdir
上一页 下一页
第 3 章 Samba 起始页 第 5 章 INND
http://netkiller.sourceforge.net/centos/ch04.html[21/5/2010 22:19:27]
第 5 章 INND
第 5 章 INND
上一页 下一页
第 5 章 INND
readers.conf
# vim /etc/news/readers.conf
auth "localhost" {
hosts: "*"
default: "*"
}
access "localhost" {
users: "*"
newsgroups: "*,!junk,!control,!control.*"
access: RPA
}
create a group
上一页 下一页
第 4 章 Apache httpd 第 6 章 snmpd - daemon to
起始页
respond to SNMP request packets.
http://netkiller.sourceforge.net/centos/ch05.html[21/5/2010 22:19:29]
第 6 章 snmpd - daemon to respond to SNMP request packets.
cacti
nagios
cacti
database
enable crontab
# cat /etc/cron.d/cacti
*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
install cacti
http://localhost/cacti/install/
上一页 下一页
第 5 章 INND 起始页 nagios
nagios
第 6 章 snmpd - daemon to respond to SNMP
上一页 下一页
request packets.
nagios
Install Nagios & Plugins
Create the default Nagios web access user & set a password
nagios -v /etc/nagios/nagios.cfg
Start Nagios
Start Nagios
http://localhost/nagios/
第 7 章 LAMP Server
上一页 下一页
第 7 章 LAMP Server
目录
Install
Configure
Apache
MySQL
Starting
apachetop
FAQ
compile php
Install
Apache
PHP
mysql
上一页 下一页
nagios 起始页 Configure
Configure
上一页 第 7 章 LAMP Server 下一页
Configure
Apache
VirtualHost
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /www/docs/dummy-host.example.com
ServerName dummy-host.example.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
MySQL
Starting
上一页 第 7 章 LAMP Server 下一页
Starting
levels
Apache
MySQL
apachetop
上一页 第 7 章 LAMP Server 下一页
apachetop
# apachetop
last hit: 00:00:00 atop runtime: 0 days, 00:00:00 09:42:54
All: 0 reqs ( 0.0/sec) 0.0B ( 0.0B/sec) 0.0B/req
2xx: 0 ( 0.0%) 3xx: 0 ( 0.0%) 4xx: 0 ( 0.0%) 5xx: 0 ( 0.0%)
R ( 1s): 0 reqs ( 0.0/sec) 0.0B ( 0.0B/sec) 0.0B/req
2xx: 0 ( 0.0%) 3xx: 0 ( 0.0%) 4xx: 0 ( 0.0%) 5xx: 0 ( 0.0%)
http://netkiller.sourceforge.net/centos/ch07s04.html[21/5/2010 22:19:40]
FAQ
FAQ
上一页 第 7 章 LAMP Server 下一页
FAQ
compile php
http://netkiller.sourceforge.net/centos/ch07s05.html[21/5/2010 22:19:42]
第 8 章 Nginx
第 8 章 Nginx
上一页 下一页
第 8 章 Nginx
目录
spawn-fcgi script
nginx.conf
chkconfig nginx on
check config
nginx -t
spawn-fcgi script
/etc/init.d/spawn-fcgi script
# pidfile: /var/run/php_cgi.pid
# Note: See how to use this script :
# http://www.cyberciti.biz/faq/rhel-fedora-install-configure-nginx-php5/
# Source function library.
. /etc/rc.d/init.d/functions
spawnfcgi="/usr/bin/spawn-fcgi"
php_cgi="/usr/bin/php-cgi"
prog=$(basename $php_cgi)
server_ip=127.0.0.1
server_port=9000
server_user=nginx
server_group=nginx
server_childs=5
pidfile="/var/run/php_cgi.pid"
start() {
[ -x $php_cgi ] || exit 1
[ -x $spawnfcgi ] || exit 2
echo -n $"Starting $prog: "
daemon $spawnfcgi -a ${server_ip} -p ${server_port} -u ${server_user} -g
${server_group} -P ${pidfile} -C ${server_childs} -f ${php_cgi}
retval=$?
echo
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} $prog -QUIT
retval=$?
echo
[ -f ${pidfile} ] && /bin/rm -f ${pidfile}
return $retval
}
restart(){
stop
sleep 2
start
rh_status(){
status -p ${pidfile} $prog
}
case "$1" in
start)
start;;
stop)
stop;;
restart)
restart;;
status)
rh_status;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 3
esac
starting spawn-fcgi
/etc/init.d/spawn-fcgi start
check port
上一页 下一页
FAQ 起始页 nginx.conf
nginx.conf
上一页 第 8 章 Nginx 下一页
nginx.conf
#----------------------------------------------------------------------
# Main Module - directives that cover basic functionality
#
# http://wiki.codemongers.com/NginxMainModule
#
#----------------------------------------------------------------------
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
#----------------------------------------------------------------------
# Events Module
#
# http://wiki.codemongers.com/NginxEventsModule
#
#----------------------------------------------------------------------
events {
worker_connections 1024;
}
#----------------------------------------------------------------------
# HTTP Core Module
#
# http://wiki.codemongers.com/NginxHttpCoreModule
#
#----------------------------------------------------------------------
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
#
# The default server
#
server {
listen 80;
server_name _;
#charset koi8-r;
# location / {
# root /usr/share/nginx/html;
# index index.html index.htm;
# }
location / {
root /var/www/nginx-default;
第 9 章 MySQL
上一页 下一页
第 9 章 MySQL
目录
Installation
Installation
上一页 下一页
nginx.conf 起始页 第 10 章 Teamwork
http://netkiller.sourceforge.net/centos/ch09.html[21/5/2010 22:19:49]
第 10 章 Teamwork
第 10 章 Teamwork
上一页 下一页
第 10 章 Teamwork
目录
Subversion
classic Unix-like xinetd daemon
WebDav
项目目录结构
Trac
standalone
Using Authentication
Permissions
Resync
Subversion
protocol = tcp
wait = no
user = svnroot
server = /usr/bin/svnserve
server_args = -i -r /home/svnroot
}
firewall
WebDav
create directory
mkdir /var/www/repository
svnadmin create /var/www/repository
subversion.conf
vhost.conf
<Location />
DAV svn
SVNPath /var/www/repository
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/subversion/svn-auth-file
Require valid-user
</Location>
auth file
项目目录结构
–trunk #存放主线
–branches #存放分支,可修改
–tags #存放标记,不可修改
上一页 下一页
第 9 章 MySQL 起始页 Trac
Trac
上一页 第 10 章 Teamwork 下一页
Trac
http://www.mantisbt.org/
standalone
multiple projects
Using Authentication
Using Authentication
bind ip
trac
$ tracd -p 8080 \
--auth=project1,/path/to/users.htdigest,mycompany.com \
--auth=project2,/path/to/users.htdigest,mycompany.com \
/path/to/project1 /path/to/project2
tracd -p 8000 \
--auth=*,/var/www/trac/.passwd,localhost \
-e /var/www/trac/
Permissions
admin
group
user
Resync
部分 I. Virtualization
上一页 下一页
部分 I. Virtualization
目录
11. Xen
install
Manager
12. KVM
上一页 下一页
Trac 起始页 第 11 章 Xen
http://netkiller.sourceforge.net/centos/pt01.html[21/5/2010 22:19:55]
第 11 章 Xen
第 11 章 Xen
上一页 部分 I. Virtualization 下一页
第 11 章 Xen
目录
install
Manager
install
ubuntu
http://netkiller.sourceforge.net/centos/ch11.html[21/5/2010 22:19:56]
Manager
Manager
上一页 第 11 章 Xen 下一页
Manager
list
start
reboot
shutdown
console
config
第 12 章 KVM
上一页 部分 I. Virtualization
第 12 章 KVM
http://wiki.centos.org/HowTos/KVM
确认处理器是否支持KVM
Installing
上一页 上一级
Manager 起始页
http://netkiller.sourceforge.net/centos/ch12.html[21/5/2010 22:20:00]