软件管理
一、Rocky配置yum源
1.必须放在/etc/yum.repos.d/ 目录下
2.必须以.repo 结尾
3.必须配置 系统源BaseOS 、AppStream 和 epel源
4.可以挂载光盘,系统源从本地文件安装
二、常用命令
yum install
yum remove
yum list
yum info //查看软件信息,找官网方便
yum provides 文件名路径 //查看命令所属的包
yum history
apt-file //查找文件名 所属包
rpm -qfwhich init
#通过安装路径查看所在包
rpm -qi systemd #通过包名查看开发组织信息,
三、编译安装
脚本示例:
VERSION=2.4.57
source /etc/os-release
if [ $(echo $NAME |grep 'Ubuntu')='Ubuntu' ] ; then
apt-get -y install apr-devel apr-util-devel pcre pcre-devel redhat-rpm-config
else if [ $(echo $NAME |grep -o 'Rocky')='Rocky' ];then
yum -y install apr-devel apr-util-devel pcre pcre-devel redhat-rpm-config
fi
#yum -y install apr-devel apr-util-devel pcre pcre-devel redhat-rpm-config
wget https://dlcdn.apache.org/httpd/httpd-$VERSION.tar.gz -P /usr/local/src
if [ ! -e /usr/local/src/httpd-$VERSION.tar.gz ];then
echo '下载失败'
exit 1
fi
cd /usr/local/src
tar xf httpd-$VERSION.tar.gz
cd /usr/local/src/httpd-$VERSION
./configure --prefix=/app/httpd && make && make install
ln -s /app/httpd/bin/apachectl /usr/local/bin/
apachectl start
echo '安装完成'