博客
关于我
linux--服务配置
阅读量:581 次
发布时间:2019-03-11

本文共 1924 字,大约阅读时间需要 6 分钟。

Apache基础服务搭建

Apache 是一个广泛使用的开放源代码导航服务,适用于 Unix-like 服务器。以下是搭建 Apache 服务的步骤指南。

Apache 配置

  • 软件包名:httpd
  • 配置文件:/etc/httpd/conf/httpd.conf
  • 默认根目录DocumentRoot /var/www/html
  • 首页文件:index.html

LAMP 环境下搭建 BBS 论坛

搭建简单的 BBS 论坛,建议使用 LAMP 环境(Linux、Apache、MySQL、PHP)。

环境搭建步骤

  • 配置 yum 源

    确保服务器连接互联网,然后更新软件包,因为 /etc/yum.repos.d 中的源可能需要联通网络。

  • 安装相应软件包

    使用以下命令安装必要软件:

    yum install httpd mariadb mariadb-server php php-mysql
  • 启动并设置 Apache 服务

    启动 Apache 服务,并确保其开机自动启动:

    systemctl start httpdsystemctl enable httpd

    如果使用防火墙,需允许 HTTP 服务通过:

    firewall-cmd --permanent --add-service=httpfirewall-cmd --reload
  • 启动并设置 MySQL 服务密码

    启动和启用 MySQL 服务,并设置默认密码:

    systemctl start mysqlsystemctl enable mysqlmysql_secure_installation
  • 上传并安装 BBS 文件

    将 BBS 安装文件(如 Discuz_X2.5_SC_UTF8.zip)复制至默认根目录,并进行解压和调整权值:

    cp -p Discuz_X2.5_SC_UTF8.zip /var/www/html/cd /var/www/html/unzip Discuz_X2.5_SC_UTF8.zipmv upload/ bbschmod 777 bbs/ -Rsetenforce 0

    最后重启 Apache 服务:

    systemctl restart httpd
  • 访问 http://127.0.0.1/bbs 开始安装 BBS 论坛。


    仅下载 FTP 服务器搭建

    FTP 是文件传输协议,常用于上传和下载文件。

    服务端配置

    • 软件名:vsftpd
    • 配置文件:/etc/vsftpd/vsftpd.conf
    • 匿名用户默认共享目录:/var/ftp/pub

    安装步骤

  • 安装 FTP 服务:

    yum install vsftpd -y
  • 启动服务并设置防火墙:

    systemctl start vsftpdsystemctl enable vsftpdfirewall-cmd --permanent --add-service=ftpfirewall-cmd --reload
  • 配置服务文件:

    vim /etc/vsftpd/vsftpd.conf

    添加以下内容:

    anonymous 2listen 端口

    根据实际需求配置匿名用户访问权限。

  • 重新启动服务:

    systemctl restart vsftpd

  • 客户端访问

    lftp 客户端连接 FTP 服务器:

    lftp 127.0.0.1

    配置 NFS 服务

    NFS 是网络文件系统,可实现文件共享。

    服务端配置

  • 关闭防火墙:

    systemctl stop firewalldsystemctl disable firewalld
  • 安装 NFS 服务:

    yum install nfs-utils -y
  • 启动 NFS 服务:

    systemctl start nfs-serversystemctl enable nfs-server
  • 准备共享目录并配置:

    mkdir -p /shareecho "/share *( rw,anon!] > /etc/exportssystemctl restart nfs-server

  • 客户端配置

  • 挂载 NFS 服务器共享目录:

    mkdir /mnt/sharemount -t nfs 192.168.0.3:/share /mnt/share/df -hT
  • 建立永久挂载(建议):

    echo "192.168.0.3:/share /mnt/share nfs defaults 0 0" >> /etc/fstab
  • 配置访问权限:

    chmod 777 /mnt/share -Rsetenforce 0
  • 完成以上配置后,可以通过命令访问 NFS 共享目录,实现文件共享便利。

    转载地址:http://fpztz.baihongyu.com/

    你可能感兴趣的文章
    perl输出中文有乱码
    查看>>
    Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). 大数据ssh权限问题 hadoop起不来 hadoopssh错
    查看>>
    PermissionError:Python 中的 [Errno 13]
    查看>>
    PermissionError:[Errno 13] 权限被拒绝:‘/manage.py‘
    查看>>
    Permutation
    查看>>
    perspective意思_2020年12月英语四级词汇讲解丨考点归纳:perspective
    查看>>
    PE启动盘和U启动盘(第三十六课)
    查看>>
    PE文件,节头有感IMAGE_SECTION_HEADER
    查看>>
    PE查找文件偏移地址
    查看>>
    PE知识复习之PE的导入表
    查看>>
    PFX(Parallel Framework) and Traditional Multithreading
    查看>>
    PGOS:今天动手给电脑装青苹果Win7 X64位系统
    查看>>
    pgpool-II3.1 的内存泄漏(一)
    查看>>
    PgSQL · 特性分析 · PG主备流复制机制
    查看>>
    PGSQL主键序列
    查看>>
    PGSQL安装PostGIS扩展模块
    查看>>
    pg数据库中两个字段相除
    查看>>
    PhalApi:[1.23] 请求和响应:GET和POST两者皆可得及超越JSON格式返回
    查看>>
    Phalcon环境搭建与项目开发
    查看>>
    Phantom.js维护者退出,项目的未来成疑
    查看>>