源码包

一、搭建新的教学环境

真机:新建2台虚拟机

clone-vm7 #老师写的脚本,一次只能自动创建一台rhel7
Enter VM number: 8 #虚拟机的编号
clone-vm7
Enter VM number: 9

利用鼠标图形将虚拟机名字,修改为A与B,然后开机
利用root用户,密码默认为 123456,进入新建的2台虚拟机

虚拟机A:作为练习使用的服务端
1.配置永久的主机名:svr7.tedu.cn
2.配置eth0永久的IP地址:192.168.4.7/24

虚拟机B:作为练习使用的客户端
1.配置永久的主机名:pc207.tedu.cn
2.配置eth0永久的IP地址:192.168.4.207/24
----------------------------------------------------------------------------------------
二、为新的教学环境搭建Yum仓库

服务端:真机上搭建
1.很多软件包 2,仓库数据文件 3,搭建FTP服务共享内容

1)搭建FTP服务
rpm -q vsftpd
重起服务,并开机自启vsftpd

2)挂载光盘内容到/var/ftp/rhel7
ls /var/ftp/rhel7/
vim /etc/fstab
/var/lib/libvirt/images/iso/rhel-server-7.4-x86_64-dvd.iso /var/ftp/rhel7 iso9660 defaults 0 0

#/etc/fstab里不支持写快捷方式iso的路径,要用ls -l 查看真实路径。

3)最终测试
firefox ftp://192.168.4.254/rhel7
----------------------------------------------------------------------------------
客户端:两台虚拟机A与虚拟机B

vim /etc/yum.repos.d/rhel7.repo
[rhel7]
name=rhel7.4
baseurl=ftp://192.168.4.254/rhel7
enabled=1
gpgcheck=0

yum -y install httpd #装包测试,是否yum配置成功
-----------------------------------------------------------------------------------
真机制作别名

head -3 /root/.bashrc
# .bashrc
alias goa='ssh -X root@192.168.4.7'
alias gob='ssh -X root@192.168.4.207'
-------------------------------------------------------------------------------
利用真机clone-vm7产生产两台虚拟机,利用root密码123456

1.搭建服务端:虚拟机C
要求:配置永久主机名svr8.tedu.cn
配置eth0永久 IP地址:192.168.4.8/24
使用真机ftp服务器作为Yum源

2.搭建客户端:虚拟机D
要求:配置永久主机名pc208.tedu.cn
配置eth0永久 IP地址:192.168.4.208/24
使用真机ftp服务器作为Yum源
------------------------------------------------------------------------------------
自定义Yum仓库

1.具备互联网下载的包,真机传递tools.tar.gz到虚拟机A
ssh+cp=scp

scp /root/桌面/tools.tar.gz root@192.168.4.7:/root

2.虚拟机A解tar包
tar -xf /root/tools.tar.gz -C /
ls /
ls /tools/
/tools/other/

3.运行createrepo生成仓库数据文件
createrepo /tools/other/
ls /tools/other/

4.书写客户端配置文件
vim /etc/yum.repos.d/rhel7.repo
[myrpm]
name=rhel7.4
baseurl=file:///tools/other #指定本机为Yum服务端
enabled=1
gpgcheck=0

yum repolist
-------------------------------------------------------------------------------
yum -y install sl

查询rpm包安装的清单
rpm -ql sl

yum -y install oneko
oneko & #放入后台运行
killall oneko #杀死所有的oneko
------------------------------------------------------------------------------
源码编译安装

rpm包: rpm -ivh yum

源码包-----运行gcc与make--->可以执行的程序---》运行安装即可

源码包的优势:可以选择安装的功能及路径,更加的灵活

虚拟机A:
1,装包gcc与make
yum -y install gcc make

2,tar解包,释放源代码至指定目录
tar -xf /tools/inotify-tools-3.13.tar.gz -C /
ls /
ls /inotify-tools-3.13/

3, ./configure 配置,指定安装目录/功能模块等选项
作用:检测本机是否安装gcc

cd /inotify-tools-3.13/
./configure --prefix=/opt/myrpm #指定安装位置

常见错误提示:没有安装gcc
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: no acceptable C compiler found in $PATH

4, make 编译,生成可执行的二进制程序文件
cd /inotify-tools-3.13/
make

5, make install 安装,将编译好的文件复制到安装目录
cd /inotify-tools-3.13/
make install
ls /opt/
ls /opt/myrpm
ls /opt/myrpm/
ls /opt/myrpm/bin/
---------------------------------------------------------------------------------
man 5 passwd

5: 配置文件的帮助信息

posted @ 2019-04-29 00:25  安于夏  阅读(644)  评论(0编辑  收藏  举报