实验6网络服务器的基本配置.doc

PAGE 2 实验六 网络服务器的基本配置 一.?? 实验目的: 1.掌握service、chkconfig命令的使用方法; 2.掌握linux防火墙的开启和关闭的方法; 3.掌握selinux的开启和关闭的方法; 4.掌握Apache服务器的基本配置和搭建方法; 二.?? 实验环境: Red?Hat?Enterprise?Linux?6以上 三.??? 实验内容: 1.service、chkconfig命令的使用方法; 2.linux防火墙的开启和关闭的方法; 3.selinux的开启和关闭的方法; 4.Apache服务器的基本配置和搭建方法; 四、 实验练习: 1、service、chkconfig命令的使用方法 service命令 格式:service 服务名 start | stop | restart | status 功能:启用、停止、重启指定的服务,或查看指定服务的状态。 service命令本身是一个shell脚本,它在/etc/init.d/目录下查找指定的服务脚本,然后调用服务脚本完成任务。 如果你的执行命令为service mysqld stop,那么就相当于执行了/etc/init.d/mysqld stop 这个命令不是在所有的linux发行版本中都有。 [root@localhost ~]# service httpd status httpd 已停 [root@localhost ~]# service httpd start 正在启动 httpd:httpd: Could not reliably determine the servers fully qualified domain name, using localhost.localdomain for ServerName [确定] [root@localhost ~]# service httpd status httpd (pid 2660) 正在运行... [root@localhost ~]# service httpd restart 停止 httpd: [确定] 正在启动 httpd:httpd: Could not reliably determine the servers fully qualified domain name, using localhost.localdomain for ServerName [确定] chkconfig命令 格式:chkconfig [选项] [服务名] [on | off ] 功能:设置服务开机自动启用,用于查看、设置服务的运行级别。 注:chkconfig命令必须重启后才会生效。 [root@localhost ~]# cat /etc/inittab # inittab is only used by upstart for the default runlevel. # …… # Default runlevel. The runlevels used are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # id:5:initdefault: #查看开机是否自动启用httpd服务: [root@localhost ~]# chkconfig --list httpd httpd 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭 #设置开机自动启用httpd服务: [root@localhost ~]# chkconfig httpd on [root@localhost ~]# chkconfig --list httpd httpd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭 #设置运行级别为2

文档评论(0)

1亿VIP精品文档

相关文档