• 安装脚本文件夹


    内容:

    #1.Samba_yum安装脚本
    #2.httpd_源码包安装脚本
    

    #1.Samba_yum安装脚本

    #!/bin/bash
    #Samba安装脚本
    
    [ -d /abcs/shared ] || mkdir -p /abcs/shared
    rpm -qa | grep samba-4. &>/dev/null
    
    if [ $? -eq  1 ] 
    then 
      yum install samba -y &>/dev/null
    fi
    
    systemctl start smb
    systemctl status smb
    
    #创建用于访问共享资源的账户信息。账户必须在当前系统已经存在
    id sambaUser
    if [ $? -eq  1 ] 
    then 
      groupadd sambaUser &>/dev/null
      useradd -g sambaUser sambaUser &>/dev/null
      echo "sambaUser User has been created."
    else
      echo "sambaUser User has been created."
    fi
    
    pdbedit -a -u sambaUser
    
    
    #文件读写权限的问题,还需要考虑应用于该目录的SELinux安全上下文所带来的限制
    chown -Rf sambaUser:sambaUser /abcs/shared
    semanage fcontext -a -t samba_share_t /abcs/shared
    restorecon -Rv /abcs/shared
    
    #设置SELinux服务与策略,使其允许通过Samba服务程序访问普通用户家目录
    setsebool -P samba_enable_home_dirs on
    getsebool -a | grep samba
    
    
    #在Samba服务程序的主配置文件中,追加共享文件夹配置参数信息
    cd /etc/samba/
    echo "[database]" >> smb.conf
    echo "comment = Do not arbitrarily modify the database file" >> smb.conf
    echo "path = /abcs/shared" >> smb.conf
    echo "public = on" >> smb.conf
    echo "writable = yes" >> smb.conf
    
    
    #重启Samba服务并加入开机启动项。为避免防火墙妨碍,清空iptables防火墙
    systemctl restart smb
    systemctl enable smb
    
    iptables -F
    

    运行情况

    [root@mytest001 202204]# sh sambaInstall.sh
    ● smb.service - Samba SMB Daemon
    Loaded: loaded (/usr/lib/systemd/system/smb.service; disabled; vendor preset: disabled)
    Active: active (running) since 四 2022-04-28 22:40:33 CST; 54ms ago
    Docs: man:smbd(8)
    man:samba(7)
    man:smb.conf(5)
    Main PID: 11211 (smbd)
    Status: "smbd: ready to serve connections..."
    Tasks: 5
    CGroup: /system.slice/smb.service
    ├─11211 /usr/sbin/smbd --foreground --no-process-group
    ├─11213 /usr/sbin/smbd --foreground --no-process-group
    ├─11214 /usr/sbin/smbd --foreground --no-process-group
    ├─11216 /usr/sbin/smbd --foreground --no-process-group
    └─11217 /usr/sbin/smbd --foreground --no-process-group

    4月 28 22:40:29 mytest001 systemd[1]: Starting Samba SMB Daemon...
    4月 28 22:40:33 mytest001 smbd[11211]: [2022/04/28 22:40:33.446850, 0] ../../lib/util/become_daemon.c:136(daemon_ready)
    4月 28 22:40:33 mytest001 smbd[11211]: daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
    4月 28 22:40:33 mytest001 systemd[1]: Started Samba SMB Daemon.
    id: sambaUser: no such user
    sambaUser User has been created.
    new password:
    retype new password:
    Unix username: sambaUser
    NT username:
    Account Flags: [U ]
    User SID: S-1-5-21-1844027821-2317543029-3027736436-1000
    Primary Group SID: S-1-5-21-1844027821-2317543029-3027736436-513
    Full Name:
    Home Directory: \mytest001\sambauser
    HomeDir Drive:
    Logon Script:
    Profile Path: \mytest001\sambauser\profile
    Domain: MYTEST001
    Account desc:
    Workstations:
    Munged dial:
    Logon time: 0
    Logoff time: 三, 06 2月 2036 23:06:39 CST
    Kickoff time: 三, 06 2月 2036 23:06:39 CST
    Password last set: 四, 28 4月 2022 22:41:16 CST
    Password can change: 四, 28 4月 2022 22:41:16 CST
    Password must change: never
    Last bad password : 0
    Bad password count : 0
    Logon hours : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    restorecon reset /abcs/shared context unconfined_u:object_r:default_t:s0->unconfined_u:object_r:samba_share_t:s0
    samba_create_home_dirs --> off
    samba_domain_controller --> off
    samba_enable_home_dirs --> on
    samba_export_all_ro --> off
    samba_export_all_rw --> off
    samba_load_libgfapi --> off
    samba_portmapper --> off
    samba_run_unconfined --> off
    samba_share_fusefs --> off
    samba_share_nfs --> off
    sanlock_use_samba --> off
    tmpreaper_use_samba --> off
    use_samba_home_dirs --> off
    virt_use_samba --> off
    Created symlink from /etc/systemd/system/multi-user.target.wants/smb.service to /usr/lib/systemd/system/smb.service.


    samba服务脚本运行成功,可以使用服务;
    目前没发现问题,后续使用时观察改进。
    


    #2.httpd_源码包安装脚本

    #!/bin/bash
    # httpd-2.4.46
    
    # create apache files
    mkdir  /usr/src/apache_tar_gz
    
    
    # centos yi_lai
    yum -y install make gcc gcc-c++ kernel-devel m4  ncurses-devel openssl-devel expat-devel
    
    # install apr
    cd /usr/src/apache_tar_gz
    wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gz
    tar zxf apr-1.7.0.tar.gz
    cd ./apr-1.7.0
    ./configure --prefix=/usr/local/apr
    make && make install
    
    # install apr-util
    cd /usr/src/apache_tar_gz
    wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
    tar zxf apr-util-1.6.1.tar.gz
    cd ./apr-util-1.6.1
    ./configure --prefix=/usr/local/apr-util \
      --with-apr=/usr/local/apr
    make && make install
    
    # install zlib
    cd /usr/src/apache_tar_gz
    wget https://zlib.net/fossils/zlib-1.2.11.tar.gz
    tar zxf zlib-1.2.11.tar.gz
    cd ./zlib-1.2.11
    ./configure --prefix=/usr/local/zlib
    make && make install
    
    # install pcre
    cd /usr/src/apache_tar_gz
    wget https://sourceforge.net/projects/pcre/files/pcre/8.44/pcre-8.44.tar.gz
    tar zxf pcre-8.44.tar.gz
    cd ./pcre-8.44
    ./configure --prefix=/usr/local/pcre
    make && make install
    
    # install openssl
    cd /usr/src/apache_tar_gz
    wget https://ftp.openssl.org/source/openssl-1.1.1j.tar.gz
    tar zxf openssl-1.1.1j.tar.gz
    cd ./openssl-1.1.1j
    ./config -fPIC --prefix=/usr/local/openssl enable-shared
    make && make install
    
    
    # install httpd
    cd /usr/src/apache_tar_gz
    wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.53.tar.gz
    tar zxf httpd-2.4.53.tar.gz
    cd ./httpd-2.4.53
    cp -r ../apr-1.7.0 srclib/apr
    cp -r ../apr-util-1.6.1 srclib/apr-util
    ./configure --prefix=/usr/local/httpd \
      --enable-so \
      --enable-cgi \
      --enable-cgid \
      --enable-ssl \
      --with-ssl=/usr/local/openssl \
      --enable-rewrite \
      --with-pcre=/usr/local/pcre \
      --with-z=/usr/local/zlib \
      --with-apr=/usr/local/apr \
      --with-apr-util=/usr/local/apr-util \
      --enable-modules=most \
      --enable-mods-shared=most \
      --enable-mpms-shared=all \
      --with-mpm=event \
      --enable-proxy \
      --enable-proxy-fcgi \
      --enable-expires \
      --enable-deflate \
      --with-included-apr
    make && make install
    
    # 
    ln -s /usr/local/httpd/bin/* /usr/local/bin
    
    cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
    echo "# chkconfig: 35 85 85
    # description: apache 2.4.53" >> /etc/init.d/httpd
    chkconfig --add httpd
    
    
    
    echo "__end__"
    

    运行情况

    [root@myhost002 httpd-2.4.53]# which httpd
    /usr/local/bin/httpd
    [root@myhost002 httpd-2.4.53]# systemctl start httpd
    [root@myhost002 httpd-2.4.53]# systemctl status httpd
    ● httpd.service - SYSV: apache 2.4.53
    Loaded: loaded (/etc/rc.d/init.d/httpd; bad; vendor preset: disabled)
    Active: active (running) since 三 2022-05-25 13:50:45 CST; 1min 53s ago
    Docs: man:systemd-sysv-generator(8)
    Process: 78172 ExecStart=/etc/rc.d/init.d/httpd start (code=exited, status=0/SUCCESS)
    Tasks: 82
    CGroup: /system.slice/httpd.service
    ├─78185 /usr/local/httpd/bin/httpd -k start
    ├─78188 /usr/local/httpd/bin/httpd -k start
    ├─78189 /usr/local/httpd/bin/httpd -k start
    └─78190 /usr/local/httpd/bin/httpd -k start

    5月 25 13:50:33 myhost002 systemd[1]: Starting SYSV: apache 2.4.53...
    5月 25 13:50:45 myhost002 httpd[78172]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::c23e:7df:9017:19a6%ens33. Set the 'ServerName' direc...s this message
    5月 25 13:50:45 myhost002 systemd[1]: Started SYSV: apache 2.4.53.
    Hint: Some lines were ellipsized, use -l to show in full.
    [root@myhost002 httpd-2.4.53]#
    [root@myhost002 httpd-2.4.53]#




  • 相关阅读:
    【转】《基于MFC的OpenGL编程》Part 5 Transformations Rotations, Translations and Scaling
    【转】 《基于MFC的OpenGL编程》Part 10 Texture Mapping
    【转】 《基于MFC的OpenGL编程》Part 11 Blending, Antialiasing and Fog
    win form 托盘功能的实现(引用CSDN)
    C# win form退出窗体时对话框实用
    智能DNS 笔记
    iis无法启动, 找出占用80端口的罪魁祸首
    gvim for windows的剪贴板操作
    内容交换
    Content Networking 读书笔记
  • 原文地址:https://www.cnblogs.com/yachengmuCC/p/16148533.html
Copyright © 2020-2023  润新知