YUM(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器。基於RPM包管理,能够从指定的服务器自动下载RPM包并且安装。
RHEL的提供YUM工具默认指向Redhat的源服务器,使用YUM之前需要向Redhat注册方能使用。
CentOS提供了与RHEL相同的移植版本,可以使用CentOS版本的YUM替换RHEL的YUM,需要先删除后安装。
同时替换一下YUM的源头服务器即可
1.删除RHEL默认安装的YUM
rpm -qa|grep yum|xargs rpm -e —nodeps |
rpm -qa|grep yum|xargs rpm -e —nodeps
2.下载CentOS版本的YUM安装包
curl -o ./ http://vault.centos.org/6.0/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
curl -o ./ http://vault.centos.org/6.0/os/x86_64/Packages/yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm
curl -o ./ http://vault.centos.org/6.0/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm
curl -o ./ http://vault.centos.org/6.0/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm |
curl -o ./ http://vault.centos.org/6.0/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
curl -o ./ http://vault.centos.org/6.0/os/x86_64/Packages/yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm
curl -o ./ http://vault.centos.org/6.0/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm
curl -o ./ http://vault.centos.org/6.0/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm
Read more…
一个简单的需求:
Windows 环境下用VBS/VBA来实现抽取某一个特定目录下的全部所有文件,要求遍历当前目录下所有的子目录。
注意各子目录下文件的文件名可能会重复,各子目录下存在空目录的情况。
实现VBS代码
'需要遍历的目录路径
dim strDirPath = "c:\dir"
'遍历目录
Private Sub FileTree(strPath)
Set obFso = CreateObject("Scripting.FileSystemObject")
If obFso.FolderExists(strPath) Then
Set obFolder = obFso.GetFolder(strPath)
'遍历当前目录下的所有目录,递归调用
Set obSubFolders = obFolder.SubFolders
For Each obSubFolder In obSubFolders
Call FileTree(obSubFolder.Path & "")
Next
'剔除当前目录
If strPath = Trim(strDirPath) Then
Exit Sub
End If
'遍历当前目录下的所有文件
Set obFiles = obFolder.Files
For Each obFile In obFiles
Call ExcuteFolderConcentrate(obFile.Path & "")
Next
Else
MsgBox "Invalide Path"
Exit Sub
End If
End Sub
'文件归集操作
Private Sub ExcuteFolderConcentrate(strPath)
Set obFso = CreateObject("Scripting.FileSystemObject")
If obFso.FileExists(strPath) Then
fullPath = Trim(strDirPath) & “\"
'按目录层级设置新文件名
newFileName = Replace(Right(strPath, Len(strPath) - Len(fullPath)), "\", "_”)
'重复文件重新命名
If obFso.FileExists(fullPath & newFileName) Then
Call obFso.copyFile(strPath, fullPath & newFileName & ".duplicate")
Else
Call obFso.copyFile(strPath, fullPath & newFileName)
End If
End If
End Sub
'遍历整个目录,完成文件归集
FileTree (strDirPath)
'重新打开目录文件夹
CreateObject("Shell.Application").Explore strDirPath |
'需要遍历的目录路径
dim strDirPath = "c:\dir"
'遍历目录
Private Sub FileTree(strPath)
Set obFso = CreateObject("Scripting.FileSystemObject")
If obFso.FolderExists(strPath) Then
Set obFolder = obFso.GetFolder(strPath)
'遍历当前目录下的所有目录,递归调用
Set obSubFolders = obFolder.SubFolders
For Each obSubFolder In obSubFolders
Call FileTree(obSubFolder.Path & "")
Next
'剔除当前目录
If strPath = Trim(strDirPath) Then
Exit Sub
End If
'遍历当前目录下的所有文件
Set obFiles = obFolder.Files
For Each obFile In obFiles
Call ExcuteFolderConcentrate(obFile.Path & "")
Next
Else
MsgBox "Invalide Path"
Exit Sub
End If
End Sub
'文件归集操作
Private Sub ExcuteFolderConcentrate(strPath)
Set obFso = CreateObject("Scripting.FileSystemObject")
If obFso.FileExists(strPath) Then
fullPath = Trim(strDirPath) & “\"
'按目录层级设置新文件名
newFileName = Replace(Right(strPath, Len(strPath) - Len(fullPath)), "\", "_”)
'重复文件重新命名
If obFso.FileExists(fullPath & newFileName) Then
Call obFso.copyFile(strPath, fullPath & newFileName & ".duplicate")
Else
Call obFso.copyFile(strPath, fullPath & newFileName)
End If
End If
End Sub
'遍历整个目录,完成文件归集
FileTree (strDirPath)
'重新打开目录文件夹
CreateObject("Shell.Application").Explore strDirPath
CentOS在7.x和6.x分别使用firewalld和iptables作为防火墙工具,习惯上iptables之后firewalld各种不适应。
下面总结在各个版本CentOS下firewalld和iptables使用。 这里配置打开HTTP/HTTPs端口功能,分别对应80和443端口
CentOS7.x 使用firewalld
#====================CENTOS 7.x==================
systemctl enable firewalld
systemctl start firewalld
# HTTP
firewall-cmd --permanent --zone=public --add-port=80/tcp
# HTTPS
firewall-cmd --permanent --zone=public --add-port=443/tcp
firewall-cmd —reload |
#====================CENTOS 7.x==================
systemctl enable firewalld
systemctl start firewalld
# HTTP
firewall-cmd --permanent --zone=public --add-port=80/tcp
# HTTPS
firewall-cmd --permanent --zone=public --add-port=443/tcp
firewall-cmd —reload
Read more…
[CentOS] JDK+tomcat集群+nginx一键安装脚本
整理了一下在CentOS下JDK+tomcat集群+nginx的安装脚本. 支持CentOS6.x/7.x
1.安装前准备
# is root user
if [ "$(whoami)" != 'root' ]; then
echo "install need root user"
exit
fi |
# is root user
if [ "$(whoami)" != 'root' ]; then
echo "install need root user"
exit
fi
Read more…
Recent Comments