CentOS7部署安裝文件管理系統MinDoc
阿新 • • 發佈:2018-11-19
簡單說明
MinDoc 是一款針對IT團隊開發的簡單好用的文件管理系統,可做為部門內部文件共享使用
官網地址: https://www.iminho.me/
相關文件: https://github.com/lifei6671/mindoc/tree/master、https://github.com/lifei6671/mindoc/wiki
部署步驟:
# 依據《CentOS7實驗機模板搭建部署》克隆實驗機
HOSTNAME=mindoc
hostnamectl set-hostname "$HOSTNAME"
echo "$HOSTNAME">/etc/hostname
echo "$(grep -E '127|::1' /etc/hosts)">/etc/hosts
echo "$(ip a|grep "inet "|grep -v 127|awk -F'[ /]' '{print $6}') $HOSTNAME">>/etc/hosts
# 安裝配置redis
cd /tmp
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
rpm -ivh /tmp/epel-release-7-11.noarch.rpm
yum -y install redis
sed -i 's/bind 127.0.0.1/bind 0.0.0.0/g' /etc/redis.conf
systemctl restart redis
systemctl enable redis
echo ping|redis-cli
# 安裝mysql並建庫
cd /tmp
yum -y install mariadb-server mariadb
sed -i 's/\[mysqld\]/&\ncollation-server=utf8mb4_general_ci/g' /etc/my.cnf
sed -i 's/\[mysqld\]/&\ncharacter-set-server=utf8mb4/g' /etc/my.cnf
systemctl restart mariadb
systemctl enable mariadb
echo -e "select user()\G\nexit"|mysql
mysql
CREATE DATABASE mindoc DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
grant all privileges on mindoc.* to [email protected] identified by 'mindoc';
grant all privileges on mindoc.* to [email protected]'127.0.0.1' identified by 'mindoc';
-- grant all privileges on mindoc.* to [email protected]'%' identified by 'mindoc';
flush privileges;
exit
# 下載mindoc
cd /tmp
wget https://github.com/lifei6671/mindoc/releases/download/v1.0.1/mindoc_linux_amd64.zip
mkdir /opt/mindoc
cd /opt/mindoc
unzip /tmp/mindoc_linux_amd64.zip
# 設定環境變數
echo 'export ZONEINFO=/opt/mindoc/lib/time/zoneinfo.zip'>>/etc/profile
source /etc/profile
# 配置mindoc
cd /opt/mindoc/conf
cat >app.conf<<EOF
appname = mindoc
httpaddr="0.0.0.0"
httpport = "80"
runmode = "dev"
sessionon = true
sessionname = mindoc_id
copyrequestbody = true
baseurl="http://$(hostname -i)"
highlight_style="github"
config_auto_delay="60"
beegoserversessionkey=NY1B$28pms12JM&c
sessionprovider="redis"
sessionproviderconfig="127.0.0.1:6379"
sessiongcmaxlifetime="3600"
timezone = Asia/Shanghai
db_adapter="mysql"
db_host="127.0.0.1"
db_port="3306"
db_database="mindoc"
db_username="mindoc"
db_password="mindoc"
cover=./static/images/book.jpg
avatar=./static/images/headimgurl.jpg
token_size=12
# upload_file_ext=txt|doc|docx|xls|xlsx|ppt|pptx|pdf|7z|rar|jpg|jpeg|png|gif
upload_file_ext=*
upload_file_size=50MB
enable_mail="false"
mail_number="5"
smtp_user_name="[email protected]"
smtp_host="smtp.163.com"
smtp_password="..."
smtp_port="25"
form_user_name="[email protected]"
mail_expired="30"
secure="LOGIN"
enable_export="true"
export_process_num="5"
export_limit_num="5"
export_queue_limit_num="100"
export_output_path="./runtime/cache"
baidumapkey=
ldap_enable=false
ldap_host=ad.example.com
ldap_port=3268
ldap_attribute=sAMAccountName
ldap_base=DC=example,DC=com
ldap_user=CN=ldap helper,OU=example.com,DC=example,DC=com
ldap_password=superSecret
ldap_user_role=2
ldap_filter=objectClass=posixAccount
# cdn="MINDOC_CDN_URL"
# cdnjs="MINDOC_CDN_JS_URL"
# cdncss="MINDOC_CDN_CSS_URL"
# cdnimg="MINDOC_CDN_IMG_URL"
cache="true"
cache_provider="redis"
cache_redis_host="127.0.0.1:6379"
cache_redis_db="0"
cache_redis_password=""
cache_redis_prefix="mindoc::cache"
log_path="./runtime/logs"
log_maxlines="1000000"
log_maxsize="50 MB"
log_daily="true"
log_maxdays="30"
# Emergency/Alert/Critical/Error/Warning/Notice/Informational/Debug/Trace
log_level="Informational"
log_is_async="TRUE"
EOF
# 配置檔案可以參見app.conf.example和官當
# 資料初始化並配置開機啟動
cd /opt/mindoc
chmod +x mindoc_linux_amd64
./mindoc_linux_amd64 install
./mindoc_linux_amd64 service install
# ./mindoc_linux_amd64 service remove
echo '/usr/bin/sleep 30 && /usr/bin/systemctl restart mindocd'>>/etc/rc.local
# CentOS7的mindoc早於mysql啟動,導致mindoc無法連線到庫,啟動失敗
# 因此不能使用systemctl新增開機啟動項
reboot
# 瀏覽器訪問 http://IP
# 超級管理員預設賬號和密碼:admin 密碼:123456
[TOC]