环境: 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能够访问数据库
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
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
在命令行测试以下:
2.2 配置httpd服务,开启虚拟主机:
vim /etc/httpd/conf/httpd.conf
修改以下:
NameVirtualHost *.80
修改以下:
<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!!!
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 ]
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的全部权限
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
点击Please click here to install it.
上图须知,php需开启标签功能
vim /etc/php.ini
short_open_tag=on #以下图
保存退出,推出后,重启httpd服务
service httpd restart
而后宿主机浏览器中F5刷新,点击我赞成,以下图
而后开机检测运行环境以及,文件权限和依赖关系所有Ok,点击下一步,以下图:
开始安装数据库,填写以前配置好的信息,并建立管理员密码以下图,点击下一步:
出现,以下图界面表示,已安装成功!!!,点击下一步:
尝试输入密码,登陆
OK,UCenter安装完成了
安装UCenter_Home
在宿主机浏览器地址栏中,输入www.xgan63.cn,
按图,在服务器中操做以下:
mv /var/www/html/ucenter_home/config.new.php /var/www/html/ucenter_home/config.php
而后在宿主机浏览器中按F5刷新,
出现以下图(检测文件访问权限,都没有问题):(点击受权协议,并开始安装)
而后,出现以下图,让咱们输入UCenter信息(地址和创世密码),输入后点击提交:
出现以下图,找不到UCenter,输入IP地址,并点击确认
点击下一步,开始安装数据库
填入已经设置好的数据库信息,以下图,并点击设置完毕:
UCenter Home链接到数据库并建立数据库结构,添加默认数据后,出现以下图:
(填写想要建立的管理员帐户和密码后,点击开通管理员空间)
出现以下图界面,Ok UCenter Home已安装完成,可点击 进入个人空间或进入管理平台进行管理
---> 进入个人空间
---> 进入管理平台
Ok,到此时,咱们的UCenter和UCenter_Home已搭建完成了!!!