CRM系统环境搭建部署(nginx、jdk、tomcat、keepalived、mysql、zabbix)
以下是一个基于CentOS 7的CRM系统环境搭建的示例,包括安装Nginx、JDK、Tomcat、Keepalived、MySQL以及Zabbix。
#!/bin/bash
# 更新系统
yum update -y
# 安装必要的工具
yum install -y wget net-tools
# 安装Nginx
yum install -y epel-release
yum install -y nginx
systemctl start nginx
systemctl enable nginx
# 安装JDK
yum install -y java-1.8.0-openjdk-devel
# 设置JDK环境变量
echo 'export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk'> /etc/profile.d/java.sh
echo 'export PATH=$PATH:$JAVA_HOME/bin' >> /etc/profile.d/java.sh
source /etc/profile.d/java.sh
# 安装Tomcat
wget https://downloads.apache.org/tomcat/tomcat-9/v9.0.62/bin/apache-tomcat-9.0.62.tar.gz
tar xzf apache-tomcat-9.0.62.tar.gz
mv apache-tomcat-9.0.62 /opt/tomcat
ln -s /opt/tomcat/bin/catalina.sh /etc/init.d/tomcat
chmod +x /etc/init.d/tomcat
chkconfig --add tomcat
chkconfig tomcat on
service tomcat start
# 安装Keepalived
yum install -y keepalived
# 配置Keepalived
echo '10.0.0.10' > /etc/keepalived/keepalived.conf
systemctl start keepalived
systemctl enable keepalived
# 安装MySQL
yum install -y mariadb-server
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
# 创建CRM数据库和用户
mysql -u root -p <
CREATE DATABASE crm;
CREATE USER 'crmuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON crm.* TO 'crmuser'@'localhost';
FLUSH PRIVILEGES;
EOF
# 安装Zabbix
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent
# 配置Zabbix数据库
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u crmuser -pcrmuser crm
# 配置Zabbix server配置文件
sed -i 's/^DBPassword=.*$/DBPassword=password/' /etc/zabbix/zabbix_server.conf
# 启动Zabbix server和agent
systemctl start zabbix-server
systemctl enable zabbix-server
systemctl start zabbix-agent
systemctl enable zabbix-agent
# 配置Zabbix前端
sed -i 's/^.*DBPassword=.*$/DBPassword=password/' /etc/zabbix/web/zabbix.conf.php
# 重启Tomcat以应用配置
service tomcat restart
# 配置Nginx为Zabbix前端代理
echo '
server {
listen 80;
server_name zabbix.example.com;
location / {
proxy_pass http://localhost:8080/zabbix;
评论已关闭