zoukankan      html  css  js  c++  java
  • linux 学习第十三天(screen不间断会话、apache服务、SELinux安全子系统)

    一、screen 命令不间断会话

    1、安装screen(从系统镜像作为yum仓库安装)

    1.1、加载系统镜像

    1.2、mount /dev/cdrom /media/cdrom/  (挂在系统镜像)

    vim /etc/fstab  (添加开机启动项)

    1.3、yum仓库配置

    1.3.1、挂载系统镜像

    1.3.2、编辑yum仓库配置文件

    1.3.3、yum install 软件包名称

    yum install screen

    二、apache服务

     

    Apache  显示默认页面 1、网站内没有数据 2、权限不足,受到控制

    网站默认保存位置  cd /var/www/html/

    主配置文件: /etc/服务名称/服务名称.conf

    创建网站index首页

    echo "my house" > index.html  (创建index文件)

    systemctl restart httpd  (重启httpd服务)

    systemctl enable httpd  (将httpd服务添加到启动项)

    修改网站保存路径为/home/wwwroot

    echo "welcome to wwwroot" > /home/wwwroot/index.html

     

    vim /etc/httpd/conf/httpd.conf

     

    systemctl restart httpd

    systemctl enable httpd

    网页页面显示

    关闭SELinux

    setenforce 0(临时关闭SELinux)

    三、SELinux 安全子系统配置

     

    setenforce 0(临时关闭SELinux) setenforce 1(临时开启SELinux)

    SELinux分为两个部分:SELinux 域 SELinux安全上下文

     

    查看目录SELinux安全上下文

     

    ls -lZd wwwroot/

    配置/home/wwwroot SELinux 权限(修改安全上下文)

    semanage fcontext -a -t httpd_sys_content_t /home/wwwroot(对目录修改)

    semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/*(对所有文件进行修改)

     

    restorecon -Rv /home/wwwroot  (恢复,配置立即生效)

    四、添加用户主页

     

    vim /etc/httpd/conf.d/userdir.conf  (注释第17行,开启第24行)

    su - dream

    mkdir public_html

    vim public_html/index.html

    chmod -Rf 755 ~

     

    su - root

    systemctl restart httpd

    systemctl enable httpd

     

    报错处理

    getsebool -a | grep http (查看SELinux)

    setsebool -P httpd_enable_homedirs=on

     

    五、个人用户添加密码

     

    htpasswd -c /etc/httpd/passwd test

     

    vim /etc/httpd/conf.d/userdir.conf

     

    systemctl restart httpd

     

  • 相关阅读:
    人月神话阅读笔记01
    Map Reduce数据清洗及Hive数据库操作
    Hadoop实验六——MapReduce的操作
    假期第九周学习记录
    假期第八周学习记录
    假期第七周学习记录
    hadoop不在sudoers文件中。此事将被报告。 解决方法
    假期第六周学习记录
    2021寒假(22)
    2021寒假(21)
  • 原文地址:https://www.cnblogs.com/rise-home/p/10565643.html
Copyright © 2011-2022 走看看