1、服务的分类

2、启动与自启动

服务启动:就是在当前系统中让服务运行,并提供功能;

服务自启动:自启动是指让服务在系统开机或重启动之后,随着系统的启动而自启动服务。

3、查询已安装的服务

》RPM包安装的服务

> chkconfig --list

#查看服务自启动状态,可以看到所有RPM包安装的服务

》源码包安装的服务

>查看服务安装的位置,一般在 /usr/local/ 下

原因:

RPM 安装服务和源码包安装服务的区别:

》RPM安装服服务和源码包安装服务的区别就是安装位置的不同

>源码包安装在指定位置,一般是/usr/local/

>RPM包安装在默认位置中

二、RPM服务的管理

1、RPM服务分为两类,独立的服务和基于xinetd服务

1)RPM包默认安装的位置:

>/etc/init.d/  :启动脚本位置(独立服务启动脚本存放的位置)

>/etc/sysconfig/  :初始化环境配置文件位置

>/etc/  :配置文件位置(RPM服务的配置文件位置)

>/etc/xinetd.conf  :xinetd配置文件

>/etc/xinetd.d/  :基于xinetd服务的启动脚本

>/var/lib/  :服务产生的数据放在这里(RPM服务产生的数据存放的位置)

>/var/log/  :日志

2、独立服务的管理介绍:

1)独立服务的启动

>/etc/init.d/独立服务名    start|stop|status|restart

>service  独立服务名  start | stop | restart | status  (Red Hat系列Linux特有的简化服务管理的命令,其他Linux可能不适用)

补充:service  status --all

以上两种方式只能适用于当前状态,开机重启可能会丢失

2)如何实现自启动打开与关闭?

》方法1:chkconfig   [ --level    运行级别]  [独立服务名] [on|off]

>chkconfig --level 2345 httpd on            表示将当前服务自启动设置打开,允许下次开机自启动

>chkconfig --level 2345 httpd off           表示将当前服务自启动设置关闭,下次开机不能自启动

》方法2:修改/etc/rc.d/rc.local文件

[root@localhost sh]# ll /etc/rc.d/rc.local
-rwxr-xr-x. 1 root root 220 6月  20 2018 /etc/rc.d/rc.local
[root@localhost sh]# ll /etc/rc.local
lrwxrwxrwx. 1 root root 13 11月 25 22:58 /etc/rc.local -> rc.d/rc.local/etc/rc.local 是原文件,/etc/rc.d/rc.local是前者的软链接,
修改哪个文件都可建议修改原文件
原文件在Linux系统启动时,所有服务启动完成,而输入用户名和密码之前会执行该文件中的命令,文件内容或者说格式如下
[root@localhost sh]# vim /etc/rc.local #!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.touch /var/lock/subsys/local
~
#注,touch 首次调用字符串表示创建以该字符串为名的文件,以后调用表示修改该
#文件的最后访问时间
~
~                

》使用ntsysv命令管理自启动(Red Hat 特有)

可以管理独立服务管理的服务和基于xinetd服务管理的服务

进入该图形界面工具,前面加 *  号的表示允许自启动,前面为空表示拒绝自启动

3、基于xinetd的服务管理:

预读:xinetd不是一个单词,是计算机中的专有名词,意思是超级守护进程服务。

1)查询所有用rpm包安装的所有自启动服务命令为:
[root@localhost ~]# chkconfig --list

[root@localhost ~]# chkconfig --list
NetworkManager  0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
abrt-ccpp       0:关闭    1:关闭    2:关闭    3:启用    4:关闭    5:启用    6:关闭
abrtd           0:关闭    1:关闭    2:关闭    3:启用    4:关闭    5:启用    6:关闭
acpid           0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
atd             0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
auditd          0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
autofs          0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
blk-availability    0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
bluetooth       0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
certmonger      0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
cpuspeed        0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
crond           0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
cups            0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
dnsmasq         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
firstboot       0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
haldaemon       0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
htcacheclean    0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
httpd           0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
ip6tables       0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
iptables        0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
irqbalance      0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
kdump           0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
lvm2-monitor    0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
mdmonitor       0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
messagebus      0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
netconsole      0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
netfs           0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
network         0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
nfs             0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
nfs-rdma        0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
nfslock         0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
ntpd            0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
ntpdate         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
oddjobd         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
portreserve     0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
postfix         0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
pppoe-server    0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
psacct          0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
quota_nld       0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rdisc           0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rdma            0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
restorecond     0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rngd            0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rpcbind         0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
rpcgssd         0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
rpcsvcgssd      0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rsyslog         0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
saslauthd       0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
smartd          0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
spice-vdagentd  0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:启用    6:关闭
sshd            0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
sssd            0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
sysstat         0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
udev-post       0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
wdaemon         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
winbind         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
wpa_supplicant  0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭

随着Linux的版本更新,基于xinetd服务的越来越少,只有几个不太安全的服务是基于它的。

比如2.2  2.4内核之前很多,现在很少,只有telnet sync 等是基于xinetd的,telnet服务也被

ssh服务代替。在此只是了解下xinetd的就可。

2)安装xinetd与Telnet

注:安装Telnet用于演示如何开启关闭xinetd服务。

[root@localhost ~]# yum -y install xinetd

[root@localhost ~] # yum -y install telnet

[root@localhost ~] # yum -y install telnet-server

[root@localhost ~]# yum -y install xinetd
已加载插件:fastestmirror, refresh-packagekit, security
设置安装进程
Loading mirror speeds from cached hostfile* base: mirrors.cn99.com* c6-media: * extras: mirrors.aliyun.com* updates: mirrors.cn99.com
file:///media/cdrecorder/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/cdrecorder/repodata/repomd.xml
尝试其他镜像。
file:///media/cdrom/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/cdrom/repodata/repomd.xml
尝试其他镜像。
file:///mnt/cdrom//repodata/repomd.xml: [Errno 14] Could not open/read file:///mnt/cdrom//repodata/repomd.xml
尝试其他镜像。
解决依赖关系
--> 执行事务检查
---> Package xinetd.x86_64 2:2.3.14-40.el6 will be 安装
--> 完成依赖关系计算依赖关系解决==================================================================================================软件包               架构                 版本                          仓库                大小
==================================================================================================
正在安装:xinetd               x86_64               2:2.3.14-40.el6               base               122 k事务概要
==================================================================================================
Install       1 Package(s)总下载量:122 k
Installed size: 259 k
下载软件包:
xinetd-2.3.14-40.el6.x86_64.rpm                                            | 122 kB     00:00
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务正在安装   : 2:xinetd-2.3.14-40.el6.x86_64                                                  1/1 Verifying  : 2:xinetd-2.3.14-40.el6.x86_64                                                  1/1 已安装:xinetd.x86_64 2:2.3.14-40.el6                                                                   完毕!
[root@localhost ~]# chkconfig --list
NetworkManager  0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
abrt-ccpp       0:关闭    1:关闭    2:关闭    3:启用    4:关闭    5:启用    6:关闭
abrtd           0:关闭    1:关闭    2:关闭    3:启用    4:关闭    5:启用    6:关闭
acpid           0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
atd             0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
auditd          0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
autofs          0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
blk-availability    0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
bluetooth       0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
certmonger      0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
cpuspeed        0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
crond           0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
cups            0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
dnsmasq         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
firstboot       0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
haldaemon       0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
htcacheclean    0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
httpd           0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
ip6tables       0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
iptables        0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
irqbalance      0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
kdump           0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
lvm2-monitor    0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
mdmonitor       0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
messagebus      0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
netconsole      0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
netfs           0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
network         0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
nfs             0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
nfs-rdma        0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
nfslock         0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
ntpd            0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
ntpdate         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
oddjobd         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
portreserve     0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
postfix         0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
pppoe-server    0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
psacct          0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
quota_nld       0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rdisc           0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rdma            0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
restorecond     0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rngd            0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rpcbind         0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
rpcgssd         0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
rpcsvcgssd      0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rsyslog         0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
saslauthd       0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
smartd          0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
spice-vdagentd  0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:启用    6:关闭
sshd            0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
sssd            0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
sysstat         0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
udev-post       0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
wdaemon         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
winbind         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
wpa_supplicant  0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
xinetd          0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
ypbind          0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭基于 xinetd 的服务:chargen-dgram:     关闭chargen-stream:   关闭daytime-dgram:    关闭daytime-stream:   关闭discard-dgram:    关闭discard-stream:   关闭echo-dgram:       关闭echo-stream:      关闭rsync:            关闭tcpmux-server:    关闭time-dgram:       关闭time-stream:      关闭
[root@localhost ~]#

注:xinetd 服务的过程是,xinetd服务是个独立的常驻于内存的服务,它的作用就是管理基于它的服务。具体来说,xinetd

负责接收用户请求,然后相应处理,调用基于它的服务,比如上面可以查到的基于xinetd的服务,

基于它的服务返回结果给xinetd,xinetd再返回结果给客户端。

由xinetd服务管理的好处是,基于xinetd的服务不直接占据内存;

坏处是:反应比其他慢,比如它比Telnet服务等请求响应结果慢。

注:Telnet和Telnet-server的安装,按如上命令即可。安装过程此处不再截图。

另外,Telnet不安全,建议试验完成,无特殊需要,卸载这个软件

安装完成应该如下,在基于xinetd服务中出现Telnet

[root@localhost ~]# chkconfig --list
NetworkManager  0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
#省略多项服务,确认下方有出现Telnet即表示安装上了Telnet基于 xinetd 的服务:chargen-dgram:    关闭chargen-stream:   关闭daytime-dgram:    关闭daytime-stream:   关闭discard-dgram:    关闭discard-stream:   关闭echo-dgram:       关闭echo-stream:      关闭rsync:            关闭tcpmux-server:    关闭telnet:           关闭time-dgram:       关闭time-stream:      关闭

3)xinetd服务的启动

如何查看Telnet服务是否打开?

方法:已知Telnet默认会占用23 端口,只要查询下当给钱端口被占用状况,是否有它即可

(当然,如果手动更改过,则查询更改后的端口号是否出现)

[root@localhost ~]# netstat -tlun
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 127.0.0.1:6010              0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:35531               0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN
tcp        0      0 ::1:6010                    :::*                        LISTEN
tcp        0      0 :::35778                    :::*                        LISTEN
tcp        0      0 :::111                      :::*                        LISTEN
tcp        0      0 :::22                       :::*                        LISTEN
tcp        0      0 ::1:631                     :::*                        LISTEN
tcp        0      0 ::1:25                      :::*                        LISTEN
udp        0      0 0.0.0.0:35806               0.0.0.0:*
udp        0      0 127.0.0.1:1001              0.0.0.0:*
udp        0      0 0.0.0.0:111                 0.0.0.0:*
udp        0      0 0.0.0.0:631                 0.0.0.0:*
udp        0      0 0.0.0.0:935                 0.0.0.0:*
udp        0      0 :::111                      :::*
udp        0      0 :::40589                    :::*
udp        0      0 :::935                      :::*   

如上,没有出现23端口,即Telnet默认没有打开,那怎么打开呢?

因为基于xinetd服务不是独立的rpm服务,所以无法用service 服务名 start 或restart启动

[root@localhost ~]# service telnet restart
telnet: 未被识别的服务

[root@localhost ~]# vi /etc/xinetd.d/telnet

[root@localhost ~]# vim /etc/xinetd.d/telnet # default: on
# description: The telnet server serves telnet sessions; it uses \
#       unencrypted username/password pairs for authentication.
service telnet                       #服务的名称
{flags           = REUSE      #标志位reuse,设定TCP/IP socket 可重用socket_type     = stream     #使用TCP协议数据包wait            = no         #允许多个连接同时连接user            = root       #启动服务的用户为rootserver          = /usr/sbin/in.telnetd   #服务的启动程序log_on_failure  += USERID                #登录失败后,记录用户的IDdisable         = yes        #服务不启动
}~                                                                                                                                                                                                                      

由上方最后一行可知,把该文件中的最后一行设置为no,重新启动xinetd服务才可

(特别注意,是重新启动xinetd服务,而不是直接启动Telnet)

[root@localhost ~]# vim /etc/xinetd.d/telnet # default: on
# description: The telnet server serves telnet sessions; it uses \
#       unencrypted username/password pairs for authentication.
service telnet
{flags           = REUSEsocket_type     = streamwait            = nouser            = rootserver          = /usr/sbin/in.telnetdlog_on_failure  += USERIDdisable         = no
}[root@localhost ~]#
[root@localhost ~]# service xinetd restart
停止 xinetd:                                              [失败]
正在启动 xinetd:                                          [确定]
[root@localhost ~]#
[root@localhost ~]# netstat -tlun
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 127.0.0.1:6010              0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:35531               0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN
tcp        0      0 ::1:6010                    :::*                        LISTEN
tcp        0      0 :::35778                    :::*                        LISTEN
tcp        0      0 :::111                      :::*                        LISTEN
tcp        0      0 :::22                       :::*                        LISTEN
tcp        0      0 :::23                       :::*                        LISTEN
tcp        0      0 ::1:631                     :::*                        LISTEN
tcp        0      0 ::1:25                      :::*                        LISTEN
udp        0      0 0.0.0.0:35806               0.0.0.0:*
udp        0      0 127.0.0.1:1001              0.0.0.0:*
udp        0      0 0.0.0.0:111                 0.0.0.0:*
udp        0      0 0.0.0.0:631                 0.0.0.0:*
udp        0      0 0.0.0.0:935                 0.0.0.0:*
udp        0      0 :::111                      :::*
udp        0      0 :::40589                    :::*
udp        0      0 :::935     [root@localhost ~]# chkconfig --list
NetworkManager  0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
abrt-ccpp       0:关闭    1:关闭    2:关闭    3:启用    4:关闭    5:启用    6:关闭
abrtd           0:关闭    1:关闭    2:关闭    3:启用    4:关闭    5:启用    6:关闭
acpid           0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
atd             0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
auditd          0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
autofs          0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
blk-availability    0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
bluetooth       0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
certmonger      0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
cpuspeed        0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
crond           0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
cups            0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
dnsmasq         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
firstboot       0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
haldaemon       0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
htcacheclean    0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
httpd           0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
ip6tables       0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
iptables        0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
irqbalance      0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
kdump           0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
lvm2-monitor    0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
mdmonitor       0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
messagebus      0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
netconsole      0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
netfs           0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
network         0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
nfs             0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
nfs-rdma        0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
nfslock         0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
ntpd            0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
ntpdate         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
oddjobd         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
portreserve     0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
postfix         0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
pppoe-server    0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
psacct          0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
quota_nld       0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rdisc           0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rdma            0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
restorecond     0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rngd            0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rpcbind         0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
rpcgssd         0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
rpcsvcgssd      0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
rsyslog         0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
saslauthd       0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
smartd          0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
spice-vdagentd  0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:启用    6:关闭
sshd            0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
sssd            0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
sysstat         0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
udev-post       0:关闭    1:启用    2:启用    3:启用    4:启用    5:启用    6:关闭
wdaemon         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
winbind         0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
wpa_supplicant  0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
xinetd          0:关闭    1:关闭    2:关闭    3:启用    4:启用    5:启用    6:关闭
ypbind          0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭基于 xinetd 的服务:chargen-dgram:     关闭chargen-stream:   关闭daytime-dgram:    关闭daytime-stream:   关闭discard-dgram:    关闭discard-stream:   关闭echo-dgram:       关闭echo-stream:      关闭rsync:            关闭tcpmux-server:    关闭telnet:           启用time-dgram:       关闭time-stream:      关闭

如上,可以看到23端口已经被占用,而且chkconfig --list也显示Telnet服务已经启动

如上,就是基于xinetd服务的启动方式:

先更改基于该服务的配置文件,设置为可用状态,然后service xinetd restart 即可启动

4)xinetd服务的自启动方式(自启动是指关机重启计算机,该服务是否会自行启动)

>方法一:

[root@localhost ~]# chkconfig telnet on (换成off 即表示关闭)

>方法二:

nesysv

注意:

一般的服务关闭自启动服务表示的是影响计算机关机重启后的效果,而不是当前影响

但是在基于xinetd的服务中,启动和自启动效果一致,如果关闭自启动,当前时刻

此服务也会随即关闭,这点和独立rpm服务不一样。

(独立rpm服务中,关闭自启动,只会影响本次计算机直接后继的关机重启,但在当前

状态——不关机时,该服务仍处于设置自启动关闭动作前的状态。)

4、Linux服务管理之源码包服务的管理

1)源码包安装服务的启动

》使用绝对路径,调用启动脚本来启动弄。不同的源码包的启动脚本不同。可以查看

源码包的安装说明,查看启动脚本的方法(进入安装目录,有readme install等的文件)

[root@localhost ~]# /usr/local/apache2/bin/apachectl  start | stop

2)源码包服务的自启动

[root@localhost ~]# vi /etc/rc.d/rc.local

在其中加入/usr/local/apache2/apachectl start

注:因为计算机启动时,默认会检查/etc/rc.d/rc.local 文件,执行其中的内容

[root@localhost ~]# vi /etc/rc.
rc.d/       rc.local    rc.sysinit
[root@localhost ~]# vi /etc/rc.d/
init.d/     rc0.d/      rc2.d/      rc4.d/      rc6.d/      rc.sysinit
rc          rc1.d/      rc3.d/      rc5.d/      rc.local
[root@localhost ~]# vi /etc/rc.d/rc.local #!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.touch /var/lock/subsys/local
/usr/local/apache2/bin/apachectl start

3)让源码包服务被服务管理命令识别

预读:为演示本章节学习,特意在官网下载了一个2.2.10版本的源码包,

因为当前用的centos6.5 系统不包含最新的httpd的安装依赖包,出于简单,

选择了相对旧的httpd版本。不过后期练习或者真实项目创建,会用较新的httpd版本。

源码可以通过官网下载,http://archive.apache.org/dist/httpd/

源码的安装命令补充在本文档末尾处:

》让源码包的Apache服务能被service命令管理启动

ln -s /usr/local/apache2/bin/apachectl  /etc/init.d/apache

这样就能用service命令管理

比如service httpd  start  |  stop

[root@localhost usr]# cd local/
[root@localhost local]# ls
apache2  bin  etc  games  include  lib  lib64  libexec  sbin  share  src
[root@localhost local]# cd apache2/
[root@localhost apache2]# ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  logs  man  manual  modules
[root@localhost apache2]# cd /etc/init.d/
[root@localhost init.d]# ls
abrt-ccpp         cups          killall         ntpd          rpcbind         sysstat
abrtd             dnsmasq       lvm2-lvmetad    ntpdate       rpcgssd         udev-post
abrt-oops         firstboot     lvm2-monitor    oddjobd       rpcidmapd       wdaemon
acpid             functions     mdmonitor       portreserve   rpcsvcgssd      winbind
atd               haldaemon     messagebus      postfix       rsyslog         wpa_supplicant
auditd            halt          netconsole      pppoe-server  sandbox         xinetd
autofs            htcacheclean  netfs           psacct        saslauthd       ypbind
blk-availability  httpd         network         quota_nld     single
bluetooth         ip6tables     NetworkManager  rdisc         smartd
certmonger        iptables      nfs             rdma          spice-vdagentd
cpuspeed          irqbalance    nfslock         restorecond   sshd
crond             kdump         nfs-rdma        rngd          sssd
[root@localhost init.d]# ln -s /usr/local/apache2/bin/apachectl /etc/init.d/apache
[root@localhost init.d]#
[root@localhost init.d]# ls
abrt-ccpp         crond         kdump           nfs-rdma      rngd            sssd
abrtd             cups          killall         ntpd          rpcbind         sysstat
abrt-oops         dnsmasq       lvm2-lvmetad    ntpdate       rpcgssd         udev-post
acpid             firstboot     lvm2-monitor    oddjobd       rpcidmapd       wdaemon
apache            functions     mdmonitor       portreserve   rpcsvcgssd      winbind
atd               haldaemon     messagebus      postfix       rsyslog         wpa_supplicant
auditd            halt          netconsole      pppoe-server  sandbox         xinetd
autofs            htcacheclean  netfs           psacct        saslauthd       ypbind
blk-availability  httpd         network         quota_nld     single
bluetooth         ip6tables     NetworkManager  rdisc         smartd
certmonger        iptables      nfs             rdma          spice-vdagentd
cpuspeed          irqbalance    nfslock         restorecond   sshd
[root@localhost init.d]# service apache restart
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
httpd not running, trying to start
[root@localhost init.d]# service apache start
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
httpd (pid 19723) already running
[root@localhost init.d]#

》让源码包的Apache服务能被chkconfig 与ntsysv 命令管理自启动

注意:chkconfig 命令和ntsysv 命令默认是不会识别自己创建的“apache”这个服务,

换句话说,我们需要做一些设置让chkconfig 和ntsysv 自动识别到我们自己创建的“apache”

来帮助我们通过这俩命令管理这个服务。

验证如下:

[root@localhost init.d]# ls
abrt-ccpp         crond         kdump           nfs-rdma      rngd            sssd
abrtd             cups          killall         ntpd          rpcbind         sysstat
abrt-oops         dnsmasq       lvm2-lvmetad    ntpdate       rpcgssd         udev-post
acpid             firstboot     lvm2-monitor    oddjobd       rpcidmapd       wdaemon
apache            functions     mdmonitor       portreserve   rpcsvcgssd      winbind
atd               haldaemon     messagebus      postfix       rsyslog         wpa_supplicant
auditd            halt          netconsole      pppoe-server  sandbox         xinetd
autofs            htcacheclean  netfs           psacct        saslauthd       ypbind
blk-availability  httpd         network         quota_nld     single
bluetooth         ip6tables     NetworkManager  rdisc         smartd
certmonger        iptables      nfs             rdma          spice-vdagentd
cpuspeed          irqbalance    nfslock         restorecond   sshd
[root@localhost init.d]# chkconfig --list | grep apache
[root@localhost init.d]# chkconfig --list | grep httpd
httpd           0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
[root@localhost init.d]#
#如上,未设置前,系统无法通过chkconfig识别到apache,下面将讲述如何做到让其识别

步骤一:

vi  /etc/init.d/apache

#chkconfig: 36 86 76

#指定httpd脚本可以被chkconfig命令的格式是:

chkconfig: 运行级别 启动顺序  关闭顺序

特别注意:设置的启动顺序和关闭顺序不能和当前系统中已经有的顺序一致,

那如何查看系统的运行级别和开关顺序呢?

[root@localhost init.d]# cd /etc/rc.d
[root@localhost rc.d]# ls
init.d  rc  rc0.d  rc1.d  rc2.d  rc3.d  rc4.d  rc5.d  rc6.d  rc.local  rc.sysinit
#如上看到的 rc rc0 rc1 rc2 rc3等等,分别表示不同的运行级别
#打开某个运行级别,比如rc3.d,查看,可以看到在该运行级别状态时,不同的服务
#等的启动和关闭顺序,比如k01 k73 k99等等,新添加的内容要和此处已有的不重复
[root@localhost rc.d]# cd rc3.d/
[root@localhost rc3.d]# ls
K01smartd          K73winbind         K99rngd          S13rpcbind           S28autofs
K02oddjobd         K74ntpd            S01sysstat       S15mdmonitor         S50bluetooth
K05wdaemon         K75ntpdate         S02lvm2-monitor  S22messagebus        S50kdump
K10psacct          K75quota_nld       S05rdma          S23NetworkManager    S55sshd
K10saslauthd       K76ypbind          S08ip6tables     S24nfslock           S56xinetd
K15htcacheclean    K84wpa_supplicant  S08iptables      S24rpcgssd           S80postfix
K15httpd           K87restorecond     S10network       S25blk-availability  S82abrtd
K30spice-vdagentd  K88sssd            S11auditd        S25cups              S83abrt-ccpp
K50dnsmasq         K89netconsole      S11portreserve   S25netfs             S90crond
K60nfs             K89rdisc           S12rsyslog       S26acpid             S95atd
K61nfs-rdma        K92pppoe-server    S13cpuspeed      S26haldaemon         S99certmonger
K69rpcsvcgssd      K95firstboot       S13irqbalance    S26udev-post         S99local
[root@localhost rc3.d]#

#description: source package apache

#说明,内容随意上方的启动

如下为绑定apache到 chkconfig中,具体为在/etc/init.d/apache 文件中

添加如下两句

# chkconfig:35 86 76
# description: source package apache

我是加在了命令的上方

[root@localhost rc3.d]# vim /etc/init.d/apache#!/bin/sh#
# chkconfig:35 86 76
# description: source package apache
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Apache control script designed to allow an easy command line interface
# to controlling Apache.  Written by Marc Slemko, 1997/08/23
#
# The exit codes returned are:
#   XXX this doc is no longer correct now that the interesting
#   XXX functions are handled by httpd
#       0 - operation completed successfully
#       1 -
#       2 - usage error
#       3 - httpd could not be started
#       4 - httpd could not be stopped
#       5 - httpd could not be started during a restart
#       6 - httpd could not be restarted during a restart
#       7 - httpd could not be restarted during a graceful restart
#       8 - configuration syntax error
#
# When multiple arguments are given, only the error from the _last_
# one is reported.  Run "apachectl help" for usage info
#
ARGV="$@"
#
# |||||||||||||||||||| START CONFIGURATION SECTION  ||||||||||||||||||||
# --------------------                              --------------------
#
# the path to your httpd binary, including options if necessary
HTTPD='/usr/local/apache2/bin/httpd'
#
# pick up any necessary environment variables
if test -f /usr/local/apache2/bin/envvars; then. /usr/local/apache2/bin/envvars
fi
#
# a command that outputs a formatted text version of the HTML at the
# url given on the command line.  Designed for lynx, however other
# programs may work.
LYNX="lynx -dump"
#
# the URL to your server's mod_status status page.  If you do not
# have one, then status and fullstatus will not work.
STATUSURL="http://localhost:80/server-status"
#
# Set this variable to a command that increases the maximum
# number of file descriptors allowed per child process. This is
# critical for configurations that use many file descriptors,
# such as mass vhosting, or a multithreaded server.
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
# --------------------                              --------------------
# ||||||||||||||||||||   END CONFIGURATION SECTION  ||||||||||||||||||||# Set the maximum number of file descriptors allowed per child process.
if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then$ULIMIT_MAX_FILES
fiERROR=0
if [ "x$ARGV" = "x" ] ; thenARGV="-h"
ficase $ARGV in
start|stop|restart|graceful|graceful-stop)$HTTPD -k $ARGVERROR=$?;;
startssl|sslstart|start-SSL)echo The startssl option is no longer supported.echo Please edit httpd.conf to include the SSL configuration settingsecho and then use "apachectl start".ERROR=2;;
configtest)$HTTPD -tERROR=$?;;
status)$LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } ';;
fullstatus)$LYNX $STATUSURL;;
*)$HTTPD $ARGVERROR=$?
esacexit $ERROR

步骤二:把某项服务 加到chkconfig中

[root@localhost rc3.d]#
[root@localhost rc3.d]# chkconfig --add apache
[root@localhost rc3.d]# chkconfig --list | grep apache
apache          0:关闭    1:关闭    2:关闭    3:启用    4:关闭    5:启用    6:关闭
[root@localhost rc3.d]#
#此外,此时ntsysv 命令也可管理apache
[root@localhost rc3.d]# ntsysvntsysv 1.3.49.5 - (C) 2000-2001 Red Hat, Inc. ┌────────────┤ 服务 ├────────────┐│                                │ │ 您想自动启动哪些服务?         │ │                                │ │    [*] NetworkManager    ↑     │ │    [*] abrt-ccpp         ▮     │ │    [*] abrtd             ▒     │ │    [*] acpid             ▒     │ │    [*] apache            ▒     │ │    [*] atd               ▒     │ │    [*] auditd            ▒     │ │    [*] autofs            ▒     │ │    [*] blk-availability  ▒     │ │    [*] bluetooth         ▒     │ │    [*] certmonger        ▒     │ │    [ ] chargen-dgram     ▒     │ │    [ ] chargen-stream    ▒     │ │    [*] cpuspeed          ▒     │ │    [*] crond             ▒     │ │    [*] cups              ▒     │ │    [ ] daytime-dgram     ↓     │ │                                │ │    ┌──────┐       ┌──────┐     │ │    │ 确定 │       │ 取消 │     │ │    └──────┘       └──────┘     │ │                                │ │                                │ └────────────────────────────────┘ 按 <F1> 可获取关于某项服务的详情。

如上,即实现了把 源码包安装的服务,通过chkconfig  和ntsysv命令进行了管理

5、服务管理总结

        1、使用/etc/init.d/目录中脚本启动服务如:/etc/init.d/httpd start | stop | restart
      1、启动  
        2、使用service命令启动服务,如:service httpd start | stop |restart
    1、独立的服务    
        1)使用chkconfig命令管理自启动,如:chkconfig --level 2345 httpd on |off
         
      2、自启动 2)修改/etc/rc.d/rc.local 文件,如:vi /etc/rc.d/rc.local  加入:/etc/init.d/httpd start
         
        3)使用ntsysv 命令管理服务的自启动
  1、RPM包默认安装的服务      
      1)启动 修改/etc/xinetd.d配置文件 如:vi /etc/xinetd.d/telnet 把disable=yes改为no 启动基于xinetd服务统一为:service xinetd start
    2、基于xinetd服务    
        1)使用chkconfig命令管理自启动,如:chkconfig Telnet on | off
      2)自启动
        2)使用ntsysv 命令管理服务自启动
         
Linux服务      
         
    启动:使用源码包自动脚本启动服务 如:/usr/local/apache2/bin/apachectl start
  2、源码包安装的服务      
    自启动:修改/etc/rc.d/rc.local文件 如:vi /etc/rc.d/rc.local 加入:/usr/local/apache2/bin/apachectl start

注:/etc/rc.d/rc.local 配置文件是在用户输入用户名和密码之前读取

而环境变量配置文件是在用户输入用户明和密码之后读取

扩展:服务管理优化,最常见的就是关闭不必要的服务

常见服务目录

服务名称 功能简介 建议
scpid 电源管理接口。如果是笔记本用户建议开启,可以监听内核层的相关电源事件  
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

附:如下为利用源码包安装httpd的过程

[root@localhost ~]# cp /root/下载/httpd-2.2.10.tar.bz2 /usr/local/src/
[root@localhost src]# tar -xjvf httpd-2.2.10.tar.bz2
[root@localhost src]# ls
httpd-2.2.10  httpd-2.2.10.tar.bz2
[root@localhost src]# cd httpd-2.2.10
[root@localhost httpd-2.2.10]# ls
ABOUT_APACHE      BuildBin.dsp   docs         InstallBin.dsp  modules           ROADMAP
acinclude.m4      buildconf      emacs-style  LAYOUT          NOTICE            server
Apache.dsw        CHANGES        httpd.dsp    libhttpd.dsp    NWGNUmakefile     srclib
apachenw.mcp.zip  config.layout  httpd.spec   LICENSE         os                support
build             configure      include      Makefile.in     README            test
BuildAll.dsp      configure.in   INSTALL      Makefile.win    README.platforms  VERSIONING
[root@localhost httpd-2.2.10]# ./configure --prefix=/usr/local/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnuConfiguring Apache Portable Runtime library ...checking for APR... yessetting CC to "gcc"setting CPP to "gcc -E"setting CFLAGS to "  -pthread"setting CPPFLAGS to " -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE"setting LDFLAGS to " "Configuring Apache Portable Runtime Utility library...checking for APR-util... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
configure: Configuring PCRE regular expression library
configuring package in srclib/pcre now
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking for bcopy... yes
checking for memmove... yes
checking for strerror... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating pcre.h
config.status: creating pcre-config
config.status: creating config.h
config.status: executing default commands
srclib/pcre configured properlysetting AP_LIBS to "/usr/local/src/httpd-2.2.10/srclib/pcre/libpcre.la"setting INCLUDES to "-I$(top_builddir)/srclib/pcre"Configuring Apache httpd ...adding "-I." to INCLUDESadding "-I$(top_srcdir)/os/$(OS_DIR)" to INCLUDESadding "-I$(top_srcdir)/server/mpm/$(MPM_SUBDIR_NAME)" to INCLUDESadding "-I$(top_srcdir)/modules/http" to INCLUDESadding "-I$(top_srcdir)/modules/filters" to INCLUDESadding "-I$(top_srcdir)/modules/proxy" to INCLUDESadding "-I$(top_srcdir)/include" to INCLUDESadding "-I$(top_srcdir)/modules/generators" to INCLUDESadding "-I$(top_srcdir)/modules/mappers" to INCLUDESadding "-I$(top_srcdir)/modules/database" to INCLUDESadding "-I/usr/include/apr-1" to INCLUDESApplying OS-specific hints for httpd ...forcing SINGLE_LISTEN_UNSERIALIZED_ACCEPT to "1"forcing AP_NONBLOCK_WHEN_MULTI_LISTEN to "1"
checking for rm... /bin/rm
checking for pkg-config... /usr/bin/pkg-config
checking for rsync... /usr/bin/rsync
checking for gawk... gawk
checking whether ln -s works... yes
checking for ranlib... ranlib
checking for lynx... no
checking for links... no
checking for elinks... no
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for AIX... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for library containing strerror... none required
checking for APR version 1.2.0 or later... yes
checking for APR-util version 1.2.0 or later... yes
checking for ANSI C header files... (cached) yes
checking for string.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for unistd.h... (cached) yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking grp.h usability... yes
checking grp.h presence... yes
checking for grp.h... yes
checking for strings.h... (cached) yes
checking sys/prctl.h usability... yes
checking sys/prctl.h presence... yes
checking for sys/prctl.h... yes
checking sys/processor.h usability... no
checking sys/processor.h presence... no
checking for sys/processor.h... no
checking sys/sem.h usability... yes
checking sys/sem.h presence... yes
checking for sys/sem.h... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for an ANSI C-conforming const... yes
checking for library containing sqrt... -lm
checking for getpwnam... yes
checking for getgrnam... yes
checking for initgroups... yes
checking for bindprocessor... no
checking for prctl... yes
checking for timegm... yes
checking for getpgid... yes
checking for void pointer length... no
checking for tm_gmtoff in struct tm... yes
checking whether to enable mod_authn_file... yes (default)
checking whether to enable mod_authn_dbm... no
checking whether to enable mod_authn_anon... no
checking whether to enable mod_authn_dbd... no
checking whether to enable mod_authn_default... yes (default)
checking whether to enable mod_authn_alias... no
checking whether to enable mod_authz_host... yes (default)
checking whether to enable mod_authz_groupfile... yes (default)
checking whether to enable mod_authz_user... yes (default)
checking whether to enable mod_authz_dbm... no
checking whether to enable mod_authz_owner... no
checking whether to enable mod_authnz_ldap... no
checking whether to enable mod_authz_default... yes (default)
checking whether to enable mod_auth_basic... yes (default)
checking whether to enable mod_auth_digest... no
checking whether to enable mod_isapi... no
checking whether to enable mod_file_cache... no
checking whether to enable mod_cache... no
checking whether to enable mod_disk_cache... no
checking whether to enable mod_mem_cache... no
checking whether to enable mod_dbd... no
checking whether to enable mod_bucketeer... no
checking whether to enable mod_dumpio... no
checking whether to enable mod_echo... no
checking whether to enable mod_example... no
checking whether to enable mod_case_filter... no
checking whether to enable mod_case_filter_in... no
checking whether to enable mod_ext_filter... no
checking whether to enable mod_include... yes (default)
checking whether to enable mod_filter... yes (default)
checking whether to enable mod_substitute... no
checking whether to enable mod_charset_lite... no
checking whether to enable mod_deflate... no
checking whether to enable mod_ldap... no
checking whether to enable mod_log_config... yes (default)
checking whether to enable mod_log_forensic... no
checking whether to enable mod_logio... no
checking whether to enable mod_env... yes (default)
checking whether to enable mod_mime_magic... no
checking whether to enable mod_cern_meta... no
checking whether to enable mod_expires... no
checking whether to enable mod_headers... no
checking whether to enable mod_ident... no
checking whether to enable mod_usertrack... no
checking whether to enable mod_unique_id... no
checking whether to enable mod_setenvif... yes (default)
checking whether to enable mod_version... no
checking whether to enable mod_proxy... no
checking whether to enable mod_proxy_connect... no
checking whether to enable mod_proxy_ftp... no
checking whether to enable mod_proxy_http... no
checking whether to enable mod_proxy_ajp... no
checking whether to enable mod_proxy_balancer... noadding "-I$(top_srcdir)/modules/proxy/../generators" to INCLUDES
checking whether to enable mod_ssl... noadding "-I$(top_srcdir)/modules/ssl" to INCLUDES
checking whether to enable mod_optional_hook_export... no
checking whether to enable mod_optional_hook_import... no
checking whether to enable mod_optional_fn_import... no
checking whether to enable mod_optional_fn_export... no
checking for target platform... unix
checking for rlim_t... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking for sys/sem.h... (cached) yes
checking sys/ipc.h usability... yes
checking sys/ipc.h presence... yes
checking for sys/ipc.h... yes
checking for setsid... yes
checking for killpg... yes
checking bstring.h usability... no
checking bstring.h presence... no
checking for bstring.h... no
checking for unistd.h... (cached) yes
checking for syslog... yes
checking sys/times.h usability... yes
checking sys/times.h presence... yes
checking for sys/times.h... yes
checking for times... yes
checking which MPM to use... prefork
checking whether to enable mod_http... yes
checking whether to enable mod_mime... yes (default)
checking for extra modules... none
checking whether to enable mod_dav... noadding "-I$(top_srcdir)/modules/dav/main" to INCLUDES
checking whether to enable mod_status... yes (default)
checking whether to enable mod_autoindex... yes (default)
checking whether to enable mod_asis... yes (default)
checking whether to enable mod_info... no
checking whether to enable mod_suexec... no
checking whether to enable mod_cgi... yes (default)
checking whether to enable mod_cgid... no
checking whether to enable mod_dav_fs... no
checking whether to enable mod_dav_lock... no
checking whether to enable mod_vhost_alias... no
checking whether to enable mod_negotiation... yes (default)
checking whether to enable mod_dir... yes (default)
checking whether to enable mod_imagemap... no
checking whether to enable mod_actions... yes (default)
checking whether to enable mod_speling... no
checking whether to enable mod_userdir... yes (default)
checking whether to enable mod_alias... yes (default)
checking whether to enable mod_rewrite... nosetting HTTPD_LDFLAGS to "-export-dynamic"
checking whether to enable mod_so... yesRestore user-defined environment settings...restoring CPPFLAGS to ""setting EXTRA_CPPFLAGS to " -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE"restoring CFLAGS to ""setting EXTRA_CFLAGS to "  -pthread"restoring CXXFLAGS to ""setting EXTRA_CXXFLAGS to ""restoring LDFLAGS to ""setting EXTRA_LDFLAGS to " "restoring LIBS to ""setting EXTRA_LIBS to "-lm "restoring INCLUDES to ""setting EXTRA_INCLUDES to "-I$(top_builddir)/srclib/pcre -I. -I$(top_srcdir)/os/$(OS_DIR) -I$(top_srcdir)/server/mpm/$(MPM_SUBDIR_NAME) -I$(top_srcdir)/modules/http -I$(top_srcdir)/modules/filters -I$(top_srcdir)/modules/proxy -I$(top_srcdir)/include -I$(top_srcdir)/modules/generators -I$(top_srcdir)/modules/mappers -I$(top_srcdir)/modules/database -I/usr/include/apr-1 -I$(top_srcdir)/modules/proxy/../generators -I$(top_srcdir)/modules/ssl -I$(top_srcdir)/modules/dav/main"Construct makefiles and header files...creating config_vars.mk
configure: creating ./config.status
creating modules/aaa/Makefile
creating modules/arch/win32/Makefile
creating modules/cache/Makefile
creating modules/database/Makefile
creating modules/debug/Makefile
creating modules/echo/Makefile
creating modules/experimental/Makefile
creating modules/filters/Makefile
creating modules/ldap/Makefile
creating modules/loggers/Makefile
creating modules/metadata/Makefile
creating modules/proxy/Makefile
creating modules/ssl/Makefile
creating modules/test/Makefile
creating os/unix/Makefile
creating server/mpm/Makefile
creating server/mpm/prefork/Makefile
creating modules/http/Makefile
creating modules/dav/main/Makefile
creating modules/generators/Makefile
creating modules/dav/fs/Makefile
creating modules/dav/lock/Makefile
creating modules/mappers/Makefile
creating Makefile
creating modules/Makefile
creating srclib/Makefile
creating os/Makefile
creating server/Makefile
creating support/Makefile
creating srclib/pcre/Makefile
creating test/Makefile
config.status: creating docs/conf/httpd.conf
config.status: creating docs/conf/extra/httpd-autoindex.conf
config.status: creating docs/conf/extra/httpd-dav.conf
config.status: creating docs/conf/extra/httpd-default.conf
config.status: creating docs/conf/extra/httpd-info.conf
config.status: creating docs/conf/extra/httpd-languages.conf
config.status: creating docs/conf/extra/httpd-manual.conf
config.status: creating docs/conf/extra/httpd-mpm.conf
config.status: creating docs/conf/extra/httpd-multilang-errordoc.conf
config.status: creating docs/conf/extra/httpd-ssl.conf
config.status: creating docs/conf/extra/httpd-userdir.conf
config.status: creating docs/conf/extra/httpd-vhosts.conf
config.status: creating include/ap_config_layout.h
config.status: creating support/apxs
config.status: creating support/apachectl
config.status: creating support/dbmmanage
config.status: creating support/envvars-std
config.status: creating support/log_server_status
config.status: creating support/logresolve.pl
config.status: creating support/phf_abuse_log.cgi
config.status: creating support/split-logfile
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
[root@localhost httpd-2.2.10]# make
#如上为编译,编译的执行结果会自动显示很多内容,此处省略,只要中间无错误提示,
#命令自动停止,则表示安装成功,接下来就可以进行下一步安装;如果中间出错,直接
#make clean 即可无需更多操作(该命令执行完,不会有任何多余垃圾)
[root@localhost httpd-2.2.10]# make install
#如上命令执行时,才会有内容写入到apache2路径下

Linux学习基础之Linux服务管理相关推荐

  1. LINUX学习基础篇(十五)软件包管理

    LINUX学习基础篇(十五)软件包管理 软件包管理 软件包分类 源码包 二进制包 选择 依赖性 rpm包安装 rpm包命名规则 rpm包安装和卸载 服务命令 rpm查询命令 验证 数字证书 rpm中文 ...

  2. LINUX学习基础篇(三十五)日志管理

    LINUX学习基础篇(三十五)日志管理 日志管理 系统中常见的日志文件 日志文件格式 rsyslogd服务的配置文件 日志轮替 logrotate配置文件 配置文件夹 /etc/logrotate.d ...

  3. LINUX学习基础篇(十七)用户与用户组

    LINUX学习基础篇(十七)用户与用户组 用户相关文件 /etc/passwd 用户信息文件 /etc/shadow 影子文件 /etc/group 组信息文件 其他用户有关文件 用户管理命令 use ...

  4. archlinux grub启动无win7_CentOS Linux操作系统各种启动和服务管理

    CentOS7.3学习笔记总结(六十七)- CentOS Linux操作系统各种启动和服务管理 linux启动流程: CentOS5.6: 开机主板自检-MBR引导-装在GRUB-加载内核-Init进 ...

  5. LINUX学习基础篇(十二)痕迹命令

    LINUX学习基础篇(十二)痕迹命令 系统痕迹命令 w命令 who命令 last命令 lastlog命令 lastb命令 系统痕迹命令 系统中有一些重要的痕迹日志文件,如/var/log/wtmp./ ...

  6. Linux 第九章-系统进程和服务管理

    Linux 第九章-系统进程和服务管理 1.管理Linux进程 ​ 进程是操作系统中非常基本的概念,在系统运维管理中经常设计到对进程的管理. 1.1.什么是进程 ​ 我们在系统中运行的所有文件都是通过 ...

  7. 【Linux学习笔记】Linux服务器:配置与管理samba服务器

    Linux系列文章目录 一.[linux学习笔记]红帽Linux 7.8系统在虚拟机上的安装 二.[Linux学习笔记]Linux系统的基本操作 三.[Linux学习笔记]管理Linux操作系统:用户 ...

  8. linux目录表及功能n鸟哥,鸟哥linux学习之-资料与目录管理

    鸟哥linux学习之--文件与目录管理 目录与路径 相对路径:由当前目录算起 绝对路径:由根目录算起,linux的根目录为"/" 几个目录符号: . 表示当前目录 .. 表示上一层 ...

  9. LINUX学习基础篇(六)帮助命令

    LINUX学习基础篇(六)帮助命令 帮助命令 man(Manual) info help - -help 帮助命令 man(Manual) 作用:查看联机帮助手册. 执行权限:所有用户. man命令的 ...

  10. LINUX学习基础篇(三十三)系统资源

    LINUX学习基础篇(三十三)系统资源 系统资源查看 vmstat命令监控系统资源 dmesg显示开机时内核检测信息 free命令查看内存使用状态 查看CPU信息 查看内存信息 查看当前登录的用户 u ...

最新文章

  1. 还在苦恼机器学习和线性回归?这篇总结拿走不谢 | 原力计划
  2. 深度学习有哪些经典数据集?
  3. 2021年机器学习的下一步是什么?
  4. 《C语言及程序设计》实践参考——分数的累加
  5. 渗透工具开发——XSS平台的命令行实现
  6. POJ - 2002 Squares 数正方形【二分】【哈希表】
  7. 读写应用程序数据-NSUserDefault、对象归档(NSKeyedArchiver)、文件操作
  8. python:lambda、filter、map、reduce
  9. 【Socket】关于socket长连接的心跳包
  10. linux shell 基本规范
  11. IplImage 加载图像
  12. 计算机辅助设计和工程图学,工程制图与计算机辅助设计
  13. recv函数的返回值梳理
  14. arduino-解决舵机与直流电机冲突问题
  15. 怎样在matlab中使用多项式,MATLAB中的多项式运算
  16. 使用Python进行12306抢票
  17. itunes计算机无法启动,itunes无法成功更新后无法打开
  18. EXCEL数据分析——分列
  19. 林轩田机器学习基石--The Learning Problem
  20. 3 年9.9元,网站从HTTP升级到HTTPS

热门文章

  1. 求助帖 就是它()=Compaq Visual Fortran
  2. 目标检测之分类、回归和损失函数
  3. DR和乳腺(MG)的挂片方位描述
  4. 关于MIUI中cit.apk暴露bugreport的漏洞
  5. 小程序中如何核销订单和优惠券
  6. 发作性睡病有哪些特点?
  7. Siggraph I3D 2022
  8. Redis的五种常用数据类型、三种特殊数据类型详解
  9. 【分享篇】谷胱甘肽化蛋白的分析方法小结
  10. 基于Win10的Ubuntu16.04双系统安装方法