next up previous contents
Next: 防火牆設定 Up: PHP 安裝 Previous: PHP 安裝   Contents   DYWANG_HOME

建立使用環境

  1. 遠端登入 kvm8.deyu.wang 虛擬機。
    [root@dyw219 ~]# ssh root@kvm8.deyu.wang
    root@kvm8.deyu.wang's password: 
    Last login: Sat Jan 25 17:37:42 2020 from 192.168.122.1
    [root@kvm8 ~]#
    
  2. 使用 yum 安裝 php,會將其相依套件 httpd,也就是網頁伺服器也裝起來。
    [root@kvm8 ~]# yum install php
    Last metadata expiration check: 0:07:07 ago on Sat 25 Jan 2020 05:43:20 PM CST.
    Dependencies resolved.
    ================================================================================
     Package           Arch   Version                               Repository
                                                                               Size
    ================================================================================
    Installing:
     php               x86_64 7.2.11-1.module_el8.0.0+56+d1ca79aa   AppStream 1.5 M
    Installing dependencies:
     apr               x86_64 1.6.3-9.el8                           AppStream 125 k
     apr-util          x86_64 1.6.1-6.el8                           AppStream 105 k
     centos-logos-httpd
                       noarch 80.5-2.el8                            AppStream  24 k
     httpd             x86_64 2.4.37-11.module_el8.0.0+172+85fc1f40 AppStream 1.7 M
     httpd-filesystem  noarch 2.4.37-11.module_el8.0.0+172+85fc1f40 AppStream  34 k
     httpd-tools       x86_64 2.4.37-11.module_el8.0.0+172+85fc1f40 AppStream 102 k
     mod_http2         x86_64 1.11.3-2.module_el8.0.0+10+abf51267   AppStream 156 k
     nginx-filesystem  noarch 1:1.14.1-8.module_el8.0.0+5+258f653c  AppStream  24 k
     php-cli           x86_64 7.2.11-1.module_el8.0.0+56+d1ca79aa   AppStream 3.1 M
     php-common        x86_64 7.2.11-1.module_el8.0.0+56+d1ca79aa   AppStream 653 k
     mailcap           noarch 2.1.48-3.el8                          BaseOS     39 k
    Installing weak dependencies:
     apr-util-bdb      x86_64 1.6.1-6.el8                           AppStream  25 k
     apr-util-openssl  x86_64 1.6.1-6.el8                           AppStream  27 k
     php-fpm           x86_64 7.2.11-1.module_el8.0.0+56+d1ca79aa   AppStream 1.6 M
    
    Transaction Summary
    ================================================================================
    Install  15 Packages
    
    Total download size: 9.2 M
    Installed size: 32 M
    Is this ok [y/N]: y
    ..........
    Complete!
    
  3. httpd 的設定檔 /etc/httpd/conf/httpd.conf,預設設定中只要加入你的網頁伺服器網域名稱就可以了。
    [root@kvm8 ~]# vim /etc/httpd/conf/httpd.conf 
    [root@kvm8 ~]# grep kvm8 /etc/httpd/conf/httpd.conf 
    ServerName kvm8.deyu.wang:80
    
  4. 設定開機啟動 httpd 服務,並立即啟動。
    [root@kvm8 ~]# systemctl enable --now httpd.service 
    Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service →
     /usr/lib/systemd/system/httpd.service.
    



De-Yu Wang 2020-04-07