Fastdfs-zyc配置
1.安装jdk运行环境
1.1下载
http://www.oracle.com/technetwork/java/javase/downloads/index.html
1.2 解压缩jdk
tar -xzvf jdk-7u11-linux-x64.gz mv jdk1.7.0_11/ /usr/local/
1.3配置java全局环境变量
vim /etc/profile exportJAVA_HOME=/usr/local/jdk1.7.0_11 exportCLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib exportPATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin source /etc/profile //将变量载入系统 java -version //查看java版本号,若输出如下信息,则正常 java version "1.7.0_11" Java(TM) SE Runtime Environment (build 1.7.0_11-b21) Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixedmode)
2.安装tomcat
2.1下载
2.2解压缩tomcat
tar -zxvf apache-tomcat-7.0.35.tar.gz -C /usr/local/tomcat cd /usr/local/tomcat ./bin/startup.sh //若成功执行并返回如下信息,表明tomcat正常工作 Using CATALINA_BASE: /usr/local/apache-tomcat-7.0.35 Using CATALINA_HOME: /usr/local/apache-tomcat-7.0.35 Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.35/temp Using JRE_HOME: /usr/local/jdk1.7.0_11 Using CLASSPATH: /usr/local/apache-tomcat-7.0.35/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.35/bin/tomcat-juli.jar
3.Mysql安装及配置
3.1安装
yum install mysql-server
3.2启动并配置
service mysqld start //启动服务 chkconfig mysqld on //开机启动 mysqladmin -u root password ‘password’ //设置root密码 mysql -uroot -p //登录mysql mysql > create database fastdfs; //创建fastdfs数据库 mysql > grant all privileges on fastdfs.* to ‘useranme’@’hostname’identified ‘password’; //为fastdfs-zyc创建数据库访问账户
4.安装fastdfs-zyc
4.1下载
http://code.google.com/p/fastdfs-zyc/
4.2安装及配置
cd /usr/local/tomcat/webapps unzip fastdfs-zyc.zip cd fastdfs-zyc mysql -u root -p --default-character-set UTF8 fastdfs < fdfs.sql cd /usr/local/tomcat/webapps/fastdfs-zyc/WEB-INF/classes vim application.properties //数据库连接配置 datasource.url=jdbc:mysql://localhost:3306/fastdfs?useUnicode=true&characterEncoding=UTF-8 //数据库连接属性 datasource.username=root //用户 datasource.password=1qazxsw2 //密码 mail.smtp.host=demo.temp.com //报警邮箱设置 mail.smtp.username=demo mail.smtp.password=demo vim fdfs_client.conf //指定tracker tracker_server ip=192.168.20.140:22122 vim config.xml //指定storage配置 <?xmlversion="1.0" encoding="UTF-8"?> <root> <server> <ip>192.168.20.141</ip> <port>22</port> <username>root</username> <password>1qazxsw2</password> <logpath>/usr/local/nginx-1.3.4/logs/</logpath> </server> <server> <ip>192.168.20.144</ip> <port>22</port> <username>root</username> <password>1qazxsw2</password> <logpath>/usr/local/nginx-1.3.4/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>
4.3重启tomcat
访问http://172.16.23.57:8080/fastdfs-zyc/
默认用户名和密码为:root,123456
如果在登录页面数据用户和密码没有反应,查看tomcat日志(/usr/loca/tomcat/log/tomcat/cataline.out),可知是mysql没有赋予相应用户的访问权限造成。