[STEP] DELL server iDRAC physical disk foreign state clean

Step One: Check the state of physical disk

Storage –> Overview –> Physical Disks
We can see the State is Foreign not Ready

Step Two: Clean the foreign state of physical disk

2.1 Access controllers interface

Storage –> Overview –> Controllers

2.2 Clean the foreign state of physical disk

Choose Controllers à Action à Foreign Configuration à Clean Foreign

[步骤] Rocky Linux & RHEL 本地缓存的软件包的安装

步骤一:将 yum 工具 & dnf 工具缓存下来的软件包设置为持续保存

# vi /etc/yum.conf

或者:

# vi /etc/dnf/dnf.conf

将部分内容修改如下:

......
keepcache = 1

步骤二:清空本地 yum 工具 & dnf 工具的缓存

# yum clean all

或者:

# dnf clean all

步骤三:将 yum 工具 & dnf 工具的软件包清单缓存到本地

# yum makecache

步骤四:将 yum 工具 & dnf 工具所有可以升级的软件包缓存到本地

# yum update --downloadonly

或者:

# dnf update --downloadonly

步骤五:显示已经缓存的软件包

5.1 显示所有已经缓存的软件包

# yum -C list

或者:

# dnf -C list

5.2 显示某个已经缓存的软件包

# yum -C list kernel

或者:

# dnf -C list kernel

(补充:这里以显示已经缓存的 kernel 软件包为例)

步骤六:使用 yum 工具 & dnf 工具缓存的所有软件包提到系统里现存的老的软件包

# yum -C update

或者:

# dnf -C update

[CONTENT] SUSE Repository Mirroring Tool (RMT) mirror schedule configuration

Content One: Configure the mirror schedule

1.1 Modify /etc/systemd/system/multi-user.target.wants/rmt-server-sync.timer file

# vi /etc/systemd/system/multi-user.target.wants/rmt-server-sync.timer

Modify all content as follows:

[Unit]
Description=RMT Sync timer

[Timer]
OnCalendar=*-*-01 01:00:00
RandomizedDelaySec=9h
Unit=rmt-server-sync.service

[Install]
WantedBy=multi-user.target

(Note: here is an example with setting the mirror schedule to the 1st of every month)

1.2 Apply the settings to make them take effect

# systemctl restart rmt-server-sync.timer
# systemctl restart rmt-server-mirror.timer

Content Two: Disable the mirror schedule

2.1 Disable the mirror schedule

# systemctl disable --now rmt-server-sync.timer
# systemctl disable --now rmt-server-mirror.timer
# systemctl daemon-reload

2.2 Manual Mirror

# rmt-cli sync
# rmt-cli mirror

Or:

# rmt-cli sync ; rmt-cli mirror

[工具] Shell 还原本地网站文件和网站数据库备份到本地 LNMP

介绍

基本信息

作者:朱明宇
名称:将本地网站文件备份和网站数据库备份还原到本地 LNMP
作用:将本地网站文件备份和网站数据库备份还原到本地 LNMP

使用方法

1. 将网站的文件备份、网站的 SSL 公钥、网站的 SSL 私钥、网站的数据库备份,4 个文件放在此脚本中变量 tmppath 对应的目录里
2. 给此脚本添加执行权限
3. 执行此脚本

脚本分割线里的变量

tmppath=/bcache #本地存放网站的文件备份、网站的 SSL 公钥、网站的 SSL 私钥、网站的数据库备份的地方
midname=eternalcenter #网站的文件备份和网站的数据库备份的中间名
cmidname=fullchain #网站的 SSL 公钥的中间名
kmidname=privkey #网站的 SSL 私钥的中间名
webpath=/usr/share/nginx/html #网站文件在本地的正式存放位置
sslpath=/etc/nginx/ssl #网站网站的 SSL 公钥、网站的 SSL 私钥在本地的正式存放位置dbuser=ec #网站在数据库中的用户名
dbname=ec #网站在数据库中的的库名

注意

1. 本地需要已经搭建好 LNMP 平台
2. 必须以 root 的身份执行此脚本
3. 这里的网站的 SSL 公钥和网站的 SSL 私钥都是以 pem 后缀结尾,可以修改成真实对应的后缀
4. 脚本中类似 ”mysql -uroot -p’eternalcenter’ -e “drop database $dbname;”“ 中的 “eternalcenter“ 是指本地 MariaDB 数据库 root 用户的密码,需要修改成 MariaDB 数据库的 root 用户的真实密码

脚本

#!/bin/bash

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


tmppath=/bcache
midname=eternalcenter
cmidname=fullchain
kmidname=privkey

webpath=/usr/share/nginx/html
sslpath=/etc/nginx/ssl

dbuser=ec
dbname=ec


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

nowdirectory=`pwd`

#sudo systemctl stop nginx
#sudo systemctl stop php-fpm

cd $tmppath

sqlfile=`ls | grep $midname | grep -E \.sql$ | tail -1`
tarfile=`ls | grep $midname | grep -E \.tar | tail -1`
crtfile=`ls | grep $cmidname | grep -E \.pem$ | tail -1`
keyfile=`ls | grep $kmidname | grep -E \.pem$ | tail -1`


#sleep 300

echo $sqlfile
if [ -n "$sqlfile" ];then
    mysql -uroot -p'eternalcenter' -e "drop database $dbname;"
    mysql -uroot -p'eternalcenter' -e "create database $dbname;"
    mysql -uroot -p'eternalcenter' -e "grant all privileges on $dbuser.* to \"$dbuser\"@\"localhost\";"
    mysql -uroot -p'eternalcenter' $dbname < $sqlfile
    rm -rf $sqlfile
fi

echo $tarfile
if [ -n "$tarfile" ];then
    rm -rf $webpath/*
    tar -zxvf $tarfile -C $webpath/ &> /dev/null
    rm -rf $tarfile
    chcon -t httpd_sys_content_t -R $webpath/*
    chown -R php-fpm:php-fpm $webpath/
fi

echo $crtfile
if [ -n "$crtfile" ];then
    rm -rf $sslpath/$crtfile
    mkdir -p $sslpath &> /dev/null
    mv $crtfile $sslpath/
    chcon -t httpd_config_t $sslpath/*
fi

echo $keyfile
if [ -n "$keyfile" ];then
    rm -rf $sslpath/$keyfile
    mkdir -p $sslpath &> /dev/null
    mv $keyfile $sslpath/
    chcon -t httpd_config_t $sslpath/*
fi

chcon -t httpd_config_t $sslpath

sudo systemctl restart nginx
sudo systemctl restart php-fpm

cd $nowdirectory