一、说明
本次部署环境为CentOS6.3 x86_64
二、环境布署
A. 挂载硬盘
Ø 查看分区情况
fdisk –l
Ø cd /
Ø mkdir e-Taxi
Ø chmod 777 -R e-Taxi/
Ø 挂载
mount /dev/xvdb1 /e-Taxi
Ø 查看挂载情况
df –k
Ø 实现开机自动挂载
vi /etc/fstab
添加一行
/dev/xvdb1 /e-Taxi ext4 defaults 0 0
Ø 重启电脑
Reboot
B. WEB环境搭建
Ø yum -y install gcc
Ø yum -y install gcc-c++
Ø yum -y install httpd php mysql mysql-server mysql-devel php-mysqlphp-xml php-cgi php-mbstring php-gd
yum install php-pdo_mysql
Ø chkconfig httpd on
Ø hkconfig mysqld on
Ø chkconfig mysqld on
Ø service mysqld start
Ø chown -R apache /usr/local/www
Ø chcon -R -t httpd_sys_content_t /usr/local/www
Ø service httpd restart
Ø iptables -F
Ø 修改httpd配置文件
vi /etc/httpd/conf/httpd.conf
在文件的最后修改如下:
<VirtualHost*:80>
ServerAdminwebmaster@dummy-host.example.com
DocumentRoot /e-Taxi/www
ServerName dummy-host.example.com
ErrorLoglogs/dummy-host.example.com-error_log
CustomLoglogs/dummy-host.example.com-access_log common
</VirtualHost>
Ø mysql添加一个所有权限用户:
[root@AY140120114748509b0dZ~]# mysql -u root -p
Enterpassword:
Welcometo the MySQL monitor. Commands end with; or \g.
YourMySQL connection id is 15
Serverversion: 5.1.71 Source distribution
Copyright(c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle isa 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>insert into mysql.user(host,user,password) values("%","etaxi",password("etaxi123456"));
Query OK,1 row affected, 3 warnings (0.00 sec)
mysql>GRANT ALL PRIVILEGES ON *.* TO 'etaxi' IDENTIFIED BY 'etaxi123456' WITH GRANT OPTION;
Query OK,0 rows affected (0.00 sec)
mysql>FLUSH PRIVILEGES;
Query OK,0 rows affected (0.00 sec)
mysql>
C. ActiveMQ消息队列安装
Ø Java环境搭建
yum -y install java-1.6.0-openjdk*
Ø 查看是否安装成功
java -version
Ø 输出:
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.4)(rhel-1.49.1.11.4.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
Ø 开始安装activemq
cd /e-Taxi/service/
tar -zxvf apache-activemq-5.7.0-bin.tar.gz
mv apache-activemq-5.7.0 activemq
Ø 修改配置文件
vi /e-Taxi/service/activemq/conf/activemq.xml
添加一句
<transportConnectors>
<!-- DOS protection, limit concurrentconnections to 1000 and frame size to 100MB -->
<transportConnector name="openwire"uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireformat.maxFrameSize=104857600"/>
<transportConnectorname="stomp+nio" uri="stomp+nio://0.0.0.0:61613"/>
</transportConnectors>
Ø 启动服务
cd bin/
./activemq start
Ø 检查
netstat -an | grep 61616
tcp 0 0:::61616 :::* LISTEN
netstat -an | grep 61613
tcp 0 0:::61613 :::* LISTEN
三、项目代码布署
A. 部署API接口文档
Ø 将e-TaxiSvc文件夹拷贝到服务器的/e-Taxi/www/e-Taxi目录下
Ø 给以权限
chmod 777 -R /e-Taxi/www/e-Taxi
Ø 检查
在网页里输入http://您的IP:您的端口号/e-Taxi/e-TaxiSvc/index.php
将看到:
欢迎使用e-Taxi接口!