2-13 搭建LAMP环境并部署Ucenter和Ucenter-home网站

 

环境: php

VMware Virtual Machine : XGan63.cn html

IP: 192.168.31.63 (Bridge)mysql

已配置本地yum源 ---> /mntweb

已配置网络yum源 ---> http://mirrors.aliyun.comsql

安装前确保环境干净,避免软件冲突形成影响shell

检查环境:数据库

which httpd #查看是否安装httpd服务apache

chkconfig --list httpd #检查httpd启动项vim

chkconfig --list mysqld #检查mysqld启动项浏览器

which php #检查php是否已安装

rpm -qa | grep httpd #查看 httpd,php,mysql是否已安装

rpm -qa | grep php

rpm -qa | grep mysql

一. 安装 Apache,MySQL,PHP

yum -y install httpd mysql-server php php-mysql

# httpd是apache的web服务,提供web访问服务

# mysql-server是数据库服务,mysql是本地访问数据客户端程序,安装server时,会被装上的

# php 解析php网页

# php-mysql php与mysql链接程序,是php能够访问数据库

wpsB593.tmp

wpsB594.tmp

httpd数错了,没装上,不过php依赖关系时,给装上了

二. 配置环境

1. 配置apahce并测试php

设置开机启动项

chkconfig httpd on

启动服务,在客户端访问,测试

service httpd start

测试PHP,建立查看phpinfo()信息界面

echo "<?php phpinfo() ?> " >> /var/www/html/index.php

在宿主机中访问地址192.168.31.63,结果以下:Ok

wpsB595.tmp

2. 配置Apache开启虚拟主机实现

uc.xgan63.cn访问ucenter;

www.xgan63.cn访问ucenter_home;

2.1 在宿主机中,修改host添加域名信息,

使其可以解析域名uc.xgan63.cn和www.xgan63.cn

C:\Windows\System32\drivers\etc\hosts

192.168.31.63 uc.xgan63.cn

192.163.31.63 www.xgan63.cn

wpsB5A6.tmp

在命令行测试以下:

wpsB5A7.tmp

2.2 配置httpd服务,开启虚拟主机:

vim /etc/httpd/conf/httpd.conf

wpsB5A9.tmp

修改以下:

NameVirtualHost *.80

wpsB5AA.tmp

修改以下:

<VirtualHost *:80>

    ServerAdmin webmaster@dummy-host.example.com

    DocumentRoot /var/www/html/ucenter

    ServerName uc.xgan63.cn

    ErrorLog logs/dummy-host.example.com-error_log

    CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>

<VirtualHost *:80>

    ServerAdmin webmaster@dummy-host.example.com

    DocumentRoot /var/www/html/ucenter_home

    ServerName www.xgan63.cn

    ErrorLog logs/dummy-host.example.com-error_log

    CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>

2.3 重启squid和httpd服务:

service httpd restart #httpd重启

2.4 在宿主机中测试以下图:Ok!!!

wpsB5AB.tmp

wpsB5AC.tmp

3. 配置mysql

chkconfig mysqld on #添加开机启动

service mysqld start # 启动mysqld服务

[root@xgan63 ~]# service mysqld start

Initializing MySQL database:  Installing MySQL system tables...

OK

Filling help tables...

OK  #见到这两个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 xgan63.cn 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!

                                                           [  OK  ]

Starting mysqld:                                           [  OK  ]

wpsB5AD.tmp

mysql_secure_installation #运行安全配置初始化

[root@xgan63 ~]# mysql_secure_installation

...

Enter current password for root (enter for none): # 回车便可

OK, successfully used password, moving on...

...

Set root password? [Y/n] y # 设置root密码

New password: # 输入root密码

Re-enter new password: # 再次输入

... Success!...

...

Remove anonymous users? [Y/n] y # 删除匿名用户

... Success!

...

Disallow root login remotely? [Y/n] y # 禁止root用户远程链接

... Success!

Remove test database and access to it? [Y/n] y # 测试数据

- Dropping test database...

... Success!

...

- Removing privileges on test database...

... Success!

...

Reload privilege tables now? [Y/n] y

... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL

installation should now be secure.

为UCenter建立数据库,和专门的维护用户

安全起见,咱们应该在mysql中ucenter专门建立一个用户用于维护数据库,方法以下:

mysql -uroot -p123456 #命令行中,进入数据库

create database ucenter; # 建立UCenter数据库

create user center@localhost identified by shihuan1989; #建立本机用户,并设置密码为shihuan1989

grant all privileges on ucenter.* to center@localhost;#受权本机用户center对于ucenter的全部权限

wpsB5AE.tmp

4. 下载UCenter_1.5.2_SC_UTF8.zip和UCenter_Home_2.0_SC_UTF8.zip

并安装配置

UCenter_1.5.2 URL:

http://download.comsenz.com/UCenter/1.5.2/UCenter_1.5.2_SC_UTF8.zip

UCenter_Home_2.0 URL:

http://download.comsenz.com/UCenter_Home/2.0/UCenter_Home_2.0_SC_UTF8.zip

使用wget命令或经过浏览器下载到宿主机后使用Xshell上传到服务器XGan63.cn

解压缩UCenter和UCenter_Home到指定目录

并将解压后的upload目录中的文件所有移动到对应的工做目录下:

解压UCenter并上传文件到工做目录:

unzip -d  /usr/local/src/ucenter   UCenter_1.5.2_SC_UTF8.zip

unzip -d  /usr/local/src/ucenter_home    UCenter_Home_2.0_SC_UTF8.zip

mv /usr/local/src/ucenter/upload/* /var/www/html/ucenter/.

mv /usr/local/src/ucenter_home/upload/* /var/www/html/ucenter_home/.

并赋予apache文件权限

chown -R apache:apache /var/www

安装UCenter

在宿主机浏览器中访问uc.xgan63.cn

wpsB5AF.tmp

点击Please click here to install it.

wpsB5B0.tmp

上图须知,php需开启标签功能

vim /etc/php.ini

short_open_tag=on #以下图

wpsB5C0.tmp

保存退出,推出后,重启httpd服务

service httpd restart

而后宿主机浏览器中F5刷新,点击我赞成,以下图

wpsB5C1.tmp

而后开机检测运行环境以及,文件权限和依赖关系所有Ok,点击下一步,以下图:

wpsB5C2.tmp

开始安装数据库,填写以前配置好的信息,并建立管理员密码以下图,点击下一步:

wpsB5C3.tmp

出现,以下图界面表示,已安装成功!!!,点击下一步:

wpsB5C4.tmp

wpsB5C5.tmp

尝试输入密码,登陆

wpsB5C6.tmp

OK,UCenter安装完成了

安装UCenter_Home

在宿主机浏览器地址栏中,输入www.xgan63.cn,

wpsB5C7.tmp

按图,在服务器中操做以下:

mv /var/www/html/ucenter_home/config.new.php /var/www/html/ucenter_home/config.php

而后在宿主机浏览器中按F5刷新,

出现以下图(检测文件访问权限,都没有问题):(点击受权协议,并开始安装)

wpsB5C8.tmp

而后,出现以下图,让咱们输入UCenter信息(地址和创世密码),输入后点击提交:

wpsB5C9.tmp

出现以下图,找不到UCenter,输入IP地址,并点击确认

wpsB5CA.tmp

点击下一步,开始安装数据库

wpsB5CB.tmp

填入已经设置好的数据库信息,以下图,并点击设置完毕:

wpsB5CC.tmp

UCenter Home链接到数据库并建立数据库结构,添加默认数据后,出现以下图:

(填写想要建立的管理员帐户和密码后,点击开通管理员空间)

wpsB5CD.tmp

出现以下图界面,Ok UCenter Home已安装完成,可点击 进入个人空间或进入管理平台进行管理

wpsB5DE.tmp

---> 进入个人空间

wpsB5DF.tmp

---> 进入管理平台

wpsB5EF.tmp

Ok,到此时,咱们的UCenter和UCenter_Home已搭建完成了!!!

相关文章
相关标签/搜索