1. 程式人生 > >LInux-Lamp搭建

LInux-Lamp搭建

httpd ngx con 默認 linux .html php-mysql tro name

LInux-Lamp搭建

一 yum安裝(自動會下載依賴包)

(一)mysql安裝

檢測是否安裝:

yum list installed mysql* rpm -qa | grep mysql* 安裝: 服務端:

yum install mysql-server -y

包:

yum install mysql-devel -y

mysql配置:

/etc/my.cnf中加入default-character-set=utf8

啟動服務:

service mysqld start

或/etc/init.d/mysqld start

設置密碼:

mysqladmin -u root password root

登陸:

mysql -u root -p

註意:(2)(3)最好直接安裝php依賴安裝上apache比較簡單

(2)apcche安裝

yum install httpd -y

啟動服務:

[[email protected]_80_143_centos ~]# service httpd start
Starting httpd: httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName

修改:

vim /etc/httpd/conf/httpd.conf

ServerName 118.89.173.205:80

技術分享

註意讀這段話,意思這是默認頁面,你需要註釋file /etc/httpd/conf.d/welcome.conf和www/html為根目錄

vim /etc/httpd/conf.d/welcome.conf

重啟

(3)php安裝(apache和php有依賴關系,先安裝php會自動安裝httpd,這樣直接支持php)

yum install php -y

配置apache支持php:

vim /etc/httpd/conf/httpd.conf

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

技術分享

(4)安裝phpmysql拓展

yum php-mysql

技術分享

二 二進制安裝

參考網址:http://www.cnblogs.com/yangxia-test/p/4174372.html

mysql錯誤解決參考:http://support.moonpoint.com/software/database/mysql/not-running-centos7.php

LInux-Lamp搭建