[命令] Red Hat Satellite Server 客户端的设置

内容目录:

内容一:Redhat Satellite Server 的作用

内容二:Redhat Satellite Server 的关系拓扑图

内容三:Redhat client servers 的设置
3.1 将 client servers 注册到 Satellite Server
3.1.1 安装 katello-ca-consumer-latest.noarch.rpm
3.1.1.1 下载 katello-ca-consumer-latest.noarch.rpm
3.1.1.2 安装 katello-ca-consumer-latest.noarch.rpm
3.1.1.3 注册
3.1.2 查看注册信息
3.1.2.1 查看注册身份信息
3.1.2.2 查看所使用的 license
3.2 软件源库所对应的系统版本设置
3.2.1 查看客户端服务器现在正在使用的软件源库所对应的系统版本
3.2.2 查看客户端服务器所有可以使用的软件源库所对应的系统版本
3.2.3 修改客户端服务器的软件源库对应的系统版本
3.2.3.1 修改对应系统版本的格式
3.2.3.2 修改对应系统版本的案例
3.3 在选择了一个系统版本之后选择里面的软件源
3.3.1 查看软件源
3.3.1.1 查看客户端服务器目前正在使用的软件源
3.3.1.2 查看客户端服务器所有可以用的软件源和正在使用的软件源
3.3.2 让客户端服务器启用一个软件源
3.3.2.1 启用一个软件源的格式
3.3.2.2 启用一个软件源的案例
3.3.3 让客户端服务器禁用一个软件源
3.3.3.1 禁用一个软件源的格式
3.3.3.2 禁用一个软件源的案例
3.4 刷新所有的设置

具体的内容:

内容一:Redhat Satellite Server 的作用

1) Redhat Satellite Server 负责建立各种软件源库版本供
2) Redhat client servers 选择以安装和更新软件和补丁

内容二:Redhat Satellite Server 的关系拓扑图

                                  Redhat client server1
Redhat Satellite Server           Redhat client server2
                                  Redhat client server3
                                         ......
                                  Redhat client servern

内容三:Redhat client servers 的设置
3.1 将 client servers 注册到 Satellite Server
3.1.1 安装 katello-ca-consumer-latest.noarch.rpm
3.1.1.1 下载 katello-ca-consumer-latest.noarch.rpm

(只在 client servers 上执行以下步骤)

# curl --insecure --output katello-ca-consumer-latest.noarch.rpm https://<Satellite Server 的链接>/katello-ca-consumer-latest.noarch.rpm

3.1.1.2 安装 katello-ca-consumer-latest.noarch.rpm

(只在 client servers 上执行以下步骤)

# yum localinstall katello-ca-consumer-latest.noarch.rpm

3.1.1.3 注册

(只在 client servers 上执行以下步骤)

# subscription-manager register --org="<corresponding organization name>" --activationkey="<corresponding view name>"

3.1.2 查看注册信息
3.1.2.1 查看注册身份信息

(只在 client servers 上执行以下步骤)

# subscription-manager identity

3.1.2.2 查看所使用的 license

(只在 client servers 上执行以下步骤)

# subscription-manager list --consumed

3.2 软件源库所对应的系统版本设置
3.2.1 查看客户端服务器现在正在使用的软件源库所对应的系统版本

(只在 client servers 上执行以下步骤)

# subscription-manager release --show

3.2.2 查看客户端服务器所有可以使用的软件源库所对应的系统版本

(只在 client servers 上执行以下步骤)

# subscription-manager release –-list

3.2.3 修改客户端服务器的软件源库对应的系统版本
3.2.3.1 修改对应系统版本的格式

(只在 client servers 上执行以下步骤)

# subscription-manager release --set=<system version number>

3.2.3.2 修改对应系统版本的案例

(只在 client servers 上执行以下步骤)

# subscription-manager release -–set=7.5 

(补充:这里的 7.5 是一个系统的版本号)

(注意:这里如果低版本的系统选择了高版本的软件源库,则在更新软件的过程中可能会直接升级系统)

3.3 在选择了一个系统版本之后选择里面的软件源
3.3.1 查看软件源
3.3.1.1 查看客户端服务器目前正在使用的软件源

(只在 client servers 上执行以下步骤)

# subscription-manager repos --list-enable

3.3.1.2 查看客户端服务器所有可以用的软件源和正在使用的软件源

(只在 client servers 上执行以下步骤)

# subscription-manager repos --list

3.3.2 让客户端服务器启用一个软件源
3.3.2.1 启用一个软件源的格式

(只在 client servers 上执行以下步骤)

# subscription-manager repos --enable=<software source name>

3.3.2.2 启用一个软件源的案例

(只在 client servers 上执行以下步骤)

# subscription-manager repos --enable=rhel-7-server-satellite-tools-6.3-rpms

(补充:这里以启动 rhel-7-server-satellite-tools-6.3-rpms 软件源为例)

3.3.3 让客户端服务器禁用一个软件源
3.3.3.1 禁用一个软件源的格式

(只在 client servers 上执行以下步骤)

# subscription-manager repos --disable=<software source name>

3.3.3.2 禁用一个软件源的案例

(只在 client servers 上执行以下步骤)

# subscription-manager repos –disable=rhel-7-server-satellite-tools-6.2-rpms

(补充:这里以禁止 rhel-7-server-satellite-tools-6.3-rpms 软件源为例)

3.4 刷新所有的设置

# subscription-manager refresh

[内容] 第三方软件源的使用 (通过 webtatic 安装 php)(CentOS&RHEL 版)

内容目录:

内容一:为什么使用第三方软件源

内容二:webtatic
2.1 webtatic 源简介
2.2 使用 webtatic 的方法
2.2.1 安装 webtatic 的 epel
2.2.2 安装 webtatic
2.2.3 清理原来的 yum 源缓存
2.2.4 此时可以开始安装或升级软件了

具体的内容:

内容一:为什么使用第三方软件源

本地搭建的软件源往往会有以下缺点:

1) 软件不够全,需要使用的软件没有
2) 软件版本不够高,在功能、性能和安全方面达不到要求
3) 使用第三方网络软件源有时可以解决以上问题

内容二:webtatic
2.1 webtatic 源简介

1) webtatic 是一个致力于将实现 web 服务的各类软件
2) webtatic 通过 yum 安装
3) webtatic 是一个免费的开源 yum 源项目


注意:
1) webtatic 项目并没有在社区认可的软件库列表中:
2) 社区认可的软件库列表网址:https://wiki.centos.org/zh/AdditionalResources/Repositories

2.2 使用 webtatic 的方法


注意:
1) 如果过去已经使用了其他的第三方 yum 源,最好先删除原来的第三方 yum 源
2) 如果过去已经安装了相应的软件,最好先删除这些软件而不是使用第三方 yum 源对他们进行升级

2.2.1 安装 webtatic 的 epel

# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm

2.2.2 安装 webtatic

# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

2.2.3 清理原来的 yum 源缓存

# yum clean all

2.2.4 此时可以开始安装软件了
2.2.4.1 查看所有软件列表

# yum list all

2.2.4.2 安装想要的软件爱你

# yum install <softeware>

2.2.5 删除 webtatic

# rpm -e epel-release ;; rpm -e webtatic-release

[工具] Shell 统计 LNMP 本月与上月的网站点击量和 IP 访问数

介绍:

作者:朱明宇
名称:统计 LNMP 本月与上月的网站点击量和 IP 访问数
作用:统计 LNMP 本月与上月的网站点击量和 IP 访问数

使用方法:
1. 在此脚本的分割线内写入相应的内容
2. 给此脚本添加执行权限
3. 执行此脚本

脚本分割线里的变量:
1. user=”root” #登录 Web 服务器的用户,请确保这个用户有创建缓存备份目录的权限
2. ip=”8.8.8.8″ #Web 服务器的 IP 地址

注意:此脚本执行前必须要先保证执行脚本的主机能无秘钥远程这台 Web 服务器

脚本:

#!/bin/bash

####################### Separator ########################

user="root"
ip="8.8.8.8"

####################### Separator ########################

monthcache1=$(date +%m)
case $monthcache1 in
01)
month=Jan
lmonth=Dec;;
02)
month=Feb
lmonth=Jan;;
03)
month=Mar
lmonth=Feb;;
04)
month=Apr
lmonth=Mar;;
05)
month=May
lmonth=Apr;;
06)
month=June
lmonth=May;;
07)
month=July
lmonth=June;;
08)
month=Aug
lmonth=July;;
09)
month=Sept
lmonth=Aug;;
10)
month=Oct
lmonth=Sept;;
11)
month=Nov
lmonth=Oct;;
12)
month=Dec
lmonth=Nov
esac

cmonth=`ssh $user@$ip "grep $month /usr/local/nginx/logs/access.log | wc -l"`
clmonth=`ssh $user@$ip "grep $lmonth  /usr/local/nginx/logs/access.log | wc -l"`
cipmonth=`ssh $user@$ip "grep $month /usr/local/nginx/logs/access.log" | awk '{a[$1]++}END{for(i in a){print i}}' | wc -l `
ciplmonth=`ssh $user@$ip "grep $lmonth /usr/local/nginx/logs/access.log" | awk '{a[$1]++}END{for(i in a){print i}}' | wc -l`

echo "The count of month's hits:$cmonth 次"
echo "The count of month's IP address:$cipmonth 个"
echo "The count of last month's hits:$clmonth 次"
echo "The count of last month's IP address:$ciplmonth 个"

[工具] Shell 统计 LNMP 今天与昨天的网站点击量和 IP 访问数

介绍:

作者:朱明宇
名称:统计 LNMP 今天与昨天的网站点击量和 IP 访问数
作用:统计 LNMP 今天与昨天的网站点击量和 IP 访问数

使用方法:
1. 在此脚本的分割线内写入相应的内容
2. 给此脚本添加执行权限
3. 执行此脚本

脚本分割线里的变量:
1. user=”root” #登录 Web 服务器的用户,请确保这个用户有创建缓存备份目录的权限
2. ip=”8.8.8.8″ #Web 服务器的 IP

注意:此脚本执行前必须要先保证执行脚本的主机能无秘钥远程这台 Web 服务器

脚本:

#!/bin/bash

####################### Separator ########################

user="root"
ip="8.8.8.8"

####################### Separator ########################

tday=`date +%d`

sys=`uname -a | awk '{print $1}'`

if [ $sys == 'Linux' ];then
        yday=`date +%d -d "-1 day"`
else
        yday=`date -v-1d +%d`
fi

cday=`ssh $user@$ip "grep $tday/$month  /usr/local/nginx/logs/access.log | wc -l"`
cyday=`ssh $user@$ip "grep $yday/$month  /usr/local/nginx/logs/access.log | wc -l"`
cipday=`ssh $user@$ip "grep $tday/$month  /usr/local/nginx/logs/access.log" |awk '{a[$1]++}END{for(i in a){print i}}' | wc -l`
cipyday=`ssh $user@$ip "grep $yday/$month  /usr/local/nginx/logs/access.log" |awk '{a[$1]++}END{for(i in a){print i}}' | wc -l`

echo "The count of today's hits:$cday 次"
echo "The count of today's IP address:$cipday 个"
echo "The count of yesterday's hits:$cyday 次"
echo "The count of yesterday's IP address:$cipyday 个"

[模板] Nginx 配置模板 (nginx.conf) (LNMP+SSL 版)

worker_processes  1;

events {
    worker_connections  65536;
}

http {
    limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    server {
        listen       80;
        limit_req zone=one burst=5;
        server_name www.eternalcenter.com eternalcenter.com;

        rewrite ^/(.*)$ https://eternalcenter-2021-12.github.io/$1 permanent;
      
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        }

    server {
        listen       443 ssl;
        server_name www.eternalcenter.com eternalcenter.com;

        if ($request_method !~ ^(GET|POST)$){
        return 444;
        }

        ssl_certificate      /root/ssl/eternalcenter.com.crt;
        ssl_certificate_key  /root/ssl/eternalcenter.com.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            include fastcgi.conf;
        }

        location / {
        root html;
        index index.php index.html index.htm;
        }

        location ~ ^/\.user\.ini {
        deny all;
        }
    
        location ~* \.(jpd|jpeg|gif|png|css|js|ico|xml)$ {
        expires 30d;
        }

        error_page  404              /404.html;

        }

        gzip on;
	gzip_min_length 1000;
	gzip_comp_level 4;
	gzip_types text/plain test/css application/json application/x-javascript text/xml application/xml
	application/xml+rss text/javascripts;

	client_header_buffer_size 1k;
	large_client_header_buffers 4 4k;

	open_file_cache max=2000 inactive=20s;
	open_file_cache_valid  60s;
	open_file_cache_min_uses 5;
	open_file_cache_errors off;

}