百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 技术资源 > 正文

干货 | 这 3 个超经典的Linux实战项目,让你分分钟入门Linux系统

off999 2025-03-19 15:35 27 浏览 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= 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= 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

评论区告诉我!!!

相关推荐

免费无需排队的云电脑(不需要排队的云电脑)

目前市场上有一些云游戏平台提供无限时长且无需排队的服务。这些平台通常采用先进的云计算技术和高性能服务器,能够提供稳定流畅的游戏体验。用户可以随时登录并畅玩游戏,无需等待排队。这些平台还提供多种游戏选择...

视频播放器下载量排名(2020视频播放器排行榜)
  • 视频播放器下载量排名(2020视频播放器排行榜)
  • 视频播放器下载量排名(2020视频播放器排行榜)
  • 视频播放器下载量排名(2020视频播放器排行榜)
  • 视频播放器下载量排名(2020视频播放器排行榜)
wps官方下载(wps官方下载官网电脑版网址)

具体的步骤如下:1、首先在电脑上打开浏览器,在浏览器中输入“WPS”,找到WPS官方网站。2、接下来进入WPS官方网站中,找到WPS软件,点击“免费下载”。3、点击下载后在弹出来的对话框中修改下载位置...

win vista与win7有什么区别(win7与vista关系)

WindowsVista和Windows7是微软公司推出的两个桌面操作系统,它们之间有以下主要区别:1.界面设计:Windows7的界面设计更加简洁明了,而WindowsVista的界面...

winxp系统版本(winxp 版本)

1、微软官方3个版本:WINDOWSXPHOME(家庭版)、Professional(专业版)、MediaCenter2005(媒体中心版),每个版本的功能不一样。使用最多的是Professional...

打印机无法共享怎么回事(打印机无法共享出去)

共享打印机无法打印原因一:可能是由于病毒死机解决方法:确定是否由于病毒死机,找一张干净(确信无病毒)的系统盘,从A驱动舒上启动电脑,检查此时打印机和主机能否联机。如果正常联机,估计这种故障是由攻击硬件...

ipv6无网络访问权限怎么解决

ipv6无网络访问权限解决方法如下1、点击电脑左下角的开始,进入到开始的菜单栏,在菜单栏中找到“运行”。或者通过快捷键Windows+R打开运行窗口。  2、打开运行的窗口页面后,在页面上输入“CMD...

office ltsc版(Office LTSC版本区别)

office2021和2021ltsc的区别如下:1.更新策略不同。前者采用每个月月度更新的方法,提供功能更新、安全更新。后者不采用每个月月度更新的方法,且不提供功能更新。2.界面不同。2021采用了...

安装win7需要激活吗(现在安装win7旗舰版还需密钥吗)

要激活  Windows7如果是预装在计算机中的,买来之后便不用激活,这里预装指的是在厂商那里。正版的Windows7安装到计算机中,有三十天的试用期,若要永久使用,就要使...

originos 3升级计划公布(originos升级包)

2023年2月。1.OriginOS3.0系统第一批升级时间为11月25日。2、包含iQOONeo7,X80系列,S15系列,iQOO9、iQOO10系列,以及折叠屏XFold系列和大屏XNo...

鸿蒙系统适配第三方机型(鸿蒙 第三方适配)

最新华为官方公布了鸿蒙系统3.0支持的机型名单,具体如下。鸿蒙系统3.0升级名单:1.Mate系列:MateXs2、MateX2、MateXs、Mate40、Mate40Pro、Mate...

imei怎么下载(imei changer apk)

如果您的steam序列号激活了,可以尝试以下方法下载:1.使用steam自带的下载工具,如“下载工具”,在软件的“下载”选项卡中选择“序列号下载”。2.在下载页面中,选择要下载的游戏,然后点击“下...

电脑系统优化软件哪个好(系统优化软件排行榜)

有必要用,非常好用,WINDOWS优化大师是一个网络上下载率极高的系统维护软件。多年未曾清理过系统和硬盘的电脑,系统内部将产生大量的垃圾文件、临时文件、废旧程序等等win10系统不需要经常更新,关闭...

重装系统后硬盘不见了(重装系统后磁盘不见了)

硬盘不见可能是因为重装系统时未正确安装驱动程序或未对硬件进行正确设置。你可以按以下步骤排查问题:进入BIOS检查硬盘是否被识别,尝试重新连接数据线和电源线,更新或安装适当的硬件驱动程序,或者使用硬件故...

冰封u盘装win7系统教程图解(冰封u盘启动装机教程)

1.查找激活工具:通常来说,Win7冰封系统已经包含了必要的驱动,所以如果你的电脑上并没有出现设备错误,那你就可以正常使用。如果你需要添加任何驱动,请尝试从厂商下载相应的驱动并执行自动安装程序。如果...

取消回复欢迎 发表评论: