软件的RPM包制作,VPN服务器,frp连接Linux系统实现内网穿透,systemd简介

  1. root@web1 \~# yum -y install rpm-build
  2. root@web1 \~# rpmbuild -ba nginx.spec #会报错,没有文件或目录
  3. root@web1 \~# ls /root/rpmbuild #自动生成的目录结构
  4. BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
  5. 将源码软件复制到SOURCES目录 root@web1 \~# cp nginx-1.22.1.tar.gz /root/rpmbuild/SOURCES/

rpmbuild创建RPM软件包

    • root@web1 \~# rpmbuild -ba /root/rpmbuild/SPECS/nginx.spec
    • root@web1 \~# ls /root/rpmbuild/RPMS/x86_64/nginx-1.22.1-1.x86_64.rpm
  1. root@web1 \~# yum install /root/rpmbuild/RPMS/x86_64/nginx-1.22.1-1.x86_64.rpm
  2. root@web1 \~# rpm -qa |grep nginx
  3. root@web1 \~# ls /usr/local/nginx/

VPN服务器 Linux客户端连接WireGuard

制作密钥文件

  1. root@proxy \~#cd /usr/local/nginx/html/vpn/linux
  2. root@proxy linux# wg genkey | tee private.key | wg pubkey > public.key #生成私钥存入private.key,再利用私钥生成公钥存入public.key
  3. root@proxy linux# cp public.key ../ser.txt #拷贝一份方便客户端通过浏览器查看
  4. root@proxy linux# cat public.key UygBBCi6gEX5aJ0hMpKjBXDxltsV4+yI4NQTqK1ih1k=
  5. root@proxy linux# cat private.key
  6. GB2NbtPoAEvNufEggKM41GNEUBlxfJfVYn4i9yJ4WlU=

编写配置文件

  1. root@proxy linux# cd /etc/wireguard
  2. root@proxy wireguard# vim wg.conf
  3. Interface #服务端配置
  4. PrivateKey = GB2NbtPoAEvNufEggKM41GNEUBlxfJfVYn4i9yJ4WlU= #服务器的私钥
  5. Address = 10.10.10.1/8 #VPN隧道里面的IP和网段
  6. ListenPort = 54321 #WireGuard服务监听的端口
  7. Peer #对端(客户端)配置
  8. PublicKey = #客户端的公钥,稍后获取
  9. AllowedIPs = 10.10.10.2/32 #允许哪些客户端访问VPN服务器 ,32代表ip的二进制32位必须和10.10.10.2一样,也就是ip必须为10.10.10.2的客户才能访问

启动服务,注意,该步骤必须在上述配置文件获取客户端的公钥才可进行

  1. root@proxy wireguard# wg-quick up wg #启动VPN服务,wg是之前配置文件的名称
  2. root@proxy wireguard# ss -ntulp | grep 54321 #检查端口
  3. root@proxy wireguard# systemctl stop firewalld
  4. root@proxy wireguard# ifconfig #查看

步骤二:配置客户端

首先将$教学资料目录/vpn/linux目录拷贝到虚拟机/root下

在客户端安装VPN软件

Windows客户端连接WireGuard

frp连接Linux系统实现内网穿透

  • 熟悉systemctl常用命令
相关推荐
Li-Yongjun1 分钟前
Linux 内核等待队列(Wait Queue)
linux·运维·windows
字节高级特工2 分钟前
【Linux】深入理解C语言命令行参数与环境变量
linux·c++·人工智能·后端
linux开发之路7 分钟前
C++项目推荐:eBPF+调度器性能分析框架
linux·c++·ebpf·火焰图·调度器
humors22112 分钟前
Windows运维与安全场景合集(不定期更新)
大数据·运维·服务器·程序人生·网络安全
愿天垂怜13 分钟前
【C++脚手架】ffmpeg 库的介绍与使用
linux·服务器·开发语言·c++·ide·git·ffmpeg
WXDcsdn14 分钟前
联想服务器使用RAID卡组建RAID(企业服务器解决方案)
运维·服务器
jimy117 分钟前
Linux动态加载器,loader,dynamic linker
linux·运维·服务器
Vick_Zhang19 分钟前
ubuntu上rabbitmq
服务器·ubuntu·rabbitmq
kongba00720 分钟前
ttyd Web终端安装指南(OpenCloudOS 9)
linux·前端
lolo大魔王21 分钟前
Linux 文件权限超详细详解(读懂权限标识、数字权限、特殊权限、chmod/chown)
linux·运维·服务器