RedHat6.4系統下LAMP環境的搭建---(yum搭建)---搭建WordPress博客與Discuz論壇(精華篇)v1.1

目錄:

一 配置本地yum源

二 安裝配置apache服務器

三 安裝配置Mysql數據庫

四 安裝配置php軟件

五 關閉RedHat6.4系統SELinux功能

六 建立Mysql數據庫

七 安裝WordPress博客網站

八 使用phpMyAdmin數據庫管理工具建立數據庫discuz

九 LAMP環境建立discuz論壇

說明:按照本教程搭建的LAMP環境適用於全部服務器,若是你想搭建一個小型的我的網站,那麼就可使用本套教程php

本套教程是從一個RedHat6.4最小化安裝的狀態下開始一一操做。html

 搭建準備環境

首先咱們須要一臺純淨版的RedHat6.4(64位)最小化安裝的操做系統mysql

RedHat安裝了純淨版的RedHat6.4(64位)最小化安裝的操做系統linux

請將redhat6.4的安裝盤插入虛擬機sql

 

快速配置IP地址與YUM源-RH6.4

[root@Chris ~]# vi ifconfig.sh
[root@Chris ~]# chmod o+x ifconfig.sh
[root@Chris ~]# ./ifconfig.sh數據庫

#!/bin/bash
sudo ifconfig eth0 up
#臨時啓用
rm -f /etc/sysconfig/network-scripts/ifcfg-eth0
#刪除eth0配置文件
touch /etc/sysconfig/network-scripts/ifcfg-eth0
#建立eth0配置文件
echo "DEVICE=eth0" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "TYPE=Etherne" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "ONBOOT=yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "IPADDR=192.168.80.100" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "GATEWAY=192.168.80.2" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "DNS1=114.114.114.114" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "DNS2=8.8.8.8" >> /etc/sysconfig/network-scripts/ifcfg-eth0
service network restart
#重啓網絡服務
mkdir /mnt/cdrom
#建立一個文件夾用於存放掛載光盤的文件
mount /dev/cdrom /mnt/cdrom
#將光驅掛載在建立的文件夾中
echo "mount /dev/cdrom /mnt/cdrom" >> /etc/rc.local
#設置光驅開機自動掛載
rm -f /etc/yum.repos.d/rhel-source.repo
#刪除YUM源配置文件
touch /etc/yum.repos.d/rhel-source.repo
#建立YUM源配置文件
echo "[rhel-source]" >> /etc/yum.repos.d/rhel-source.repo
echo "name=Redhat" >> /etc/yum.repos.d/rhel-source.repo
echo "baseurl=file:///mnt/cdrom/Server" >> /etc/yum.repos.d/rhel-source.repo
echo "enabled=1" >> /etc/yum.repos.d/rhel-source.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/rhel-source.repo
#配置本地YUM源
yum repolist
#查看可用的本地yum源
echo "UseDNS no" >> /etc/ssh/sshd_config
service sshd restart

 

快速配置IP地址與YUM源-CentOS6.6

#!/bin/bash
rm -f /etc/udev/rules.d/70-persistent-net.rules
#刪除網卡名稱文件
start_udev
#重置文件
sed -i "s#eth1#eth0#" /etc/udev/rules.d/70-persistent-net.rules
#將eth1網卡替換成eth0
sudo ifconfig eth0 up
#臨時啓用
rm -f /etc/sysconfig/network-scripts/ifcfg-eth0
#刪除eth0配置文件
touch /etc/sysconfig/network-scripts/ifcfg-eth0
#建立eth0配置文件
echo "DEVICE=eth0" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "TYPE=Etherne" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "ONBOOT=yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "IPADDR=192.168.80.200" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "GATEWAY=192.168.80.2" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "DNS1=114.114.114.114" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "DNS2=8.8.8.8" >> /etc/sysconfig/network-scripts/ifcfg-eth0
service network restart
#重啓網絡服務
mkdir /mnt/cdrom
#建立一個文件夾用於存放掛載光盤的文件
mount /dev/cdrom /mnt/cdrom
#將光驅掛載在建立的文件夾中
echo "mount /dev/cdrom /mnt/cdrom" >> /etc/rc.local
#設置光驅開機自動掛載
rm -f /etc/yum.repos.d/*
#刪除YUM源配置文件
touch /etc/yum.repos.d/centos-local.repo
#建立YUM源配置文件
echo "[rhel-centos]" >> /etc/yum.repos.d/centos-local.repo
echo "name=centos6.6" >> /etc/yum.repos.d/centos-local.repo
echo "baseurl=file:///mnt/cdrom" >> /etc/yum.repos.d/centos-local.repo
echo "enabled=1" >> /etc/yum.repos.d/centos-local.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/centos-local.repo
#配置本地YUM源
yum repolist
#查看可用的本地yum源echo "UseDNS no" >> /etc/ssh/sshd_config
service sshd restart

 

 

快速LAMP環境部署

 腳本運行:apache

[root@Chris ~]# vi lamp.sh
[root@Chris ~]# chmod o+x lamp.sh
[root@Chris ~]# ./lamp.shcentos

 

!/bin/bash

#------------------------------------------------------------------------
#安裝部分
#
#
#
yum -y install httpd mysql-server php php-mysql php-xml php-gd php-soap
#使用yum命令安裝 apache mysql php 以及php模塊軟件
#
#--------------------------------------------------------------------------
#啓動部分
#
chkconfig httpd on
#設置apache服務開機自動啓動
chkconfig mysqld on
#設置mysqld服務開機自動啓動
service httpd start
#啓動apache服務
service mysqld start
#啓動mysql服務
#
#
#-------------------------------------------------------------------------
#
#配置PHP支持Apache
echo "AddType application/x-httpd-php .php .phtml" >> /etc/httpd/conf/httpd.conf
echo "AddType application/x-httpd-source .phps" >> /etc/httpd/conf/httpd.conf
#向apache配置文件寫入兩行代碼,設置apache支持php
service httpd restart
#重啓apache服務
#
#
#---------------------------------------------------------------------------
#
#防火牆配置部分
#
iptables -t filter -I INPUT -p tcp --dport 80 -j ACCEPT
#臨時開啓防火牆的80端口
iptables -t filter -I INPUT -p tcp --dport 3306 -j ACCEPT
#臨時開啓防火牆的3306端口
/etc/rc.d/init.d/iptables save
#保存當前防火牆配置
service iptables restart
#重啓防火牆服務

#
#----------------------------------------------------------------------------
#MySQL數據庫配置部分
#
mysqladmin -u root password "q55609800"
#設置mysql數據庫的root帳號的密碼
#


#
#------------------------------------------------------------------------------
#Apache配置文件修改部分
#
useradd -s /sbin/nologin -M www
#建立一個訪問網站的默認用戶
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
#備份一份apache的原始配置文件
sed -i "s;ServerTokens OS;ServerTokens Prod;" /etc/httpd/conf/httpd.conf
#隱藏Apache的版本號
sed -i "s#User apache#User www#" /etc/httpd/conf/httpd.conf
#修改訪問Apache的默認用戶
sed -i "s#Group apache#Group www#" /etc/httpd/conf/httpd.conf
#修改訪問Apache的默認用戶組
sed -i "s#Options Indexes FollowSymLinks#Options -Indexes FollowSymLinks#" /etc/httpd/conf/httpd.conf
#首頁文件的目錄訪問控制
sed -i "s;#ServerName www.example.com:80;ServerName www.wordpress.com:80;" /etc/httpd/conf/httpd.conf
#更改默認的網站域名
sed -i "s#DirectoryIndex index.html index.html.var#DirectoryIndex index.php index.html index.htm#" /etc/httpd/conf/httpd.conf
#修改默認的網站首頁名稱,更改成index.php優先級
sed -i "s#ServerAdmin root@localhost#ServerAdmin 838997384@qq.com#" /etc/httpd/conf/httpd.conf
#添加網站的管理員郵箱
mkdir /var/www/wordpress
#爲網站建立一個站點目錄
cat >>/etc/httpd/conf/httpd.conf<<kkk
#
#------------------------------------
#WordPress
#------------------------------------
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin 838997384@qq.com
DocumentRoot /var/www/wordpress
ServerName www.wordpress.com
ServerAlias wordpress.com
DirectoryIndex index.php index.html
ErrorLog logs/wordpress-error_log
CustomLog logs/wordpress-access_log common
</VirtualHost>
#------------------------------------
kkk
#去掉Apache配置文件的註釋行
#
#------------------------------------------------------------------------
#PHP配置文件修改部分
#
cp /etc/php.ini    /etc/php.ini.bak
#將PHP原始文件備份
sed -i "s#upload_max_filesize = 2M#upload_max_filesize = 10M#" /etc/php.ini
#更改PHP的上傳文件限制
sed -i "s#post_max_size = 8M#post_max_size = 10M#" /etc/httpd/conf/php.ini
#更改PHP最大容許上傳文件限制
service httpd restart

 

 

 

 

 

 

 

配置IP地址

下面我來教你們如何api

 

 一:配置本地yum源 :--目錄


做者:李文軒瀏覽器

座右銘:一個願意爲理想奮鬥終生的人!

聯繫QQ:838997384

網站地址:www.74cto.com

說明:本篇安裝的系統版本RedHat6.4(64位),若是不按照個人版本安裝,可能會出現錯誤

1 建立一個文件夾用於存放掛載光盤的文件

mkdir /mnt/cdrom  

2 將光驅掛載在建立的文件夾中

mount /dev/cdrom /mnt/cdrom 

3 固然咱們也能夠設置爲開機自動掛載光驅:
用vi編輯/etc/rc.local文件,由於在系統啓動過程當中,完成初始化腳本的執行後,會執行這個腳本文件添加命令以下:

 vi /etc/rc.local
 mount /dev/cdrom /mnt/cdrom                 #後面掛載點能夠本身選擇

4 配置本地yum源的文件:

 vi /etc/yum.repos.d/rhel-source.repo        #配置本地yum源的文件
[rhel-source]
name=Redhat                                  #設置本地yum源的名稱
baseurl=file:///mnt/cdrom/Server             #設置本地yum源的地址
enabled=1                                    #1表明啓用本地yum源   0則表示禁用
gpgcheck=1

5 查看可用的本地yum源:

 yum repolist 

顯示以下:

[root@Chris ~]#  yum repolist 
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel-source                                                                | 3.9 kB     00:00 ... 
repo id                                         repo name                                   status
rhel-source                                     Redhat                                      3,648
repolist: 3,648

到了這裏就表示本地yum源配置完成!

-------------------------------------------------------------------------------------------------------------------------------------------

 

二  安裝配置apache服務器 --目錄


做者:李文軒

座右銘:一個願意爲理想奮鬥終生的人!

聯繫QQ:838997384

網站地址:www.74cto.com

6 yum安裝apache服務器:

[root@Chris ~]# yum install httpd -y

安裝完成顯示以下:

Installed:
  httpd.x86_64 0:2.2.15-26.el6                                                                    

Dependency Installed:
  apr.x86_64 0:1.3.9-5.el6_2                        apr-util.x86_64 0:1.3.9-3.el6_0.1            
  apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1            httpd-tools.x86_64 0:2.2.15-26.el6           

Complete!

7 開啓Apache服務

[root@Chris ~]# service httpd start

顯示以下:

[root@Chris ~]# service httpd start
正在啓動 httpd:httpd: apr_sockaddr_info_get() failed for Chris
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[肯定]

8 查看apache服務器是否開啓,查看80端口是否處於監聽狀態

[root@Chris ~]# netstat -an | grep :80

顯示以下:

[root@Chris ~]# netstat -an | grep :80
tcp        0      0 :::80                       :::*                        LISTEN   

9 設置apache服務開機自動啓動

[root@Chris ~]# chkconfig httpd on

10 查看apache服務是否已經加入開機啓動項:

[root@Chris ~]# chkconfig | grep httpd

顯示以下:

[root@Chris ~]# chkconfig | grep httpd
httpd           0:關閉  1:關閉  2:啓用  3:啓用  4:啓用  5:啓用  6:關閉

上面顯示2-5都是啓用狀態就表示apache服務器已經能夠開機自動啓動啦!

11 配置防火牆容許80端口經過

[root@Chris ~]# iptables -t filter -I INPUT -p tcp --dport 80 -j ACCEPT     
[root@Chris ~]#

 12 將當前的防火牆配置保存到配置文件中

[root@Chris ~]#  /etc/rc.d/init.d/iptables save 
iptables:將防火牆規則保存到 /etc/sysconfig/iptables:[肯定]

13 重啓防火牆服務生效

[root@Chris ~]# service iptables restart
iptables:清除防火牆規則:[肯定]
iptables:將鏈設置爲政策 ACCEPT:filter [肯定]
iptables:正在卸載模塊:[肯定]
iptables:應用防火牆規則:[肯定]
[root@Chris ~]# 

14 最後使用瀏覽器訪問測試一下便可  顯示以下:

到了這裏咱們的apache服務器就安裝配置完成啦!


---------------------------------------------------------------------------------------------------------


三 安裝配置Mysql數據庫--目錄


 做者:李文軒

座右銘:一個願意爲理想奮鬥終生的人!

聯繫QQ:838997384

網站地址:www.74cto.com

15 使用yum安裝mysql數據庫

[root@Chris ~]#  yum -y install mysql-server

安裝完成之後顯示以下:

Installed:
  mysql-server.x86_64 0:5.1.66-2.el6_3                                                            

Dependency Installed:
  mysql.x86_64 0:5.1.66-2.el6_3                perl-DBD-MySQL.x86_64 0:4.013-3.el6   

16 啓動mysql服務

[root@Chris ~]# service mysqld start
初始化 MySQL 數據庫: WARNING: The host 'Chris' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h Chris password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

[肯定]
正在啓動 mysqld: [肯定]

17 設置mysql開機自動啓動

[root@Chris ~]# chkconfig mysqld on
[root@Chris ~]#

查看Mysql是否加入開機啓動項

[root@Chris ~]# chkconfig |grep mysqld
mysqld          0:關閉  1:關閉  2:啓用  3:啓用  4:啓用  5:啓用  6:關閉

上面顯示2-5都是啓用狀態就表示Mysql服務器已經能夠開機自動啓動啦!

18 開啓防火牆的3306端口

[root@Chris ~]# iptables -t filter -I INPUT -p tcp --dport 3306 -j ACCEPT 
[root@Chris ~]# 

將當前的防火牆配置保存到配置文件中

[root@Chris ~]#  /etc/rc.d/init.d/iptables save
iptables:將防火牆規則保存到 /etc/sysconfig/iptables:[肯定]
[root@Chris ~]# 

19 重啓防火牆服務生效

[root@Chris ~]# service iptables restart
iptables:清除防火牆規則:[肯定]
iptables:將鏈設置爲政策 ACCEPT:filter [肯定]
iptables:正在卸載模塊:[肯定]
iptables:應用防火牆規則:[肯定]

20 測試Mysql服務是否開啓

[root@Chris ~]# netstat -ltnp |grep 3306
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      2061/mysqld         

21 以root身份進入Mysql數據庫

[root@Chris ~]# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.66 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

22 設置Mysql的root用戶的密碼

mysql> set password = password ('123456');
Query OK, 0 rows affected (0.00 sec)

23 再次進入Mysql數據庫的話就須要輸入其餘命令啦!

[root@Chris ~]# mysql -uroot -p
Enter password: 

而後輸入密碼便可登陸進入mysql數據庫。

 

四 安裝配置php軟件--目錄


做者:李文軒

座右銘:一個願意爲理想奮鬥終生的人!

聯繫QQ:838997384

網站地址:www.74cto.com

安裝準備:

24 咱們在安裝PHP軟件時須要先安裝幾個php的擴展插件

[root@Chris ~]# yum -y install php-xml php-gd php-soap

安裝完成之後顯示以下:

Installed:
  php-gd.x86_64 0:5.3.3-22.el6   php-soap.x86_64 0:5.3.3-22.el6   php-xml.x86_64 0:5.3.3-22.el6  

Dependency Installed:
  libXpm.x86_64 0:3.5.10-2.el6                  php-common.x86_64 0:5.3.3-22.el6  

25 如今開始安裝PHP軟件

[root@Chris ~]#  yum -y install php

安裝完成之後顯示以下:

Installed:
  php.x86_64 0:5.3.3-22.el6                                                                       

Dependency Installed:
  php-cli.x86_64 0:5.3.3-22.el6                                                                   

26  配置PHP支持MySQL

[root@Chris ~]# yum install -y php-mysql

顯示以下就表示安裝完成

Installed:
  php-mysql.x86_64 0:5.3.3-22.el6                                                                 

Dependency Installed:
  php-pdo.x86_64 0:5.3.3-22.el6 

27 配置Apache支持php  須要先進入Apache配置文件

[root@Chris ~]# vi /etc/httpd/conf/httpd.conf

找到AddType application/x-gzip .gz .tgz這一行

在下面添加
  AddType application/x-httpd-php .php .phtml
  AddType application/x-httpd-source .phps

最終修改效果以下:

# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-source .phps

28 重啓apche服務器生效

[root@Chris ~]# service httpd restart
中止 httpd:[肯定]
正在啓動 httpd:httpd: apr_sockaddr_info_get() failed for Chris
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[肯定]

29 建立一個主頁文件測試PHP是否生效,主頁文件的名稱爲index.php
  代碼部分:
   <?php
   echo phpinfo();
   ?>  

最終修改內容顯示以下:

[root@Chris ~]# vi /var/www/html/index.php

<?php
  echo phpinfo();
?> 

保存退出便可!

咱們使用瀏覽器訪問測試出現下面的界面就表示PHP配置已經生效

到了這裏咱們的PHP就配置完成啦!
    

 五  關閉RedHat6.4系統SELinux功能 --目錄


做者:李文軒

座右銘:一個願意爲理想奮鬥終生的人!

聯繫QQ:838997384

網站地址:www.74cto.com

30 Linux系統中的selinux功能可能會影響咱們對於網站服務器的配置,因此爲了方便你們的實驗,建議關閉

[root@Chris ~]# vi /etc/selinux/config

註釋:#SELINUX=enforcing

添加:SELINUX=disabled

最終修改後顯示結果以下:

[root@Chris ~]# vi /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled # SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

保存退出便可!到了這裏咱們就把selinux給禁用啦。

 

六 建立Mysql數據庫--目錄


做者:李文軒

座右銘:一個願意爲理想奮鬥終生的人!

聯繫QQ:838997384

網站地址:www.74cto.com

31 進入Mysql數據庫,由於以前已經設置了mysql的密碼。因此須要輸入mysql -uroot -p 命令輸入密碼才能進入管理數據庫

[root@Chris ~]# mysql -uroot -p
Enter password: 

請輸入以前設置的密碼就能夠進入mysql的管理目錄啦!

[root@Chris ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.66 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

32 建立數據庫-----wordpress

mysql> create database wordpress;
Query OK, 1 row affected (0.01 sec)

33 查看剛剛建立的數據庫

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
| wordpress          |
+--------------------+
4 rows in set (0.00 sec)

到了這裏咱們的數據庫就算是建立完成啦!

 

七 安裝WordPress博客網站--目錄


做者:李文軒

座右銘:一個願意爲理想奮鬥終生的人!

聯繫QQ:838997384

網站地址:www.74cto.com

33 由於剛剛作PHP的生效測試,咱們須要將剛剛建立的index.php的主頁刪除

[root@Chris ~]# rm /var/www/html/index.php 
rm:是否刪除普通文件 "/var/www/html/index.php"?y

34 請將WordPress博客網站的全部源碼文件上傳到服務器的/var/www/html的文件夾中

35 使用瀏覽器訪問網站主頁開始安裝咱們的WordPress博客網站

36 到了這一步咱們須要在服務器上建立一個wp-config.php的文件夾,而後把方框裏的內容複製到這個文件裏

[root@Chris ~]# vi /var/www/html/wp-config.php

下面是文件的內容(必定要保存退出,在進行下一步)

[root@Chris ~]# vi /var/www/html/wp-config.php

<?php
/**
 * WordPress基礎配置文件。
 *
 * 本文件包含如下配置選項:MySQL設置、數據庫表名前綴、密鑰、
 * WordPress語言設定以及ABSPATH。如需更多信息,請訪問
 * {@link http://codex.wordpress.org/zh-cn:%E7%BC%96%E8%BE%91_wp-config.php
 * 編輯wp-config.php}Codex頁面。MySQL設置具體信息請諮詢您的空間提供商。
 *
 * 這個文件被安裝程序用於自動生成wp-config.php配置文件,
 * 您能夠手動複製這個文件,並重命名爲「wp-config.php」,而後填入相關信息。
 *
 * @package WordPress
 */

// ** MySQL 設置 - 具體信息來自您正在使用的主機 ** //
/** WordPress數據庫的名稱 */
define('DB_NAME', 'wordpress');

/** MySQL數據庫用戶名 */
define('DB_USER', 'root');

/** MySQL數據庫密碼 */
define('DB_PASSWORD', '123456');

/** MySQL主機 */
define('DB_HOST', 'localhost');

/** 建立數據表時默認的文字編碼 */
define('DB_CHARSET', 'utf8');

/** 數據庫整理類型。如不肯定請勿更改 */
define('DB_COLLATE', '');

/**#@+
 * 身份認證密鑰與鹽。
 *
 * 修改成任意獨一無二的字串!
 * 或者直接訪問{@link https://api.wordpress.org/secret-key/1.1/salt/
 * WordPress.org密鑰生成服務}
 * 任何修改都會致使全部cookies失效,全部用戶將必須從新登陸。
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         'DTbzG~X{]m-M~5Q-R.|TBJ+({x@bw7Xj2:6I!,!j5yQmekY?@}Mn_e~D4~Q=1ze}');
define('SECURE_AUTH_KEY',  'aYcB6 &U{wZG;w3-nRe5fN01?aC-MorT}O]9_m2fKCL-?rx:& c >!Z4^{j#Uys[');
define('LOGGED_IN_KEY',    '=[n@qDM[|.v?#i/-jEdj&E`ic[aCA54zSr,wg+h.NC2KdZ7S-;%XGhxd|3Wi/2=0');
define('NONCE_KEY',        'C8,||uR2d.+cK@=<n&pD+P|Hn%}fe|3Lb$u<.[*i D}Jdc+|2ablmEtD#bcn=Ib?');
define('AUTH_SALT',        'zwl=h5+pXCa-3Oxl-+1rEcwKN{9RL4S,o9|2mf?^AOEe.0+S|PY%|C2V02Kd}_ot');
define('SECURE_AUTH_SALT', 'u;K-0K21tAEh]Wy-Nx[y1t!new.2DFac2#>A)8GqnKUW+*uUfsFSI#0-7?]N<a/&');
define('LOGGED_IN_SALT',   'p7qy4707r)R`cho,;w?|rGurj]P-F,8PNK&j^2;W6;+{:9(|YT*!r&j4 O,bTW;5');
define('NONCE_SALT',       'SG-PQN1x--_HNn&QU*5;:7#!mHY<AS.Pvq^#E=g#yVd;qiSRGI>2GX/xde*w##H+');

/**#@-*/

/**
 * WordPress數據表前綴。
 *
 * 若是您有在同一數據庫內安裝多個WordPress的需求,請爲每一個WordPress設置
 * 不一樣的數據表前綴。前綴名只能爲數字、字母加下劃線。
 */
$table_prefix  = 'wp_';

/**
 * 開發者專用:WordPress調試模式。
 *
 * 將這個值改成true,WordPress將顯示全部用於開發的提示。
 * 強烈建議插件開發者在開發環境中啓用WP_DEBUG。
 */
define('WP_DEBUG', false);

/**
 * zh_CN本地化設置:啓用ICP備案號顯示
 *
 * 可在設置→常規中修改。
 * 如需禁用,請移除或註釋掉本行。
 */
define('WP_ZH_CN_ICP_NUM', true);

/* 好了!請不要再繼續編輯。請保存本文件。使用愉快! */

/** WordPress目錄的絕對路徑。 */
if ( !defined('ABSPATH') )
        define('ABSPATH', dirname(__FILE__) . '/');

/** 設置WordPress變量和包含文件。 */
require_once(ABSPATH . 'wp-settings.php');

37 點擊開始安裝

38 下面開始設置一些站點的信息

39 安裝完成之後訪問網站測試,下面是最後的效果圖

到了這裏咱們的WordPress博客網站就搭建完成啦!

 

八 使用phpMyAdmin數據庫管理工具建立數據庫discuz--目錄


做者:李文軒

座右銘:一個願意爲理想奮鬥終生的人!

聯繫QQ:838997384

網站地址:www.74cto.com

40 在網站的根目錄建立一個文件夾爲phpadmin

[root@Chris ~]# mkdir /var/www/html/phpadmin
[root@Chris ~]#

查看剛剛建立的文件夾

[root@Chris ~]# ll /var/www/html/ |grep phpadmin
drwxr-xr-x.  2 root root  4096 1月   4 07:13 phpadmin

41 下載phpMyAdmin-3.5.6數據庫管理軟件,並將源碼上傳到剛剛建立的phpadmin文件夾中

42 打開瀏覽器輸入一下地址:192.168.80.101/phpadmin

43 使用phpadmin建立數據庫discuz

 

九 LAMP環境建立discuz論壇--目錄


做者:李文軒

座右銘:一個願意爲理想奮鬥終生的人!

聯繫QQ:838997384

網站地址:www.74cto.com

44 在網站的跟目錄建立一個文件夾名稱爲discuz

[root@Chris ~]# mkdir /var/www/html/discuz
[root@Chris ~]#

查看剛剛建立的discuz文件是否建立成功

[root@Chris ~]# ll /var/www/html/ |grep discuz
drwxr-xr-x.  2 root root  4096 1月   4 07:22 discuz

45 將discuz的全部源碼上傳到/var/www/html/discuz這個文件夾中

46 打開瀏覽器輸入192.168.80.100/discuz

47 假如出現以上界面出現安裝時亂碼,咱們須要打開apache的配置文件找到AddDefaultCharset UTF-8這一行,並將其註釋掉重啓apache服務器便可

[root@Chris ~]# vi /etc/httpd/conf/httpd.conf

# Specify a default charset for all content served; this enables
# interpretation of all content as UTF-8 by default.  To use the 
# default browser choice (ISO-8859-1), or to allow the META tags
# in HTML content to override this choice, comment out this
# directive:
#
#AddDefaultCharset UTF-8

48 重啓apache服務器

[root@Chris ~]# service httpd restart
中止 httpd:[肯定]
正在啓動 httpd:httpd: apr_sockaddr_info_get() failed for Chris
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[肯定]

49 刷新一下網頁便可,而後點擊我贊成

50 等到安裝的時候,會出現下面的界面會提示目錄的不少文件沒法寫入,以下界面

51 上面有不少都是紅叉狀態,這個就表示discuz的配置文件沒法寫入,這是咱們就須要對其進行受權。

首先咱們須要cd到discuz網站的根目錄

[root@Chris ~]# cd /var/www/html/discuz/

而後在discuz網站的根目錄下對其進行受權寫入

[root@Chris ~]# cd /var/www/html/discuz/
[root@Chris discuz]# chmod o+w config data data/cache data/avatar data/plugindata data/download data/addonmd5 data/template data/threadcache data/attachment data/attachment/album data/attachment/forum data/attachment/group data/log uc_client/data/cache uc_server/data/ uc_server/data/cache uc_server/data/avatar uc_server/data/backup uc_server/data/logs uc_server/data/tmp uc_server/data/view
[root@Chris discuz]# 

52 刷新一下網頁便可,點擊下一步

53 選擇全新安裝discuz

54 配置好數據庫信息點擊下一步便可安裝

55 出現下面的界面就表示discuz安裝安裝啦

 

 


 

做者:李文軒

座右銘:一個願意爲理想奮鬥終生的人!

聯繫QQ:838997384

網站地址:www.74cto.com

相關文章
相關標籤/搜索