说明:按照本教程搭建的LAMP环境适用于全部服务器,若是你想搭建一个小型的我的网站,那么就可使用本套教程php
本套教程是从一个RedHat6.4最小化安装的状态下开始一一操做。html
首先咱们须要一台纯净版的RedHat6.4(64位)最小化安装的操做系统mysql
RedHat安装了纯净版的RedHat6.4(64位)最小化安装的操做系统linux
请将redhat6.4的安装盘插入虚拟机sql
[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
#!/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
脚本运行: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
下面我来教你们如何api
做者:李文轩浏览器
座右铭:一个愿意为理想奋斗终生的人!
联系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源配置完成!
-------------------------------------------------------------------------------------------------------------------------------------------
做者:李文轩
座右铭:一个愿意为理想奋斗终生的人!
联系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服务器就安装配置完成啦!
---------------------------------------------------------------------------------------------------------
做者:李文轩
座右铭:一个愿意为理想奋斗终生的人!
联系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数据库。
做者:李文轩
座右铭:一个愿意为理想奋斗终生的人!
联系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就配置完成啦!
做者:李文轩
座右铭:一个愿意为理想奋斗终生的人!
联系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给禁用啦。
做者:李文轩
座右铭:一个愿意为理想奋斗终生的人!
联系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)
到了这里咱们的数据库就算是建立完成啦!
做者:李文轩
座右铭:一个愿意为理想奋斗终生的人!
联系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博客网站就搭建完成啦!
做者:李文轩
座右铭:一个愿意为理想奋斗终生的人!
联系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
做者:李文轩
座右铭:一个愿意为理想奋斗终生的人!
联系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