当前位置: 首页 > news >正文

利用宝塔安装一套linux开发环境

  1. 更新yum,并且更换阿里镜像源
删除yum文件
cd /etc/yum.repos.d/    进入yum核心目录
ls
sun.repo
rm -rf *    删除之前配置的本地源
ls
配置阿里镜像源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
配置扩展包
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
  1. 安装jdk8
检索jdk列表
yum list | grep jdk
选择合适的安装
yum install java-1.8.0-openjdk-devel.x86_64
验证
java -version
  1. 安装宝塔(centos安装脚本)
yum install -y wget && wget -O install.sh https://download.bt.cn/install/install_6.0.sh && sh install.sh ed8484bec
  1. 使用宝塔安装mysql、redis、kafka、nacos、nginx
    mysql、redis、kafka、nacos统统不开放外网访问
  2. 配置nginx转发mysql、redis、kafka、nacos
    这里的mysql、redis、kafkanacos有所不同
    mysql等服务是tcp协议,而nacos是使用的http协议
user  www www;
worker_processes auto;
error_log  /www/wwwlogs/nginx_error.log  crit;
pid        /www/server/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;stream {upstream mysqlProxy {hash $remote_addr consistent;server 127.0.0.1:3306 weight=5 max_fails=3 fail_timeout=30s;}upstream redisProxy {hash $remote_addr consistent;server 127.0.0.1:6379 weight=5 max_fails=3 fail_timeout=30s;}upstream kafkaProxy {hash $remote_addr consistent;server 127.0.0.1:9092 weight=5 max_fails=3 fail_timeout=30s;}server {listen 11009;proxy_connect_timeout 10s;proxy_timeout 300s;proxy_pass redisProxy;}server {listen 11008;proxy_connect_timeout 10s;proxy_timeout 300s;proxy_pass mysqlProxy;}server {listen 11007;proxy_connect_timeout 10s;proxy_timeout 300s;proxy_pass kafkaProxy;}log_format tcp_format '$time_local|$remote_addr|$protocol|$status|$bytes_sent|$bytes_received|$session_time|$upstream_addr|$upstream_bytes_sent|$upstream_bytes_received|$upstream_connect_time';access_log /www/wwwlogs/tcp-access.log tcp_format;error_log /www/wwwlogs/tcp-error.log;include /www/server/panel/vhost/nginx/tcp/*.conf;
}events{use epoll;worker_connections 51200;multi_accept on;}http{include       mime.types;include proxy.conf;lua_package_path "/www/server/nginx/lib/lua/?.lua;;";default_type  application/octet-stream;server_names_hash_bucket_size 512;client_header_buffer_size 32k;large_client_header_buffers 4 32k;client_max_body_size 50m;sendfile   on;tcp_nopush on;keepalive_timeout 60;tcp_nodelay on;fastcgi_connect_timeout 300;fastcgi_send_timeout 300;fastcgi_read_timeout 300;fastcgi_buffer_size 64k;fastcgi_buffers 4 64k;fastcgi_busy_buffers_size 128k;fastcgi_temp_file_write_size 256k;fastcgi_intercept_errors on;gzip on;gzip_min_length  1k;gzip_buffers     4 16k;gzip_http_version 1.1;gzip_comp_level 2;gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/json image/jpeg image/gif image/png font/ttf font/otf image/svg+xml application/xml+rss text/x-js;gzip_vary on;gzip_proxied   expired no-cache no-store private auth;gzip_disable   "MSIE [1-6]\.";limit_conn_zone $binary_remote_addr zone=perip:10m;limit_conn_zone $server_name zone=perserver:10m;server_tokens off;access_log off;server {						listen       11005;		# server_name  www.test001.com;		location / {	proxy_pass http://127.0.0.1:8848/nacos/;}}server {listen       80;# 这里可以指定每一个块会被那个服务器处理# server_name  127.0.0.1;location / {root   html;index  index.html index.htm;}error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}}include /www/server/panel/vhost/nginx/*.conf;
}
  1. 调整kafka配置
    这样配置是可以将kafka转发到nginx的11007端口
    但是在消费的时候会提示连接断开或者无法获取连接
    修改kafka配置文件
    listeners配置kafka服务的地址
    advertised.listeners配置nginx转发的地址
listeners=PLAINTEXT://127.0.0.1:9092
# 外部代理地址                                
advertised.listeners=PLAINTEXT://127.0.0.1:11007
  1. 编写生产者和消费者测试
    在这里插入图片描述

补充:有条件的可以把nginx放在公网即可,并且可以利用nginx限制ip

http://www.lryc.cn/news/398787.html

相关文章:

  • VB 实例:掌握 Visual Basic 编程的精髓
  • 层次分析法:matlab代码实现
  • 07-7.5.3 处理冲突的方法
  • 几何距离与函数距离:解锁数据空间中的奥秘
  • LabVIEW的Actor Framework (AF) 结构介绍
  • gitlab 搭建使用
  • 探索JT808协议在车辆远程视频监控系统中的应用
  • 视频使用操作说明书-T80005系列视频编码器如何对接海康NVR硬盘录像机,包括T80005系列高清HDMI编码器、4K超高清HDMI编码器
  • keep-alive缓存组件
  • Linux上如何安装ffmpeg视频处理软件
  • element如何实现自定义表头?
  • OTP防重放攻击
  • Oracle数据库加密与安全
  • 【YOLO格式的数据标签,目标检测】
  • Memcached内存碎片清理术:优化缓存性能的策略
  • 禁止使用存储过程
  • Flink异常:org/apache/hadoop/hive/ql/parse/SemanticException
  • Java:构造函数与对象
  • Leetcode(经典题)day1
  • k8s record 20240710 监控
  • pdf工具
  • 百度文心4.0 Turbo开放,领跑国内AI大模型赛道!
  • Vue3 defineProps的使用
  • 面向对象进阶基础练习
  • iPhone删除所有照片的高效三部曲
  • OceanBase 配置项系统变量实现及应用详解(2):系统变量的定义及使用场景
  • 本地部署,去除动漫图像背景Anime Remove Background
  • wireshark与tcpdump使用
  • 【密码学】密码学中的四种攻击方式和两种攻击手段
  • 网络层的角色与重要性:互联网通信的关键