华为云智能社区rc
【摘要】 #!/bin/bashrm -rf /etc/yum.repos.d/*cat << EOF > /etc/yum.repos.d/centos.repo[os]name=Qcloud centos os - \$basearchbaseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/os/\$basearch/enabled...
#!/bin/bash
rm -rf /etc/yum.repos.d/*
cat << EOF > /etc/yum.repos.d/centos.repo
[os]
name=Qcloud centos os - \$basearch
baseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/os/\$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-7
[updates]
name=Qcloud centos updates - \$basearch
baseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/updates/\$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-7
[extras]
name=Qcloud centos extras - \$basearch
baseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/extras/\$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-7
[epel]
name=EPEL for redhat/centos \$releasever - \$basearch
baseurl=http://mirrors.cloud.tencent.com/epel/\$releasever/\$basearch/
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/epel/RPM-GPG-KEY-EPEL-7
EOF
yum -y install vsftpd
echo "anon_root=/opt" >> /etc/vsftpd/vsftpd.conf
systemctl restart vsftpd
tar -xvf yum.tar.gz -C /opt
cat >> /etc/yum.repos.d/ftp.repo << EOF
[local]
name=local
baseurl=file:///opt/yum
enabled=1
gpgcheck=0
EOF
yum install mongodb-org -y
rm -rf /etc/mongod.conf
cat >> /etc/mongod.conf << EOF
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
#security:
#operationProfiling:
replication:
replSetName: cloud
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
EOF
systemctl restart mongod.service
systemctl status mongod.service
#!/bin/bash
SQL1_ip=""
rm -rf /etc/yum.repos.d/*
cat >> /etc/yum.repos.d/ftp.repo << EOF
[local]
name=local
baseurl=ftp://$SQL1_ip/yum
enabled=1
gpgcheck=0
EOF
yum install mongodb-org -y
rm -rf /etc/mongod.conf
cat >> /etc/mongod.conf << EOF
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
#security:
#operationProfiling:
replication:
replSetName: cloud
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
EOF
systemctl restart mongod.service
systemctl status mongod.service
#!/bin/bash
SQL1_IP=""
SQL2_IP=""
SQL3_IP=""
mongo --host "$SQL1_IP" --port 27017 --eval "rs.initiate({
_id: 'cloud',
members: [
{ _id: 0, host: '$SQL1_IP' },
{ _id: 1, host: '$SQL2_IP' },
{ _id: 2, host: '$SQL3_IP' }
]
});"
#!/bin/bash
HOST_IP=""
SQL1=""
rm -rf /etc/yum.repos.d/*
cat << EOF > /etc/yum.repos.d/centos.repo
[os]
name=Qcloud centos os - \$basearch
baseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/os/\$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-7
[updates]
name=Qcloud centos updates - \$basearch
baseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/updates/\$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-7
[extras]
name=Qcloud centos extras - \$basearch
baseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/extras/\$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-7
[epel]
name=EPEL for redhat/centos \$releasever - \$basearch
baseurl=http://mirrors.cloud.tencent.com/epel/\$releasever/\$basearch/
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/epel/RPM-GPG-KEY-EPEL-7
EOF
tar -zxvf node-v12.16.1-linux-x64.tar.gz
echo "export PATH=/usr/local/node/bin:$PATH" >> /etc/profile
mv node-v12.16.1-linux-x64 /usr/local/node
source /etc/profile
yum install -y gcc-c++ make
yum install -y GraphicsMagick
# 配置 npm
source /etc/profile
npm config set registry http://registry.npm.taobao.org/
npm config set electron_mirror http://npm.taobao.org/mirrors/electron/
# 解压 Rocket.Chat 安装包
tar -zxvf rocket.chat-3.2.2.tgz
# 进入服务器程序目录并安装依赖
cd bundle/programs/server
npm install
# 移动安装包到 /opt/Rocket.Chat 目录
mv /root/bundle /opt/Rocket.Chat
# 创建 Rocketchat 用户并设置权限
useradd -M rocketchat && usermod -L rocketchat
chown -R rocketchat:rocketchat /opt/Rocket.Chat
# 创建 systemd 服务配置文件
cat >> /lib/systemd/system/rocketchat.service << EOF
[Unit]
Description=The Rocket.Chat server
After=network.target remote-fs.target nss-lookup.target nginx.service mongod.service
[Service]
ExecStart=/usr/local/node/bin/node /opt/Rocket.Chat/main.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocketchat
Environment=MONGO_URL=mongodb://$SQL1:27017/rocketchat?replicaSet=cloud MONGO_OPLOG_URL=mongodb://$SQL1:27017/local?replicaSet=cloud ROOT_URL=http://$HOST_IP:3000/ PORT=3000
[Install]
WantedBy=multi-user.target
EOF
# 启动 Rocket.Chat 服务并检查状态
systemctl restart rocketchat
sleep 15
systemctl status rocketchat
【版权声明】本文为华为云社区用户原创内容,未经允许不得转载,如需转载请自行联系原作者进行授权。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)