Mysql初步认实和搭建LAMP环境部署Ucenter和Ucenter-home网站

目标:

在xuegod63.cn服务器上,使用网站模版UCenter_1.5.0_SC_UTF8.zip和UCenter_Home_2.0_SC_UTF8.zip为公司搭建一个类似人人网的网站。在Windows上,使用访问uc.duwers63.cn可以访问UCenter;使用www.duwers63.cn可以访问UCenter_Home。

安装

yum -y install httpd mysql-server mysql phpphp-mysql

软件包解释:

 httpd #web网站服务器

 mysql-server #mysql数据库服务器

 mysql   #mysql数据库linux客户端

php   #php

php-mysql  # 

查看php-mysql包作用:

wKiom1ey9AuReB56AAF-DZxC0AY703.jpg

查看apache版本:

[root@duwers63 ~]# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built:   Jul 18 2016 15:24:00
[root@duwers63 ~]#

 

查看mysql数据库的版本

[root@duwers63 ~]# rpm -qa | grep mysql
mysql-server-5.1.73-7.el6.x86_64
php-mysql-5.3.3-48.el6_8.x86_64
mysql-devel-5.1.73-7.el6.x86_64
mysql-libs-5.1.73-7.el6.x86_64
mysql-5.1.73-7.el6.x86_64
[root@duwers63 ~]#

mysql –V是查看mysql客户端的版本

[root@duwers63 ~]# mysql -V
mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline5.1

启动服务LAMP相关服务:

[root@duwers63 ~]# service httpd restart
[root@duwers63 ~]# chkconfig --level 35httpd on
[root@duwers63 ~]# chkconfig --level 35 mysqldon
[root@duwers63 ~]# service mysqld start

测试数据库连接:

连接 mysql 数据库,连接本机可以去掉-h

  • #mysql

  • # mysql -h IP -u USER -pPASS

mysql mysql 的超级管理员 root 拥有最 mysql 数据库的最高权限。例:

  • # mysql -u root

  • mysql> exit; #退出mysql mysql每条命令后都加一个分号;结束。

 

配置mysql数据库root密码

/usr/bin/mysqladmin -u root password'123456'

wKioL1ey9N2DwFc8AACTUwOqWWQ133.jpg

wKiom1ey9N2S14LOAAAWAeE2IkY903.png

数据库净化

 #这一段实在不能弄成代码模式,不知道51怎么回事,就这样了哈!!

#着色的地方是需要手工选择的【脚本当然也可以咯】

[root@duwers63 ~]#mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT ISRECOMMENDED FOR ALL MySQL

     SERVERS IN PRODUCTION USE!  PLEASEREAD EACH STEP CAREFULLY!

In order to log into MySQL to secure it,we'll need the current

password for the root user.  If you've just installed MySQL, and

you haven't set the root password yet, thepassword will be blank,

so you should just press enter here.

Enter current password for root (enter fornone):

OK, successfully used password, movingon...

Setting the root password ensures thatnobody can log into the MySQL

root user without the proper authorisation.

You already have a root password set, soyou can safely answer 'n'.

Change the root password? [Y/n] n

 ...skipping.

By default, a MySQL installation has ananonymous user, allowing anyone

to log into MySQL without having to have auser account created for

them. This is intended only for testing, and to make the installation

go a bit smoother.  You should remove them before moving into a

production environment.

Remove anonymous users? [Y/n] Y

 ...Success!

Normally, root should only be allowed toconnect from 'localhost'.  This

ensures that someone cannot guess at theroot password from the Network.

Disallow root login remotely? [Y/n] Y

 ...Success!

By default, MySQL comes with a databasenamed 'test' that anyone can

access. This is also intended only for testing, and should be removed

before moving into a production environment.

Remove test database and access to it?[Y/n] Y

 -Dropping test database...

 ...Success!

 -Removing privileges on test database...

 ...Success!

Reloading the privilege tables will ensurethat all changes made so far

will take effect immediately.

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.

Thanks for using MySQL!

[root@duwers63 ~]#

 

 

净化后的数据库

 

[root@duwers63 ~]# mysql -u root -p123456

Welcome to the MySQL monitor.  commands end with ; or \g.

Your MySQL connection id is 12

Server version: 5.1.73 Source distribution

 

Copyright (c) 2000, 2013, Oracle and/or itsaffiliates. All rights reserved.

 

Oracle is a registered trademark of OracleCorporation and/or its

affiliates. Other names may be trademarksof their respective

owners.

 

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

 

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

+--------------------+

2 rows in set (0.01 sec)

 

mysql> exit

Bye

配置文件

[root@duwers63 ~]# ls /etc/my.cnf
/etc/my.cnf
[root@duwers63 ~]#

 

测试网站是否支持PHP

[root@duwers63 ~]# cd /var/www/html/
[root@duwers63 html]# vim index.php

 index.php内容就是个探针了:

<?php

phpinfo();

?>

wKiom1ey9xaBDFLZAAJCt_tJMBY403.jpg-wh_50

 

部署UcenterUcenter-home网站

 

上传相关软件包[如下图暗黄色的]

wKiom1ey91KyO1YfAABVZ51M5Wg757.jpg

 

安装ucenter

解压ucenter

unzip -d /usr/local/src/ucenterUCenter_1.6.0_SC_UTF8.zip

复制解压后的文件到网站目录

cd /usr/local/src/ucenter
[root@duwers63 ucenter]# ls
advanced readme  upload  utilities
[root@duwers63 ucenter]# mv upload//var/www/html/kaixin001
[root@duwers63 ucenter]# cd/var/www/html/kaixin001/
[root@duwers63 kaixin001]# ls
admin.php avatar.php  crossdomain.xml  images    install  lib    plugin  robots.txt
api       control     data             index.php  js      model  release  view
[root@duwers63 kaixin001]#

修改data目录权限

[root@duwers63 kaixin001]# ll -d data/
drwxr-xr-x 8 root root 4096 May 20  2011 data/
[root@duwers63 kaixin001]# chownapache:apache data/
[root@duwers63 kaixin001]# ll -d data/
drwxr-xr-x 8 apache apache 4096 May 20  2011 data/
[root@duwers63 kaixin001]#

 

web安装ucenter

http://192.168.20.63/kaixin001/install/

 

 wKioL1ey96qTnaHvAADibvCLrUg437.jpg-wh_50

 

安要求修改配置文件

[root@duwers63 kaixin001]# vim /etc/php.ini

修改的内容为:short_open_tag = On

重启服务

[root@duwers63 kaixin001]# service httpdrestart
Stopping httpd:                                           [  OK  ]
Starting httpd:                                           [  OK  ]
[root@duwers63 kaixin001]#

解决完问题后从新安装

 wKiom1ey99biCJL2AAG1AzHbHNw616.jpg-wh_50

 

 

安装完后的界面

 wKioL1ey-ASRzhEMAAGNSbGFcBE160.jpg-wh_50

 

创建用户中心管理员账户为ucenter_home安装做准备

 wKioL1ey-DWShsGNAADQC5uGfZA423.jpg-wh_50

 

安装UCenter_Home

解压软件包

unzip -d /usr/local/src/uchomeUCenter_Home_2.0_SC_UTF8.zip
[root@duwers63 ~]# cd/usr/local/src/uchome/
[root@duwers63 uchome]# ls
2.0_changelog.txt  readme.txt update  upload
[root@duwers63 uchome]# mv upload//var/www/html/kaixin
[root@duwers63 uchome]# cd !$
cd /var/www/html/kaixin
[root@duwers63 kaixin]# ls
admin       common.php       do.php      install     magic.php    template    xmlrpc.php
admincp.php config.new.php   editor.php  invite.php network.php  theme
api         cp.php           help.php    js.php     rss.php      uc_client
app.php     crossdomain.xml  image       language    source      userapp.php
attachment  data             index.php   link.php   space.php    ver.php

生成安装文件

[root@duwers63 kaixin]# cp config.new.phpconfig.php
[root@duwers63 kaixin]# chmod 755config.php

修改相关文件权限

[root@duwers63 kaixin]# chown apache:apacheattachment/ data/ uc_client/ -R
[root@duwers63 kaixin]#

web安装UCenter_Home

http://192.168.20.63/kaixin/install

wKiom1ey-PLTc46UAADOKJoRvkI519.jpg-wh_50

 

按要求解决问题

[root@duwers63 kaixin]# chown apache:apacheconfig.php

回到web安装

 

wKioL1ey-R_TMQwiAAEvvCBM-w4580.png-wh_50

 

下图的创始人密码就是上文创建的用户的密码,这里是123456

URL则为ucenter的访问地址,下图多写了//

 

wKiom1ey-UjwRtRhAAEdBZzL3BM002.png-wh_50

 

下图画线的地方应该留意

wKiom1ey-XPCZYnOAADA-aesajk211.jpg-wh_50

 

安装完成的界面

wKioL1ey-ayTmhmsAAEWr7PC9uA811.jpg-wh_50

 

 

配置apache使两个域名可以在一个IP上被访问

修改apache配置文件

[root@duwers63 kaixin]# vim/etc/httpd/conf/httpd.conf

 

去掉下行的注释

NameVirtualHost *:80

 

修改CIrtualHost

<VirtualHost *:80>
   ServerAdmin webmaster@dummy-host.example.com
   DocumentRoot /var/www/html/kaixin001
   ServerName uc.duwers63.space
   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/kaixin
   ServerName www.duwers63.space
   ErrorLog logs/dummy-host.example.com-error_log
   CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

修改hosts文件

[root@duwers63 kaixin]# tail /etc/hosts
127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain4
::1        localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.20.63 duwers63.space duwers63
192.168.20.60 duwers60.space duwers60
192.168.20.63 uc.duwers63.space duwers63
192.168.20.63 www.duwers63.space duwers63
[root@duwers63 kaixin]#

重启服务

[root@duwers63 kaixin]# service httpdrestart
Stopping httpd:                                           [  OK  ]
Starting httpd:                                           [  OK  ]
[root@duwers63 kaixin]#

 

修改windowshosts文件

修改如下图说明

wKiom1ey-kuxANYnAAIXjfzF_Sw608.jpg

测试

 

访问www.duwers63.space

 

wKioL1ey-oaQLGFPAAGrqnuobOI218.jpg-wh_50

 

访问uc.duwers63.space

wKioL1ey-qOhERsQAAGrqnuobOI986.jpg-wh_50 

 

 The End!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

本文出自 “duwers” 博客,请务必保留此出处http://duwers.blog.51cto.com/7376225/1839341

赞 (0) 评论 分享 ()