改动时间
2020-3-12 21:15:17
自己常用
1 | # 软链接【建立软链接到环境变量路径中,查看环境变量`echo $PATH`。注意:追加到root下,普通用户是访问不了的】 |
服务的分类
- Linux服务
1
2
3
41. RPM包默认安装的服务
+ 独立的服务
+ 基于xinetd服务
2. 源码包安装的服务
- RPM包与源码包的安装服务的区别就是安装位置不同
1
2
3
4
5
6
7
8
9* 源码包一般在`/usr/local/`
* RPM包安装在默认位置
+ `/etc/init.d/`
+ `/etc/sysconfig/`初始化环境配置文件位置
+ `/etc/`配置文件位置
+ `/etc/xinetd.conf`xinetd配置文件
+ `/etc/xinetd.d/`基于xinetd服务的启动脚本
+ `/var/lib/`服务产生的数据放在这里
+ `/var/log/`日志
init.d和rc.local
- rc.local
/etc/rc.d/rc.local
用于添加开机启动命令,/etc/rc.local
是/etc/rc.d/rc.local
的软连接 - service命令其实是去执行
/etc/init.d
目录下的程序。/etc/init.d
是/etc/rc.d/init.d
的硬连接
service
1 | # 把服务添加到service服务中 |
systemctl
systemctl命令兼容了service。意思就是systemctl也会去/etc/init.d目录下,查看,执行相关程序
我认为:就不用去了解systemctl了。使用service就行了。
systemd是Linux系统最新的初始化系统(init),作用是提高系统的启动速度,尽可能启动较少的进程,尽可能更多进程并发启动。
systemd对应的进程管理命令是systemctl,位置是/etc/systemd
1 | 1. 列出所有可用单元 |
chkconfig
设置开机启动
1 | [root@localhost ~]$ ls /etc/init.d/httpd # /etc/init.d/目录下必须有启动脚本 |
1 | [root@localhost ~]$ chkconfig --list # 列出所有被chkconfig管理的服务 |
1 | [root@localhost ~]$ chkconfig --list # 等级0:关机 |