文章目录
- Nginx安装部署【简单】
- 简介
- 安装
- RabbitMQ安装部署【简单】
- 简介
- 安装
Nginx安装部署【简单】
简介
- Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器,同时也提供了IMAP/POP3/SMTP服务。
- Nginx可以托管用户编写的WEB应用程序成为可访问的网页服务,同时也可以作为流量代理服务器,控制流量的中转。
- Nginx在WEB开发领域,基本上也是必备组件之一。
安装
- Nginx需要配置额外的yum仓库,才可以使用yum安装
安装Nginx的操作需要root身份
-
安装yum依赖程序
# root执行 yum install -y yum-utils
-
手动添加,nginx的yum仓库
yum程序使用的仓库配置文件,存放在:
/etc/yum.repo.d
内。# root执行 # 创建文件使用vim编辑 vim /etc/yum.repos.d/nginx.repo # 填入如下内容并保存退出 [nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true[nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true
通过如上操作,手动添加nginx的yum仓库
-
通过yum安装最新稳定版的nginx
# root执行 yum install -y nginx
-
启动
# nginx自动注册了systemctl系统服务 systemctl start nginx # 启动 systemctl stop nginx # 停止 systemctl status nginx # 运行状态 systemctl enable nginx # 开机自启 systemctl disable nginx # 关闭开机自启
-
配置防火墙放行
- nginx默认绑定80端口,需要关闭防火墙或放行80端口
# 方式1(推荐),关闭防火墙 systemctl stop firewalld # 关闭 systemctl disable firewalld # 关闭开机自启# 方式2,放行80端口 firewall-cmd --add-port=80/tcp --permanent # 放行tcp规则下的80端口,永久生效 firewall-cmd --reload # 重新加载防火墙规则
-
启动后,浏览器输入Linux服务器的IP地址或主机名即可访问
- http://192.168.xxx.xxx
ps:80端口是访问网站的默认端口,所以后面无需跟随端口号
至此,Nginx安装配置完成。
RabbitMQ安装部署【简单】
简介
-
RabbitMQ一款知名的开源消息队列系统,为企业提供消息的发布、订阅、点对点传输等消息服务。
-
RabbitMQ在企业开发中十分常见,课程为大家演示快速搭建RabbitMQ环境。
安装
rabbitmq在yum仓库中的版本比较老,所以需要手动构建yum仓库
-
准备yum仓库
# root执行 # 1. 准备gpgkey密钥 rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc rpm --import https://packagecloud.io/rabbitmq/erlang/gpgkey rpm --import https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey# 2. 准备仓库文件 vim /etc/yum.repos.d/rabbitmq.repo # 填入如下内容 ## ## Zero dependency Erlang ##[rabbitmq_erlang] name=rabbitmq_erlang baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch repo_gpgcheck=1 gpgcheck=1 enabled=1 # PackageCloud's repository key and RabbitMQ package signing key gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkeyhttps://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300[rabbitmq_erlang-source] name=rabbitmq_erlang-source baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS repo_gpgcheck=1 gpgcheck=0 enabled=1 # PackageCloud's repository key and RabbitMQ package signing key gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkeyhttps://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300## ## RabbitMQ server ##[rabbitmq_server] name=rabbitmq_server baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/$basearch repo_gpgcheck=1 gpgcheck=0 enabled=1 # PackageCloud's repository key and RabbitMQ package signing key gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkeyhttps://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300[rabbitmq_server-source] name=rabbitmq_server-source baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/SRPMS repo_gpgcheck=1 gpgcheck=0 enabled=1 gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300
-
安装RabbitMQ
# root执行 yum install erlang rabbitmq-server -y
-
启动
# root执行 # 使用systemctl管控,服务名:rabbitmq-server systemctl start rabbitmq-server # 启动 systemctl stop rabbitmq-server # 关闭 systemctl enable rabbitmq-server # 开机自启 systemctl disable rabbitmq-server # 关闭开机自启 systemctl status rabbitmq-server # 查看状态
-
放行防火墙,RabbitMQ使用5672、15672、25672 3个端口
# 方式1(推荐),关闭防火墙 systemctl stop firewalld # 关闭 systemctl disable firewalld # 关闭开机自启# 方式2,放行5672 25672端口 firewall-cmd --add-port=5672/tcp --permanent # 放行tcp规则下的5672端口,永久生效 firewall-cmd --add-port=15672/tcp --permanent # 放行tcp规则下的15672端口,永久生效 firewall-cmd --add-port=25672/tcp --permanent # 放行tcp规则下的25672端口,永久生效 firewall-cmd --reload # 重新加载防火墙规则
# 启动有报错的信息但是,查看状态 [root@yuan ~]# systemctl start rabbitmq-server Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details. [root@yuan ~]# systemctl status rabbitmq-server ● rabbitmq-server.service - RabbitMQ brokerLoaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)Active: activating (auto-restart) (Result: exit-code) since 五 2023-10-13 22:44:30 CST; 8s agoProcess: 21723 ExecStart=/usr/sbin/rabbitmq-server (code=exited, status=1/FAILURE)Main PID: 21723 (code=exited, status=1/FAILURE)Status: "Standing by"10月 13 22:44:30 yuan systemd[1]: rabbitmq-server.service: main process exited, code=exited, status=1/FAILURE 10月 13 22:44:30 yuan systemd[1]: Failed to start RabbitMQ broker. 10月 13 22:44:30 yuan systemd[1]: Unit rabbitmq-server.service entered failed state. 10月 13 22:44:30 yuan systemd[1]: rabbitmq-server.service failed.
-
启动RabbitMQ的WEB管理控制台
rabbitmq-plugins enable rabbitmq_management
# 停止RabbitMQ管理插件 rabbitmq-plugins disable rabbitmq_management
-
添加admin用户,并赋予权限rabbitmqctl add_user admin 'yuan66^' rabbitmqctl set_permissions -p "/" "admin" ".*" ".*" ".*" rabbitmqctl set_user_tags admin administrator
-
浏览器打开管理控制台
- http://192.168.xxx.xxx:15672