干货 | 这 3 个超经典的Linux实战项目,让你分分钟入门Linux系统
nanshan 2025-05-30 16:33 23 浏览 0 评论
编译安装nginx搭建小游戏网站
编译安装流程
下载nginx代码
wget -P /server/tools/ http:nginx.org/download/nginx1.22.0.tar.gz
解压并进入目录
cd /server/tools/ tar xf nginx-1.22.0.tar.gz cd nginx-1.22.0/
配置
./configure prefix=/app/nginx-1.22.0/ user=nginx
group=nginx with-http_ssl_module with-http_v2_module
with-http_stub_status_module
# prefix指定安装目录
user 用户
group 用户组
成功提示:
错误提示:
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using withouthttp_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using with-
pcre=<path> option.
yum install -y pcre-devel
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using with-openssl=<path> option.
yum install -y openssl-devel
编译make成功提示:
安装:
make install
后续配置
检查目录
ll /app/nginx-1.22.0/
总用量 0
drwxr-xr-x 2 root root 333 7月
drwxr-xr-x 2 root root 40 7月
drwxr-xr-x 2 root root 6 7月
drwxr-xr-x 2 root root 19 7月
创建用户
useradd -s /sbin/nologin -M nginx
创建软链接
ln -s /app/nginx-1.22.0/ /app/nginx
并检查
管理编译安装的nginx
温馨提示:关闭防火墙和selinux
#1. 查看nginx版本信息及编译信息
/app/nginx/sbin/nginx -V nginx version: nginx/1.22.0 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: prefix=/app/nginx-1.22.0/ user=nginx group=nginx with-http_ssl_module withhttp_v2_module with-http_stub_status_module
#2.启动nginx
/app/nginx/sbin/nginx ps aux |grep nginx
#3. 关闭
pkill nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx已经运行了并占用80端口
检查端口nginx
ss -lntup |grep nginx
访问网站
启动nginx并检查:浏览器中输入服务器ip地址即可
配置代码
代码目录/app/nginx/html/下面 默认显示index.html内容
代码目录/app/nginx/html/下面 默认显示index.html内容
配置小鸟飞飞代码
#1. 解压
unzip bird.zip
#2. 移动
\mv bird/* /app/nginx/html/
#3. 检查
ll /app/nginx/html/
总用量 144
-rw-r--r-- 1 root root 15329 8月 2 2014 2000.png
-rw-r--r-- 1 root root 51562 8月 2 2014 21.js
-rw-r--r-- 1 root root 497 7月 29 12:10 50x.html
-rw-r--r-- 1 root root 254 8月 2 2014 icon.png
drwxr-xr-x 2 root root 102 8月 8 2014 img
-rw-r--r-- 1 root root 3049 8月 2 2014 index.html
-rw-r--r-- 1 root root 63008 8月 2 2014 sound1.mp3
检查最终结果
二进制方式安装Tomcat
部署tomcat
安装jdk
yum install -y java #openjdk
下载
wget -P /server/tools/
https://dlcdn.apache.org/tomcat/tomcat9/v9.0.65/bin/apache-tomcat-9.0.65.tar.gz
https://mirrors.aliyun.com/apache/
下载地址:
https://mirrors.aliyun.com/apache/tomcat/tomcat9/v9.0.65/bin/?spm=a2c6h.25603864.0.0.1bca5120a32WtZ
wget -P /server/tools/ https://mirrors.aliyun.com/apache/tomcat/tomcat9/v9.0.65/bin/apache-tomcat-9.0.65.tar.gz
解压
tar xf apache-tomcat-9.0.65.tar.gz -C /app/
软连接
ln -s /app/apache-tomcat-9.0.65/ /app/tomcat
启动与访问
启动
/app/tomcat/bin/startup.sh
/app/tomcat/bin/shutdown.sh
检查端口与进程
ps -ef |grep java
ss -lntup |grep java
浏览器访问: http://10.0.0.200:8080
搭建企业内部yum仓库
yum仓库架构详解
自己搭建内部yum仓库
yum仓库服务端
创建目录
/app/yumlocal
解压软件包到/app/yumlocal目录下
php72w-new.tar.gz
通过creatrepo在这个目录中生成rpm包列表(属性信息文件)
yum install -y createrepo
createrepo /app/yumlocal/
目录下面就多了个repodata目录.
安装与配置nginx
#关闭已有的
nginx pkill nginx ps -ef |grep nginx
#安装
yum install -y nginx
#启动
systemctl enable nginx systemctl start nginx
#检查端口与进程
#浏览器访问
配置nginx
[root@oldboy83-prod tools]# cat
/etc/nginx/conf.d/yumlocal.conf
server {
listen 12306;
root /app/yumlocal;
autoindex on;
index index.html;
}
systemctl restart nginx
ss -lntup |grep nginx
tcp LISTEN 0 128 *:12306
*:* users:(("nginx",pid=10460,fd=6),
("nginx",pid=10458,fd=6))
tcp LISTEN 0 128 *:80
*:* users:(("nginx",pid=10460,fd=7),
("nginx",pid=10458,fd=7))
tcp LISTEN 0 128 [ ]:80
[ ]:* users:(("nginx",pid=10460,fd=8),
("nginx",pid=10458,fd=8))
浏览器访问测试 http: 10.0.0.200:12306
yum客户端配置
注释已经配置的yum源文件
cd /etc/yum.repos.d/
gzip *
书写新的yum配置即可
cat yumlocal-10.0.0.200.repo
[yumlocal]
name = 'yum local 内部yum源 10.0.0.200'
baseurl = http:10.0.0.200:12306
enalbed = 1
gpgcheck = 0
测试是否可以使用内部yum仓库
#1.清空缓存
yum clean all
Loaded plugins: fastestmirror
Cleaning repos: yumlocal
Cleaning up list of fastest mirrors
Other repos take up 183 M of disk space (use verbose for
details)
#2.根据新的配置生成缓存
yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
yumlocal
| 2.9 kB 00:00:00
(1/3): yumlocal/filelists_db
| 13 kB 00:00:00
(2/3): yumlocal/other_db
| 5.3 kB 00:00:00
(3/3): yumlocal/primary_db
| 22 kB 00:00:00
Metadata Cache Created
#3. 查看yum源列表
yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id repo name
status
yumlocal 'yum local 内部
yum源 10.0.0.200' 20
repolist: 20
遇到下载失败或依赖问题
服务端:需要在服务端下载依赖,上传到目录中
#1. 开启keepcache功能
grep keepcache /etc/yum.conf
#2. 进入软件包目录
cd /app/yumlocal/
#3. 本地安装并下载依赖
yum localinstall -y *.rpm
#4. 找出缓存的rpm包
find /var/cache/yum/ -type f -name "*.rpm"
#4.找出缓存的rpm包并复制到/app/yumlocal/目录
find /var/cache/yum/ -type f -name "*.rpm" |xargs cp -t
/app/yumlocal/
ll /app/yumlocal/*.rpm |wc -l
服务端:重新createrepo
#5. 重新生成
createrepo /app/yumlocal/
服务端:yum clean all 然后 yum makecache 然后 yum install
yum clean all
yum makecache
yum repolist
yum install -y php72w-cli
企业级SRE运维必会项目
【学习资料+视频教程合集】
免费领取,限 200 名
评论区告诉我!!!
相关推荐
- CentOS 7 搭建 Harbor2.4.1 Docker镜像仓库
-
上一篇文章我们使用了registry镜像来搭建Docker私有镜像仓库,但是使用体验不是很好,没有一个可管理的UI界面,管理很麻烦。本篇文章将介绍一个新的搭建Docker镜像仓库的工具叫做Har...
- 简单认识认识mqtt及mosquitto(mqtt报文解析)
-
某项目中使用了MQTT作为进程间的通信方式,之前没用过,这两篇笔记我们就来一起学习一下这种方式。MQTT的一些介绍以下介绍内容来自《[野火]《LwIP应用开发实战指南》MQTT协议全称是Messa...
- 全源码打造高性能 LNMP 架构: 实战教程(2025最新版)
-
适用场景:企业生产环境、自建Web服务、深度性能调优操作系统:CentOS7/8、RockyLinux、Debian、Ubuntu(本文以CentOSStream9为例)技术栈:N...
- Nacos3.0重磅来袭!全面拥抱AI,单机及集群模式安装详细教程!
-
之前和大家分享过JDK17的多版本管理及详细安装过程,然后在项目升级完jdk17后又发现之前的注册和配置中心nacos又用不了,原因是之前的nacos1.3版本的,版本太老了,已经无法适配当前新的JD...
- Ubuntu24.04.2 企业级MinIO存储系统部署指南
-
一、概要1.1MinIO架构解析MinIO是一款高性能的云原生对象存储系统,采用Golang开发并遵循ApacheLicensev2.0协议。其核心架构基于纠删码(ErasureCode)技...
- 从零打造自己的 国产鸿蒙(OpenHarmony)定制系统-完整可落地流程
-
适用版本:OpenHarmony4.0/5.0Standard目标人群:想在x86PC、RK3568开发板或自有硬件上裁剪、加品牌、预装应用并生成可刷机镜像的开发者/团队目录环境准...
- 一次暂未成功的dify安装经历(dify怎么安装)
-
前几天在阿里云买了一台机,这几天一直在尝试安装dify,到现在还没安装上我是按这个教程装的https://blog.csdn.net/2401_82469710/article/details/14...
- ZLMediaKit教程(五)支持webrtc(webrtc lib)
-
ZLMediaKit系列文章(共六篇):ZLMediaKit流媒体(一)编译安装ZLMediaKit教程(二)主程序和配置文件解析ZLMediaKit教程(三)URL规则ZLMediaKit教程...
- Linux程序安装与管理指南(linux程序安装命令大全)
-
在Linux系统中,安装和管理程序主要通过包管理器和手动编译安装两种主要方式实现。以下是详细的操作指南,涵盖常见发行版(如Ubuntu/Debian、CentOS/RHEL、Fedora等)的用法。一...
- 离线状态下安装 Nginx 各个模块?这篇攻略让你轻松搞定
-
你是不是也在为离线状态下安装Nginx各个模块而发愁?在互联网大厂后端开发工作中,我们常常会遇到一些特殊的网络环境,比如公司内部的离线服务器,或是处于隔离状态的测试环境。当需要在这些离线环境中安装...
- Rust实践:Win10环境下的openssl交叉编译
-
Rust支持跨平台,可以指定生成目标平台,交叉编译也是支持的。当然,想要交叉编译成功,还需要指定平台的编译器(如:msvc、gcc等)。openssl是C语言开发的库,如果在Rust代码中用到open...
- Linux下Blackwell架构显卡(RTX5070/5090)编译PaddlePaddle指南
-
Blackwell显卡架构如RTX5070\5090等显卡当前Paddle预编译版本中包含的GPU架构(即SM架构)是有限的,比如常见的SM75(T4)、SM86(A10)、SM89(...
- 突破操作系统界限,掌握Linux的必备指南
-
#头条创作挑战赛#简介Linux是一种开源的操作系统,它的核心思想是自由和开放。Linux以其稳定性、可靠性和安全性而闻名,被广泛用于服务器和嵌入式设备中。Linux创始人Linux安装在安装Linu...
- Linux日常高频使用的100条命令,强烈建议收藏
-
查看系统信息如何查看系统版本:uname-alsb_release-acat/etc/os-release如何查看系统内核信息:uname-r如何查看系统CPU信息:lscpucat...
- Linux文件系统结构全解析(linux文件结构详解)
-
对Linux新手而言,“一切皆文件”的设计哲学常让人既兴奋又困惑——打开终端输入ls/,看到的bin、etc、var等目录到底有什么用?如何快速定位关键文件?本文将从Linux文件系统的底层逻...
你 发表评论:
欢迎- 一周热门
-
-
UOS服务器操作系统防火墙设置(uos20关闭防火墙)
-
极空间如何无损移机,新Z4 Pro又有哪些升级?极空间Z4 Pro深度体验
-
手机如何设置与显示准确时间的详细指南
-
NAS:DS video/DS file/DS photo等群晖移动端APP远程访问的教程
-
如何在安装前及安装后修改黑群晖的Mac地址和Sn系列号
-
如何修复用户配置文件服务在 WINDOWS 上登录失败的问题
-
一加手机与电脑互传文件的便捷方法FileDash
-
日本海上自卫队的军衔制度(日本海上自卫队的军衔制度是什么)
-
10个免费文件中转服务站,分享文件简单方便,你知道几个?
-
爱折腾的特斯拉车主必看!手把手教你TESLAMATE的备份和恢复
-
- 最近发表
-
- CentOS 7 搭建 Harbor2.4.1 Docker镜像仓库
- 简单认识认识mqtt及mosquitto(mqtt报文解析)
- 全源码打造高性能 LNMP 架构: 实战教程(2025最新版)
- Nacos3.0重磅来袭!全面拥抱AI,单机及集群模式安装详细教程!
- Ubuntu24.04.2 企业级MinIO存储系统部署指南
- 从零打造自己的 国产鸿蒙(OpenHarmony)定制系统-完整可落地流程
- 一次暂未成功的dify安装经历(dify怎么安装)
- ZLMediaKit教程(五)支持webrtc(webrtc lib)
- Linux程序安装与管理指南(linux程序安装命令大全)
- 离线状态下安装 Nginx 各个模块?这篇攻略让你轻松搞定
- 标签列表
-
- linux 查询端口号 (58)
- docker映射容器目录到宿主机 (66)
- 杀端口 (60)
- yum更换阿里源 (62)
- internet explorer 增强的安全配置已启用 (65)
- linux自动挂载 (56)
- 禁用selinux (55)
- sysv-rc-conf (69)
- ubuntu防火墙状态查看 (64)
- windows server 2022激活密钥 (56)
- 无法与服务器建立安全连接是什么意思 (74)
- 443/80端口被占用怎么解决 (56)
- ping无法访问目标主机怎么解决 (58)
- fdatasync (59)
- 405 not allowed (56)
- 免备案虚拟主机zxhost (55)
- linux根据pid查看进程 (60)
- dhcp工具 (62)
- mysql 1045 (57)
- 宝塔远程工具 (56)
- ssh服务器拒绝了密码 请再试一次 (56)
- ubuntu卸载docker (56)
- linux查看nginx状态 (63)
- tomcat 乱码 (76)
- 2008r2激活序列号 (65)