)
Linux 软件包管理二源码安装软件源码安装 nginx介绍Nginx是一个高性能的HTTP和反向代理web服务器。官方地址https://nginx.org安装# 安装依赖[rootcentos7 ~]# yum install gcc make pcre-devel zlib-devel# 下载[rootcentos7 ~]# wget https://nginx.org/download/nginx-1.24.0.tar.gz# 解压[rootcentos7 ~]# tar -xf nginx-1.24.0.tar.gz# 配置[rootcentos7 ~]# cd nginx-1.24.0/[rootcentos7 ~]# ./configure --prefix/usr/local/nginx# 将所有的nginx相关文件存放在/usr/local/nginx# 编译安装[rootcentos7 nginx-1.24.0]# make make install[rootserver ~10:11:53]# ls /usr/local/nginx/client_body_temp conf fastcgi_temp html logs proxy_temp sbin scgi_temp uwsgi_temp#查看tree[rootserver nginx-1.24.0 09:44:12]# tree /usr/local/nginx/usr/local/nginx|-- conf||-- fastcgi.conf||-- fastcgi.conf.default||-- fastcgi_params||-- fastcgi_params.default||-- koi-utf||-- koi-win||-- mime.types||-- mime.types.default||-- nginx.conf||-- nginx.conf.default||-- scgi_params||-- scgi_params.default||-- uwsgi_params||-- uwsgi_params.default|-- win-utf|-- html||-- 50x.html|-- index.html|-- logs-- sbin-- nginx4directories,18files# 配置环境变量[rootserver nginx-1.24.0 09:44:28]# echo $PATH/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin[rootserver nginx-1.24.0 09:44:50]# PATH$PATH:/usr/local/nginx/sbin/使用# 启动服务[rootserver nginx-1.24.0 09:47:12]# nginx[rootserver nginx-1.24.0 09:47:22]# ps -C nginxPID TTY TIME CMD9322? 00:00:00 nginx9323? 00:00:00 nginx# 验证[rootserver nginx-1.24.0 09:48:32]# echo Welcome myz /usr/local/nginx/html/index.html[rootserver nginx-1.24.0 09:49:49]# curl localhostWelcome myz# 退出服务[rootserver ~10:08:47]# nginx -s quit[rootserver ~10:11:46]# ps -C nginxPID TTY TIME CMD命令总结nginx启动服务nginx -s quit待nginx进程处理任务完毕进行停止。nginx -s stop查出nginx进程id再使用kill命令强制杀掉进程。nginx -s reload重新加载服务。配置nginx服务[rootcentos7 ~]# cp /usr/lib/systemd/system/sshd.service /etc/systemd/system/nginx.service[rootcentos7 ~]# vim /etc/systemd/system/nginx.service[Unit]DescriptionNginx server daemon[Service]TypeforkingExecStart/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.confExecReload/usr/local/nginx/sbin/nginx-sreloadExecStop/usr/local/nginx/sbin/nginx-squit[Install]WantedBymulti-user.target[rootcentos7 ~]# systemctl daemon-reload[rootcentos7 ~]# systemctl enable nginx.service --now源码安装 cmatrix介绍Cmatrix 是一款 Linux 环境下的炫酷屏保软件其效果类似于黑客帝国电影中的代码雨。项目地址https://github.com/abishekvashok/cmatrix安装# 安装依赖包[rootcentos7 ~]# yum -y install gcc make autoconf ncurses-devel# 下载[rootcentos7 ~]# wget https://jaist.dl.sourceforge.net/project/cmatrix/cmatrix/1.2/cmatrix-1.2.tar.gz# 解压[rootcentos7 ~]# tar -xf cmatrix-1.2.tar.gz# 配置软件[rootcentos7 ~]# cd cmatrix-1.2/[rootcentos7 cmatrix-1.2]# ./configure --prefix/usr/local/cmatrix# 编译并安装[rootcentos7 cmatrix-1.2]# make make install使用# 配置环境变量[rootcentos7 ~]# export PATH$PATH:/usr/local/cmatrix/bin# 帮助信息[rootcentos7 ~]# cmatrix --helpUsage: cmatrix -[abBfhlsVx][-u delay][-C color]-a: Asynchronous scroll -b: Bold characters on -B: All bold characters(overrides -b)-f: Force the linux$TERMtypeto be on -l: Linux mode(uses matrix console font)-o: Use old-style scrolling -h: Print usage andexit-n: No bold characters(overrides-band -B, default)-s:Screensavermode, exits on first keystroke -x: X window mode, useifyour xterm is using mtx.pcf -V: Print version information andexit-udelay(0-10, default4): Screen update delay-C[color]: Use this colorformatrix(default green)# 执行[rootcentos7 ~]# cmatrix# 效果如下[rootcentos7 ~]# cmatrix -b -u 3 -C red# -b 加粗字体# -u 滚动速度# -C 字体颜色 绿色green、红色red、蓝色blue、白色white、黄色yellow、青色cyan、洋红色magenta以及黑色black这些颜色。随时改变颜色当然你无需重新启动程序就可以随时改变显示的颜色。但需要记住不同的键位对应着不同的颜色。在 Cmatrix 未关闭的情况下如果你按下了存储在键位上的指令显示的颜色将会直接变更。颜色相应键位对应数字键红色!shift1绿色shift2黄色#shift3蓝色$shift4洋红色%shift5青色^shift6白色shift7黑色)shift8自由调整速度在 Cmatrix 运行的过程中你可以按0到9的任何一位数字键来随意改变当前的更新速度。自建仓库自建仓库流程准备软件包创建仓库索引信息发布仓库客户端配置验证详细操作步骤[rootserver ~]# mkdir rpms[rootserver ~]# cd rpms# 下载软件包以及依赖的软件包[rootserver rpms]# yum install --downloadonly --downloaddir . vim open-vm-tools vsftpd lrzsz bash-completion nginx httpd mariadb-server# 移动软件包到发布目录[rootserver ~]# mkdir /usr/local/nginx/html/tools[rootserver ~]# mv rpms /usr/local/nginx/html/tools/Packages# 安装创建仓库软件包[rootserver ~]# yum install -y createrepo# 创建仓库索引信息[rootserver ~]# createrepo /usr/local/nginx/html/tools/[rootserver ~]# vim /usr/local/nginx/conf/nginx.conf# 在http块中新增一行autoindex on# 作用提供文件清单http{autoindex on;.....# 重启nginx服务[rootserver ~]# systemctl reload nginx# 备份原有仓库[rootclient ~11:36:24]# mkdir /etc/yum.repos.d/old[rootclient ~11:37:07]# mv /etc/yum.repos.d/*repo /etc/yum.repos.d/old# 添加新仓库[rootclient ~11:37:12]# cat EOF /etc/yum.repos.d/tools.repo[tools]namecentos7 tools from server.laoma.cloudbaseurlhttp://server.laoma.cloud/tools/enabled1gpgcheck0EOF[rootclient ~11:37:47]# ls /etc/yum.repos.d/backup epel.repo.rpmnew old tools.repo# 安装软件包[rootclient ~]# yum install -y httpd同步仓库# 将仓库中软件包和元数据全部同步到本地[rootclient ~]# reposync --repoidtools --download-metadata[rootclient ~]# createrepo tools[rootclient ~]# ls tools/Packages repodata.repo.rpmnew old tools.repo安装软件包[rootclient ~]# yum install -y httpd## 同步仓库 bash # 将仓库中软件包和元数据全部同步到本地 [rootclient ~]# reposync --repoidtools --download-metadata [rootclient ~]# createrepo tools [rootclient ~]# ls tools/ Packages repodata参考yum-REPOSYNC(8)。