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

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

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

评论区告诉我!!!

相关推荐

电脑高手24在线咨询(电脑高手联系方式)

现在的电脑一般都不要重启键了。如果死机的话,按住开关键五秒,自动关机。再开机就行。至于他们说的快速关机CTRL+ALT+ENT快速重启CTRL+ALT+HOME是GOHST版安装后自带的快捷键,你的系...

你的电脑未正确启动自动修复

1、试试“禁止驱动强制签名”能不能进入桌面在“疑难解答”->“高级选项”->“启动模式”中选择“禁止驱动强制签名”,如果这样能正常开启,那么就说明是某个驱动的问题2、把错误驱动删掉如果你安...

电脑开机弹出系统恢复选项(电脑开机经常出现系统恢复界面)

  这种情况一般都是系统引导出现问题,可以【F8】选择【最后一次正确配置】,重启后一般都能恢复;如果不行可以选择进入【安全模式】【恢复我的计算机到一个较早的时间】。以下是详细介绍:  1、开机时多次点...

手机版电脑模拟器下载(手机电脑模拟器下载的文件在哪)
手机版电脑模拟器下载(手机电脑模拟器下载的文件在哪)

  玩家们想要在电脑上畅快地玩真实手机,首先就需要先下载它的电脑版模拟器啦。在这里推荐大家使用的是电脑安卓模拟器,这是一款十分流畅好用的真实手机安卓模拟器,性能强悍,功能完备。  1、下载完真实手机安卓模拟器。  2、在电脑上进行安装,双击...

2026-01-01 16:03 off999

下载计算机到手机(手机下载计算机怎么下载)
  • 下载计算机到手机(手机下载计算机怎么下载)
  • 下载计算机到手机(手机下载计算机怎么下载)
  • 下载计算机到手机(手机下载计算机怎么下载)
  • 下载计算机到手机(手机下载计算机怎么下载)
u盘启动不了怎么回事(u盘启动也启动不了)

原因三:USB传输性能不佳导致;解决三:换个USB插口试试,建议将u盘插入到电脑机箱后置的USB插口处。原因四:u盘自身的质量问题导致;解决四:换一个u盘制作试一试。原因五:电脑系统问题导致;解决五:...

联想笔记本电脑键盘输入没反应

1.首先在可以进行输入的位置,长按下某个按键1秒以上,看看有没有反应。有反应看第2,没反应看第3。2.控制面板~轻松使用~轻松使用设置中心~更改键盘的工作方式~取消筛选键并应用即可。3.打开设备管理器...

软件管家电脑版下载官网(软件管家电脑版下载官网安装)

要下载和安装应用程序,您可以按照以下步骤使用电脑管家:1.打开电脑管家应用程序。2.在主界面上,您可以找到一个名为“应用中心”的选项,点击它。3.在应用中心中,您可以浏览各种应用程序的列表。您可...

台式电脑怎么取消定时关机(台式电脑设置自动关机怎么取消)

电脑设置了每天定时关机,取消的方法有多种,以下提供三种方式:方法一:打开任务计划程序(TaskScheduler)。找到“任务计划程序库”(TaskSchedulerLibrary),找到设置的...

win7怎么截屏快捷键(win7怎样截屏快捷键)

在Win7系统中,自带的截图快捷键是“PrtScn”键,即PrintScreen键。按下这个键后,系统会将当前屏幕的内容复制到剪贴板中,然后用户可以将其粘贴到其他应用程序中进行编辑或保存。此外,Wi...

如何查看笔记本配置(如何查看笔记本配置高低)

两种方法一种你在笔记本背面有个ID号,也就是序列号,你把它抄下来,输到笔记本品牌的官网上,查看他的配置就可以,这是第1种方法,第2种方法,你开机后,我的电脑上单击右键,点属性,就会在出来你的CPU内存...

linux软件(linux软件图标)

Linux是一种自由和开放源代码的类UNIX操作系统。该操作系统的内核由林纳斯·托瓦兹在1991年10月5日首次发布。在加上用户空间的应用程序之后,成为Linux操作系统。Linux也是自由软件和开放...

hp laserjet p1108打印机驱动

惠普LaserJetProP1108打印机安装打印机驱动的方法,可以通过以下步骤操作来实现:1、运行驱动安装包,在“HPLaserJetProP1100打印机系列”下,点击“USB安装...

台式机最好的配置(台式机最强配置)

家用台式电脑cpu一般选择英特尔8-10代的i3就能满足正常的家用,内存方面选择16g,绝对够用,再选择一块512g的固态硬盘,保证电脑的速度2022年台式电脑建议你可以配16gb或32gb的内存。硬...

笔记本电脑home键在哪(笔记本的home键怎么用)

home键位置一般有三个:一、键就在键盘最右边一列的上方,也是右上角处。二、在数字键盘的“7”键上,如果想使用"home"键功能,需要先关闭数字键功能。一般笔记本开、关数字键功能是按F...

取消回复欢迎 发表评论: