1.安装jdk运行环境
jdk下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html
此处我使用的jdk7U99版本,如下
[root@zabbix ~]# java -version java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
注:不要忘记设置环境变量
[root@zabbix ~]# more /etc/profile.d/jdk.sh export JAVA_HOME=/usr/java/default export PATH=$JAVA_HOME/bin/:$PATH
2.安装tomcat
tomcat下载地址:http://tomcat.apache.org/
此处我使用的是tomcat-7.0.57
解压至/USR/LOCAL
[root@zabbix src]# tar xf apache-tomcat-7.0.57.tar.gz -C ../ [root@zabbix src]# cd .. [root@zabbix local]# ln -s apache-tomcat-7.0.57/ tomcat
3.安装Mysql
默认yum自带的mysql版本都很低,此处我们需要升级一下
[root@zabbix~]# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm [root@zabbix-b1 ~]# yum --enablerepo=remi,remi-test list mysql mysql-server Loaded plugins: security Available Packages mysql.x86_64 5.5.47-1.el6.remi remi mysql-server.x86_64 5.5.47-1.el6.remi remi [root@zabbix-b1 ~]# yum --enablerepo=remi install mysql mysql-server -y
启动并配置mysql:
[root@zabbix ~]# /etc/init.d/mysqld start #启动mysql [root@zabbix ~]# chkconfig mysqld on #设置开机启动 [root@zabbix ~]# mysqladmin -u root password '123456' #设置root密码 [root@zabbix ~]# mysql -uroot -p #登陆mysql mysql> create database fastdfs; #创建fastdfs数据库 Query OK, 1 row affected (0.00 sec) #为fastdfs-zyc创建数据库访问账户 mysql> grant all privileges on fastdfs.* to 'fastdfs'@'127.0.0.1' identified by '123456'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
4.安装fastdfs-zyc
下载地址:http://code.google.com/p/fastdfs-zyc/
安装及配置:
[root@zabbix webapps]# pwd /usr/local/tomcat/webapps [root@zabbix webapps]# unzip fastdfs-zyc-fastdfs_client1.24版本.zip #为了便于访问,将解压目录更名为ROOT [root@zabbix webapps]# mv fastdfs-zyc ROOT [root@zabbix webapps]# cd ROOT [root@zabbix ROOT]# mysql -u root -p --default-character-set UTF8 fastdfs < fdfs.sql [root@zabbix ROOT]# cd /usr/local/tomcat/webapps/ROOT/WEB-INF/classes [root@zabbix classes]# vim application.properties #数据库连接的配置 #修改 datasource.type=mysql datasource.driverClassName=com.mysql.jdbc.Driver datasource.url=jdbc:mysql://127.0.0.1:3306/fastdfs?useUnicode=true&characterEncoding=UTF-8 #属性 datasource.username=root #用户 datasource.password=123456 #密码 datasource.maxActive=5 datasource.maxIdle=2 datasource.maxWait=120000 datasource.whenExhaustedAction=1 datasource.validationQuery=select 1 from sequenceid datasource.testOnBorrow=true datasource.testOnReturn=false c3p0.acquireIncrement=3 c3p0.initialPoolSize=3 c3p0.idleConnectionTestPeriod=900 c3p0.minPoolSize=2 c3p0.maxPoolSize=50 c3p0.maxStatements=100 c3p0.numHelperThreads=10 c3p0.maxIdleTime=600 #mail server info mail.smtp.host=XXXXXXX #报警邮箱 mail.smtp.auth=true mail.smtp.username=XXXXX mail.smtp.password=XXXXXXXXX #cache.config=oscache.propertie [root@zabbix classes]# vim fdfs_client.conf #指定tracker connect_timeout = 2 network_timeout = 30 charset = ISO8859-1 http.tracker_http_port = 8080 http.anti_steal_token = no http.secret_key = FastDFS1234567890 tracker_server = 192.168.x.x:22122 [root@zabbix classes]# vim config.xml #指定storage配置 <?xml version="1.0" encoding="UTF-8"?> <root> <server> <ip>192.168.xx.xxx</ip> <port>22</port> <username>root</username> <password>1qazxsw2</password> <logpath>/usr/local/tomcat/logs/</logpath> </server> <server> <ip>192.168.xx.xx</ip> <port>22</port> <username>root</username> <password>1qazxsw2</password> <logpath>/usr/local/tomcat/logs/</logpath> </server> <!-- 方式1 <ssh>/Users/Chen/.ssh/id_rsa</ssh> <ip>192.168.40.53</ip> <port>22</port> <username>root</username> <logpath>/usr/local/nginx-1.3.4/logs/</logpath> </server> --> <!--方式2 <ip>192.168.40.53</ip> <username>root</username> <password>vivame@2012</password> <logpath>/usr/local/nginx-1.3.4/logs/</logpath> </server> --> </root>
之后重启tomcat即可,访问地址http://192.168.xx.xx:8080
如果前面不把目录设置成ROOT,那么访问路径应该为http://192.168.xx.xx:8080/fastdfs-zyc
出现如下界面,恭喜你,搭建成功
默认用户名为admin,密码为123456