Fedora-27-install-zammad-工单系统-支持在线聊天

参考:https://docs.zammad.org/en/latest/install-source.html#install-zammad-on-your-system

dnf update -y

dnf install -y git ruby-devel gcc libxml2 libxml2-devel libxslt-devel libxml2-static redhat-rpm-config rubygem-thor sqlite-devel nodejs mariadb-devel httpd mariadb mariadb-server gcc-c++

gem install json
gem update
gem update --system
#mysql ssh rails
gem install mysql2 rails rails

systemctl start mariadb
systemctl enable mariadb

#mysql_secure_installation

firewall-cmd --add-service={https,http}
firewall-cmd --add-service={https,http} --permanent

cd /opt/
git clone https://github.com/zammad/zammad.git
useradd zammad -m -d /opt/zammad -s /bin/bash
chown -R zammad:zammad zammad/
su - zammad
echo "export RAILS_ENV=production" >> /opt/zammad/.bashrc

gem install bundler rake rails

bundle install --path vendor/bundle --without test development postgres

cp contrib/travis-ci.org/database.yml.test-mysql config/database.yml
#config/database.yml
sed -i "s/test:/production:/g" config/database.yml

#######
mysql -u root -p -e "CREATE USER 'zammad'@'localhost' IDENTIFIED BY 'Your_Pass_Word'; GRANT ALL PRIVILEGES ON zammad.* TO 'zammad'@'localhost'; FLUSH PRIVILEGES;"

sed -i "s/zammad_test/zammad/g" config/database.yml
sed -i "s/some_user/zammad/g" config/database.yml
sed -i "s/some_pass/Your_Pass_Word/g" config/database.yml


#vim config/database.yml

export RAILS_ENV=production
export RAILS_SERVE_STATIC_FILES=true
rake db:create
rake db:migrate
rake db:seed
rake assets:precompile

#visudo

rails s -p 3000 &>> log/zammad.log &
script/websocket-server.rb start &>> log/zammad.log &
script/scheduler.rb start &>> log/zammad.log &

cd script/systemd
sudo ./install-zammad-systemd-services.sh


#######################
dnf install nginx -y
systemctl enable nginx

########################
cp /opt/zammad/contrib/nginx/zammad.conf  /etc/nginx/conf.d/

sed -i "38,57s/^/#/g" /etc/nginx/nginx.conf

systemctl restart nginx

########################

#dnf install -y elasticsearch
#dnf install https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.1.rpm