一 RPM包安装服务的位置
1、RPM安装服务和源码包安装服务的区别就是安装位置的不同
源码包安装在指定位置,一般是/usr/local
RPM包安装在默认位置中,不需要人为手动指定安装目录,是写这个RPM包的作者规定的位置。
所谓的默认位置,一般为下面这些目录
![](http://dl2.iteye.com/upload/attachment/0126/7904/196d928f-b743-3565-87c6-882bd4ce6a69.png)
注意:usr是Unix System Resource,即Unix系统资源的缩写。
二 独立服务的启动
1、Linux通用启动方式
/etc/init.d/独立服务名 start|stop|status|restart
2、redhat系列启动方式
service 独立服务名 start|stop|restart|status
三 实战
[root@localhost ~]# service httpd status
Redirecting to /bin/systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2017-07-16 10:43:02 CST; 6min ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 5192 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─5192 /usr/sbin/httpd -DFOREGROUND
├─5198 /usr/sbin/httpd -DFOREGROUND
├─5199 /usr/sbin/httpd -DFOREGROUND
├─5200 /usr/sbin/httpd -DFOREGROUND
├─5201 /usr/sbin/httpd -DFOREGROUND
└─5202 /usr/sbin/httpd -DFOREGROUND
Jul 16 10:43:02 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Jul 16 10:43:02 localhost.localdomain httpd[5192]: AH00558: httpd: Could not reliably determine the server's fully ...ssage
Jul 16 10:43:02 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
四 独立服务自启动
1、第一种方法
chkconfig [--level 运行级别] [独立服务名] [on|off]
2、第二种方法
修改/etc/rc.d/rc.local文件
3、使用npsysv命令管理自启动