在 CentOS 7.x 安裝 Apache / MariaDB / PHP

星期五, 1st 八月 2014

安裝 Apache
# yum install httpd

啟動 Web Server
# service httpd start
Redirecting to /bin/systemctl start  httpd.service

# systemctl start httpd

在防火牆開啟 http 服務
# firewall-cmd --permanent --add-service=http
# systemctl restart firewalld

設定開機時啟動 Web Server
# systemctl enable httpd
安裝 PHP
# yum install php php-mysql php-pdo php-gd php-mbstring

修改時區設定
# sed -i 's/;date.timezone =/date.timezone = Asia\/Taipei/' /etc/php.ini

重新啟動 Web Server
# service httpd restart
Redirecting to /bin/systemctl restart  httpd.service

# systemctl restart httpd

安裝 MariaDB
# yum install mariadb-server mariadb

啟動 MariaDB
# systemctl start mariadb

初始化資料庫設定
# /usr/bin/mysql_secure_installation

設定開機時啟動 MariaDB
# systemctl enable mariadb