VM安裝LAMP+WordPress筆記

VM安裝LAMP+WordPress筆記

用hyper-V安裝CentOS

之後須安裝Linux Integration Services Version 3.4 for Hyper-V

但"聽說"hyper-V效能不是很好,所以我這裡用VMware來安裝CentOS6

LAMP(Linux(CentOS)+Apache+Mysql+Php)

安裝Apache
[root@dorigo ]#yum install httpd

安裝Mysql
[root@dorigo ]#yum install mysql mysql-server

安裝Php 並且使其支持Mysql
[root@dorigo ]#yum install php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash

測試PHP 在/var/www/html vim test.php 寫下

設置Apache Mysql 自啟動
[root@dorigo ]#chkconfig httpd on;chkconfig mysqld on

啟動apache mysql服務
[root@dorigo ]#service httpd start;service mysqld start

設定root的密碼
[root@dorigo ]$ mysqladmin -u root password 'password'

使用root登入需密碼
[root@dorigo ]$ mysql -u root -p

創建一個用戶名為:dorigo 密碼為:dorigo123
mysql>insert into mysql.user(Host,User,Password) values("localhost","dorigo",password("dorigo123"));

創建WordPress使用的數據庫(這裡我創建了一個名叫wordpress的數據庫給wordpress用)
mysql>create database wordpress;

給dorigo用戶授權WordPress
mysql>grant all privileges on wordpress.* to dorigo @localhost identified by 'dorigo';

mysql>flush privileges;

解壓WordPress
[root@dorigo www]#tar -zxvf wordpress-3.9.1.tar.gz

更改wp-config-simple為wp-config
[root@dorigo wordpress]#mv wp-config-simple.php wp-config.php

VM安裝LAMP+WordPress筆記
VM安裝LAMP+WordPress筆記

配置WordPress連接數據庫文件
[root@dorigo wordpress]#vim wp-config.php
define('DB_NAME', 'wordpress'"這裡是剛才建立的數據庫的名稱");
define('DB_USER', 'dorigo' "這個便是訪問數據庫的用戶");
define('DB_PASSWORD', "dorigo123");
define('DB_HOST', "localhost");

移動WordPress到/var/www/html/
[root@dorigo www]#mv wordpress /var/www/html/

更改用戶
[root@dorigo html]#chown -R apache:apache wordpress

更改權限
[root@dorigo html]#chmod -R 755 wordpress

重啟apache和mysql服務
[root@dorigo ]#service httpd restart;service mysqld restart

[root@dorigo ]#setenforce permissive

[root@dorigo ]#vi /etc/httpd/conf/httpd.conf

瀏覽器輸入http://127.0.0.1看看

參考:
centos安裝教程,最完整centos6.4安裝圖文教程
Aandd的開發實驗站

關於作者 多力哥
VM安裝LAMP+WordPress筆記
影像創作攝影師/網頁動畫設計師/系統網路工程師/水草研究生
景文科大畢業後,我成為一名網站動畫設計師,並副修MIS電腦資訊管理。2004年,我開始接觸單眼相機,並在2008年正式成為一名接案攝影師,目前使用Canon系統進行拍攝。2016年,我愛上了美麗的水草缸,這讓我的生活多了另一層次的放鬆。每天在電腦前修圖時,能欣賞紅吱吱、綠油油的水草,彷彿多了一份平靜與愉悅。攝影與水草讓我的生活充滿了藝術與自然的交融。
連絡信箱:hello@hahasmile.com (歡迎合作提案)
DORIGO IMAGE 攝影工作室:https://dorigo-image.com
如果你喜歡我的內容,可以用行動贊助我一杯咖啡☕,支持我持續創作,也讓這個網站可以繼續營運下去喔!

若您喜歡這篇文章,歡迎按讚分享喔!
0 回復

發表評論

想要留言嗎?
歡迎歡迎!

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *