package management

rpm tool usage 

1. Installation command: rpm -ivh rpm package file 
2. Upgrade command: rpm -Uvh rpm package file 
3. Uninstall command: rpm -e package name 
4. Query the installed package: rpm -qa 
5. Check whether the specified package is installed: rpm -q package name 
6. Query the specified package information: rpm -qi package name 
7. List the files installed by the package: rpm -ql package name 
8. Check which package a file is installed by: rpm -qf file absolute path 


yum tool usage 


1. List the available rpm packages: yum list 
2. View the yum configuration file: ls /etc/yum.repos.d/ 
(If you want to change the download source address, you can also modify it from this configuration file)

3. Search package: yum search vim 
4. Installation command: yum install -y package name 
5. List the rpm package of the group: yum grouplist 
6. If you want to install the rpm package of the group, you can use the command to install: yum groupinstall -y package name

7. Uninstall command: yum remove -y package name 
8. Upgrade command: yum update -y package name 
(if no package name is added, all installed software in the system will be upgraded to the latest by default, including the system) 
9. If you use the command During the process, it is prompted that there is no such command. You can use the command to find the package name information of this command: yum provides “/*/vim”

 
yum builds local warehouse 


What should I do if yum cannot be used because of the inability to connect to the Internet? Let's build a local yum source installation.

(The premise is to have a CD-ROM, a CD-ROM, an image file, and then mount the CD-ROM)

1. Mount the image to the /mnt directory (because it has been mounted before, so this step is directly passed)

2. Use the command to back up the yum.repos.d file: cp -r /etc/yum.repos.d/ /etc/yum.bak.repo

3. Then delete all repo suffix files in the /etc directory: rm -f /etc/yum.repos.d/*

4. Use the command to edit: vim /etc/yum.repos.d/base.repo

[base] 
name=base
baseurl=file:///misc/cd
enable=1 
gpgcheck=0

5. Use the command yum clean all to clear the cache

6. Use the command yum list to view and install 

centos6 compile and install httpd2.2

Preparation:
1 Close firwalld
centos6: service iptables stop;
chkconfig iptables off
centos7: systemctl stop firewalld;
systemctl disable firewalld

2 关闭SElinux
setenforce 0
vim /etc/selinux/config
SELINUX=disabled

1. yum groupinstall "development tools" (install package group files)
yum install openssl-devel (install missing packages)

2 、download src
tar xvf httpd-2.4.33.tar.bz2(解包)

3 、cd httpd-2.2.34
cat README
cat INSTALL

4 、./configure --help(编译安装查看帮助)
./configure --prefix=/app --sysconfdir=/etc/httpd22 --enable-ssl

5、 make -j 4 && make install

6 、vim /etc/profile.d/env.sh
PATH=/app/bin:$PATH

. /etc/profile.d/env.sh(更改后的变量source一下)

7、apachectl start (运行服务)

练习:
脚本编译安装centos6上的httpd2.2.34
#!/bin/bash
# -----------------------------------------
# Filename:     installhattpd.sh
# Revision:     1.0v
# Date:         2018-04-23
# Author:       yuanyaqiong
# Email:        1498078591@qq.com
# Website:      http://www.cnblogs.com/yaun1498078591/
# Description:  This is the installhattpd script
# -----------------------------------------
# Copyright:    @2018 yaqiong
# License:      GPL
yum clean all &> dev/null
cp -a /etc/yum.repos.d/* /tmp
cat > /etc/yum.repos.d/base.repo <<EOF
[base]
name=base
baseuurl=file:///misc/cd
gpgcheck=0
enabled=1
EOF

rpm -q httpd &> /dev/null && yum remove httpd
yum groupinstall "Development Tools" &> /dev/null && echo "install software finished."

curl http://192.168.140.129:80 &> /dev/null ||{ echo "network error"; exit; }
[! -d /root/src ] && mkdir /root/scr/
wget http://192.168.140.129/src/httpd-2.2.34.tar.bz2 -O /root/src/httpd-2.2.34.tar.bz2
cd /root/scr/
tar xf httpd-2.2.34.tar.bz2
cd /root/src/httpd-2.2.34
.//configure --pfefix=/data/app/ --sysconfdir=/etc/httpd
make && make install
echo "successful"                            

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324769769&siteId=291194637