Unit13 软件安装
1.如何安装软件
安装软件是在系统中增加文件的过程
yum search 关键字 ##搜索相关软件
yum installgcc.x86_64(软件名称) -y ##安装软件(加y表示不询问直接安装)
Is this ok [y/d/N]: y表示安装d表示下载n表示什么都不做
yum remove gcc -y ##卸载gcc
yum list all ##查询全部安装包
yumlist all | wc -l ##统计安装包数量
yum list installed ##查询已安装的安装包
yum list available ##查询未安装的
yum info gcc ##查询软件信息
yum groups installGNOME(名称) ##安装组
yum group infoGNOME ##查询组信息
yum groups removeGNOME ##卸载组
yum group list ##列出软件组
yum history ##查看软件修改情况
Hostnamectl ##查看那本机信息
2.软件仓库的建立
① 安装镜像文件
[kiosk@foundation13Desktop]$ lftp 172.25.254.250:/pub
cd ok,cwd=/pub
lftp172.25.254.250:/pub> cd iso/
cd ok,cwd=/pub/iso
lftp172.25.254.250:/pub/iso> getrhel-server-7.0-x86_64-dvd.iso ##下载镜像文件
② 挂载镜像文件
[root@foundation13 Desktop]# mount rhel-server-7.0-x86_64-dvd.iso /source ##挂载镜像文件到/source
[root@foundation13 Desktop]# cd /source
[root@foundation13 source]# ls
addons p_w_picpaths Packages RPM-GPG-KEY-redhat-release
EFI isolinux release-notes TRANS.TBL
EULA LiveOS repodata
GPL media.repo RPM-GPG-KEY-redhat-beta
[root@foundation13 source]# cd Packages/ ##所有安装包都在Packages/中
③ 将/etc/yum.repos.d中的文件移出
mv /etc/yum.repos.d/* /mnt ##将/etc/yum.repos.d中的左右文件移动到/mnt中
④ 建立仓库
[root@foundation13source]# cd /etc/yum.repos.d/ ##必须在此目录下写.repo文件
[root@foundation13yum.repos.d]# vim yum.repo ##文件名随意,类型一定要是.repo
[root@foundation13yum.repos.d]# cat yum.repo ##查看内容
[server] ##仓库名称
name=server ##仓库描述
baseurl=file:///source ##仓库的地址
gpgcheck=0 ##是否检测软件的gpgkey(相当于标签,1表示检测,如不同则拒绝安装。0表示不检测)
[root@foundation13yum.repos.d]# yum clean all ##刷新仓库配置
Loaded plugins:langpacks, product-id, subscription-manager
This system is notregistered to Red Hat Subscription Management. You can use subscription-managerto register.
Cleaning repos:server
Cleaning upeverything
3.虚拟机上安装软件
① 网络yum源的配置(真机上操作)
yum install httpd ##安装httpd服务
systemctl stop firewalld ##关闭防火墙
systemctl start httpd ##启动http服务
systemctl enable httpd
[root@foundation13 yum.repos.d]# yum install httpd -y ##安装http服务
Loaded plugins: langpacks, product-id,subscription-manager
This system is not registered to Red HatSubscription Management. You can use subscription-manager to register.
server | 4.1 kB 00:00
(1/2): server/group_gz | 134kB 00:00
(2/2): server/primary_db | 3.4MB 00:00
Package matching httpd-2.4.6-17.el7.x86_64already installed. Checking for update.
Nothing to do
[root@foundation13 yum.repos.d]# systemctl stop firewalld ##关闭防火墙
[root@foundation13 yum.repos.d]# systemctl start httpd ##开启http服务
[root@foundation13 yum.repos.d]# mkdir -p/var/www//html/yumsource ##新建目录
[root@foundation13 yum.repos.d]# mount /home/kiosk/Desktop/rhel-server-7.0-x86_64-dvd.iso/var/www/html/yumsource/ ##挂载镜像文件
mount: /dev/loop2 is write-protected,mounting read-only
[root@foundation13 yum.repos.d]#
② 虚拟机操作
[root@localhost ~]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# ls
yum.repo
[root@localhost yum.repos.d]# vim yum.repo
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: langpacks
Cleaning repos: server
Cleaning up everything
[root@localhost yum.repos.d]#
转载于:https://blog.51cto.com/12096808/1861309