美文网首页
CentOS安装后基本命令

CentOS安装后基本命令

作者: pianosecret | 来源:发表于2019-01-09 19:28 被阅读0次

    修改主机名

    # hostnamectl set-hostname <host-name>
    

    修改密码

    # passwd
    

    更新yum

    #yum update
    

    yum源修改为阿里

     mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak 
     wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
     yum makecache
     yum -y update 
    

    安装apache

    yum -y install apache
    systemctl start httpd
    systemctl enable httpd
    
    其中apache的主要目录以及用途
    服务目录    /etc/httpd
    主配置文件   /etc/httpd/conf/httpd.conf
    网站数据目录  /var/www/html
    访问日志    /var/log/httpd/access_log
    错误日志    /var/log/httpd/error_log
    
    主要参数有
    ServerRoot  服务目录
    ServerAdmin 管理员邮箱
    User    运行服务的用户
    Group   运行服务的用户组
    ServerName  网站服务器的域名
    DocumentRoot    网站数据目录
    Listen  监听的IP地址与端口号
    DirectoryIndex  默认的索引页页面
    ErrorLog    错误日志文件
    CustomLog   访问日志文件
    Timeout 网页超时时间,默认为300秒.
    Include 需要加载的其他文件
    

    配置php

    rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 
    rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    yum list php*
    yum -y install php72w
    yum -y install php72w-cli php72w-common php72w-devel php72w-mysql
    yum -y install php72w-gd php72w-imap php72w-ldap php72w-odbc php72w-pear php72w-xml php72w-xmlrpc
    find / -name php.ini
    find / -name httpd.conf
    在httpd.conf最后加上  
    PHPIniDir /etc/php.ini 让httpd知道php的配置信息
    ps aux | grep httpd
    打开防火墙80端口  
    firewall-cmd --zone=public --add-port=80/tcp --permanent
    firewall-cmd --zone=public --query-port=80/tcp
    systemctl restart httpd
    php -v
    

    相关文章

      网友评论

          本文标题:CentOS安装后基本命令

          本文链接:https://www.haomeiwen.com/subject/bxpwrqtx.html