首页 >>  正文

centos安装yum命令

来源:baiyundou.net   日期:2024-09-24

作者:justime

背景

公司网络没有公网IP,无法将内网服务器的服务通过互联网供给在上海、北京等员工使用,因此需要通过内网穿透服务,通过具备公网IP的搬瓦工服务器,安全、便捷地将内网服务暴露到公网。

安装配置

内网和搬瓦工服务器系统均为Ubuntu.

  1. 选择对应版本,我这里为frp_0.53.2_linux_amd64.tar.gz

  2. 下载

    wget https://github.com/fatedier/frp/releases/download/v0.53.2/frp_0.53.2_linux_amd64.tar.gz\n

  3. 解压缩

    tar -xzvf frp_0.53.2_linux_amd64.tar.gz\n

  4. 编辑配置文件

    1. 搬瓦工服务器

      在 frps.toml 文件中添加以下内容,以指定 HTTP 请求的监听端口为 8080:

      bindPort = 7000\nvhostHTTPPort = 8080\n

      如果需要配置 HTTPS 代理,还需要设置 vhostHTTPSPort。

    2. 内网服务器

      在 frpc.toml 文件中添加以下内容,确保设置了正确的服务器 IP 地址、本地 Web 服务监听端口和自定义域名:

      serverAddr = "x.x.x.x"\nserverPort = 7000\n\n[[proxies]]\nname = "web"\ntype = "http"\nlocalPort = 80\ncustomDomains = ["www.yourdomain.com"]\n\n[[proxies]]\nname = "web2"\ntype = "http"\nlocalPort = 8080\ncustomDomains = ["www.yourdomain2.com"]\n

  5. 启动frps 和 frpc

    1. 搬瓦工服务器: ./frps -c ./frps.toml

    2. 内网服务器: ./frpc -c ./frpc.toml

    需要在后台长期运行,结合 systemd 配置(不需要则跳过):

    1. 安装systemd

      如果您的 Linux 服务器上尚未安装 systemd,可以使用包管理器如 yum(适用于 CentOS/RHEL)或 apt(适用于 Debian/Ubuntu)来安装它:

      # 使用 yum 安装 systemd(CentOS/RHEL)\nyum install systemd\n\n# 使用 apt 安装 systemd(Debian/Ubuntu)\napt install systemd\n

    2. 搬瓦工服务器 ,创建 frps.service 文件

      1. 使用文本编辑器 (如 vim) 在 /etc/systemd/system 目录下创建一个 frps.service 文件,用于配置 frps 服务

        $ sudo vim /etc/systemd/system/frps.service\n

      2. 写入内容

        [Unit]\n# 服务名称,可自定义\nDescription = frp server\nAfter = network.target syslog.target\nWants = network.target\n\n[Service]\nType = simple\n# 启动frps的命令,需修改为您的frps的安装路径\nExecStart = /path/to/frps -c /path/to/frps.toml\n\n[Install]\nWantedBy = multi-user.target\n

      3. 使用 systemd 命令管理 frps 服务

        # 启动frp\nsudo systemctl start frps\n# 停止frp\nsudo systemctl stop frps\n# 重启frp\nsudo systemctl restart frps\n# 查看frp状态\nsudo systemctl status frps\n

      4. 设置 frps 开机自启动

        sudo systemctl enable frps\n

    3. 内网服务器 ,创建 frpc.service 文件

      1. 使用文本编辑器 (如 vim) 在 /etc/systemd/system 目录下创建一个 frpc.service 文件,用于配置 frpc 服务

        $ sudo vim /etc/systemd/system/frpc.service\n

      2. 写入内容

        [Unit]\n# 服务名称,可自定义\nDescription = frp client\nAfter = network.target syslog.target\nWants = network.target\n\n[Service]\nType = simple\n# 启动frpc的命令,需修改为您的frpc的安装路径\nExecStart = /path/to/frpc -c /path/to/frpc.toml\n\n[Install]\nWantedBy = multi-user.target\n

      3. 使用 systemd 命令管理 frpc 服务

        # 启动frp\nsudo systemctl start frpc\n# 停止frp\nsudo systemctl stop frpc\n# 重启frp\nsudo systemctl restart frpc\n# 查看frp状态\nsudo systemctl status frpc\n

      4. 设置 frpc 开机自启动

        sudo systemctl enable frpc\n

  6. 域名解析

    将 www.yourdomain.com 和 www.yourdomain2.com 的域名 A 记录解析到服务器的 IP 地址 x.x.x.x

  7. 使用浏览器访问 http://www.yourdomain.com:8080 即可访问内网机器上的 80 端口服务,访问 http://www.yourdomain2.com:8080 可以访问内网机器上的 8080 端口服务。

通过反向代理及二级域名访问

  1. 设置域名解析

    通过二级域名 gitlab.yourdomain.com 域名 A 记录解析到服务器的 IP 地址 x.x.x.x ,目前已经可以通过http://gitlab.yourdomain.com:8080 访问内网的gitlab服务

  2. 由于搬瓦工服务器已经安装了aaPanel面板,通过新建网站

  1. 申请SSL证书

  1. 设置反向代理

  1. 已可通过http://gitlab.yourdomain.com 访问内网服务器gitlab

查看文章精彩评论,请前往什么值得买进行阅读互动

","gnid":"9baf244431ffbf68a","img_data":[{"flag":2,"img":[{"desc":"","height":"447","title":"","url":"https://p0.ssl.img.360kuai.com/t01144f6c5d8e8cea13.jpg","width":"337"},{"desc":"","height":"649","title":"","url":"https://p0.ssl.img.360kuai.com/t01554b7b4a6a14393d.jpg","width":"637"},{"desc":"","height":"683","title":"","url":"https://p0.ssl.img.360kuai.com/t016e2c2381e22e1742.jpg","width":"788"},{"desc":"","height":"681","title":"","url":"https://p0.ssl.img.360kuai.com/t01d003f4f678ddbe36.jpg","width":"788"},{"desc":"","height":"514","title":"","url":"https://p0.ssl.img.360kuai.com/t016ba714a7e6bcaf21.jpg","width":"659"}]}],"original":0,"pat":"art_src_1,fts0,sts0","powerby":"pika","pub_time":1705795597000,"pure":"","rawurl":"http://zm.news.so.com/da5c863e330d5659c2045ef1d7065e38","redirect":0,"rptid":"c64eaad8bcbbf252","rss_ext":[],"s":"t","src":"什么值得买","tag":[{"clk":"ktechnology_1:http","k":"http","u":""},{"clk":"ktechnology_1:linux","k":"linux","u":""}],"title":"frp 内网穿透

瞿待玲3824centos7下yum怎么安装 -
庾蒋冠14777965214 ______ 安装Lamp环境.1. 安装apahce yum install httpd 可能会用到的:systemctl start httpd.service #启动apache systemctl stop httpd.service #停止apache systemctl restart httpd.service #重启apache systemctl enable httpd.service #设置apache开机启动2...

瞿待玲3824如何配置Centos 6.5 的yum源 -
庾蒋冠14777965214 ______ 无论是使用哪一个版本的Linux都会用到一个源安装软件库,方便软件的安装与卸载,下面我与大家分享一下如何配置Centos 6.5 的yum源.浏览器 putty Centos 6.5 X86_64 首先我们根据自己使用的系统找到对应的软件库,例如我服务器的系统...

瞿待玲3824centos怎么配置本地yum -
庾蒋冠14777965214 ______ 使用光盘或镜像文件制作本地安装源 创建和修改local.repo(文件名可任意起)#vim/etc/yum.repos.d/local.repo [local] name=local baseurl=file:///path/to/mount/point enable=1 gpgcheck=0

瞿待玲3824如何在 CentOS 7 上安装 Docker -
庾蒋冠14777965214 ______ CentOS 7 中Docker 的安装Docker 软件包已经包括在默认的 CentOS-Extras 软件源里.因此想要安装 docker,只需要运行下面的 yum 命令:[root@localhost ~]# yum install docker启动 D...

瞿待玲3824如何在CentOS 7中安装Git -
庾蒋冠14777965214 ______ centos7的yum仓库中已经自带了git,你可以使用如下命令安装:yum install git 前期准备 请确保您的机器上安装有CentOS 7系统以及一个帐户具有root权限.因为我们需要在系统上安装软件.安装Git - 从源代码编译 从源代码编译和安装软件并不...

瞿待玲3824最小化centos 6.5怎样用yum 安装桌面环境 -
庾蒋冠14777965214 ______ 方法/步骤 一、首先查看系统的运行级别以及是否安装了桌面环境 1、使用命令 runlevel 查看当前的运行级别 ,如图所示 2、使用命令 yum grouplist | more 查看是否安装了桌面环境的组件,如图所示 二、再次从上面分析的结果看到,当前运行级...

瞿待玲3824centos怎么配置本地yum源 -
庾蒋冠14777965214 ______ 应该前面有回答过啊可以直接用阿里云的源#wget -O /etc/yum.repos.d/CentOS-Base.repo /repo/Centos-6.repo然后运行#yum makecache

瞿待玲3824centos 5.2下怎么安装yum -
庾蒋冠14777965214 ______ yum 默认就已经安装好在centos中,不需要另外安装.具体的yum 可以用man yum查看.更新及安装:yum install package 安装指定的安装包package yum localinstall package 本地安装软件包 yum update 全部更新 yum update package 更新指定程序包package yum check-update 检查可更新的程序 查找和显示 yum info 显示安装包信息 yum list 显示所有已经安装和可以安装的程序包 yum list 显示指定程序包安装情况 yum search 查找软件包

瞿待玲3824如何在centos7上通过yum安装docker -
庾蒋冠14777965214 ______ 在centos7上我们可以通过yum来安装docker1.确保你拥有管理员权限,需要可以使用sudo或者root的命令的权限.2.需要将你的yum的包升级到最新的状态.sudo yum update3.为你的yum添加一个repo文件.在centos7下面您可以直接运行下面的...

瞿待玲3824如何测试centos中的yum是否安装 -
庾蒋冠14777965214 ______ centos中查看yum安装软件日志的方法:tail /var/log/yum.log查看yum使用的历史记录的方法:yum history info

(编辑:自媒体)
关于我们 | 客户服务 | 服务条款 | 联系我们 | 免责声明 | 网站地图 @ 白云都 2024