Centos部署Yum、JDK、Nginx、Tomcat、MySQL、Emqx、FTP及配置(超详细)
由于篇幅限制,以下是部署Yum、JDK、Nginx、Tomcat、MySQL、EMQX和FTP的核心步骤,包括部分配置步骤。
- 部署Yum:
# 安装EPEL仓库
yum install epel-release -y
# 清理缓存
yum clean all
# 生成缓存
yum makecache fast
- 部署JDK:
# 安装OpenJDK
yum install java-1.8.0-openjdk -y
- 部署Nginx:
# 安装Nginx
yum install nginx -y
# 启动Nginx
systemctl start nginx
# 设置开机自启
systemctl enable nginx
- 部署Tomcat:
# 安装Tomcat
yum install tomcat -y
# 启动Tomcat
systemctl start tomcat
# 设置开机自启
systemctl enable tomcat
- 部署MySQL:
# 安装MySQL
yum install mariadb-server mariadb -y
# 启动MySQL
systemctl start mariadb
# 设置开机自启
systemctl enable mariadb
# 安全设置(设置root密码等)
mysql_secure_installation
- 部署EMQX:
# 导入EMQX公钥
rpm --import https://repos.emqx.io/emqx-ce/linux/centos/EMQX-CE-6.0.0.repo
# 安装EMQX
yum install emqx -y
# 启动EMQX
systemctl start emqx
# 设置开机自启
systemctl enable emqx
- 部署FTP:
# 安装vsftpd
yum install vsftpd -y
# 启动vsftpd
systemctl start vsftpd
# 设置开机自启
systemctl enable vsftpd
配置部分:
# Nginx配置示例
vim /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
# 代理Tomcat
location ~ \.jsp$ {
proxy_pass http://localhost:8080;
}
}
# MySQL配置示例(设置字符集和大小写敏感性)
vim /etc/my.cnf
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
# EMQX配置示例(更改监听端口和节点名等)
vim /etc/emqx/emqx.conf
listener.tcp.external = 0.0.0.0:1883
node.name = emqx@127.0.0.1
# FTP配置示例(设置用户和权限等)
vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
useradd -d /home/ftpuser -s /sbin/nologin ftpuser
echo ftpuser:passwd | chpasswd
以上仅为部署和配置的核心步骤,具体配置文件的详细参数和设置需根据实际需求进行调整。
评论已关闭