2017年7月7日 星期五

[CentOS 7.3] 安裝Apache, MariaDB, PHP(LAMP)

sudo yum –y update
sudo yum –y upgrade
sudo yum -y install yum-utils

一、安裝apache
sudo yum install httpd //安裝apache
sudo systemctl start httpd //開啟伺服器
sudo systemctl enable httpd //開機會自動開啟伺服器

二、安裝MariaDB
sudo yum -y install mariadb-server mariadb
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
mysql_secure_installation


三、安裝PHP 7.1
sudo yum install epel-release
sudo wget -q http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo rpm -Uvh remi-release-7.rpm
sudo yum-config-manager --enable remi-php71
sudo yum -y install php php-opcache


四、重新整理
sudo yum update
sudo systemctl restart httpd.service


五、測試PHP
sudo nano /var/www/html/info.php

<?php
            phpinfo();
?>

PS:
chcon -R -t httpd_sys_rw_content_t storage
sudo setsebool -P httpd_can_network_connect_db=1
yum install php php-mysql
sudo systemctl restart httpd.service

https://linuxhostsupport.com/blog/how-to-upgrade-mariadb-on-centos-7/

沒有留言:

張貼留言

[CentOS] httpd port 9000 to 80

<VirtualHost *:80>     ServerName domain.name     ProxyRequests Off     ProxyVia Block     ProxyPreserveHost On     <Proxy *...