yum搭建本地仓库
[root@localhost ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
cp -r /etc/yum.repos.d /etc/yum.repos.d.bak
[root@localhost ~]# cp -r /etc/yum.repos.d/ /etc/yum.repos.d.ori/ //复制
rm -f /etc/yum.repos.d/*
[root@localhost ~]# rm -f /etc/yum.repos.d/* //删除文件
vim /etc/yum.repos.d/dvd.repo //内容如下
[dvd] //右侧仓库名字
name=install dvd //作为描述的字符串
baseurl=file:///mnt //rpm在哪
enable=1 //是否可用 1可用
gpgcheck=0 //是否检查。0不检测
yum clean all
[root@localhost ~]# yum clean all //清理缓存
已加载插件:fastestmirror
正在清理软件源: dvd
Cleaning up everything
Cleaning up list of fastest mirrors
yum list
[root@localhost ~]# yum list
zenity.x86_64 3.8.0-4.el7 dvd
zziplib.x86_64 0.13.62-5.el7 dvd
yum更换国内源
cd /etc/yum.repos.d/
[root@localhost ~]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# cp ./dvd.repo dvd.repo.ori
rm -f dvd.repo
[root@localhost yum.repos.d]# rm -f dvd.repo
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo //下载
或者
curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo //-O 使用URL中默认的文件名保存文件到本地
yum list
yum下载rpm包
yum install -y 包名 --downloadonly
[root@localhost yum.repos.d]# yum install -y zsh --downloadonly //仅仅下载不安装
[root@localhost yum.repos.d]# rpm -q zsh
未安装软件包 zsh
ls /var/cache/yum/x86_64/7/
[root@localhost yum.repos.d]# ls /var/cache/yum/x86_64/7/base/packages/ //默认下载到此
zlib-static-1.2.7-17.el7.x86_64.rpm zsh-5.0.2-28.el7.x86_64.rpm
yum install -y 包名 --downloadonly --downloaddir=路径
[root@localhost yum.repos.d]# yum install -y zabbix20-proxy-mysql.x86_64 --downloadonly --downloaddir=/root/ //--downloaddir指定下载到哪里去
yum reinstall -y 包名 --downloadonly --downloaddir=路径
[root@localhost yum.repos.d]# yum reinstall -y vim --downloadonly --downloaddir=/tmp //reinstall 重新安装
源码包安装
cd /usr/local/src/
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.32.tar.gz
tar zxvf httpd-2.2.32.tar.gz //解压
cd httpd-2.2.32
./configure --prefix=/usr/local/apache2
make //编译
make install
卸载就是删除安装的文件
转载于:https://blog.51cto.com/lsxme/1980876