1 理论知识
1.1 支持技术特点
Technology: Java JEE (Java 7),
Directories: LDAP, Active Directory,
Data bases: PostgreSQL, MySQL,
Operating systems: GNU/Linux,
Servers: Tomcat, Jetty.
Browers: Internet Explorer (9,10,11), Firefox (17 ESR and above), Chrome (latest).
1.2 部署的运行环境
1)CentOS 6
2)Java 7
2)Tomcat
3)Apache
4)MySQL
2 实践部分
2.1 yum源的安装
2.1.1 yum安装Java 7
yum -y install java-1.7.0-openjdk
2.1.2 yum安装Tomcat
yum -y install tomcat6 tomcat6-webapps tomcat6-admin-webapps tomcat6-docs-webapp tomcat6-javadoc
2.1.3 yum安装Apache
yum -y install httpd
2.1.4 yum安装MySQL
yum -y install mysql-server mysql-devel mysql
以上可以合并成一条指令
yum -y install java-1.7.0-openjdk tomcat6 tomcat6-webapps tomcat6-admin-webapps tomcat6-docs-webapp tomcat6-javadoc httpd mysql-server mysql-devel mysql
2.1.5 yum安装部署工具
yum -y install unzip bzip2 wget vim
2.2 LinShare的下载
2.2.1 官方的下载地址
http://download.linshare.org/versions/latest
2.2.2 下载的文件名称
linshare-core-{VERSION}-without-SSO.war
linshare-ui-admin-{VERSION}.tar.bz2
2.2.3 实际下载到的文件
实际的版本和名称如下:
linshare-core-1.9.5.war
inshare-ui-admin-2.3.4.tar.bz2
2.2 配置MySQL
2.2.1 启动MySQL并设置开机启动
/etc/init.d/mysqld start chkconfig mysqld on
2.2.2 初始化MySQL
mysql_secure_installation
注:初始化过程省略
2.2.3 创建数据库
cp linshare-core-1.9.5.war linshare.war unzip -j linshare.war WEB-INF/classes/sql/mysql/createDatabase.sql
详细内容如下:
-- Default script for database creation DROP DATABASE IF EXISTS `linshare`; DROP DATABASE IF EXISTS `linshare_data`; CREATE DATABASE `linshare` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE DATABASE `linshare_data` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE USER 'linshare'@'localhost' IDENTIFIED BY 'linshare'; GRANT ALL PRIVILEGES ON `linshare`.* TO 'linshare'@'localhost'; GRANT ALL PRIVILEGES ON `linshare_data`.* TO 'linshare'@'localhost'; FLUSH PRIVILEGES;
请修改第9行密码部分后再执行如下语句:
mysql -uroot -p < createDatabase.sql
2.2.4 导入表结构
unzip -j linshare.war WEB-INF/classes/sql/mysql/createSchema.sql mysql -uroot -p linshare < createSchema.sql
2.2.5 导入基础的数据
unzip -j linshare.war WEB-INF/classes/sql/mysql/import-mysql.sql mysql -uroot -p linshare < import-mysql.sql
2.2.6 解压配置文件到指定目录
mkdir -p /etc/linshare unzip -j -d /etc/linshare/ linshare.war WEB-INF/classes/{linshare,log4j}.*
2.2.7 配置数据库连接文件
cp /etc/linshare/linshare.properties.sample /etc/linshare/linshare.properties vim /etc/linshare/linshare.properties
DataStore部分修改如下(关闭PostgreSQL的jdbc同时开启MySQL的jdbc):
#******************* DATASTORE #uncomment this line to encrypt the files #linshare.datastore.class=org.linagora.linshare.core.dao.EncDbDataStore #******************** DATABASE ### PostgreSQL #linshare.db.username=linshare #linshare.db.password=linshare #linshare.db.driver.class=org.postgresql.Driver #linshare.db.url=jdbc:postgresql://localhost:5432/linshare #linshare.db.dialect=org.hibernate.dialect.PostgreSQLDialect #linshare.db.persistence_manager=org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager ### MySQL linshare.db.username=linshare linshare.db.password=linshare linshare.db.driver.class=com.mysql.jdbc.Driver linshare.db.url=jdbc:mysql://localhost:3306/linshare linshare.db.dialect=org.hibernate.dialect.MySQL5Dialect linshare.db.persistence_manager=org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager
2.3 部署linshare程序包
cp linshare.war /var/lib/tomcat6/webapps/ mkdir -p /var/lib/linshare chown -R tomcat:tomcat /var/lib/linshare
2.4 配置ui-user
2.4.1 创建应用程序目录
mkdir /var/www/linshare chown -R apache:apache /var/www/linshare
2.4.2 创建日志目录
mkdir /var/log/apache2/
2.4.3 配置虚拟服务
vim /etc/httpd/conf.d/linshare-user.conf
输入如下内容:
<VirtualHost *:80> ServerName www.cmdschool.org #The following is in the case of you create a root document. DocumentRoot /var/www/linshare # This option allows you to add a custom repository in the document root, where you can put your personal resources RedirectMatch ^/(?!custom|linshare) http://www.cmdschool.org/linshare/ <Location /linshare> ProxyPass http://127.0.0.1:8080/linshare ProxyPa***everse http://127.0.0.1:8080/linshare </Location> <Directory /var/www/linshare> Options -Indexes AllowOverride None Order Allow,Deny Allow from all </Directory> ErrorLog /var/log/apache2/linshare-user-error.log CustomLog /var/log/apache2/linshare-user-access.log combined </Virtualhost>
2.4.4 启动httpd服务
/etc/init.d/httpd start chkconfig httpd on
2.4 配置ui-admin
2.4.1 配置ui-admin程序
tar -xf linshare-ui-admin-2.3.4.tar.bz2 mv linshare-ui-admin-2.3.4 /var/www/linshare-ui-admin chown -R apache:apache /var/www/linshare-ui-admin
2.4.2 配置虚拟机
vim /etc/httpd/conf.d/linshare-admin.conf
输入如下内容:
<VirtualHost *:80> ServerName www.cmdschool.org DocumentRoot /var/www/linshare-ui-admin <Location /linshare> ProxyPass http://127.0.0.1:8080/linshare/webservice/rest/admin ProxyPa***everse http://127.0.0.1:8080/linshare/webservice/rest/admin ProxyPa***everseCookiePath /linshare / #This header is added to avoid the JSON cache issue on IE. Header set Cache-Control "max-age=0,no-cache,no-store" </Location> <Directory /var/www/linshare-ui-admin> Options -Indexes AllowOverride None Order Allow,Deny Allow from all </Directory> ErrorLog /var/log/apache2/linshare-admin-error.log CustomLog /var/log/apache2/linshare-admin-access.log combined </Virtualhost>
2.5 登录测试
http://www.cmdschool.org/linshare/
Login : root@localhost.localdomain
Password : adminlinshare
2.5 LinShare的配置与创建
mkdir -p /var/lib/linshare
2.9 防火墙配置
2.9.1 加入新的防火墙规则
vim /etc/sysconfig/iptables
加入如下行
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
2.9.2 重启防火墙服务使规则生效
/etc/init.d/iptables restart
参阅资料:
1)项目官方网站
2)安装方法
http://download.linshare.org/documentation/intallation/
https://github.com/linagora/linshare/tree/master/documentation/EN/installation
3)管理员手册
转载于:https://blog.51cto.com/cmdschool/1789956